1
0

amber-cli.js 2.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. var module = void 0; // Bad UMDs workaround
  5. requirejs.resolve = require.resolve;
  6. require = requirejs;
  7. /*!
  8. * @overview es6-promise - a tiny implementation of Promises/A+.
  9. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  10. * @license Licensed under MIT license
  11. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  12. * @version 3.3.1
  13. */
  14. (function (global, factory) {
  15. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  16. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  17. (global.ES6Promise = factory());
  18. }(this, (function () { 'use strict';
  19. function objectOrFunction(x) {
  20. return typeof x === 'function' || typeof x === 'object' && x !== null;
  21. }
  22. function isFunction(x) {
  23. return typeof x === 'function';
  24. }
  25. var _isArray = undefined;
  26. if (!Array.isArray) {
  27. _isArray = function (x) {
  28. return Object.prototype.toString.call(x) === '[object Array]';
  29. };
  30. } else {
  31. _isArray = Array.isArray;
  32. }
  33. var isArray = _isArray;
  34. var len = 0;
  35. var vertxNext = undefined;
  36. var customSchedulerFn = undefined;
  37. var asap = function asap(callback, arg) {
  38. queue[len] = callback;
  39. queue[len + 1] = arg;
  40. len += 2;
  41. if (len === 2) {
  42. // If len is 2, that means that we need to schedule an async flush.
  43. // If additional callbacks are queued before the queue is flushed, they
  44. // will be processed by this flush that we are scheduling.
  45. if (customSchedulerFn) {
  46. customSchedulerFn(flush);
  47. } else {
  48. scheduleFlush();
  49. }
  50. }
  51. };
  52. function setScheduler(scheduleFn) {
  53. customSchedulerFn = scheduleFn;
  54. }
  55. function setAsap(asapFn) {
  56. asap = asapFn;
  57. }
  58. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  59. var browserGlobal = browserWindow || {};
  60. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  61. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  62. // test for web worker but not in IE10
  63. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  64. // node
  65. function useNextTick() {
  66. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  67. // see https://github.com/cujojs/when/issues/410 for details
  68. return function () {
  69. return process.nextTick(flush);
  70. };
  71. }
  72. // vertx
  73. function useVertxTimer() {
  74. return function () {
  75. vertxNext(flush);
  76. };
  77. }
  78. function useMutationObserver() {
  79. var iterations = 0;
  80. var observer = new BrowserMutationObserver(flush);
  81. var node = document.createTextNode('');
  82. observer.observe(node, { characterData: true });
  83. return function () {
  84. node.data = iterations = ++iterations % 2;
  85. };
  86. }
  87. // web worker
  88. function useMessageChannel() {
  89. var channel = new MessageChannel();
  90. channel.port1.onmessage = flush;
  91. return function () {
  92. return channel.port2.postMessage(0);
  93. };
  94. }
  95. function useSetTimeout() {
  96. // Store setTimeout reference so es6-promise will be unaffected by
  97. // other code modifying setTimeout (like sinon.useFakeTimers())
  98. var globalSetTimeout = setTimeout;
  99. return function () {
  100. return globalSetTimeout(flush, 1);
  101. };
  102. }
  103. var queue = new Array(1000);
  104. function flush() {
  105. for (var i = 0; i < len; i += 2) {
  106. var callback = queue[i];
  107. var arg = queue[i + 1];
  108. callback(arg);
  109. queue[i] = undefined;
  110. queue[i + 1] = undefined;
  111. }
  112. len = 0;
  113. }
  114. function attemptVertx() {
  115. try {
  116. var r = require;
  117. var vertx = r('vertx');
  118. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  119. return useVertxTimer();
  120. } catch (e) {
  121. return useSetTimeout();
  122. }
  123. }
  124. var scheduleFlush = undefined;
  125. // Decide what async method to use to triggering processing of queued callbacks:
  126. if (isNode) {
  127. scheduleFlush = useNextTick();
  128. } else if (BrowserMutationObserver) {
  129. scheduleFlush = useMutationObserver();
  130. } else if (isWorker) {
  131. scheduleFlush = useMessageChannel();
  132. } else if (browserWindow === undefined && typeof require === 'function') {
  133. scheduleFlush = attemptVertx();
  134. } else {
  135. scheduleFlush = useSetTimeout();
  136. }
  137. function then(onFulfillment, onRejection) {
  138. var _arguments = arguments;
  139. var parent = this;
  140. var child = new this.constructor(noop);
  141. if (child[PROMISE_ID] === undefined) {
  142. makePromise(child);
  143. }
  144. var _state = parent._state;
  145. if (_state) {
  146. (function () {
  147. var callback = _arguments[_state - 1];
  148. asap(function () {
  149. return invokeCallback(_state, child, callback, parent._result);
  150. });
  151. })();
  152. } else {
  153. subscribe(parent, child, onFulfillment, onRejection);
  154. }
  155. return child;
  156. }
  157. /**
  158. `Promise.resolve` returns a promise that will become resolved with the
  159. passed `value`. It is shorthand for the following:
  160. ```javascript
  161. let promise = new Promise(function(resolve, reject){
  162. resolve(1);
  163. });
  164. promise.then(function(value){
  165. // value === 1
  166. });
  167. ```
  168. Instead of writing the above, your code now simply becomes the following:
  169. ```javascript
  170. let promise = Promise.resolve(1);
  171. promise.then(function(value){
  172. // value === 1
  173. });
  174. ```
  175. @method resolve
  176. @static
  177. @param {Any} value value that the returned promise will be resolved with
  178. Useful for tooling.
  179. @return {Promise} a promise that will become fulfilled with the given
  180. `value`
  181. */
  182. function resolve(object) {
  183. /*jshint validthis:true */
  184. var Constructor = this;
  185. if (object && typeof object === 'object' && object.constructor === Constructor) {
  186. return object;
  187. }
  188. var promise = new Constructor(noop);
  189. _resolve(promise, object);
  190. return promise;
  191. }
  192. var PROMISE_ID = Math.random().toString(36).substring(16);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var GET_THEN_ERROR = new ErrorObject();
  198. function selfFulfillment() {
  199. return new TypeError("You cannot resolve a promise with itself");
  200. }
  201. function cannotReturnOwn() {
  202. return new TypeError('A promises callback cannot return that same promise.');
  203. }
  204. function getThen(promise) {
  205. try {
  206. return promise.then;
  207. } catch (error) {
  208. GET_THEN_ERROR.error = error;
  209. return GET_THEN_ERROR;
  210. }
  211. }
  212. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then, thenable, function (value) {
  223. if (sealed) {
  224. return;
  225. }
  226. sealed = true;
  227. if (thenable !== value) {
  228. _resolve(promise, value);
  229. } else {
  230. fulfill(promise, value);
  231. }
  232. }, function (reason) {
  233. if (sealed) {
  234. return;
  235. }
  236. sealed = true;
  237. _reject(promise, reason);
  238. }, 'Settle: ' + (promise._label || ' unknown promise'));
  239. if (!sealed && error) {
  240. sealed = true;
  241. _reject(promise, error);
  242. }
  243. }, promise);
  244. }
  245. function handleOwnThenable(promise, thenable) {
  246. if (thenable._state === FULFILLED) {
  247. fulfill(promise, thenable._result);
  248. } else if (thenable._state === REJECTED) {
  249. _reject(promise, thenable._result);
  250. } else {
  251. subscribe(thenable, undefined, function (value) {
  252. return _resolve(promise, value);
  253. }, function (reason) {
  254. return _reject(promise, reason);
  255. });
  256. }
  257. }
  258. function handleMaybeThenable(promise, maybeThenable, then$$) {
  259. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$ === GET_THEN_ERROR) {
  263. _reject(promise, GET_THEN_ERROR.error);
  264. } else if (then$$ === undefined) {
  265. fulfill(promise, maybeThenable);
  266. } else if (isFunction(then$$)) {
  267. handleForeignThenable(promise, maybeThenable, then$$);
  268. } else {
  269. fulfill(promise, maybeThenable);
  270. }
  271. }
  272. }
  273. function _resolve(promise, value) {
  274. if (promise === value) {
  275. _reject(promise, selfFulfillment());
  276. } else if (objectOrFunction(value)) {
  277. handleMaybeThenable(promise, value, getThen(value));
  278. } else {
  279. fulfill(promise, value);
  280. }
  281. }
  282. function publishRejection(promise) {
  283. if (promise._onerror) {
  284. promise._onerror(promise._result);
  285. }
  286. publish(promise);
  287. }
  288. function fulfill(promise, value) {
  289. if (promise._state !== PENDING) {
  290. return;
  291. }
  292. promise._result = value;
  293. promise._state = FULFILLED;
  294. if (promise._subscribers.length !== 0) {
  295. asap(publish, promise);
  296. }
  297. }
  298. function _reject(promise, reason) {
  299. if (promise._state !== PENDING) {
  300. return;
  301. }
  302. promise._state = REJECTED;
  303. promise._result = reason;
  304. asap(publishRejection, promise);
  305. }
  306. function subscribe(parent, child, onFulfillment, onRejection) {
  307. var _subscribers = parent._subscribers;
  308. var length = _subscribers.length;
  309. parent._onerror = null;
  310. _subscribers[length] = child;
  311. _subscribers[length + FULFILLED] = onFulfillment;
  312. _subscribers[length + REJECTED] = onRejection;
  313. if (length === 0 && parent._state) {
  314. asap(publish, parent);
  315. }
  316. }
  317. function publish(promise) {
  318. var subscribers = promise._subscribers;
  319. var settled = promise._state;
  320. if (subscribers.length === 0) {
  321. return;
  322. }
  323. var child = undefined,
  324. callback = undefined,
  325. detail = promise._result;
  326. for (var i = 0; i < subscribers.length; i += 3) {
  327. child = subscribers[i];
  328. callback = subscribers[i + settled];
  329. if (child) {
  330. invokeCallback(settled, child, callback, detail);
  331. } else {
  332. callback(detail);
  333. }
  334. }
  335. promise._subscribers.length = 0;
  336. }
  337. function ErrorObject() {
  338. this.error = null;
  339. }
  340. var TRY_CATCH_ERROR = new ErrorObject();
  341. function tryCatch(callback, detail) {
  342. try {
  343. return callback(detail);
  344. } catch (e) {
  345. TRY_CATCH_ERROR.error = e;
  346. return TRY_CATCH_ERROR;
  347. }
  348. }
  349. function invokeCallback(settled, promise, callback, detail) {
  350. var hasCallback = isFunction(callback),
  351. value = undefined,
  352. error = undefined,
  353. succeeded = undefined,
  354. failed = undefined;
  355. if (hasCallback) {
  356. value = tryCatch(callback, detail);
  357. if (value === TRY_CATCH_ERROR) {
  358. failed = true;
  359. error = value.error;
  360. value = null;
  361. } else {
  362. succeeded = true;
  363. }
  364. if (promise === value) {
  365. _reject(promise, cannotReturnOwn());
  366. return;
  367. }
  368. } else {
  369. value = detail;
  370. succeeded = true;
  371. }
  372. if (promise._state !== PENDING) {
  373. // noop
  374. } else if (hasCallback && succeeded) {
  375. _resolve(promise, value);
  376. } else if (failed) {
  377. _reject(promise, error);
  378. } else if (settled === FULFILLED) {
  379. fulfill(promise, value);
  380. } else if (settled === REJECTED) {
  381. _reject(promise, value);
  382. }
  383. }
  384. function initializePromise(promise, resolver) {
  385. try {
  386. resolver(function resolvePromise(value) {
  387. _resolve(promise, value);
  388. }, function rejectPromise(reason) {
  389. _reject(promise, reason);
  390. });
  391. } catch (e) {
  392. _reject(promise, e);
  393. }
  394. }
  395. var id = 0;
  396. function nextId() {
  397. return id++;
  398. }
  399. function makePromise(promise) {
  400. promise[PROMISE_ID] = id++;
  401. promise._state = undefined;
  402. promise._result = undefined;
  403. promise._subscribers = [];
  404. }
  405. function Enumerator(Constructor, input) {
  406. this._instanceConstructor = Constructor;
  407. this.promise = new Constructor(noop);
  408. if (!this.promise[PROMISE_ID]) {
  409. makePromise(this.promise);
  410. }
  411. if (isArray(input)) {
  412. this._input = input;
  413. this.length = input.length;
  414. this._remaining = input.length;
  415. this._result = new Array(this.length);
  416. if (this.length === 0) {
  417. fulfill(this.promise, this._result);
  418. } else {
  419. this.length = this.length || 0;
  420. this._enumerate();
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. _reject(this.promise, validationError());
  427. }
  428. }
  429. function validationError() {
  430. return new Error('Array Methods must be provided an Array');
  431. };
  432. Enumerator.prototype._enumerate = function () {
  433. var length = this.length;
  434. var _input = this._input;
  435. for (var i = 0; this._state === PENDING && i < length; i++) {
  436. this._eachEntry(_input[i], i);
  437. }
  438. };
  439. Enumerator.prototype._eachEntry = function (entry, i) {
  440. var c = this._instanceConstructor;
  441. var resolve$$ = c.resolve;
  442. if (resolve$$ === resolve) {
  443. var _then = getThen(entry);
  444. if (_then === then && entry._state !== PENDING) {
  445. this._settledAt(entry._state, i, entry._result);
  446. } else if (typeof _then !== 'function') {
  447. this._remaining--;
  448. this._result[i] = entry;
  449. } else if (c === Promise) {
  450. var promise = new c(noop);
  451. handleMaybeThenable(promise, entry, _then);
  452. this._willSettleAt(promise, i);
  453. } else {
  454. this._willSettleAt(new c(function (resolve$$) {
  455. return resolve$$(entry);
  456. }), i);
  457. }
  458. } else {
  459. this._willSettleAt(resolve$$(entry), i);
  460. }
  461. };
  462. Enumerator.prototype._settledAt = function (state, i, value) {
  463. var promise = this.promise;
  464. if (promise._state === PENDING) {
  465. this._remaining--;
  466. if (state === REJECTED) {
  467. _reject(promise, value);
  468. } else {
  469. this._result[i] = value;
  470. }
  471. }
  472. if (this._remaining === 0) {
  473. fulfill(promise, this._result);
  474. }
  475. };
  476. Enumerator.prototype._willSettleAt = function (promise, i) {
  477. var enumerator = this;
  478. subscribe(promise, undefined, function (value) {
  479. return enumerator._settledAt(FULFILLED, i, value);
  480. }, function (reason) {
  481. return enumerator._settledAt(REJECTED, i, reason);
  482. });
  483. };
  484. /**
  485. `Promise.all` accepts an array of promises, and returns a new promise which
  486. is fulfilled with an array of fulfillment values for the passed promises, or
  487. rejected with the reason of the first passed promise to be rejected. It casts all
  488. elements of the passed iterable to promises as it runs this algorithm.
  489. Example:
  490. ```javascript
  491. let promise1 = resolve(1);
  492. let promise2 = resolve(2);
  493. let promise3 = resolve(3);
  494. let promises = [ promise1, promise2, promise3 ];
  495. Promise.all(promises).then(function(array){
  496. // The array here would be [ 1, 2, 3 ];
  497. });
  498. ```
  499. If any of the `promises` given to `all` are rejected, the first promise
  500. that is rejected will be given as an argument to the returned promises's
  501. rejection handler. For example:
  502. Example:
  503. ```javascript
  504. let promise1 = resolve(1);
  505. let promise2 = reject(new Error("2"));
  506. let promise3 = reject(new Error("3"));
  507. let promises = [ promise1, promise2, promise3 ];
  508. Promise.all(promises).then(function(array){
  509. // Code here never runs because there are rejected promises!
  510. }, function(error) {
  511. // error.message === "2"
  512. });
  513. ```
  514. @method all
  515. @static
  516. @param {Array} entries array of promises
  517. @param {String} label optional string for labeling the promise.
  518. Useful for tooling.
  519. @return {Promise} promise that is fulfilled when all `promises` have been
  520. fulfilled, or rejected if any of them become rejected.
  521. @static
  522. */
  523. function all(entries) {
  524. return new Enumerator(this, entries).promise;
  525. }
  526. /**
  527. `Promise.race` returns a new promise which is settled in the same way as the
  528. first passed promise to settle.
  529. Example:
  530. ```javascript
  531. let promise1 = new Promise(function(resolve, reject){
  532. setTimeout(function(){
  533. resolve('promise 1');
  534. }, 200);
  535. });
  536. let promise2 = new Promise(function(resolve, reject){
  537. setTimeout(function(){
  538. resolve('promise 2');
  539. }, 100);
  540. });
  541. Promise.race([promise1, promise2]).then(function(result){
  542. // result === 'promise 2' because it was resolved before promise1
  543. // was resolved.
  544. });
  545. ```
  546. `Promise.race` is deterministic in that only the state of the first
  547. settled promise matters. For example, even if other promises given to the
  548. `promises` array argument are resolved, but the first settled promise has
  549. become rejected before the other promises became fulfilled, the returned
  550. promise will become rejected:
  551. ```javascript
  552. let promise1 = new Promise(function(resolve, reject){
  553. setTimeout(function(){
  554. resolve('promise 1');
  555. }, 200);
  556. });
  557. let promise2 = new Promise(function(resolve, reject){
  558. setTimeout(function(){
  559. reject(new Error('promise 2'));
  560. }, 100);
  561. });
  562. Promise.race([promise1, promise2]).then(function(result){
  563. // Code here never runs
  564. }, function(reason){
  565. // reason.message === 'promise 2' because promise 2 became rejected before
  566. // promise 1 became fulfilled
  567. });
  568. ```
  569. An example real-world use case is implementing timeouts:
  570. ```javascript
  571. Promise.race([ajax('foo.json'), timeout(5000)])
  572. ```
  573. @method race
  574. @static
  575. @param {Array} promises array of promises to observe
  576. Useful for tooling.
  577. @return {Promise} a promise which settles in the same way as the first passed
  578. promise to settle.
  579. */
  580. function race(entries) {
  581. /*jshint validthis:true */
  582. var Constructor = this;
  583. if (!isArray(entries)) {
  584. return new Constructor(function (_, reject) {
  585. return reject(new TypeError('You must pass an array to race.'));
  586. });
  587. } else {
  588. return new Constructor(function (resolve, reject) {
  589. var length = entries.length;
  590. for (var i = 0; i < length; i++) {
  591. Constructor.resolve(entries[i]).then(resolve, reject);
  592. }
  593. });
  594. }
  595. }
  596. /**
  597. `Promise.reject` returns a promise rejected with the passed `reason`.
  598. It is shorthand for the following:
  599. ```javascript
  600. let promise = new Promise(function(resolve, reject){
  601. reject(new Error('WHOOPS'));
  602. });
  603. promise.then(function(value){
  604. // Code here doesn't run because the promise is rejected!
  605. }, function(reason){
  606. // reason.message === 'WHOOPS'
  607. });
  608. ```
  609. Instead of writing the above, your code now simply becomes the following:
  610. ```javascript
  611. let promise = Promise.reject(new Error('WHOOPS'));
  612. promise.then(function(value){
  613. // Code here doesn't run because the promise is rejected!
  614. }, function(reason){
  615. // reason.message === 'WHOOPS'
  616. });
  617. ```
  618. @method reject
  619. @static
  620. @param {Any} reason value that the returned promise will be rejected with.
  621. Useful for tooling.
  622. @return {Promise} a promise rejected with the given `reason`.
  623. */
  624. function reject(reason) {
  625. /*jshint validthis:true */
  626. var Constructor = this;
  627. var promise = new Constructor(noop);
  628. _reject(promise, reason);
  629. return promise;
  630. }
  631. function needsResolver() {
  632. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  633. }
  634. function needsNew() {
  635. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  636. }
  637. /**
  638. Promise objects represent the eventual result of an asynchronous operation. The
  639. primary way of interacting with a promise is through its `then` method, which
  640. registers callbacks to receive either a promise's eventual value or the reason
  641. why the promise cannot be fulfilled.
  642. Terminology
  643. -----------
  644. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  645. - `thenable` is an object or function that defines a `then` method.
  646. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  647. - `exception` is a value that is thrown using the throw statement.
  648. - `reason` is a value that indicates why a promise was rejected.
  649. - `settled` the final resting state of a promise, fulfilled or rejected.
  650. A promise can be in one of three states: pending, fulfilled, or rejected.
  651. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  652. state. Promises that are rejected have a rejection reason and are in the
  653. rejected state. A fulfillment value is never a thenable.
  654. Promises can also be said to *resolve* a value. If this value is also a
  655. promise, then the original promise's settled state will match the value's
  656. settled state. So a promise that *resolves* a promise that rejects will
  657. itself reject, and a promise that *resolves* a promise that fulfills will
  658. itself fulfill.
  659. Basic Usage:
  660. ------------
  661. ```js
  662. let promise = new Promise(function(resolve, reject) {
  663. // on success
  664. resolve(value);
  665. // on failure
  666. reject(reason);
  667. });
  668. promise.then(function(value) {
  669. // on fulfillment
  670. }, function(reason) {
  671. // on rejection
  672. });
  673. ```
  674. Advanced Usage:
  675. ---------------
  676. Promises shine when abstracting away asynchronous interactions such as
  677. `XMLHttpRequest`s.
  678. ```js
  679. function getJSON(url) {
  680. return new Promise(function(resolve, reject){
  681. let xhr = new XMLHttpRequest();
  682. xhr.open('GET', url);
  683. xhr.onreadystatechange = handler;
  684. xhr.responseType = 'json';
  685. xhr.setRequestHeader('Accept', 'application/json');
  686. xhr.send();
  687. function handler() {
  688. if (this.readyState === this.DONE) {
  689. if (this.status === 200) {
  690. resolve(this.response);
  691. } else {
  692. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  693. }
  694. }
  695. };
  696. });
  697. }
  698. getJSON('/posts.json').then(function(json) {
  699. // on fulfillment
  700. }, function(reason) {
  701. // on rejection
  702. });
  703. ```
  704. Unlike callbacks, promises are great composable primitives.
  705. ```js
  706. Promise.all([
  707. getJSON('/posts'),
  708. getJSON('/comments')
  709. ]).then(function(values){
  710. values[0] // => postsJSON
  711. values[1] // => commentsJSON
  712. return values;
  713. });
  714. ```
  715. @class Promise
  716. @param {function} resolver
  717. Useful for tooling.
  718. @constructor
  719. */
  720. function Promise(resolver) {
  721. this[PROMISE_ID] = nextId();
  722. this._result = this._state = undefined;
  723. this._subscribers = [];
  724. if (noop !== resolver) {
  725. typeof resolver !== 'function' && needsResolver();
  726. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  727. }
  728. }
  729. Promise.all = all;
  730. Promise.race = race;
  731. Promise.resolve = resolve;
  732. Promise.reject = reject;
  733. Promise._setScheduler = setScheduler;
  734. Promise._setAsap = setAsap;
  735. Promise._asap = asap;
  736. Promise.prototype = {
  737. constructor: Promise,
  738. /**
  739. The primary way of interacting with a promise is through its `then` method,
  740. which registers callbacks to receive either a promise's eventual value or the
  741. reason why the promise cannot be fulfilled.
  742. ```js
  743. findUser().then(function(user){
  744. // user is available
  745. }, function(reason){
  746. // user is unavailable, and you are given the reason why
  747. });
  748. ```
  749. Chaining
  750. --------
  751. The return value of `then` is itself a promise. This second, 'downstream'
  752. promise is resolved with the return value of the first promise's fulfillment
  753. or rejection handler, or rejected if the handler throws an exception.
  754. ```js
  755. findUser().then(function (user) {
  756. return user.name;
  757. }, function (reason) {
  758. return 'default name';
  759. }).then(function (userName) {
  760. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  761. // will be `'default name'`
  762. });
  763. findUser().then(function (user) {
  764. throw new Error('Found user, but still unhappy');
  765. }, function (reason) {
  766. throw new Error('`findUser` rejected and we're unhappy');
  767. }).then(function (value) {
  768. // never reached
  769. }, function (reason) {
  770. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  771. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  772. });
  773. ```
  774. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  775. ```js
  776. findUser().then(function (user) {
  777. throw new PedagogicalException('Upstream error');
  778. }).then(function (value) {
  779. // never reached
  780. }).then(function (value) {
  781. // never reached
  782. }, function (reason) {
  783. // The `PedgagocialException` is propagated all the way down to here
  784. });
  785. ```
  786. Assimilation
  787. ------------
  788. Sometimes the value you want to propagate to a downstream promise can only be
  789. retrieved asynchronously. This can be achieved by returning a promise in the
  790. fulfillment or rejection handler. The downstream promise will then be pending
  791. until the returned promise is settled. This is called *assimilation*.
  792. ```js
  793. findUser().then(function (user) {
  794. return findCommentsByAuthor(user);
  795. }).then(function (comments) {
  796. // The user's comments are now available
  797. });
  798. ```
  799. If the assimliated promise rejects, then the downstream promise will also reject.
  800. ```js
  801. findUser().then(function (user) {
  802. return findCommentsByAuthor(user);
  803. }).then(function (comments) {
  804. // If `findCommentsByAuthor` fulfills, we'll have the value here
  805. }, function (reason) {
  806. // If `findCommentsByAuthor` rejects, we'll have the reason here
  807. });
  808. ```
  809. Simple Example
  810. --------------
  811. Synchronous Example
  812. ```javascript
  813. let result;
  814. try {
  815. result = findResult();
  816. // success
  817. } catch(reason) {
  818. // failure
  819. }
  820. ```
  821. Errback Example
  822. ```js
  823. findResult(function(result, err){
  824. if (err) {
  825. // failure
  826. } else {
  827. // success
  828. }
  829. });
  830. ```
  831. Promise Example;
  832. ```javascript
  833. findResult().then(function(result){
  834. // success
  835. }, function(reason){
  836. // failure
  837. });
  838. ```
  839. Advanced Example
  840. --------------
  841. Synchronous Example
  842. ```javascript
  843. let author, books;
  844. try {
  845. author = findAuthor();
  846. books = findBooksByAuthor(author);
  847. // success
  848. } catch(reason) {
  849. // failure
  850. }
  851. ```
  852. Errback Example
  853. ```js
  854. function foundBooks(books) {
  855. }
  856. function failure(reason) {
  857. }
  858. findAuthor(function(author, err){
  859. if (err) {
  860. failure(err);
  861. // failure
  862. } else {
  863. try {
  864. findBoooksByAuthor(author, function(books, err) {
  865. if (err) {
  866. failure(err);
  867. } else {
  868. try {
  869. foundBooks(books);
  870. } catch(reason) {
  871. failure(reason);
  872. }
  873. }
  874. });
  875. } catch(error) {
  876. failure(err);
  877. }
  878. // success
  879. }
  880. });
  881. ```
  882. Promise Example;
  883. ```javascript
  884. findAuthor().
  885. then(findBooksByAuthor).
  886. then(function(books){
  887. // found books
  888. }).catch(function(reason){
  889. // something went wrong
  890. });
  891. ```
  892. @method then
  893. @param {Function} onFulfilled
  894. @param {Function} onRejected
  895. Useful for tooling.
  896. @return {Promise}
  897. */
  898. then: then,
  899. /**
  900. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  901. as the catch block of a try/catch statement.
  902. ```js
  903. function findAuthor(){
  904. throw new Error('couldn't find that author');
  905. }
  906. // synchronous
  907. try {
  908. findAuthor();
  909. } catch(reason) {
  910. // something went wrong
  911. }
  912. // async with promises
  913. findAuthor().catch(function(reason){
  914. // something went wrong
  915. });
  916. ```
  917. @method catch
  918. @param {Function} onRejection
  919. Useful for tooling.
  920. @return {Promise}
  921. */
  922. 'catch': function _catch(onRejection) {
  923. return this.then(null, onRejection);
  924. }
  925. };
  926. function polyfill() {
  927. var local = undefined;
  928. if (typeof global !== 'undefined') {
  929. local = global;
  930. } else if (typeof self !== 'undefined') {
  931. local = self;
  932. } else {
  933. try {
  934. local = Function('return this')();
  935. } catch (e) {
  936. throw new Error('polyfill failed because global object is unavailable in this environment');
  937. }
  938. }
  939. var P = local.Promise;
  940. if (P) {
  941. var promiseToString = null;
  942. try {
  943. promiseToString = Object.prototype.toString.call(P.resolve());
  944. } catch (e) {
  945. // silently ignored
  946. }
  947. if (promiseToString === '[object Promise]' && !P.cast) {
  948. return;
  949. }
  950. }
  951. local.Promise = Promise;
  952. }
  953. polyfill();
  954. // Strange compat..
  955. Promise.polyfill = polyfill;
  956. Promise.Promise = Promise;
  957. return Promise;
  958. })));
  959. //# sourceMappingURL=es6-promise.map;
  960. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  961. promiseLib.polyfill();
  962. });
  963. (function () {
  964. define('app',["require", "amber/es2015-polyfills"], function (require) {
  965. require(["__app__"]);
  966. });
  967. }());
  968. //jshint eqnull:true
  969. define('amber/kernel-runtime',[],function () {
  970. "use strict";
  971. function defineMethod (klass, name, method) {
  972. Object.defineProperty(klass.prototype, name, {
  973. value: method,
  974. enumerable: false, configurable: true, writable: true
  975. });
  976. }
  977. function installJSMethod (obj, jsSelector, fn) {
  978. Object.defineProperty(obj, jsSelector, {
  979. value: fn,
  980. enumerable: false, configurable: true, writable: true
  981. });
  982. }
  983. function installMethod (method, klass) {
  984. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  985. }
  986. DNUBrik.deps = ["selectors", "smalltalkGlobals", "classes"];
  987. function DNUBrik (brikz, st) {
  988. var selectorPairs = brikz.selectors.selectorPairs;
  989. var globals = brikz.smalltalkGlobals.globals;
  990. var nilAsClass = brikz.classes.nilAsClass;
  991. /* Method not implemented handlers */
  992. function makeDnuHandler (pair, targetClasses) {
  993. var jsSelector = pair.js;
  994. var fn = createHandler(pair.st);
  995. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  996. targetClasses.forEach(function (target) {
  997. installJSMethod(target.fn.prototype, jsSelector, fn);
  998. });
  999. }
  1000. this.makeDnuHandler = makeDnuHandler;
  1001. /* Dnu handler method */
  1002. function createHandler (stSelector) {
  1003. return function () {
  1004. return globals.Message._selector_arguments_notUnderstoodBy_(
  1005. stSelector, [].slice.call(arguments), this
  1006. );
  1007. };
  1008. }
  1009. selectorPairs.forEach(function (pair) {
  1010. makeDnuHandler(pair, []);
  1011. });
  1012. }
  1013. RuntimeClassesBrik.deps = ["event", "selectors", "dnu", "behaviors", "classes"];
  1014. function RuntimeClassesBrik (brikz, st) {
  1015. var selectors = brikz.selectors;
  1016. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1017. var wireKlass = brikz.classes.wireKlass;
  1018. var emit = brikz.event.emit;
  1019. var detachedRootClasses = [];
  1020. function markClassDetachedRoot (klass) {
  1021. klass.detachedRoot = true;
  1022. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1023. return klass.detachedRoot;
  1024. });
  1025. }
  1026. this.detachedRootClasses = function () {
  1027. return detachedRootClasses;
  1028. };
  1029. /* Initialize a class in its class hierarchy. Handle both classes and
  1030. metaclasses. */
  1031. function initClassAndMetaclass (klass) {
  1032. initClass(klass);
  1033. if (klass.a$cls && !klass.meta) {
  1034. initClass(klass.a$cls);
  1035. }
  1036. }
  1037. traitsOrClasses.forEach(function (traitOrClass) {
  1038. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1039. });
  1040. emit.classAdded = function (klass) {
  1041. initClassAndMetaclass(klass);
  1042. klass._enterOrganization();
  1043. };
  1044. emit.traitAdded = function (trait) {
  1045. trait._enterOrganization();
  1046. };
  1047. emit.classRemoved = function (klass) {
  1048. klass._leaveOrganization();
  1049. };
  1050. emit.traitRemoved = function (trait) {
  1051. trait._leaveOrganization();
  1052. };
  1053. function initClass (klass) {
  1054. wireKlass(klass);
  1055. if (klass.detachedRoot) {
  1056. copySuperclass(klass);
  1057. }
  1058. installMethods(klass);
  1059. }
  1060. function copySuperclass (klass) {
  1061. var myproto = klass.fn.prototype,
  1062. superproto = klass.superclass.fn.prototype;
  1063. selectors.selectorPairs.forEach(function (selectorPair) {
  1064. var jsSelector = selectorPair.js;
  1065. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1066. });
  1067. }
  1068. function installMethods (klass) {
  1069. var methods = klass.methods;
  1070. Object.keys(methods).forEach(function (selector) {
  1071. installMethod(methods[selector], klass);
  1072. });
  1073. }
  1074. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1075. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1076. markClassDetachedRoot(klass);
  1077. klass.fn = constructor;
  1078. initClass(klass);
  1079. };
  1080. }
  1081. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1082. function FrameBindingBrik (brikz, st) {
  1083. var globals = brikz.smalltalkGlobals.globals;
  1084. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1085. setClassConstructor(globals.Number, Number);
  1086. setClassConstructor(globals.BlockClosure, Function);
  1087. setClassConstructor(globals.Boolean, Boolean);
  1088. setClassConstructor(globals.Date, Date);
  1089. setClassConstructor(globals.String, String);
  1090. setClassConstructor(globals.Array, Array);
  1091. setClassConstructor(globals.RegularExpression, RegExp);
  1092. setClassConstructor(globals.Error, Error);
  1093. setClassConstructor(globals.Promise, Promise);
  1094. this.__init__ = function () {
  1095. st.alias(globals.Array, "OrderedCollection");
  1096. st.alias(globals.Date, "Time");
  1097. }
  1098. }
  1099. RuntimeMethodsBrik.deps = ["event", "dnu", "runtimeClasses"];
  1100. function RuntimeMethodsBrik (brikz, st) {
  1101. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  1102. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  1103. var emit = brikz.event.emit;
  1104. emit.behaviorMethodAdded = function (method, klass) {
  1105. installMethod(method, klass);
  1106. propagateMethodChange(klass, method, klass);
  1107. };
  1108. emit.selectorsAdded = function (newSelectors) {
  1109. var targetClasses = detachedRootClasses();
  1110. newSelectors.forEach(function (pair) {
  1111. makeDnuHandler(pair, targetClasses);
  1112. });
  1113. };
  1114. emit.behaviorMethodRemoved = function (method, klass) {
  1115. delete klass.fn.prototype[method.jsSelector];
  1116. propagateMethodChange(klass, method, null);
  1117. };
  1118. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1119. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1120. };
  1121. function propagateMethodChange (klass, method, exclude) {
  1122. var selector = method.selector;
  1123. var jsSelector = method.jsSelector;
  1124. st.traverseClassTree(klass, function (subclass, sentinel) {
  1125. if (subclass === exclude) return;
  1126. if (subclass.methods[selector]) return sentinel;
  1127. if (subclass.detachedRoot) {
  1128. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1129. }
  1130. });
  1131. }
  1132. }
  1133. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1134. function PrimitivesBrik (brikz, st) {
  1135. var globals = brikz.smalltalkGlobals.globals;
  1136. /* Converts a JavaScript object to valid Smalltalk Object */
  1137. st.readJSObject = function (js) {
  1138. if (js == null) return null;
  1139. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1140. else if (js.constructor !== Object) return js;
  1141. var pairs = [];
  1142. for (var i in js) {
  1143. pairs.push(i, st.readJSObject(js[i]));
  1144. }
  1145. return globals.Dictionary._newFromPairs_(pairs);
  1146. };
  1147. /* Boolean assertion */
  1148. st.assert = function (shouldBeBoolean) {
  1149. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1150. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1151. shouldBeBoolean = shouldBeBoolean.valueOf();
  1152. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1153. }
  1154. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1155. };
  1156. }
  1157. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1158. function RuntimeBrik (brikz, st) {
  1159. var globals = brikz.smalltalkGlobals.globals;
  1160. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1161. function SmalltalkMethodContext (home, setup) {
  1162. // TODO lazy fill of .sendIdx
  1163. this.sendIdx = {};
  1164. // TODO very likely .senderContext, not .homeContext here
  1165. this.homeContext = home;
  1166. this.setup = setup;
  1167. }
  1168. // Fallbacks
  1169. SmalltalkMethodContext.prototype.supercall = false;
  1170. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1171. SmalltalkMethodContext.prototype.receiver = null;
  1172. SmalltalkMethodContext.prototype.selector = null;
  1173. SmalltalkMethodContext.prototype.lookupClass = null;
  1174. SmalltalkMethodContext.prototype.outerContext = null;
  1175. SmalltalkMethodContext.prototype.index = 0;
  1176. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1177. this.receiver = receiver;
  1178. this.selector = selector;
  1179. if (locals != null) this.locals = locals;
  1180. this.lookupClass = lookupClass;
  1181. if (this.homeContext) {
  1182. this.homeContext.evaluatedSelector = selector;
  1183. }
  1184. });
  1185. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1186. if (locals != null) this.locals = locals;
  1187. this.outerContext = ctx;
  1188. if (index) this.index = index;
  1189. });
  1190. defineMethod(SmalltalkMethodContext, "method", function () {
  1191. var method;
  1192. var lookup = this.lookupClass || this.receiver.a$cls;
  1193. while (!method && lookup) {
  1194. method = lookup.methods[st.js2st(this.selector)];
  1195. lookup = lookup.superclass;
  1196. }
  1197. return method;
  1198. });
  1199. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1200. /* This is the current call context object.
  1201. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1202. In JS code, use api.getThisContext() (see below).
  1203. */
  1204. var thisContext = null;
  1205. /*
  1206. Runs worker function so that error handler is not set up
  1207. if there isn't one. This is accomplished by unconditional
  1208. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1209. which then stops error handler setup (see st.withContext above).
  1210. The effect is, $core.seamless(fn)'s exceptions are not
  1211. handed into ST error handler and caller should process them.
  1212. */
  1213. st.seamless = function (worker) {
  1214. var oldContext = thisContext;
  1215. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1216. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1217. });
  1218. var result = worker(thisContext);
  1219. thisContext = oldContext;
  1220. return result;
  1221. };
  1222. function resultWithErrorHandling (worker) {
  1223. try {
  1224. return worker(thisContext);
  1225. } catch (error) {
  1226. globals.ErrorHandler._handleError_(error);
  1227. thisContext = null;
  1228. // Rethrow the error in any case.
  1229. throw error;
  1230. }
  1231. }
  1232. /*
  1233. Standard way to run within context.
  1234. Sets up error handler if entering first ST context in a stack.
  1235. */
  1236. st.withContext = function (worker, setup) {
  1237. var oldContext = thisContext;
  1238. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1239. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1240. thisContext = oldContext;
  1241. return result;
  1242. };
  1243. /* Handle thisContext pseudo variable */
  1244. st.getThisContext = function () {
  1245. if (!thisContext) return null;
  1246. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1247. frame.setup(frame);
  1248. }
  1249. return thisContext;
  1250. };
  1251. }
  1252. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1253. function MessageSendBrik (brikz, st) {
  1254. var globals = brikz.smalltalkGlobals.globals;
  1255. var nilAsReceiver = brikz.root.nilAsReceiver;
  1256. /* Send message programmatically. Used to implement #perform: & Co. */
  1257. st.send2 = function (self, selector, args, klass) {
  1258. if (self == null) {
  1259. self = nilAsReceiver;
  1260. }
  1261. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1262. return method != null ?
  1263. method.apply(self, args || []) :
  1264. globals.Message._selector_arguments_notUnderstoodBy_(
  1265. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1266. );
  1267. };
  1268. function wrapJavaScript (o) {
  1269. return globals.JSObjectProxy._on_(o);
  1270. }
  1271. st.wrapJavaScript = wrapJavaScript;
  1272. /* If the object property is a function, then call it, except if it starts with
  1273. an uppercase character (we probably want to answer the function itself in this
  1274. case and send it #new from Amber).
  1275. */
  1276. st.accessJavaScript = function (self, propertyName, args) {
  1277. var propertyValue = self[propertyName];
  1278. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1279. return propertyValue.apply(self, args || []);
  1280. } else if (args.length === 0) {
  1281. return propertyValue;
  1282. } else {
  1283. self[propertyName] = args[0];
  1284. return self;
  1285. }
  1286. };
  1287. }
  1288. StartImageBrik.deps = ["smalltalkGlobals"];
  1289. function StartImageBrik (brikz, st) {
  1290. var globals = brikz.smalltalkGlobals.globals;
  1291. this.run = function () {
  1292. globals.AmberBootstrapInitialization._run();
  1293. };
  1294. }
  1295. /* Making smalltalk that can run */
  1296. function configureWithRuntime (brikz) {
  1297. brikz.dnu = DNUBrik;
  1298. brikz.runtimeClasses = RuntimeClassesBrik;
  1299. brikz.frameBinding = FrameBindingBrik;
  1300. brikz.runtimeMethods = RuntimeMethodsBrik;
  1301. brikz.messageSend = MessageSendBrik;
  1302. brikz.runtime = RuntimeBrik;
  1303. brikz.primitives = PrimitivesBrik;
  1304. brikz.startImage = StartImageBrik;
  1305. brikz.rebuild();
  1306. }
  1307. return configureWithRuntime;
  1308. });
  1309. // Depend on each module that is loaded lazily.
  1310. // Add to packager tasks as dependency,
  1311. // so the lazy-loaded modules are included.
  1312. define('amber/lazypack',['./kernel-runtime'], {});
  1313. //jshint eqnull:true
  1314. define('amber/kernel-checks',[],function () {
  1315. "use strict";
  1316. function assert (fn) {
  1317. try {
  1318. if (fn()) return;
  1319. } catch (ex) {
  1320. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1321. }
  1322. throw new Error("Assertion failed:\n" + fn);
  1323. }
  1324. assert(function () {
  1325. return !("hasOwnProperty" in Object.create(null));
  1326. });
  1327. assert(function () {
  1328. return Object.getPrototypeOf(Object.create(null)) === null;
  1329. });
  1330. assert(function () {
  1331. var p = {};
  1332. return Object.getPrototypeOf(Object.create(p)) === p;
  1333. });
  1334. // assert(function () {
  1335. // return new Function("return this")().Object === Object;
  1336. // });
  1337. // assert(function () {
  1338. // return Object.create(new Function("return this")()).Object === Object;
  1339. // });
  1340. assert(function () {
  1341. return typeof global !== "undefined";
  1342. });
  1343. assert(function () {
  1344. return global.Object === Object;
  1345. });
  1346. assert(function () {
  1347. return Object.create(global).Object === Object;
  1348. });
  1349. assert(function () {
  1350. return (function () {
  1351. return this;
  1352. }).apply(void 0) === void 0;
  1353. });
  1354. assert(function () {
  1355. return (function () {
  1356. return this;
  1357. }).apply(null) === null;
  1358. });
  1359. assert(function () {
  1360. return (function () {
  1361. return this;
  1362. }).apply(3) === 3;
  1363. });
  1364. assert(function () {
  1365. return (function () {
  1366. return this;
  1367. }).apply("foo") === "foo";
  1368. });
  1369. assert(function () {
  1370. return (function () {
  1371. return this;
  1372. }).apply(true) === true;
  1373. });
  1374. assert(function () {
  1375. var o = Object.freeze({});
  1376. try {
  1377. o.foo = "bar";
  1378. } catch (ex) {
  1379. }
  1380. return o.foo == null;
  1381. });
  1382. assert(function () {
  1383. return typeof Promise === "function";
  1384. });
  1385. assert(function () {
  1386. return typeof Promise.resolve === "function";
  1387. });
  1388. assert(function () {
  1389. return typeof Promise.reject === "function";
  1390. });
  1391. assert(function () {
  1392. return typeof new Promise(function () {
  1393. }).then === "function";
  1394. });
  1395. });
  1396. define('amber/brikz',[], function () {
  1397. return function Brikz(api, apiKey, initKey) {
  1398. "use strict";
  1399. //jshint eqnull:true
  1400. var brikz = this,
  1401. backup = {};
  1402. apiKey = apiKey || 'exports';
  1403. initKey = initKey || '__init__';
  1404. function mixin(src, target, what) {
  1405. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1406. if (src == null) {
  1407. target[keys[i]] = undefined;
  1408. } else {
  1409. var value = src[keys[i]];
  1410. if (typeof value !== "undefined") {
  1411. target[keys[i]] = value;
  1412. }
  1413. }
  1414. }
  1415. return target;
  1416. }
  1417. Object.defineProperties(this, {
  1418. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1419. });
  1420. var exclude = mixin(this, {});
  1421. this.rebuild = function () {
  1422. Object.keys(backup).forEach(function (key) {
  1423. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1424. });
  1425. var oapi = mixin(api, {}),
  1426. order = [],
  1427. chk = {};
  1428. function ensure(key) {
  1429. if (key in exclude) {
  1430. return null;
  1431. }
  1432. var b = brikz[key],
  1433. bak = backup[key];
  1434. mixin(null, api, api);
  1435. while (typeof b === "function") {
  1436. (b.deps || []).forEach(ensure);
  1437. b = new b(brikz, api, bak);
  1438. }
  1439. brikz[key] = b;
  1440. if (b && !chk[key]) {
  1441. chk[key] = true;
  1442. order.push(b);
  1443. }
  1444. if (b && !b[apiKey]) {
  1445. b[apiKey] = mixin(api, {});
  1446. }
  1447. }
  1448. Object.keys(brikz).forEach(ensure);
  1449. mixin(oapi, mixin(null, api, api));
  1450. order.forEach(function (brik) {
  1451. mixin(brik[apiKey] || {}, api);
  1452. });
  1453. order.forEach(function (brik) {
  1454. if (brik[initKey]) {
  1455. brik[initKey]();
  1456. if (brik[initKey].once) {
  1457. delete brik[initKey];
  1458. }
  1459. }
  1460. });
  1461. backup = mixin(brikz, {});
  1462. };
  1463. };
  1464. });
  1465. /* ====================================================================
  1466. |
  1467. | Amber Smalltalk
  1468. | http://amber-lang.net
  1469. |
  1470. ======================================================================
  1471. ======================================================================
  1472. |
  1473. | Copyright (c) 2010-2014
  1474. | Nicolas Petton <petton.nicolas@gmail.com>
  1475. |
  1476. | Copyright (c) 2012-2017
  1477. | The Amber team https://lolg.it/org/amber/members
  1478. | Amber contributors (see /CONTRIBUTORS)
  1479. |
  1480. | Amber is released under the MIT license
  1481. |
  1482. | Permission is hereby granted, free of charge, to any person obtaining
  1483. | a copy of this software and associated documentation files (the
  1484. | 'Software'), to deal in the Software without restriction, including
  1485. | without limitation the rights to use, copy, modify, merge, publish,
  1486. | distribute, sublicense, and/or sell copies of the Software, and to
  1487. | permit persons to whom the Software is furnished to do so, subject to
  1488. | the following conditions:
  1489. |
  1490. | The above copyright notice and this permission notice shall be
  1491. | included in all copies or substantial portions of the Software.
  1492. |
  1493. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1494. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1495. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1496. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1497. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1498. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1499. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1500. |
  1501. ==================================================================== */
  1502. //jshint eqnull:true
  1503. define('amber/kernel-fundamentals',[],function () {
  1504. "use strict";
  1505. function inherits (child, parent) {
  1506. child.prototype = Object.create(parent.prototype, {
  1507. constructor: {
  1508. value: child,
  1509. enumerable: false, configurable: true, writable: true
  1510. }
  1511. });
  1512. return child;
  1513. }
  1514. function SmalltalkGlobalsBrik (brikz, st) {
  1515. var globals = Object.create(global);
  1516. globals.SmalltalkSettings = {};
  1517. this.globals = globals;
  1518. }
  1519. function EventBrik (brikz, st) {
  1520. var emit = {};
  1521. this.emit = emit;
  1522. this.declareEvent = function (event) {
  1523. if (!emit[event]) emit[event] = function () {
  1524. };
  1525. }
  1526. }
  1527. function RootBrik (brikz, st) {
  1528. /* Smalltalk foundational objects */
  1529. var coreFns = this.coreFns = {};
  1530. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1531. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1532. Detached roots (eg. wrapped JS classes like Number or Date)
  1533. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1534. function SmalltalkRoot () {
  1535. }
  1536. function SmalltalkProtoObject () {
  1537. }
  1538. function SmalltalkObject () {
  1539. }
  1540. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1541. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1542. this.Root = SmalltalkRoot;
  1543. this.Object = SmalltalkObject;
  1544. }
  1545. SelectorsBrik.deps = ["selectorConversion"];
  1546. function SelectorsBrik (brikz, st) {
  1547. var selectorSet = Object.create(null);
  1548. var selectors = this.selectors = [];
  1549. var selectorPairs = this.selectorPairs = [];
  1550. this.registerSelector = function (stSelector) {
  1551. if (selectorSet[stSelector]) return null;
  1552. var jsSelector = st.st2js(stSelector);
  1553. selectorSet[stSelector] = true;
  1554. selectors.push(stSelector);
  1555. var pair = {st: stSelector, js: jsSelector};
  1556. selectorPairs.push(pair);
  1557. return pair;
  1558. };
  1559. st.allSelectors = function () {
  1560. return selectors;
  1561. };
  1562. }
  1563. function PackagesBrik (brikz, st) {
  1564. st.packages = st.packageDescriptors = {};
  1565. /* Add a package load descriptor to the system */
  1566. st.addPackage = function (name, properties) {
  1567. if (!name) return null;
  1568. return st.packageDescriptors[name] = {properties: properties};
  1569. };
  1570. }
  1571. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1572. function BehaviorsBrik (brikz, st) {
  1573. var globals = brikz.smalltalkGlobals.globals;
  1574. var addElement = brikz.arraySet.addElement;
  1575. var removeElement = brikz.arraySet.removeElement;
  1576. /* Smalltalk classes and traits */
  1577. var traitsOrClasses = [];
  1578. this.buildTraitOrClass = function (category, builder) {
  1579. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1580. if (traitOrClass) {
  1581. builder.updateExisting(traitOrClass);
  1582. } else {
  1583. traitOrClass = builder.make();
  1584. traitOrClass.category = category;
  1585. addTraitOrClass(traitOrClass);
  1586. }
  1587. return traitOrClass;
  1588. };
  1589. function addTraitOrClass (traitOrClass) {
  1590. globals[traitOrClass.name] = traitOrClass;
  1591. addElement(traitsOrClasses, traitOrClass);
  1592. traitOrClass.added();
  1593. }
  1594. function removeTraitOrClass (traitOrClass) {
  1595. traitOrClass.removed();
  1596. removeElement(traitsOrClasses, traitOrClass);
  1597. delete globals[traitOrClass.name];
  1598. }
  1599. this.removeTraitOrClass = removeTraitOrClass;
  1600. /* Create an alias for an existing class */
  1601. st.alias = function (traitOrClass, alias) {
  1602. globals[alias] = traitOrClass;
  1603. };
  1604. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1605. }
  1606. MethodsBrik.deps = ["event", "selectors", "root", "selectorConversion"];
  1607. function MethodsBrik (brikz, st) {
  1608. var registerSelector = brikz.selectors.registerSelector;
  1609. var SmalltalkObject = brikz.root.Object;
  1610. var coreFns = brikz.root.coreFns;
  1611. var emit = brikz.event.emit;
  1612. var declareEvent = brikz.event.declareEvent;
  1613. function SmalltalkMethod () {
  1614. }
  1615. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1616. /* Smalltalk method object. To add a method to a class,
  1617. use api.addMethod() */
  1618. st.method = function (spec) {
  1619. var that = new SmalltalkMethod();
  1620. var selector = spec.selector;
  1621. that.selector = selector;
  1622. that.jsSelector = st.st2js(selector);
  1623. that.args = spec.args || {};
  1624. that.protocol = spec.protocol;
  1625. that.source = spec.source;
  1626. that.messageSends = spec.messageSends || [];
  1627. // TODO remove .referencedClasses, have .referencedGlobals
  1628. that.referencedClasses = spec.referencedClasses || [];
  1629. that.fn = spec.fn;
  1630. return that;
  1631. };
  1632. /* Add/remove a method to/from a class */
  1633. st.addMethod = function (method, traitOrBehavior) {
  1634. if (method.owner != null) {
  1635. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1636. }
  1637. method.owner = traitOrBehavior;
  1638. // TODO deprecation helper; remove
  1639. Object.defineProperty(method, "methodClass", {
  1640. get: function () {
  1641. console.warn("Use of .methodClass deprecated, use .owner");
  1642. return method.owner;
  1643. },
  1644. set: function (v) {
  1645. console.warn("Use of .methodClass= deprecated, use .owner=");
  1646. method.owner = v;
  1647. }
  1648. });
  1649. registerNewSelectors(method);
  1650. traitOrBehavior.localMethods[method.selector] = method;
  1651. updateMethod(method.selector, traitOrBehavior);
  1652. };
  1653. declareEvent("selectorsAdded");
  1654. function registerNewSelectors (method) {
  1655. var newSelectors = [];
  1656. function selectorInUse (stSelector) {
  1657. var pair = registerSelector(stSelector);
  1658. if (pair) {
  1659. newSelectors.push(pair);
  1660. }
  1661. }
  1662. selectorInUse(method.selector);
  1663. method.messageSends.forEach(selectorInUse);
  1664. emit.selectorsAdded(newSelectors);
  1665. }
  1666. st.removeMethod = function (method, traitOrBehavior) {
  1667. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1668. delete traitOrBehavior.localMethods[method.selector];
  1669. updateMethod(method.selector, traitOrBehavior);
  1670. };
  1671. this.setupMethods = function (traitOrBehavior) {
  1672. traitOrBehavior.localMethods = Object.create(null);
  1673. traitOrBehavior.methods = Object.create(null);
  1674. };
  1675. declareEvent("methodReplaced");
  1676. function updateMethod (selector, traitOrBehavior) {
  1677. var oldMethod = traitOrBehavior.methods[selector],
  1678. newMethod = traitOrBehavior.localMethods[selector];
  1679. if (oldMethod == null && newMethod == null) {
  1680. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1681. return;
  1682. }
  1683. if (newMethod === oldMethod) return;
  1684. if (newMethod != null) {
  1685. traitOrBehavior.methods[selector] = newMethod;
  1686. traitOrBehavior.methodAdded(newMethod);
  1687. } else {
  1688. delete traitOrBehavior.methods[selector];
  1689. traitOrBehavior.methodRemoved(oldMethod);
  1690. }
  1691. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1692. }
  1693. this.updateMethod = updateMethod;
  1694. }
  1695. function ArraySetBrik (brikz, st) {
  1696. st.addElement = this.addElement = function (array, el) {
  1697. if (typeof el === 'undefined') {
  1698. return;
  1699. }
  1700. if (array.indexOf(el) === -1) {
  1701. array.push(el);
  1702. }
  1703. };
  1704. st.removeElement = this.removeElement = function (array, el) {
  1705. var i = array.indexOf(el);
  1706. if (i !== -1) {
  1707. array.splice(i, 1);
  1708. }
  1709. };
  1710. }
  1711. function SelectorConversionBrik (brikz, st) {
  1712. /* Convert a Smalltalk selector into a JS selector */
  1713. st.st2js = function (string) {
  1714. return '_' + string
  1715. .replace(/:/g, '_')
  1716. .replace(/[\&]/g, '_and')
  1717. .replace(/[\|]/g, '_or')
  1718. .replace(/[+]/g, '_plus')
  1719. .replace(/-/g, '_minus')
  1720. .replace(/[*]/g, '_star')
  1721. .replace(/[\/]/g, '_slash')
  1722. .replace(/[\\]/g, '_backslash')
  1723. .replace(/[\~]/g, '_tild')
  1724. .replace(/%/g, '_percent')
  1725. .replace(/>/g, '_gt')
  1726. .replace(/</g, '_lt')
  1727. .replace(/=/g, '_eq')
  1728. .replace(/,/g, '_comma')
  1729. .replace(/[@]/g, '_at');
  1730. };
  1731. /* Convert a string to a valid smalltalk selector.
  1732. if you modify the following functions, also change st2js
  1733. accordingly */
  1734. st.js2st = function (selector) {
  1735. if (selector.match(/^__/)) {
  1736. return binaryJsToSt(selector);
  1737. } else {
  1738. return keywordJsToSt(selector);
  1739. }
  1740. };
  1741. function keywordJsToSt (selector) {
  1742. return selector.replace(/^_/, '').replace(/_/g, ':');
  1743. }
  1744. function binaryJsToSt (selector) {
  1745. return selector
  1746. .replace(/^_/, '')
  1747. .replace(/_and/g, '&')
  1748. .replace(/_or/g, '|')
  1749. .replace(/_plus/g, '+')
  1750. .replace(/_minus/g, '-')
  1751. .replace(/_star/g, '*')
  1752. .replace(/_slash/g, '/')
  1753. .replace(/_backslash/g, '\\')
  1754. .replace(/_tild/g, '~')
  1755. .replace(/_percent/g, '%')
  1756. .replace(/_gt/g, '>')
  1757. .replace(/_lt/g, '<')
  1758. .replace(/_eq/g, '=')
  1759. .replace(/_comma/g, ',')
  1760. .replace(/_at/g, '@');
  1761. }
  1762. st.st2prop = function (stSelector) {
  1763. var colonPosition = stSelector.indexOf(':');
  1764. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1765. };
  1766. }
  1767. NilBrik.deps = ["root"];
  1768. function NilBrik (brikz, st) {
  1769. var SmalltalkObject = brikz.root.Object;
  1770. var coreFns = brikz.root.coreFns;
  1771. function SmalltalkNil () {
  1772. }
  1773. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1774. this.nilAsReceiver = new SmalltalkNil();
  1775. this.nilAsValue = this.nilAsReceiver; // TODO null
  1776. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1777. // nil objects from one environment to another, doing
  1778. // `anObject == nil` (in JavaScript) does not always answer
  1779. // true as the referenced nil object might come from the other
  1780. // environment.
  1781. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1782. value: true,
  1783. enumerable: false, configurable: false, writable: false
  1784. });
  1785. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1786. value: true,
  1787. enumerable: false, configurable: false, writable: false
  1788. });
  1789. }
  1790. /* Making smalltalk that has basic building blocks */
  1791. function configureWithFundamentals (brikz) {
  1792. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1793. brikz.root = RootBrik;
  1794. brikz.nil = NilBrik;
  1795. brikz.event = EventBrik;
  1796. brikz.arraySet = ArraySetBrik;
  1797. brikz.selectorConversion = SelectorConversionBrik;
  1798. brikz.selectors = SelectorsBrik;
  1799. brikz.packages = PackagesBrik;
  1800. brikz.behaviors = BehaviorsBrik;
  1801. brikz.methods = MethodsBrik;
  1802. brikz.rebuild();
  1803. }
  1804. return configureWithFundamentals;
  1805. });
  1806. /* ====================================================================
  1807. |
  1808. | Amber Smalltalk
  1809. | http://amber-lang.net
  1810. |
  1811. ======================================================================
  1812. ======================================================================
  1813. |
  1814. | Copyright (c) 2010-2014
  1815. | Nicolas Petton <petton.nicolas@gmail.com>
  1816. |
  1817. | Copyright (c) 2012-2017
  1818. | The Amber team https://lolg.it/org/amber/members
  1819. | Amber contributors (see /CONTRIBUTORS)
  1820. |
  1821. | Amber is released under the MIT license
  1822. |
  1823. | Permission is hereby granted, free of charge, to any person obtaining
  1824. | a copy of this software and associated documentation files (the
  1825. | 'Software'), to deal in the Software without restriction, including
  1826. | without limitation the rights to use, copy, modify, merge, publish,
  1827. | distribute, sublicense, and/or sell copies of the Software, and to
  1828. | permit persons to whom the Software is furnished to do so, subject to
  1829. | the following conditions:
  1830. |
  1831. | The above copyright notice and this permission notice shall be
  1832. | included in all copies or substantial portions of the Software.
  1833. |
  1834. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1835. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1836. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1837. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1838. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1839. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1840. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1841. |
  1842. ==================================================================== */
  1843. //jshint eqnull:true
  1844. define('amber/kernel-language',[],function () {
  1845. "use strict";
  1846. function inherits (child, parent) {
  1847. child.prototype = Object.create(parent.prototype, {
  1848. constructor: {
  1849. value: child,
  1850. enumerable: false, configurable: true, writable: true
  1851. }
  1852. });
  1853. return child;
  1854. }
  1855. function defineMethod (klass, name, method) {
  1856. Object.defineProperty(klass.prototype, name, {
  1857. value: method,
  1858. enumerable: false, configurable: true, writable: true
  1859. });
  1860. }
  1861. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1862. function TraitsBrik (brikz, st) {
  1863. var coreFns = brikz.root.coreFns;
  1864. var SmalltalkObject = brikz.root.Object;
  1865. var setupMethods = brikz.methods.setupMethods;
  1866. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1867. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1868. var emit = brikz.event.emit;
  1869. var declareEvent = brikz.event.declareEvent;
  1870. function SmalltalkTrait () {
  1871. }
  1872. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1873. SmalltalkTrait.prototype.trait = true;
  1874. defineMethod(SmalltalkTrait, "toString", function () {
  1875. return 'Smalltalk Trait ' + this.name;
  1876. });
  1877. declareEvent("traitAdded");
  1878. defineMethod(SmalltalkTrait, "added", function () {
  1879. emit.traitAdded(this);
  1880. });
  1881. declareEvent("traitRemoved");
  1882. defineMethod(SmalltalkTrait, "removed", function () {
  1883. emit.traitRemoved(this);
  1884. });
  1885. declareEvent("traitMethodAdded");
  1886. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1887. var self = this;
  1888. this.traitUsers.forEach(function (each) {
  1889. traitMethodChanged(method.selector, method, self, each);
  1890. });
  1891. emit.traitMethodAdded(method, this);
  1892. });
  1893. declareEvent("traitMethodRemoved");
  1894. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1895. var self = this;
  1896. this.traitUsers.forEach(function (each) {
  1897. traitMethodChanged(method.selector, null, self, each);
  1898. });
  1899. emit.traitMethodRemoved(method, this);
  1900. });
  1901. function traitBuilder (traitName) {
  1902. return {
  1903. name: traitName,
  1904. make: function () {
  1905. var that = new SmalltalkTrait();
  1906. // TODO deprecation helper; remove
  1907. Object.defineProperty(that, "className", {
  1908. get: function () {
  1909. console.warn("Use of .className deprecated, use .name");
  1910. return that.name;
  1911. },
  1912. set: function (v) {
  1913. console.warn("Use of .className= deprecated, use .name=");
  1914. that.name = v;
  1915. }
  1916. });
  1917. that.name = traitName;
  1918. that.traitUsers = [];
  1919. setupMethods(that);
  1920. return that;
  1921. },
  1922. updateExisting: function (trait) {
  1923. }
  1924. };
  1925. }
  1926. st.addTrait = function (className, category) {
  1927. return buildTraitOrClass(category, traitBuilder(className));
  1928. };
  1929. }
  1930. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1931. function MethodCompositionBrik (brikz, st) {
  1932. var updateMethod = brikz.methods.updateMethod;
  1933. var addElement = brikz.arraySet.addElement;
  1934. var removeElement = brikz.arraySet.removeElement;
  1935. function aliased (selector, method) {
  1936. if (method.selector === selector) return method;
  1937. var result = st.method({
  1938. selector: selector,
  1939. args: method.args,
  1940. protocol: method.protocol,
  1941. source: '"Aliased as ' + selector + '"\n' + method.source,
  1942. messageSends: method.messageSends,
  1943. referencesClasses: method.referencedClasses,
  1944. fn: method.fn
  1945. });
  1946. result.owner = method.owner;
  1947. return result;
  1948. }
  1949. function deleteKeysFrom (keys, obj) {
  1950. keys.forEach(function (each) {
  1951. delete obj[each];
  1952. });
  1953. }
  1954. function fillTraitTransformation (traitTransformation, obj) {
  1955. // assert(Object.getOwnProperties(obj).length === 0)
  1956. var traitMethods = traitTransformation.trait.methods;
  1957. Object.keys(traitMethods).forEach(function (selector) {
  1958. obj[selector] = traitMethods[selector];
  1959. });
  1960. var traitAliases = traitTransformation.aliases;
  1961. if (traitAliases) {
  1962. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1963. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1964. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1965. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1966. });
  1967. }
  1968. var traitExclusions = traitTransformation.exclusions;
  1969. if (traitExclusions) {
  1970. deleteKeysFrom(traitExclusions, obj);
  1971. }
  1972. return obj;
  1973. }
  1974. function buildCompositionChain (traitComposition) {
  1975. return traitComposition.reduce(function (soFar, each) {
  1976. return fillTraitTransformation(each, Object.create(soFar));
  1977. }, null);
  1978. }
  1979. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1980. var oldLocalMethods = traitOrBehavior.localMethods,
  1981. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1982. Object.keys(oldLocalMethods).forEach(function (selector) {
  1983. newLocalMethods[selector] = oldLocalMethods[selector];
  1984. });
  1985. var selector;
  1986. traitOrBehavior.localMethods = newLocalMethods;
  1987. for (selector in newLocalMethods) {
  1988. updateMethod(selector, traitOrBehavior);
  1989. }
  1990. for (selector in oldLocalMethods) {
  1991. updateMethod(selector, traitOrBehavior);
  1992. }
  1993. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1994. removeElement(each.trait.traitUsers, traitOrBehavior);
  1995. });
  1996. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  1997. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1998. addElement(each.trait.traitUsers, traitOrBehavior);
  1999. });
  2000. };
  2001. function aliasesOfSelector (selector, traitAliases) {
  2002. if (!traitAliases) return [selector];
  2003. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2004. return traitAliases[aliasSelector] === selector
  2005. });
  2006. if (!traitAliases[selector]) result.push(selector);
  2007. return result;
  2008. }
  2009. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2010. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2011. changes.forEach(function (aliasSelector) {
  2012. obj[aliasSelector] = aliased(aliasSelector, method);
  2013. });
  2014. var traitExclusions = traitTransformation.exclusions;
  2015. if (traitExclusions) {
  2016. deleteKeysFrom(traitExclusions, obj);
  2017. }
  2018. return changes;
  2019. }
  2020. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2021. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2022. deleteKeysFrom(changes, obj);
  2023. return changes;
  2024. }
  2025. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2026. var traitComposition = traitOrBehavior.traitComposition,
  2027. chain = traitOrBehavior.localMethods,
  2028. changes = [];
  2029. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2030. chain = Object.getPrototypeOf(chain);
  2031. var traitTransformation = traitComposition[i];
  2032. if (traitTransformation.trait !== trait) continue;
  2033. changes.push.apply(changes, method ?
  2034. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2035. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2036. }
  2037. // assert(chain === null);
  2038. changes.forEach(function (each) {
  2039. updateMethod(each, traitOrBehavior);
  2040. });
  2041. }
  2042. this.traitMethodChanged = traitMethodChanged;
  2043. }
  2044. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2045. function ClassesBrik (brikz, st) {
  2046. var SmalltalkRoot = brikz.root.Root;
  2047. var coreFns = brikz.root.coreFns;
  2048. var globals = brikz.smalltalkGlobals.globals;
  2049. var SmalltalkObject = brikz.root.Object;
  2050. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2051. var setupMethods = brikz.methods.setupMethods;
  2052. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2053. var addElement = brikz.arraySet.addElement;
  2054. var removeElement = brikz.arraySet.removeElement;
  2055. var emit = brikz.event.emit;
  2056. var declareEvent = brikz.event.declareEvent;
  2057. function SmalltalkBehavior () {
  2058. }
  2059. function SmalltalkClass () {
  2060. }
  2061. function SmalltalkMetaclass () {
  2062. }
  2063. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2064. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2065. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2066. // Fake root class of the system.
  2067. // Effective superclass of all classes created with `nil subclass: ...`.
  2068. var nilAsClass = this.nilAsClass = {
  2069. fn: SmalltalkRoot,
  2070. a$cls: {fn: SmalltalkClass},
  2071. klass: {fn: SmalltalkClass}
  2072. };
  2073. SmalltalkMetaclass.prototype.meta = true;
  2074. defineMethod(SmalltalkClass, "toString", function () {
  2075. return 'Smalltalk ' + this.name;
  2076. });
  2077. defineMethod(SmalltalkMetaclass, "toString", function () {
  2078. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2079. });
  2080. declareEvent("classAdded");
  2081. defineMethod(SmalltalkClass, "added", function () {
  2082. addSubclass(this);
  2083. emit.classAdded(this);
  2084. });
  2085. declareEvent("classRemoved");
  2086. defineMethod(SmalltalkClass, "removed", function () {
  2087. emit.classRemoved(this);
  2088. removeSubclass(this);
  2089. });
  2090. declareEvent("behaviorMethodAdded");
  2091. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2092. emit.behaviorMethodAdded(method, this);
  2093. });
  2094. declareEvent("behaviorMethodRemove");
  2095. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2096. emit.behaviorMethodRemoved(method, this);
  2097. });
  2098. this.bootstrapHierarchy = function () {
  2099. var nilSubclasses = [globals.ProtoObject];
  2100. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2101. nilSubclasses.forEach(function (each) {
  2102. each.a$cls.superclass = globals.Class;
  2103. addSubclass(each.a$cls);
  2104. });
  2105. };
  2106. /* Smalltalk class creation. A class is an instance of an automatically
  2107. created metaclass object. Newly created classes (not their metaclass)
  2108. should be added to the system, see smalltalk.addClass().
  2109. Superclass linking is *not* handled here, see api.initialize() */
  2110. function classBuilder (className, superclass, iVarNames, fn) {
  2111. var logicalSuperclass = superclass;
  2112. if (superclass == null || superclass.a$nil) {
  2113. superclass = nilAsClass;
  2114. logicalSuperclass = null;
  2115. }
  2116. function klass () {
  2117. var that = metaclass().instanceClass;
  2118. that.superclass = logicalSuperclass;
  2119. that.fn = fn || inherits(function () {
  2120. }, superclass.fn);
  2121. that.iVarNames = iVarNames || [];
  2122. // TODO deprecation helper; remove
  2123. Object.defineProperty(that, "className", {
  2124. get: function () {
  2125. console.warn("Use of .className deprecated, use .name");
  2126. return that.name;
  2127. },
  2128. set: function (v) {
  2129. console.warn("Use of .className= deprecated, use .name=");
  2130. that.name = v;
  2131. }
  2132. });
  2133. that.name = className;
  2134. that.subclasses = [];
  2135. setupMethods(that);
  2136. return that;
  2137. }
  2138. function metaclass () {
  2139. var that = new SmalltalkMetaclass();
  2140. that.superclass = superclass.a$cls;
  2141. that.fn = inherits(function () {
  2142. }, that.superclass.fn);
  2143. that.iVarNames = [];
  2144. that.instanceClass = new that.fn();
  2145. wireKlass(that);
  2146. setupMethods(that);
  2147. return that;
  2148. }
  2149. return {
  2150. name: className,
  2151. make: klass,
  2152. updateExisting: function (klass) {
  2153. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2154. if (iVarNames) klass.iVarNames = iVarNames;
  2155. } else throw new Error("Incompatible change of class: " + klass.name);
  2156. }
  2157. };
  2158. }
  2159. function wireKlass (klass) {
  2160. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2161. value: klass,
  2162. enumerable: false, configurable: true, writable: true
  2163. });
  2164. Object.defineProperty(klass.fn.prototype, "klass", {
  2165. value: klass,
  2166. enumerable: false, configurable: true, writable: true
  2167. });
  2168. }
  2169. this.wireKlass = wireKlass;
  2170. /* Add a class to the system, creating a new one if needed.
  2171. A Package is lazily created if one with given name does not exist. */
  2172. st.addClass = function (className, superclass, iVarNames, category) {
  2173. // While subclassing nil is allowed, it might be an error, so
  2174. // warn about it.
  2175. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2176. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2177. }
  2178. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2179. };
  2180. st.removeClass = removeTraitOrClass;
  2181. function addSubclass (klass) {
  2182. if (klass.superclass) {
  2183. addElement(klass.superclass.subclasses, klass);
  2184. }
  2185. }
  2186. function removeSubclass (klass) {
  2187. if (klass.superclass) {
  2188. removeElement(klass.superclass.subclasses, klass);
  2189. }
  2190. }
  2191. function metaSubclasses (metaclass) {
  2192. return metaclass.instanceClass.subclasses
  2193. .filter(function (each) {
  2194. return !each.meta;
  2195. })
  2196. .map(function (each) {
  2197. return each.a$cls;
  2198. });
  2199. }
  2200. st.metaSubclasses = metaSubclasses;
  2201. st.traverseClassTree = function (klass, fn) {
  2202. var queue = [klass], sentinel = {};
  2203. for (var i = 0; i < queue.length; ++i) {
  2204. var item = queue[i];
  2205. if (fn(item, sentinel) === sentinel) continue;
  2206. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2207. queue.push.apply(queue, subclasses);
  2208. }
  2209. };
  2210. }
  2211. /* Making smalltalk that can load */
  2212. function configureWithHierarchy (brikz) {
  2213. brikz.traits = TraitsBrik;
  2214. brikz.composition = MethodCompositionBrik;
  2215. brikz.classes = ClassesBrik;
  2216. brikz.rebuild();
  2217. }
  2218. return configureWithHierarchy;
  2219. });
  2220. /* ====================================================================
  2221. |
  2222. | Amber Smalltalk
  2223. | http://amber-lang.net
  2224. |
  2225. ======================================================================
  2226. ======================================================================
  2227. |
  2228. | Copyright (c) 2010-2014
  2229. | Nicolas Petton <petton.nicolas@gmail.com>
  2230. |
  2231. | Copyright (c) 2012-2017
  2232. | The Amber team https://lolg.it/org/amber/members
  2233. | Amber contributors (see /CONTRIBUTORS)
  2234. |
  2235. | Amber is released under the MIT license
  2236. |
  2237. | Permission is hereby granted, free of charge, to any person obtaining
  2238. | a copy of this software and associated documentation files (the
  2239. | 'Software'), to deal in the Software without restriction, including
  2240. | without limitation the rights to use, copy, modify, merge, publish,
  2241. | distribute, sublicense, and/or sell copies of the Software, and to
  2242. | permit persons to whom the Software is furnished to do so, subject to
  2243. | the following conditions:
  2244. |
  2245. | The above copyright notice and this permission notice shall be
  2246. | included in all copies or substantial portions of the Software.
  2247. |
  2248. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2249. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2250. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2251. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2252. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2253. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2254. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2255. |
  2256. ==================================================================== */
  2257. //jshint eqnull:true
  2258. define('amber/boot',[
  2259. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2260. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2261. "use strict";
  2262. require(['./kernel-runtime']); // preload
  2263. function SmalltalkInitBrik (brikz, st) {
  2264. var initialized = false;
  2265. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2266. require(['./kernel-runtime'], resolve, reject);
  2267. });
  2268. /* Smalltalk initialization. Called on page load */
  2269. st.initialize = function () {
  2270. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2271. if (initialized) return;
  2272. brikz.classes.bootstrapHierarchy();
  2273. configureWithRuntime(brikz);
  2274. // TODO deprecation helper; remove
  2275. Object.defineProperty(st, "packages", {
  2276. get: function () {
  2277. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2278. return st.packageDescriptors;
  2279. },
  2280. set: function (v) {
  2281. console.trace();
  2282. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2283. }
  2284. });
  2285. brikz.startImage.run();
  2286. initialized = true;
  2287. });
  2288. };
  2289. }
  2290. /* Adds AMD and requirejs related methods to the api */
  2291. function AMDBrik (brikz, st) {
  2292. st.amdRequire = require;
  2293. st.defaultTransportType = st.defaultTransportType || "amd";
  2294. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2295. }
  2296. /* Defines asReceiver to be present at load time */
  2297. /* (logically it belongs more to PrimitiveBrik) */
  2298. AsReceiverBrik.deps = ["nil"];
  2299. function AsReceiverBrik (brikz, st) {
  2300. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2301. /**
  2302. * This function is used all over the compiled amber code.
  2303. * It takes any value (JavaScript or Smalltalk)
  2304. * and returns a proper Amber Smalltalk receiver.
  2305. *
  2306. * null or undefined -> nilAsReceiver,
  2307. * object having Smalltalk signature -> unchanged,
  2308. * otherwise wrapped foreign (JS) object
  2309. */
  2310. this.asReceiver = function (o) {
  2311. if (o == null) return nilAsReceiver;
  2312. else if (o.a$cls != null) return o;
  2313. else return st.wrapJavaScript(o);
  2314. };
  2315. }
  2316. var api = {};
  2317. var brikz = new Brikz(api);
  2318. configureWithFundamentals(brikz);
  2319. configureWithHierarchy(brikz);
  2320. brikz.asReceiver = AsReceiverBrik;
  2321. brikz.stInit = SmalltalkInitBrik;
  2322. brikz.amd = AMDBrik;
  2323. brikz.rebuild();
  2324. return {
  2325. api: api,
  2326. nilAsReceiver: brikz.nil.nilAsReceiver,
  2327. nilAsValue: brikz.nil.nilAsValue,
  2328. nilAsClass: brikz.classes.nilAsClass,
  2329. globals: brikz.smalltalkGlobals.globals,
  2330. asReceiver: brikz.asReceiver.asReceiver
  2331. };
  2332. });
  2333. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2334. var globals = boot.globals,
  2335. exports = {},
  2336. api = boot.api,
  2337. nil = boot.nilAsReceiver;
  2338. // API
  2339. exports.popupHelios = function () {
  2340. require(['helios/index'], function (helios) {
  2341. helios.popup();
  2342. }, function (err) {
  2343. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2344. });
  2345. };
  2346. Object.defineProperty(exports, "api", {
  2347. value: api,
  2348. enumerable: true, configurable: true, writable: false
  2349. });
  2350. Object.defineProperty(exports, "globals", {
  2351. value: globals,
  2352. enumerable: true, configurable: true, writable: false
  2353. });
  2354. Object.defineProperty(exports, "nil", {
  2355. value: nil,
  2356. enumerable: true, configurable: true, writable: false
  2357. });
  2358. function mixinToSettings (source) {
  2359. var settings = globals.SmalltalkSettings;
  2360. Object.keys(source).forEach(function (key) {
  2361. settings[key] = source[key];
  2362. });
  2363. }
  2364. function settingsInLocalStorage () {
  2365. //jshint evil:true
  2366. var storage = 'localStorage' in global && global.localStorage;
  2367. if (storage) {
  2368. var fromStorage;
  2369. try {
  2370. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2371. } catch (ex) {
  2372. // pass
  2373. }
  2374. mixinToSettings(fromStorage || {});
  2375. // TODO find less hackish way to store settings back to storage.
  2376. if (typeof window !== "undefined") {
  2377. requirejs(['jquery'], function ($) {
  2378. $(window).on('beforeunload', function () {
  2379. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2380. });
  2381. });
  2382. }
  2383. }
  2384. }
  2385. exports.initialize = function (options) {
  2386. return Promise.resolve()
  2387. .then(function () {
  2388. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2389. })
  2390. .then(settingsInLocalStorage)
  2391. .then(function () {
  2392. return options || {};
  2393. })
  2394. .then(mixinToSettings)
  2395. .then(function () {
  2396. return api.initialize();
  2397. });
  2398. };
  2399. // Exports
  2400. return exports;
  2401. });
  2402. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2403. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2404. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2405. $core.addPackage("Kernel-Helpers");
  2406. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  2407. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2408. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2409. $core.addMethod(
  2410. $core.method({
  2411. selector: "subclass:",
  2412. protocol: "class creation",
  2413. fn: function (aString){
  2414. var self=this,$self=this;
  2415. return $core.withContext(function($ctx1) {
  2416. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2417. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2418. },
  2419. args: ["aString"],
  2420. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2421. referencedClasses: [],
  2422. messageSends: ["subclass:instanceVariableNames:package:"]
  2423. }),
  2424. $globals.TSubclassable);
  2425. $core.addMethod(
  2426. $core.method({
  2427. selector: "subclass:instanceVariableNames:",
  2428. protocol: "class creation",
  2429. fn: function (aString,anotherString){
  2430. var self=this,$self=this;
  2431. return $core.withContext(function($ctx1) {
  2432. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2433. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2434. },
  2435. args: ["aString", "anotherString"],
  2436. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2437. referencedClasses: [],
  2438. messageSends: ["subclass:instanceVariableNames:package:"]
  2439. }),
  2440. $globals.TSubclassable);
  2441. $core.addMethod(
  2442. $core.method({
  2443. selector: "subclass:instanceVariableNames:category:",
  2444. protocol: "class creation",
  2445. fn: function (aString,aString2,aString3){
  2446. var self=this,$self=this;
  2447. return $core.withContext(function($ctx1) {
  2448. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2449. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2450. },
  2451. args: ["aString", "aString2", "aString3"],
  2452. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2453. referencedClasses: [],
  2454. messageSends: ["subclass:instanceVariableNames:package:"]
  2455. }),
  2456. $globals.TSubclassable);
  2457. $core.addMethod(
  2458. $core.method({
  2459. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2460. protocol: "class creation",
  2461. fn: function (aString,aString2,classVars,pools,aString3){
  2462. var self=this,$self=this;
  2463. return $core.withContext(function($ctx1) {
  2464. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2465. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2466. },
  2467. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2468. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2469. referencedClasses: [],
  2470. messageSends: ["subclass:instanceVariableNames:package:"]
  2471. }),
  2472. $globals.TSubclassable);
  2473. $core.addMethod(
  2474. $core.method({
  2475. selector: "subclass:instanceVariableNames:package:",
  2476. protocol: "class creation",
  2477. fn: function (aString,aString2,aString3){
  2478. var self=this,$self=this;
  2479. return $core.withContext(function($ctx1) {
  2480. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2481. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2482. },
  2483. args: ["aString", "aString2", "aString3"],
  2484. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2485. referencedClasses: ["ClassBuilder"],
  2486. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2487. }),
  2488. $globals.TSubclassable);
  2489. $core.addMethod(
  2490. $core.method({
  2491. selector: "subclass:uses:",
  2492. protocol: "class creation",
  2493. fn: function (aString,aTraitCompositionDescription){
  2494. var self=this,$self=this;
  2495. return $core.withContext(function($ctx1) {
  2496. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2497. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2498. },
  2499. args: ["aString", "aTraitCompositionDescription"],
  2500. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2501. referencedClasses: [],
  2502. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2503. }),
  2504. $globals.TSubclassable);
  2505. $core.addMethod(
  2506. $core.method({
  2507. selector: "subclass:uses:instanceVariableNames:",
  2508. protocol: "class creation",
  2509. fn: function (aString,aTraitCompositionDescription,anotherString){
  2510. var self=this,$self=this;
  2511. return $core.withContext(function($ctx1) {
  2512. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2513. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2514. },
  2515. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2516. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: anotherString package: nil",
  2517. referencedClasses: [],
  2518. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2519. }),
  2520. $globals.TSubclassable);
  2521. $core.addMethod(
  2522. $core.method({
  2523. selector: "subclass:uses:instanceVariableNames:category:",
  2524. protocol: "class creation",
  2525. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2526. var self=this,$self=this;
  2527. return $core.withContext(function($ctx1) {
  2528. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2529. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2530. },
  2531. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2532. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2533. referencedClasses: [],
  2534. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2535. }),
  2536. $globals.TSubclassable);
  2537. $core.addMethod(
  2538. $core.method({
  2539. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2540. protocol: "class creation",
  2541. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2542. var self=this,$self=this;
  2543. return $core.withContext(function($ctx1) {
  2544. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2545. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2546. },
  2547. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2548. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Kept for file-in compatibility. ignores class variables and pools.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3",
  2549. referencedClasses: [],
  2550. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2551. }),
  2552. $globals.TSubclassable);
  2553. $core.addMethod(
  2554. $core.method({
  2555. selector: "subclass:uses:instanceVariableNames:package:",
  2556. protocol: "class creation",
  2557. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2558. var self=this,$self=this;
  2559. var cls;
  2560. return $core.withContext(function($ctx1) {
  2561. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2562. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2563. return cls;
  2564. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2565. },
  2566. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2567. source: "subclass: aString uses: aTraitCompositionDescription instanceVariableNames: aString2 package: aString3\x0a\x09| cls |\x0a\x09cls := self subclass: aString instanceVariableNames: aString2 package: aString3.\x0a\x09cls setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ cls",
  2568. referencedClasses: [],
  2569. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2570. }),
  2571. $globals.TSubclassable);
  2572. });
  2573. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2574. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2575. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2576. $core.addPackage("Kernel-Objects");
  2577. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2578. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2579. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2580. $globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
  2581. $core.addMethod(
  2582. $core.method({
  2583. selector: "=",
  2584. protocol: "comparing",
  2585. fn: function (anObject){
  2586. var self=this,$self=this;
  2587. return $core.withContext(function($ctx1) {
  2588. return $self.__eq_eq(anObject);
  2589. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2590. },
  2591. args: ["anObject"],
  2592. source: "= anObject\x0a\x09^ self == anObject",
  2593. referencedClasses: [],
  2594. messageSends: ["=="]
  2595. }),
  2596. $globals.ProtoObject);
  2597. $core.addMethod(
  2598. $core.method({
  2599. selector: "==",
  2600. protocol: "comparing",
  2601. fn: function (anObject){
  2602. var self=this,$self=this;
  2603. return $core.withContext(function($ctx1) {
  2604. return self === anObject;
  2605. return self;
  2606. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2607. },
  2608. args: ["anObject"],
  2609. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2610. referencedClasses: [],
  2611. messageSends: []
  2612. }),
  2613. $globals.ProtoObject);
  2614. $core.addMethod(
  2615. $core.method({
  2616. selector: "asString",
  2617. protocol: "converting",
  2618. fn: function (){
  2619. var self=this,$self=this;
  2620. return $core.withContext(function($ctx1) {
  2621. return $self._printString();
  2622. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2623. },
  2624. args: [],
  2625. source: "asString\x0a\x09^ self printString",
  2626. referencedClasses: [],
  2627. messageSends: ["printString"]
  2628. }),
  2629. $globals.ProtoObject);
  2630. $core.addMethod(
  2631. $core.method({
  2632. selector: "class",
  2633. protocol: "accessing",
  2634. fn: function (){
  2635. var self=this,$self=this;
  2636. return $core.withContext(function($ctx1) {
  2637. return $self.a$cls;
  2638. return self;
  2639. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2640. },
  2641. args: [],
  2642. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2643. referencedClasses: [],
  2644. messageSends: []
  2645. }),
  2646. $globals.ProtoObject);
  2647. $core.addMethod(
  2648. $core.method({
  2649. selector: "doesNotUnderstand:",
  2650. protocol: "error handling",
  2651. fn: function (aMessage){
  2652. var self=this,$self=this;
  2653. return $core.withContext(function($ctx1) {
  2654. var $1;
  2655. $1=$recv($globals.MessageNotUnderstood)._new();
  2656. $recv($1)._receiver_(self);
  2657. $recv($1)._message_(aMessage);
  2658. $recv($1)._signal();
  2659. return self;
  2660. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2661. },
  2662. args: ["aMessage"],
  2663. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2664. referencedClasses: ["MessageNotUnderstood"],
  2665. messageSends: ["receiver:", "new", "message:", "signal"]
  2666. }),
  2667. $globals.ProtoObject);
  2668. $core.addMethod(
  2669. $core.method({
  2670. selector: "evaluate:on:",
  2671. protocol: "evaluating",
  2672. fn: function (aString,anEvaluator){
  2673. var self=this,$self=this;
  2674. return $core.withContext(function($ctx1) {
  2675. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2676. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2677. },
  2678. args: ["aString", "anEvaluator"],
  2679. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2680. referencedClasses: [],
  2681. messageSends: ["evaluate:receiver:"]
  2682. }),
  2683. $globals.ProtoObject);
  2684. $core.addMethod(
  2685. $core.method({
  2686. selector: "identityHash",
  2687. protocol: "accessing",
  2688. fn: function (){
  2689. var self=this,$self=this;
  2690. return $core.withContext(function($ctx1) {
  2691. self._deprecatedAPI();
  2692. var hash=self.identityHash;
  2693. if (hash) return hash;
  2694. hash=$core.nextId();
  2695. Object.defineProperty(self, 'identityHash', {value:hash});
  2696. return hash;
  2697. ;
  2698. return self;
  2699. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2700. },
  2701. args: [],
  2702. source: "identityHash\x0a\x09<inlineJS: '\x0a\x09\x09self._deprecatedAPI();\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=$core.nextId();\x0a\x09\x09Object.defineProperty(self, ''identityHash'', {value:hash});\x0a\x09\x09return hash;\x0a\x09'>",
  2703. referencedClasses: [],
  2704. messageSends: []
  2705. }),
  2706. $globals.ProtoObject);
  2707. $core.addMethod(
  2708. $core.method({
  2709. selector: "ifNil:",
  2710. protocol: "testing",
  2711. fn: function (aBlock){
  2712. var self=this,$self=this;
  2713. return self;
  2714. },
  2715. args: ["aBlock"],
  2716. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2717. referencedClasses: [],
  2718. messageSends: []
  2719. }),
  2720. $globals.ProtoObject);
  2721. $core.addMethod(
  2722. $core.method({
  2723. selector: "ifNil:ifNotNil:",
  2724. protocol: "testing",
  2725. fn: function (aBlock,anotherBlock){
  2726. var self=this,$self=this;
  2727. return $core.withContext(function($ctx1) {
  2728. return $recv(anotherBlock)._value_(self);
  2729. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2730. },
  2731. args: ["aBlock", "anotherBlock"],
  2732. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2733. referencedClasses: [],
  2734. messageSends: ["value:"]
  2735. }),
  2736. $globals.ProtoObject);
  2737. $core.addMethod(
  2738. $core.method({
  2739. selector: "ifNotNil:",
  2740. protocol: "testing",
  2741. fn: function (aBlock){
  2742. var self=this,$self=this;
  2743. return $core.withContext(function($ctx1) {
  2744. return $recv(aBlock)._value_(self);
  2745. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2746. },
  2747. args: ["aBlock"],
  2748. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2749. referencedClasses: [],
  2750. messageSends: ["value:"]
  2751. }),
  2752. $globals.ProtoObject);
  2753. $core.addMethod(
  2754. $core.method({
  2755. selector: "ifNotNil:ifNil:",
  2756. protocol: "testing",
  2757. fn: function (aBlock,anotherBlock){
  2758. var self=this,$self=this;
  2759. return $core.withContext(function($ctx1) {
  2760. return $recv(aBlock)._value_(self);
  2761. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2762. },
  2763. args: ["aBlock", "anotherBlock"],
  2764. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2765. referencedClasses: [],
  2766. messageSends: ["value:"]
  2767. }),
  2768. $globals.ProtoObject);
  2769. $core.addMethod(
  2770. $core.method({
  2771. selector: "initialize",
  2772. protocol: "initialization",
  2773. fn: function (){
  2774. var self=this,$self=this;
  2775. return self;
  2776. },
  2777. args: [],
  2778. source: "initialize",
  2779. referencedClasses: [],
  2780. messageSends: []
  2781. }),
  2782. $globals.ProtoObject);
  2783. $core.addMethod(
  2784. $core.method({
  2785. selector: "inspect",
  2786. protocol: "inspecting",
  2787. fn: function (){
  2788. var self=this,$self=this;
  2789. return $core.withContext(function($ctx1) {
  2790. $recv($globals.Inspector)._inspect_(self);
  2791. return self;
  2792. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2793. },
  2794. args: [],
  2795. source: "inspect\x0a\x09Inspector inspect: self",
  2796. referencedClasses: ["Inspector"],
  2797. messageSends: ["inspect:"]
  2798. }),
  2799. $globals.ProtoObject);
  2800. $core.addMethod(
  2801. $core.method({
  2802. selector: "inspectOn:",
  2803. protocol: "inspecting",
  2804. fn: function (anInspector){
  2805. var self=this,$self=this;
  2806. return self;
  2807. },
  2808. args: ["anInspector"],
  2809. source: "inspectOn: anInspector",
  2810. referencedClasses: [],
  2811. messageSends: []
  2812. }),
  2813. $globals.ProtoObject);
  2814. $core.addMethod(
  2815. $core.method({
  2816. selector: "instVarAt:",
  2817. protocol: "accessing",
  2818. fn: function (aString){
  2819. var self=this,$self=this;
  2820. return $core.withContext(function($ctx1) {
  2821. return $self['@'+aString];
  2822. return self;
  2823. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2824. },
  2825. args: ["aString"],
  2826. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2827. referencedClasses: [],
  2828. messageSends: []
  2829. }),
  2830. $globals.ProtoObject);
  2831. $core.addMethod(
  2832. $core.method({
  2833. selector: "instVarAt:put:",
  2834. protocol: "accessing",
  2835. fn: function (aString,anObject){
  2836. var self=this,$self=this;
  2837. return $core.withContext(function($ctx1) {
  2838. $self['@' + aString] = anObject;
  2839. return self;
  2840. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2841. },
  2842. args: ["aString", "anObject"],
  2843. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2844. referencedClasses: [],
  2845. messageSends: []
  2846. }),
  2847. $globals.ProtoObject);
  2848. $core.addMethod(
  2849. $core.method({
  2850. selector: "isKindOf:",
  2851. protocol: "testing",
  2852. fn: function (aClass){
  2853. var self=this,$self=this;
  2854. return $core.withContext(function($ctx1) {
  2855. var $1;
  2856. $1=$self._isMemberOf_(aClass);
  2857. if($core.assert($1)){
  2858. return true;
  2859. } else {
  2860. return $recv($self._class())._inheritsFrom_(aClass);
  2861. }
  2862. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2863. },
  2864. args: ["aClass"],
  2865. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2866. referencedClasses: [],
  2867. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2868. }),
  2869. $globals.ProtoObject);
  2870. $core.addMethod(
  2871. $core.method({
  2872. selector: "isNil",
  2873. protocol: "testing",
  2874. fn: function (){
  2875. var self=this,$self=this;
  2876. return false;
  2877. },
  2878. args: [],
  2879. source: "isNil\x0a\x09^ false",
  2880. referencedClasses: [],
  2881. messageSends: []
  2882. }),
  2883. $globals.ProtoObject);
  2884. $core.addMethod(
  2885. $core.method({
  2886. selector: "notNil",
  2887. protocol: "testing",
  2888. fn: function (){
  2889. var self=this,$self=this;
  2890. return $core.withContext(function($ctx1) {
  2891. return $recv($self._isNil())._not();
  2892. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2893. },
  2894. args: [],
  2895. source: "notNil\x0a\x09^ self isNil not",
  2896. referencedClasses: [],
  2897. messageSends: ["not", "isNil"]
  2898. }),
  2899. $globals.ProtoObject);
  2900. $core.addMethod(
  2901. $core.method({
  2902. selector: "perform:",
  2903. protocol: "message handling",
  2904. fn: function (aString){
  2905. var self=this,$self=this;
  2906. return $core.withContext(function($ctx1) {
  2907. return $self._perform_withArguments_(aString,[]);
  2908. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2909. },
  2910. args: ["aString"],
  2911. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2912. referencedClasses: [],
  2913. messageSends: ["perform:withArguments:"]
  2914. }),
  2915. $globals.ProtoObject);
  2916. $core.addMethod(
  2917. $core.method({
  2918. selector: "perform:withArguments:",
  2919. protocol: "message handling",
  2920. fn: function (aString,aCollection){
  2921. var self=this,$self=this;
  2922. return $core.withContext(function($ctx1) {
  2923. return $core.send2(self, aString, aCollection);
  2924. return self;
  2925. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2926. },
  2927. args: ["aString", "aCollection"],
  2928. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2929. referencedClasses: [],
  2930. messageSends: []
  2931. }),
  2932. $globals.ProtoObject);
  2933. $core.addMethod(
  2934. $core.method({
  2935. selector: "printOn:",
  2936. protocol: "printing",
  2937. fn: function (aStream){
  2938. var self=this,$self=this;
  2939. return $core.withContext(function($ctx1) {
  2940. var $5,$4,$3,$2,$1;
  2941. $5=$self._class();
  2942. $ctx1.sendIdx["class"]=1;
  2943. $4=$recv($5)._name();
  2944. $ctx1.sendIdx["name"]=1;
  2945. $3=$recv($4)._first();
  2946. $2=$recv($3)._isVowel();
  2947. if($core.assert($2)){
  2948. $1="an ";
  2949. } else {
  2950. $1="a ";
  2951. }
  2952. $recv(aStream)._nextPutAll_($1);
  2953. $ctx1.sendIdx["nextPutAll:"]=1;
  2954. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  2955. return self;
  2956. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2957. },
  2958. args: ["aStream"],
  2959. source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  2960. referencedClasses: [],
  2961. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2962. }),
  2963. $globals.ProtoObject);
  2964. $core.addMethod(
  2965. $core.method({
  2966. selector: "printString",
  2967. protocol: "printing",
  2968. fn: function (){
  2969. var self=this,$self=this;
  2970. return $core.withContext(function($ctx1) {
  2971. return $recv($globals.String)._streamContents_((function(str){
  2972. return $core.withContext(function($ctx2) {
  2973. return $self._printOn_(str);
  2974. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2975. }));
  2976. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2977. },
  2978. args: [],
  2979. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2980. referencedClasses: ["String"],
  2981. messageSends: ["streamContents:", "printOn:"]
  2982. }),
  2983. $globals.ProtoObject);
  2984. $core.addMethod(
  2985. $core.method({
  2986. selector: "yourself",
  2987. protocol: "accessing",
  2988. fn: function (){
  2989. var self=this,$self=this;
  2990. return self;
  2991. },
  2992. args: [],
  2993. source: "yourself\x0a\x09^ self",
  2994. referencedClasses: [],
  2995. messageSends: []
  2996. }),
  2997. $globals.ProtoObject);
  2998. $core.addMethod(
  2999. $core.method({
  3000. selector: "~=",
  3001. protocol: "comparing",
  3002. fn: function (anObject){
  3003. var self=this,$self=this;
  3004. return $core.withContext(function($ctx1) {
  3005. var $1;
  3006. $1=$recv($self.__eq(anObject)).__eq(false);
  3007. $ctx1.sendIdx["="]=1;
  3008. return $1;
  3009. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3010. },
  3011. args: ["anObject"],
  3012. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3013. referencedClasses: [],
  3014. messageSends: ["="]
  3015. }),
  3016. $globals.ProtoObject);
  3017. $core.addMethod(
  3018. $core.method({
  3019. selector: "~~",
  3020. protocol: "comparing",
  3021. fn: function (anObject){
  3022. var self=this,$self=this;
  3023. return $core.withContext(function($ctx1) {
  3024. return $recv($self.__eq_eq(anObject)).__eq(false);
  3025. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3026. },
  3027. args: ["anObject"],
  3028. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3029. referencedClasses: [],
  3030. messageSends: ["=", "=="]
  3031. }),
  3032. $globals.ProtoObject);
  3033. $core.addMethod(
  3034. $core.method({
  3035. selector: "initialize",
  3036. protocol: "initialization",
  3037. fn: function (){
  3038. var self=this,$self=this;
  3039. return self;
  3040. },
  3041. args: [],
  3042. source: "initialize",
  3043. referencedClasses: [],
  3044. messageSends: []
  3045. }),
  3046. $globals.ProtoObject.a$cls);
  3047. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3048. $globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
  3049. $core.addMethod(
  3050. $core.method({
  3051. selector: "->",
  3052. protocol: "converting",
  3053. fn: function (anObject){
  3054. var self=this,$self=this;
  3055. return $core.withContext(function($ctx1) {
  3056. return $recv($globals.Association)._key_value_(self,anObject);
  3057. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3058. },
  3059. args: ["anObject"],
  3060. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3061. referencedClasses: ["Association"],
  3062. messageSends: ["key:value:"]
  3063. }),
  3064. $globals.Object);
  3065. $core.addMethod(
  3066. $core.method({
  3067. selector: "asJSONString",
  3068. protocol: "converting",
  3069. fn: function (){
  3070. var self=this,$self=this;
  3071. return $core.withContext(function($ctx1) {
  3072. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3073. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3074. },
  3075. args: [],
  3076. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3077. referencedClasses: ["JSON"],
  3078. messageSends: ["stringify:", "asJavaScriptObject"]
  3079. }),
  3080. $globals.Object);
  3081. $core.addMethod(
  3082. $core.method({
  3083. selector: "asJavaScriptObject",
  3084. protocol: "converting",
  3085. fn: function (){
  3086. var self=this,$self=this;
  3087. var variables;
  3088. return $core.withContext(function($ctx1) {
  3089. variables=$recv($globals.HashedCollection)._new();
  3090. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3091. return $core.withContext(function($ctx2) {
  3092. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3094. }));
  3095. return variables;
  3096. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3097. },
  3098. args: [],
  3099. source: "asJavaScriptObject\x0a\x09| variables |\x0a\x09variables := HashedCollection new.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) asJavaScriptObject ].\x0a\x09^ variables",
  3100. referencedClasses: ["HashedCollection"],
  3101. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3102. }),
  3103. $globals.Object);
  3104. $core.addMethod(
  3105. $core.method({
  3106. selector: "asJavaScriptSource",
  3107. protocol: "converting",
  3108. fn: function (){
  3109. var self=this,$self=this;
  3110. return $core.withContext(function($ctx1) {
  3111. return $self._asString();
  3112. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3113. },
  3114. args: [],
  3115. source: "asJavaScriptSource\x0a\x09^ self asString",
  3116. referencedClasses: [],
  3117. messageSends: ["asString"]
  3118. }),
  3119. $globals.Object);
  3120. $core.addMethod(
  3121. $core.method({
  3122. selector: "basicAt:",
  3123. protocol: "accessing",
  3124. fn: function (aString){
  3125. var self=this,$self=this;
  3126. return $core.withContext(function($ctx1) {
  3127. return self[aString];
  3128. return self;
  3129. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3130. },
  3131. args: ["aString"],
  3132. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3133. referencedClasses: [],
  3134. messageSends: []
  3135. }),
  3136. $globals.Object);
  3137. $core.addMethod(
  3138. $core.method({
  3139. selector: "basicAt:put:",
  3140. protocol: "accessing",
  3141. fn: function (aString,anObject){
  3142. var self=this,$self=this;
  3143. return $core.withContext(function($ctx1) {
  3144. return self[aString] = anObject;
  3145. return self;
  3146. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3147. },
  3148. args: ["aString", "anObject"],
  3149. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3150. referencedClasses: [],
  3151. messageSends: []
  3152. }),
  3153. $globals.Object);
  3154. $core.addMethod(
  3155. $core.method({
  3156. selector: "basicDelete:",
  3157. protocol: "accessing",
  3158. fn: function (aString){
  3159. var self=this,$self=this;
  3160. return $core.withContext(function($ctx1) {
  3161. delete self[aString]; return aString;
  3162. return self;
  3163. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3164. },
  3165. args: ["aString"],
  3166. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3167. referencedClasses: [],
  3168. messageSends: []
  3169. }),
  3170. $globals.Object);
  3171. $core.addMethod(
  3172. $core.method({
  3173. selector: "basicPerform:",
  3174. protocol: "message handling",
  3175. fn: function (aString){
  3176. var self=this,$self=this;
  3177. return $core.withContext(function($ctx1) {
  3178. return $self._basicPerform_withArguments_(aString,[]);
  3179. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3180. },
  3181. args: ["aString"],
  3182. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3183. referencedClasses: [],
  3184. messageSends: ["basicPerform:withArguments:"]
  3185. }),
  3186. $globals.Object);
  3187. $core.addMethod(
  3188. $core.method({
  3189. selector: "basicPerform:withArguments:",
  3190. protocol: "message handling",
  3191. fn: function (aString,aCollection){
  3192. var self=this,$self=this;
  3193. return $core.withContext(function($ctx1) {
  3194. return self[aString].apply(self, aCollection);;
  3195. return self;
  3196. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3197. },
  3198. args: ["aString", "aCollection"],
  3199. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3200. referencedClasses: [],
  3201. messageSends: []
  3202. }),
  3203. $globals.Object);
  3204. $core.addMethod(
  3205. $core.method({
  3206. selector: "browse",
  3207. protocol: "browsing",
  3208. fn: function (){
  3209. var self=this,$self=this;
  3210. return $core.withContext(function($ctx1) {
  3211. $recv($globals.Finder)._findClass_($self._class());
  3212. return self;
  3213. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3214. },
  3215. args: [],
  3216. source: "browse\x0a\x09Finder findClass: self class",
  3217. referencedClasses: ["Finder"],
  3218. messageSends: ["findClass:", "class"]
  3219. }),
  3220. $globals.Object);
  3221. $core.addMethod(
  3222. $core.method({
  3223. selector: "copy",
  3224. protocol: "copying",
  3225. fn: function (){
  3226. var self=this,$self=this;
  3227. return $core.withContext(function($ctx1) {
  3228. return $recv($self._shallowCopy())._postCopy();
  3229. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3230. },
  3231. args: [],
  3232. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3233. referencedClasses: [],
  3234. messageSends: ["postCopy", "shallowCopy"]
  3235. }),
  3236. $globals.Object);
  3237. $core.addMethod(
  3238. $core.method({
  3239. selector: "deepCopy",
  3240. protocol: "copying",
  3241. fn: function (){
  3242. var self=this,$self=this;
  3243. return $core.withContext(function($ctx1) {
  3244. var copy = self.a$cls._new();
  3245. Object.keys(self).forEach(function (i) {
  3246. if(/^@.+/.test(i)) {
  3247. copy[i] = $recv(self[i])._deepCopy();
  3248. }
  3249. });
  3250. return copy;
  3251. ;
  3252. return self;
  3253. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3254. },
  3255. args: [],
  3256. source: "deepCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = $recv(self[i])._deepCopy();\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3257. referencedClasses: [],
  3258. messageSends: []
  3259. }),
  3260. $globals.Object);
  3261. $core.addMethod(
  3262. $core.method({
  3263. selector: "deprecatedAPI",
  3264. protocol: "error handling",
  3265. fn: function (){
  3266. var self=this,$self=this;
  3267. return $core.withContext(function($ctx1) {
  3268. var $1,$6,$5,$4,$8,$7,$3,$2;
  3269. $1=console;
  3270. $6=$core.getThisContext()._home();
  3271. $ctx1.sendIdx["home"]=1;
  3272. $5=$recv($6)._asString();
  3273. $ctx1.sendIdx["asString"]=1;
  3274. $4=$recv($5).__comma(" is deprecated! (in ");
  3275. $8=$recv($core.getThisContext()._home())._home();
  3276. $ctx1.sendIdx["home"]=2;
  3277. $7=$recv($8)._asString();
  3278. $3=$recv($4).__comma($7);
  3279. $ctx1.sendIdx[","]=2;
  3280. $2=$recv($3).__comma(")");
  3281. $ctx1.sendIdx[","]=1;
  3282. $recv($1)._warn_($2);
  3283. return self;
  3284. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3285. },
  3286. args: [],
  3287. source: "deprecatedAPI\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.",
  3288. referencedClasses: [],
  3289. messageSends: ["warn:", ",", "asString", "home"]
  3290. }),
  3291. $globals.Object);
  3292. $core.addMethod(
  3293. $core.method({
  3294. selector: "deprecatedAPI:",
  3295. protocol: "error handling",
  3296. fn: function (aString){
  3297. var self=this,$self=this;
  3298. return $core.withContext(function($ctx1) {
  3299. var $1,$6,$5,$4,$8,$7,$3,$2;
  3300. $1=console;
  3301. $6=$core.getThisContext()._home();
  3302. $ctx1.sendIdx["home"]=1;
  3303. $5=$recv($6)._asString();
  3304. $ctx1.sendIdx["asString"]=1;
  3305. $4=$recv($5).__comma(" is deprecated! (in ");
  3306. $8=$recv($core.getThisContext()._home())._home();
  3307. $ctx1.sendIdx["home"]=2;
  3308. $7=$recv($8)._asString();
  3309. $3=$recv($4).__comma($7);
  3310. $ctx1.sendIdx[","]=2;
  3311. $2=$recv($3).__comma(")");
  3312. $ctx1.sendIdx[","]=1;
  3313. $recv($1)._warn_($2);
  3314. $ctx1.sendIdx["warn:"]=1;
  3315. $recv(console)._warn_(aString);
  3316. return self;
  3317. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3318. },
  3319. args: ["aString"],
  3320. source: "deprecatedAPI: aString\x0a\x09\x22Just a simple way to deprecate methods.\x0a\x09#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,\x0a\x09but it could in the future.\x22\x0a\x09console warn: thisContext home asString, ' is deprecated! (in ', thisContext home home asString, ')'.\x0a\x09console warn: aString",
  3321. referencedClasses: [],
  3322. messageSends: ["warn:", ",", "asString", "home"]
  3323. }),
  3324. $globals.Object);
  3325. $core.addMethod(
  3326. $core.method({
  3327. selector: "error:",
  3328. protocol: "error handling",
  3329. fn: function (aString){
  3330. var self=this,$self=this;
  3331. return $core.withContext(function($ctx1) {
  3332. $recv($globals.Error)._signal_(aString);
  3333. return self;
  3334. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3335. },
  3336. args: ["aString"],
  3337. source: "error: aString\x0a\x09Error signal: aString",
  3338. referencedClasses: ["Error"],
  3339. messageSends: ["signal:"]
  3340. }),
  3341. $globals.Object);
  3342. $core.addMethod(
  3343. $core.method({
  3344. selector: "halt",
  3345. protocol: "error handling",
  3346. fn: function (){
  3347. var self=this,$self=this;
  3348. return $core.withContext(function($ctx1) {
  3349. $recv($globals.Halt)._signal();
  3350. return self;
  3351. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3352. },
  3353. args: [],
  3354. source: "halt\x0a\x09Halt signal",
  3355. referencedClasses: ["Halt"],
  3356. messageSends: ["signal"]
  3357. }),
  3358. $globals.Object);
  3359. $core.addMethod(
  3360. $core.method({
  3361. selector: "in:",
  3362. protocol: "evaluating",
  3363. fn: function (aValuable){
  3364. var self=this,$self=this;
  3365. return $core.withContext(function($ctx1) {
  3366. return $recv(aValuable)._value_(self);
  3367. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3368. },
  3369. args: ["aValuable"],
  3370. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3371. referencedClasses: [],
  3372. messageSends: ["value:"]
  3373. }),
  3374. $globals.Object);
  3375. $core.addMethod(
  3376. $core.method({
  3377. selector: "isBehavior",
  3378. protocol: "testing",
  3379. fn: function (){
  3380. var self=this,$self=this;
  3381. return false;
  3382. },
  3383. args: [],
  3384. source: "isBehavior\x0a\x09^ false",
  3385. referencedClasses: [],
  3386. messageSends: []
  3387. }),
  3388. $globals.Object);
  3389. $core.addMethod(
  3390. $core.method({
  3391. selector: "isBoolean",
  3392. protocol: "testing",
  3393. fn: function (){
  3394. var self=this,$self=this;
  3395. return false;
  3396. },
  3397. args: [],
  3398. source: "isBoolean\x0a\x09^ false",
  3399. referencedClasses: [],
  3400. messageSends: []
  3401. }),
  3402. $globals.Object);
  3403. $core.addMethod(
  3404. $core.method({
  3405. selector: "isClass",
  3406. protocol: "testing",
  3407. fn: function (){
  3408. var self=this,$self=this;
  3409. return false;
  3410. },
  3411. args: [],
  3412. source: "isClass\x0a\x09^ false",
  3413. referencedClasses: [],
  3414. messageSends: []
  3415. }),
  3416. $globals.Object);
  3417. $core.addMethod(
  3418. $core.method({
  3419. selector: "isCompiledMethod",
  3420. protocol: "testing",
  3421. fn: function (){
  3422. var self=this,$self=this;
  3423. return false;
  3424. },
  3425. args: [],
  3426. source: "isCompiledMethod\x0a\x09^ false",
  3427. referencedClasses: [],
  3428. messageSends: []
  3429. }),
  3430. $globals.Object);
  3431. $core.addMethod(
  3432. $core.method({
  3433. selector: "isImmutable",
  3434. protocol: "testing",
  3435. fn: function (){
  3436. var self=this,$self=this;
  3437. return false;
  3438. },
  3439. args: [],
  3440. source: "isImmutable\x0a\x09^ false",
  3441. referencedClasses: [],
  3442. messageSends: []
  3443. }),
  3444. $globals.Object);
  3445. $core.addMethod(
  3446. $core.method({
  3447. selector: "isMemberOf:",
  3448. protocol: "testing",
  3449. fn: function (aClass){
  3450. var self=this,$self=this;
  3451. return $core.withContext(function($ctx1) {
  3452. return $recv($self._class()).__eq(aClass);
  3453. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3454. },
  3455. args: ["aClass"],
  3456. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3457. referencedClasses: [],
  3458. messageSends: ["=", "class"]
  3459. }),
  3460. $globals.Object);
  3461. $core.addMethod(
  3462. $core.method({
  3463. selector: "isMetaclass",
  3464. protocol: "testing",
  3465. fn: function (){
  3466. var self=this,$self=this;
  3467. return false;
  3468. },
  3469. args: [],
  3470. source: "isMetaclass\x0a\x09^ false",
  3471. referencedClasses: [],
  3472. messageSends: []
  3473. }),
  3474. $globals.Object);
  3475. $core.addMethod(
  3476. $core.method({
  3477. selector: "isNumber",
  3478. protocol: "testing",
  3479. fn: function (){
  3480. var self=this,$self=this;
  3481. return false;
  3482. },
  3483. args: [],
  3484. source: "isNumber\x0a\x09^ false",
  3485. referencedClasses: [],
  3486. messageSends: []
  3487. }),
  3488. $globals.Object);
  3489. $core.addMethod(
  3490. $core.method({
  3491. selector: "isPackage",
  3492. protocol: "testing",
  3493. fn: function (){
  3494. var self=this,$self=this;
  3495. return false;
  3496. },
  3497. args: [],
  3498. source: "isPackage\x0a\x09^ false",
  3499. referencedClasses: [],
  3500. messageSends: []
  3501. }),
  3502. $globals.Object);
  3503. $core.addMethod(
  3504. $core.method({
  3505. selector: "isParseFailure",
  3506. protocol: "testing",
  3507. fn: function (){
  3508. var self=this,$self=this;
  3509. return false;
  3510. },
  3511. args: [],
  3512. source: "isParseFailure\x0a\x09^ false",
  3513. referencedClasses: [],
  3514. messageSends: []
  3515. }),
  3516. $globals.Object);
  3517. $core.addMethod(
  3518. $core.method({
  3519. selector: "isString",
  3520. protocol: "testing",
  3521. fn: function (){
  3522. var self=this,$self=this;
  3523. return false;
  3524. },
  3525. args: [],
  3526. source: "isString\x0a\x09^ false",
  3527. referencedClasses: [],
  3528. messageSends: []
  3529. }),
  3530. $globals.Object);
  3531. $core.addMethod(
  3532. $core.method({
  3533. selector: "isSymbol",
  3534. protocol: "testing",
  3535. fn: function (){
  3536. var self=this,$self=this;
  3537. return false;
  3538. },
  3539. args: [],
  3540. source: "isSymbol\x0a\x09^ false",
  3541. referencedClasses: [],
  3542. messageSends: []
  3543. }),
  3544. $globals.Object);
  3545. $core.addMethod(
  3546. $core.method({
  3547. selector: "postCopy",
  3548. protocol: "copying",
  3549. fn: function (){
  3550. var self=this,$self=this;
  3551. return self;
  3552. },
  3553. args: [],
  3554. source: "postCopy",
  3555. referencedClasses: [],
  3556. messageSends: []
  3557. }),
  3558. $globals.Object);
  3559. $core.addMethod(
  3560. $core.method({
  3561. selector: "putOn:",
  3562. protocol: "streaming",
  3563. fn: function (aStream){
  3564. var self=this,$self=this;
  3565. return $core.withContext(function($ctx1) {
  3566. $recv(aStream)._nextPut_(self);
  3567. return self;
  3568. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3569. },
  3570. args: ["aStream"],
  3571. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3572. referencedClasses: [],
  3573. messageSends: ["nextPut:"]
  3574. }),
  3575. $globals.Object);
  3576. $core.addMethod(
  3577. $core.method({
  3578. selector: "respondsTo:",
  3579. protocol: "testing",
  3580. fn: function (aSelector){
  3581. var self=this,$self=this;
  3582. return $core.withContext(function($ctx1) {
  3583. return $recv($self._class())._canUnderstand_(aSelector);
  3584. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3585. },
  3586. args: ["aSelector"],
  3587. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3588. referencedClasses: [],
  3589. messageSends: ["canUnderstand:", "class"]
  3590. }),
  3591. $globals.Object);
  3592. $core.addMethod(
  3593. $core.method({
  3594. selector: "shallowCopy",
  3595. protocol: "copying",
  3596. fn: function (){
  3597. var self=this,$self=this;
  3598. return $core.withContext(function($ctx1) {
  3599. var copy = self.a$cls._new();
  3600. Object.keys(self).forEach(function(i) {
  3601. if(/^@.+/.test(i)) {
  3602. copy[i] = self[i];
  3603. }
  3604. });
  3605. return copy;
  3606. ;
  3607. return self;
  3608. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3609. },
  3610. args: [],
  3611. source: "shallowCopy\x0a\x09<inlineJS: '\x0a\x09\x09var copy = self.a$cls._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09'>",
  3612. referencedClasses: [],
  3613. messageSends: []
  3614. }),
  3615. $globals.Object);
  3616. $core.addMethod(
  3617. $core.method({
  3618. selector: "shouldNotImplement",
  3619. protocol: "error handling",
  3620. fn: function (){
  3621. var self=this,$self=this;
  3622. return $core.withContext(function($ctx1) {
  3623. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3624. return self;
  3625. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3626. },
  3627. args: [],
  3628. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3629. referencedClasses: [],
  3630. messageSends: ["error:", ",", "name", "class"]
  3631. }),
  3632. $globals.Object);
  3633. $core.addMethod(
  3634. $core.method({
  3635. selector: "size",
  3636. protocol: "accessing",
  3637. fn: function (){
  3638. var self=this,$self=this;
  3639. return $core.withContext(function($ctx1) {
  3640. $self._error_("Object not indexable");
  3641. return self;
  3642. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3643. },
  3644. args: [],
  3645. source: "size\x0a\x09self error: 'Object not indexable'",
  3646. referencedClasses: [],
  3647. messageSends: ["error:"]
  3648. }),
  3649. $globals.Object);
  3650. $core.addMethod(
  3651. $core.method({
  3652. selector: "subclassResponsibility",
  3653. protocol: "error handling",
  3654. fn: function (){
  3655. var self=this,$self=this;
  3656. return $core.withContext(function($ctx1) {
  3657. $self._error_("This method is a responsibility of a subclass");
  3658. return self;
  3659. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3660. },
  3661. args: [],
  3662. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3663. referencedClasses: [],
  3664. messageSends: ["error:"]
  3665. }),
  3666. $globals.Object);
  3667. $core.addMethod(
  3668. $core.method({
  3669. selector: "value",
  3670. protocol: "evaluating",
  3671. fn: function (){
  3672. var self=this,$self=this;
  3673. return $core.withContext(function($ctx1) {
  3674. return self.valueOf();
  3675. return self;
  3676. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3677. },
  3678. args: [],
  3679. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3680. referencedClasses: [],
  3681. messageSends: []
  3682. }),
  3683. $globals.Object);
  3684. $core.addMethod(
  3685. $core.method({
  3686. selector: "accessorProtocolWith:",
  3687. protocol: "helios",
  3688. fn: function (aGenerator){
  3689. var self=this,$self=this;
  3690. return $core.withContext(function($ctx1) {
  3691. $recv(aGenerator)._accessorProtocolForObject();
  3692. return self;
  3693. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3694. },
  3695. args: ["aGenerator"],
  3696. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3697. referencedClasses: [],
  3698. messageSends: ["accessorProtocolForObject"]
  3699. }),
  3700. $globals.Object.a$cls);
  3701. $core.addMethod(
  3702. $core.method({
  3703. selector: "accessorsSourceCodesWith:",
  3704. protocol: "helios",
  3705. fn: function (aGenerator){
  3706. var self=this,$self=this;
  3707. return $core.withContext(function($ctx1) {
  3708. $recv(aGenerator)._accessorsForObject();
  3709. return self;
  3710. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3711. },
  3712. args: ["aGenerator"],
  3713. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3714. referencedClasses: [],
  3715. messageSends: ["accessorsForObject"]
  3716. }),
  3717. $globals.Object.a$cls);
  3718. $core.addMethod(
  3719. $core.method({
  3720. selector: "initialize",
  3721. protocol: "initialization",
  3722. fn: function (){
  3723. var self=this,$self=this;
  3724. return self;
  3725. },
  3726. args: [],
  3727. source: "initialize\x0a\x09\x22no op\x22",
  3728. referencedClasses: [],
  3729. messageSends: []
  3730. }),
  3731. $globals.Object.a$cls);
  3732. $core.addMethod(
  3733. $core.method({
  3734. selector: "initializeProtocolWith:",
  3735. protocol: "helios",
  3736. fn: function (aGenerator){
  3737. var self=this,$self=this;
  3738. return $core.withContext(function($ctx1) {
  3739. $recv(aGenerator)._initializeProtocolForObject();
  3740. return self;
  3741. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3742. },
  3743. args: ["aGenerator"],
  3744. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3745. referencedClasses: [],
  3746. messageSends: ["initializeProtocolForObject"]
  3747. }),
  3748. $globals.Object.a$cls);
  3749. $core.addMethod(
  3750. $core.method({
  3751. selector: "initializeSourceCodesWith:",
  3752. protocol: "helios",
  3753. fn: function (aGenerator){
  3754. var self=this,$self=this;
  3755. return $core.withContext(function($ctx1) {
  3756. $recv(aGenerator)._initializeForObject();
  3757. return self;
  3758. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3759. },
  3760. args: ["aGenerator"],
  3761. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3762. referencedClasses: [],
  3763. messageSends: ["initializeForObject"]
  3764. }),
  3765. $globals.Object.a$cls);
  3766. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3767. $globals.Boolean.comment="I define the protocol for logic testing operations and conditional control structures for the logical values (see the `controlling` protocol).\x0a\x0aI have two instances, `true` and `false`.\x0a\x0aI am directly mapped to JavaScript Boolean. The `true` and `false` objects are the JavaScript boolean objects.\x0a\x0a## Usage Example:\x0a\x0a aBoolean not ifTrue: [ ... ] ifFalse: [ ... ]";
  3768. $core.addMethod(
  3769. $core.method({
  3770. selector: "&",
  3771. protocol: "controlling",
  3772. fn: function (aBoolean){
  3773. var self=this,$self=this;
  3774. return $core.withContext(function($ctx1) {
  3775. if(self == true) {
  3776. return aBoolean;
  3777. } else {
  3778. return false;
  3779. }
  3780. ;
  3781. return self;
  3782. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3783. },
  3784. args: ["aBoolean"],
  3785. source: "& aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09'>",
  3786. referencedClasses: [],
  3787. messageSends: []
  3788. }),
  3789. $globals.Boolean);
  3790. $core.addMethod(
  3791. $core.method({
  3792. selector: "==",
  3793. protocol: "comparing",
  3794. fn: function (aBoolean){
  3795. var self=this,$self=this;
  3796. return $core.withContext(function($ctx1) {
  3797. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3798. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3799. else return false;;
  3800. return self;
  3801. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3802. },
  3803. args: ["aBoolean"],
  3804. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return (self == true) === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return (self == true) === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  3805. referencedClasses: [],
  3806. messageSends: []
  3807. }),
  3808. $globals.Boolean);
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "and:",
  3812. protocol: "controlling",
  3813. fn: function (aBlock){
  3814. var self=this,$self=this;
  3815. return $core.withContext(function($ctx1) {
  3816. if($core.assert(self)){
  3817. return $recv(aBlock)._value();
  3818. } else {
  3819. return false;
  3820. }
  3821. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3822. },
  3823. args: ["aBlock"],
  3824. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3825. referencedClasses: [],
  3826. messageSends: ["ifTrue:ifFalse:", "value"]
  3827. }),
  3828. $globals.Boolean);
  3829. $core.addMethod(
  3830. $core.method({
  3831. selector: "asBit",
  3832. protocol: "converting",
  3833. fn: function (){
  3834. var self=this,$self=this;
  3835. return $core.withContext(function($ctx1) {
  3836. if($core.assert(self)){
  3837. return (1);
  3838. } else {
  3839. return (0);
  3840. }
  3841. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3842. },
  3843. args: [],
  3844. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3845. referencedClasses: [],
  3846. messageSends: ["ifTrue:ifFalse:"]
  3847. }),
  3848. $globals.Boolean);
  3849. $core.addMethod(
  3850. $core.method({
  3851. selector: "asJavaScriptObject",
  3852. protocol: "converting",
  3853. fn: function (){
  3854. var self=this,$self=this;
  3855. return self;
  3856. },
  3857. args: [],
  3858. source: "asJavaScriptObject\x0a\x09^ self",
  3859. referencedClasses: [],
  3860. messageSends: []
  3861. }),
  3862. $globals.Boolean);
  3863. $core.addMethod(
  3864. $core.method({
  3865. selector: "asString",
  3866. protocol: "converting",
  3867. fn: function (){
  3868. var self=this,$self=this;
  3869. return $core.withContext(function($ctx1) {
  3870. return self.toString();
  3871. return self;
  3872. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3873. },
  3874. args: [],
  3875. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3876. referencedClasses: [],
  3877. messageSends: []
  3878. }),
  3879. $globals.Boolean);
  3880. $core.addMethod(
  3881. $core.method({
  3882. selector: "deepCopy",
  3883. protocol: "copying",
  3884. fn: function (){
  3885. var self=this,$self=this;
  3886. return self;
  3887. },
  3888. args: [],
  3889. source: "deepCopy\x0a\x09^ self",
  3890. referencedClasses: [],
  3891. messageSends: []
  3892. }),
  3893. $globals.Boolean);
  3894. $core.addMethod(
  3895. $core.method({
  3896. selector: "ifFalse:",
  3897. protocol: "controlling",
  3898. fn: function (aBlock){
  3899. var self=this,$self=this;
  3900. return $core.withContext(function($ctx1) {
  3901. return $self._ifTrue_ifFalse_((function(){
  3902. }),aBlock);
  3903. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3904. },
  3905. args: ["aBlock"],
  3906. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3907. referencedClasses: [],
  3908. messageSends: ["ifTrue:ifFalse:"]
  3909. }),
  3910. $globals.Boolean);
  3911. $core.addMethod(
  3912. $core.method({
  3913. selector: "ifFalse:ifTrue:",
  3914. protocol: "controlling",
  3915. fn: function (aBlock,anotherBlock){
  3916. var self=this,$self=this;
  3917. return $core.withContext(function($ctx1) {
  3918. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3919. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3920. },
  3921. args: ["aBlock", "anotherBlock"],
  3922. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3923. referencedClasses: [],
  3924. messageSends: ["ifTrue:ifFalse:"]
  3925. }),
  3926. $globals.Boolean);
  3927. $core.addMethod(
  3928. $core.method({
  3929. selector: "ifTrue:",
  3930. protocol: "controlling",
  3931. fn: function (aBlock){
  3932. var self=this,$self=this;
  3933. return $core.withContext(function($ctx1) {
  3934. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3935. }));
  3936. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3937. },
  3938. args: ["aBlock"],
  3939. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3940. referencedClasses: [],
  3941. messageSends: ["ifTrue:ifFalse:"]
  3942. }),
  3943. $globals.Boolean);
  3944. $core.addMethod(
  3945. $core.method({
  3946. selector: "ifTrue:ifFalse:",
  3947. protocol: "controlling",
  3948. fn: function (aBlock,anotherBlock){
  3949. var self=this,$self=this;
  3950. return $core.withContext(function($ctx1) {
  3951. if(self == true) {
  3952. return aBlock._value();
  3953. } else {
  3954. return anotherBlock._value();
  3955. }
  3956. ;
  3957. return self;
  3958. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3959. },
  3960. args: ["aBlock", "anotherBlock"],
  3961. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09'>",
  3962. referencedClasses: [],
  3963. messageSends: []
  3964. }),
  3965. $globals.Boolean);
  3966. $core.addMethod(
  3967. $core.method({
  3968. selector: "isBoolean",
  3969. protocol: "testing",
  3970. fn: function (){
  3971. var self=this,$self=this;
  3972. return true;
  3973. },
  3974. args: [],
  3975. source: "isBoolean\x0a\x09^ true",
  3976. referencedClasses: [],
  3977. messageSends: []
  3978. }),
  3979. $globals.Boolean);
  3980. $core.addMethod(
  3981. $core.method({
  3982. selector: "isImmutable",
  3983. protocol: "testing",
  3984. fn: function (){
  3985. var self=this,$self=this;
  3986. return true;
  3987. },
  3988. args: [],
  3989. source: "isImmutable\x0a\x09^ true",
  3990. referencedClasses: [],
  3991. messageSends: []
  3992. }),
  3993. $globals.Boolean);
  3994. $core.addMethod(
  3995. $core.method({
  3996. selector: "not",
  3997. protocol: "controlling",
  3998. fn: function (){
  3999. var self=this,$self=this;
  4000. return $core.withContext(function($ctx1) {
  4001. return $self.__eq(false);
  4002. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4003. },
  4004. args: [],
  4005. source: "not\x0a\x09^ self = false",
  4006. referencedClasses: [],
  4007. messageSends: ["="]
  4008. }),
  4009. $globals.Boolean);
  4010. $core.addMethod(
  4011. $core.method({
  4012. selector: "or:",
  4013. protocol: "controlling",
  4014. fn: function (aBlock){
  4015. var self=this,$self=this;
  4016. return $core.withContext(function($ctx1) {
  4017. if($core.assert(self)){
  4018. return true;
  4019. } else {
  4020. return $recv(aBlock)._value();
  4021. }
  4022. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4023. },
  4024. args: ["aBlock"],
  4025. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4026. referencedClasses: [],
  4027. messageSends: ["ifTrue:ifFalse:", "value"]
  4028. }),
  4029. $globals.Boolean);
  4030. $core.addMethod(
  4031. $core.method({
  4032. selector: "printOn:",
  4033. protocol: "printing",
  4034. fn: function (aStream){
  4035. var self=this,$self=this;
  4036. return $core.withContext(function($ctx1) {
  4037. $recv(aStream)._nextPutAll_($self._asString());
  4038. return self;
  4039. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4040. },
  4041. args: ["aStream"],
  4042. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4043. referencedClasses: [],
  4044. messageSends: ["nextPutAll:", "asString"]
  4045. }),
  4046. $globals.Boolean);
  4047. $core.addMethod(
  4048. $core.method({
  4049. selector: "shallowCopy",
  4050. protocol: "copying",
  4051. fn: function (){
  4052. var self=this,$self=this;
  4053. return self;
  4054. },
  4055. args: [],
  4056. source: "shallowCopy\x0a\x09^ self",
  4057. referencedClasses: [],
  4058. messageSends: []
  4059. }),
  4060. $globals.Boolean);
  4061. $core.addMethod(
  4062. $core.method({
  4063. selector: "|",
  4064. protocol: "controlling",
  4065. fn: function (aBoolean){
  4066. var self=this,$self=this;
  4067. return $core.withContext(function($ctx1) {
  4068. if(self == true) {
  4069. return true;
  4070. } else {
  4071. return aBoolean;
  4072. }
  4073. ;
  4074. return self;
  4075. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4076. },
  4077. args: ["aBoolean"],
  4078. source: "| aBoolean\x0a\x09<inlineJS: '\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09'>",
  4079. referencedClasses: [],
  4080. messageSends: []
  4081. }),
  4082. $globals.Boolean);
  4083. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4084. $globals.Date.comment="I am used to work with both dates and times. Therefore `Date today` and `Date now` are both valid in\x0aAmber and answer the same date object.\x0a\x0aDate directly maps to the `Date()` JavaScript constructor, and Amber date objects are JavaScript date objects.\x0a\x0a## API\x0a\x0aThe class-side `instance creation` protocol contains some convenience methods for creating date/time objects such as `#fromSeconds:`.\x0a\x0aArithmetic and comparison is supported (see the `comparing` and `arithmetic` protocols).\x0a\x0aThe `converting` protocol provides convenience methods for various convertions (to numbers, strings, etc.).";
  4085. $core.addMethod(
  4086. $core.method({
  4087. selector: "+",
  4088. protocol: "arithmetic",
  4089. fn: function (aDate){
  4090. var self=this,$self=this;
  4091. return $core.withContext(function($ctx1) {
  4092. return self + aDate;
  4093. return self;
  4094. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4095. },
  4096. args: ["aDate"],
  4097. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4098. referencedClasses: [],
  4099. messageSends: []
  4100. }),
  4101. $globals.Date);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "-",
  4105. protocol: "arithmetic",
  4106. fn: function (aDate){
  4107. var self=this,$self=this;
  4108. return $core.withContext(function($ctx1) {
  4109. return self - aDate;
  4110. return self;
  4111. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4112. },
  4113. args: ["aDate"],
  4114. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4115. referencedClasses: [],
  4116. messageSends: []
  4117. }),
  4118. $globals.Date);
  4119. $core.addMethod(
  4120. $core.method({
  4121. selector: "<",
  4122. protocol: "comparing",
  4123. fn: function (aDate){
  4124. var self=this,$self=this;
  4125. return $core.withContext(function($ctx1) {
  4126. return self < aDate;
  4127. return self;
  4128. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4129. },
  4130. args: ["aDate"],
  4131. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4132. referencedClasses: [],
  4133. messageSends: []
  4134. }),
  4135. $globals.Date);
  4136. $core.addMethod(
  4137. $core.method({
  4138. selector: "<=",
  4139. protocol: "comparing",
  4140. fn: function (aDate){
  4141. var self=this,$self=this;
  4142. return $core.withContext(function($ctx1) {
  4143. return self <= aDate;
  4144. return self;
  4145. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4146. },
  4147. args: ["aDate"],
  4148. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4149. referencedClasses: [],
  4150. messageSends: []
  4151. }),
  4152. $globals.Date);
  4153. $core.addMethod(
  4154. $core.method({
  4155. selector: "=",
  4156. protocol: "comparing",
  4157. fn: function (aDate){
  4158. var self=this,$self=this;
  4159. return $core.withContext(function($ctx1) {
  4160. var $2,$1,$3;
  4161. $2=$recv(aDate)._class();
  4162. $ctx1.sendIdx["class"]=1;
  4163. $1=$recv($2).__eq_eq($self._class());
  4164. $ctx1.sendIdx["=="]=1;
  4165. return $recv($1)._and_((function(){
  4166. return $core.withContext(function($ctx2) {
  4167. $3=$self._asMilliseconds();
  4168. $ctx2.sendIdx["asMilliseconds"]=1;
  4169. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4171. }));
  4172. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4173. },
  4174. args: ["aDate"],
  4175. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4176. referencedClasses: [],
  4177. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4178. }),
  4179. $globals.Date);
  4180. $core.addMethod(
  4181. $core.method({
  4182. selector: ">",
  4183. protocol: "comparing",
  4184. fn: function (aDate){
  4185. var self=this,$self=this;
  4186. return $core.withContext(function($ctx1) {
  4187. return self > aDate;
  4188. return self;
  4189. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4190. },
  4191. args: ["aDate"],
  4192. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4193. referencedClasses: [],
  4194. messageSends: []
  4195. }),
  4196. $globals.Date);
  4197. $core.addMethod(
  4198. $core.method({
  4199. selector: ">=",
  4200. protocol: "comparing",
  4201. fn: function (aDate){
  4202. var self=this,$self=this;
  4203. return $core.withContext(function($ctx1) {
  4204. return self >= aDate;
  4205. return self;
  4206. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4207. },
  4208. args: ["aDate"],
  4209. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4210. referencedClasses: [],
  4211. messageSends: []
  4212. }),
  4213. $globals.Date);
  4214. $core.addMethod(
  4215. $core.method({
  4216. selector: "asDateString",
  4217. protocol: "converting",
  4218. fn: function (){
  4219. var self=this,$self=this;
  4220. return $core.withContext(function($ctx1) {
  4221. return self.toDateString();
  4222. return self;
  4223. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4224. },
  4225. args: [],
  4226. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4227. referencedClasses: [],
  4228. messageSends: []
  4229. }),
  4230. $globals.Date);
  4231. $core.addMethod(
  4232. $core.method({
  4233. selector: "asLocaleString",
  4234. protocol: "converting",
  4235. fn: function (){
  4236. var self=this,$self=this;
  4237. return $core.withContext(function($ctx1) {
  4238. return self.toLocaleString();
  4239. return self;
  4240. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4241. },
  4242. args: [],
  4243. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4244. referencedClasses: [],
  4245. messageSends: []
  4246. }),
  4247. $globals.Date);
  4248. $core.addMethod(
  4249. $core.method({
  4250. selector: "asMilliseconds",
  4251. protocol: "converting",
  4252. fn: function (){
  4253. var self=this,$self=this;
  4254. return $core.withContext(function($ctx1) {
  4255. return $self._time();
  4256. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4257. },
  4258. args: [],
  4259. source: "asMilliseconds\x0a\x09^ self time",
  4260. referencedClasses: [],
  4261. messageSends: ["time"]
  4262. }),
  4263. $globals.Date);
  4264. $core.addMethod(
  4265. $core.method({
  4266. selector: "asNumber",
  4267. protocol: "converting",
  4268. fn: function (){
  4269. var self=this,$self=this;
  4270. return $core.withContext(function($ctx1) {
  4271. return $self._asMilliseconds();
  4272. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4273. },
  4274. args: [],
  4275. source: "asNumber\x0a\x09^ self asMilliseconds",
  4276. referencedClasses: [],
  4277. messageSends: ["asMilliseconds"]
  4278. }),
  4279. $globals.Date);
  4280. $core.addMethod(
  4281. $core.method({
  4282. selector: "asString",
  4283. protocol: "converting",
  4284. fn: function (){
  4285. var self=this,$self=this;
  4286. return $core.withContext(function($ctx1) {
  4287. return self.toString();
  4288. return self;
  4289. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4290. },
  4291. args: [],
  4292. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4293. referencedClasses: [],
  4294. messageSends: []
  4295. }),
  4296. $globals.Date);
  4297. $core.addMethod(
  4298. $core.method({
  4299. selector: "asTimeString",
  4300. protocol: "converting",
  4301. fn: function (){
  4302. var self=this,$self=this;
  4303. return $core.withContext(function($ctx1) {
  4304. return self.toTimeString();
  4305. return self;
  4306. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4307. },
  4308. args: [],
  4309. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4310. referencedClasses: [],
  4311. messageSends: []
  4312. }),
  4313. $globals.Date);
  4314. $core.addMethod(
  4315. $core.method({
  4316. selector: "day",
  4317. protocol: "accessing",
  4318. fn: function (){
  4319. var self=this,$self=this;
  4320. return $core.withContext(function($ctx1) {
  4321. return $self._dayOfWeek();
  4322. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4323. },
  4324. args: [],
  4325. source: "day\x0a\x09^ self dayOfWeek",
  4326. referencedClasses: [],
  4327. messageSends: ["dayOfWeek"]
  4328. }),
  4329. $globals.Date);
  4330. $core.addMethod(
  4331. $core.method({
  4332. selector: "day:",
  4333. protocol: "accessing",
  4334. fn: function (aNumber){
  4335. var self=this,$self=this;
  4336. return $core.withContext(function($ctx1) {
  4337. $self._dayOfWeek_(aNumber);
  4338. return self;
  4339. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4340. },
  4341. args: ["aNumber"],
  4342. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4343. referencedClasses: [],
  4344. messageSends: ["dayOfWeek:"]
  4345. }),
  4346. $globals.Date);
  4347. $core.addMethod(
  4348. $core.method({
  4349. selector: "dayOfMonth",
  4350. protocol: "accessing",
  4351. fn: function (){
  4352. var self=this,$self=this;
  4353. return $core.withContext(function($ctx1) {
  4354. return self.getDate();
  4355. return self;
  4356. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4357. },
  4358. args: [],
  4359. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4360. referencedClasses: [],
  4361. messageSends: []
  4362. }),
  4363. $globals.Date);
  4364. $core.addMethod(
  4365. $core.method({
  4366. selector: "dayOfMonth:",
  4367. protocol: "accessing",
  4368. fn: function (aNumber){
  4369. var self=this,$self=this;
  4370. return $core.withContext(function($ctx1) {
  4371. self.setDate(aNumber);
  4372. return self;
  4373. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4374. },
  4375. args: ["aNumber"],
  4376. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4377. referencedClasses: [],
  4378. messageSends: []
  4379. }),
  4380. $globals.Date);
  4381. $core.addMethod(
  4382. $core.method({
  4383. selector: "dayOfWeek",
  4384. protocol: "accessing",
  4385. fn: function (){
  4386. var self=this,$self=this;
  4387. return $core.withContext(function($ctx1) {
  4388. return self.getDay() + 1;
  4389. return self;
  4390. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4391. },
  4392. args: [],
  4393. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4394. referencedClasses: [],
  4395. messageSends: []
  4396. }),
  4397. $globals.Date);
  4398. $core.addMethod(
  4399. $core.method({
  4400. selector: "dayOfWeek:",
  4401. protocol: "accessing",
  4402. fn: function (aNumber){
  4403. var self=this,$self=this;
  4404. return $core.withContext(function($ctx1) {
  4405. return self.setDay(aNumber - 1);
  4406. return self;
  4407. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4408. },
  4409. args: ["aNumber"],
  4410. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4411. referencedClasses: [],
  4412. messageSends: []
  4413. }),
  4414. $globals.Date);
  4415. $core.addMethod(
  4416. $core.method({
  4417. selector: "hours",
  4418. protocol: "accessing",
  4419. fn: function (){
  4420. var self=this,$self=this;
  4421. return $core.withContext(function($ctx1) {
  4422. return self.getHours();
  4423. return self;
  4424. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4425. },
  4426. args: [],
  4427. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4428. referencedClasses: [],
  4429. messageSends: []
  4430. }),
  4431. $globals.Date);
  4432. $core.addMethod(
  4433. $core.method({
  4434. selector: "hours:",
  4435. protocol: "accessing",
  4436. fn: function (aNumber){
  4437. var self=this,$self=this;
  4438. return $core.withContext(function($ctx1) {
  4439. self.setHours(aNumber);
  4440. return self;
  4441. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4442. },
  4443. args: ["aNumber"],
  4444. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4445. referencedClasses: [],
  4446. messageSends: []
  4447. }),
  4448. $globals.Date);
  4449. $core.addMethod(
  4450. $core.method({
  4451. selector: "milliseconds",
  4452. protocol: "accessing",
  4453. fn: function (){
  4454. var self=this,$self=this;
  4455. return $core.withContext(function($ctx1) {
  4456. return self.getMilliseconds();
  4457. return self;
  4458. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4459. },
  4460. args: [],
  4461. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4462. referencedClasses: [],
  4463. messageSends: []
  4464. }),
  4465. $globals.Date);
  4466. $core.addMethod(
  4467. $core.method({
  4468. selector: "milliseconds:",
  4469. protocol: "accessing",
  4470. fn: function (aNumber){
  4471. var self=this,$self=this;
  4472. return $core.withContext(function($ctx1) {
  4473. self.setMilliseconds(aNumber);
  4474. return self;
  4475. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4476. },
  4477. args: ["aNumber"],
  4478. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4479. referencedClasses: [],
  4480. messageSends: []
  4481. }),
  4482. $globals.Date);
  4483. $core.addMethod(
  4484. $core.method({
  4485. selector: "minutes",
  4486. protocol: "accessing",
  4487. fn: function (){
  4488. var self=this,$self=this;
  4489. return $core.withContext(function($ctx1) {
  4490. return self.getMinutes();
  4491. return self;
  4492. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4493. },
  4494. args: [],
  4495. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4496. referencedClasses: [],
  4497. messageSends: []
  4498. }),
  4499. $globals.Date);
  4500. $core.addMethod(
  4501. $core.method({
  4502. selector: "minutes:",
  4503. protocol: "accessing",
  4504. fn: function (aNumber){
  4505. var self=this,$self=this;
  4506. return $core.withContext(function($ctx1) {
  4507. self.setMinutes(aNumber);
  4508. return self;
  4509. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4510. },
  4511. args: ["aNumber"],
  4512. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4513. referencedClasses: [],
  4514. messageSends: []
  4515. }),
  4516. $globals.Date);
  4517. $core.addMethod(
  4518. $core.method({
  4519. selector: "month",
  4520. protocol: "accessing",
  4521. fn: function (){
  4522. var self=this,$self=this;
  4523. return $core.withContext(function($ctx1) {
  4524. return self.getMonth() + 1;
  4525. return self;
  4526. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4527. },
  4528. args: [],
  4529. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4530. referencedClasses: [],
  4531. messageSends: []
  4532. }),
  4533. $globals.Date);
  4534. $core.addMethod(
  4535. $core.method({
  4536. selector: "month:",
  4537. protocol: "accessing",
  4538. fn: function (aNumber){
  4539. var self=this,$self=this;
  4540. return $core.withContext(function($ctx1) {
  4541. self.setMonth(aNumber - 1);
  4542. return self;
  4543. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4544. },
  4545. args: ["aNumber"],
  4546. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4547. referencedClasses: [],
  4548. messageSends: []
  4549. }),
  4550. $globals.Date);
  4551. $core.addMethod(
  4552. $core.method({
  4553. selector: "printOn:",
  4554. protocol: "printing",
  4555. fn: function (aStream){
  4556. var self=this,$self=this;
  4557. return $core.withContext(function($ctx1) {
  4558. $recv(aStream)._nextPutAll_($self._asString());
  4559. return self;
  4560. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4561. },
  4562. args: ["aStream"],
  4563. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4564. referencedClasses: [],
  4565. messageSends: ["nextPutAll:", "asString"]
  4566. }),
  4567. $globals.Date);
  4568. $core.addMethod(
  4569. $core.method({
  4570. selector: "seconds",
  4571. protocol: "accessing",
  4572. fn: function (){
  4573. var self=this,$self=this;
  4574. return $core.withContext(function($ctx1) {
  4575. return self.getSeconds();
  4576. return self;
  4577. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4578. },
  4579. args: [],
  4580. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4581. referencedClasses: [],
  4582. messageSends: []
  4583. }),
  4584. $globals.Date);
  4585. $core.addMethod(
  4586. $core.method({
  4587. selector: "seconds:",
  4588. protocol: "accessing",
  4589. fn: function (aNumber){
  4590. var self=this,$self=this;
  4591. return $core.withContext(function($ctx1) {
  4592. self.setSeconds(aNumber);
  4593. return self;
  4594. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4595. },
  4596. args: ["aNumber"],
  4597. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4598. referencedClasses: [],
  4599. messageSends: []
  4600. }),
  4601. $globals.Date);
  4602. $core.addMethod(
  4603. $core.method({
  4604. selector: "time",
  4605. protocol: "accessing",
  4606. fn: function (){
  4607. var self=this,$self=this;
  4608. return $core.withContext(function($ctx1) {
  4609. return self.getTime();
  4610. return self;
  4611. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4612. },
  4613. args: [],
  4614. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4615. referencedClasses: [],
  4616. messageSends: []
  4617. }),
  4618. $globals.Date);
  4619. $core.addMethod(
  4620. $core.method({
  4621. selector: "time:",
  4622. protocol: "accessing",
  4623. fn: function (aNumber){
  4624. var self=this,$self=this;
  4625. return $core.withContext(function($ctx1) {
  4626. self.setTime(aNumber);
  4627. return self;
  4628. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4629. },
  4630. args: ["aNumber"],
  4631. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4632. referencedClasses: [],
  4633. messageSends: []
  4634. }),
  4635. $globals.Date);
  4636. $core.addMethod(
  4637. $core.method({
  4638. selector: "year",
  4639. protocol: "accessing",
  4640. fn: function (){
  4641. var self=this,$self=this;
  4642. return $core.withContext(function($ctx1) {
  4643. return self.getFullYear();
  4644. return self;
  4645. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4646. },
  4647. args: [],
  4648. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4649. referencedClasses: [],
  4650. messageSends: []
  4651. }),
  4652. $globals.Date);
  4653. $core.addMethod(
  4654. $core.method({
  4655. selector: "year:",
  4656. protocol: "accessing",
  4657. fn: function (aNumber){
  4658. var self=this,$self=this;
  4659. return $core.withContext(function($ctx1) {
  4660. self.setFullYear(aNumber);
  4661. return self;
  4662. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4663. },
  4664. args: ["aNumber"],
  4665. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4666. referencedClasses: [],
  4667. messageSends: []
  4668. }),
  4669. $globals.Date);
  4670. $core.addMethod(
  4671. $core.method({
  4672. selector: "classTag",
  4673. protocol: "accessing",
  4674. fn: function (){
  4675. var self=this,$self=this;
  4676. return "magnitude";
  4677. },
  4678. args: [],
  4679. 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^ 'magnitude'",
  4680. referencedClasses: [],
  4681. messageSends: []
  4682. }),
  4683. $globals.Date.a$cls);
  4684. $core.addMethod(
  4685. $core.method({
  4686. selector: "fromMilliseconds:",
  4687. protocol: "instance creation",
  4688. fn: function (aNumber){
  4689. var self=this,$self=this;
  4690. return $core.withContext(function($ctx1) {
  4691. return $self._new_(aNumber);
  4692. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4693. },
  4694. args: ["aNumber"],
  4695. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4696. referencedClasses: [],
  4697. messageSends: ["new:"]
  4698. }),
  4699. $globals.Date.a$cls);
  4700. $core.addMethod(
  4701. $core.method({
  4702. selector: "fromSeconds:",
  4703. protocol: "instance creation",
  4704. fn: function (aNumber){
  4705. var self=this,$self=this;
  4706. return $core.withContext(function($ctx1) {
  4707. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4708. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4709. },
  4710. args: ["aNumber"],
  4711. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4712. referencedClasses: [],
  4713. messageSends: ["fromMilliseconds:", "*"]
  4714. }),
  4715. $globals.Date.a$cls);
  4716. $core.addMethod(
  4717. $core.method({
  4718. selector: "fromString:",
  4719. protocol: "instance creation",
  4720. fn: function (aString){
  4721. var self=this,$self=this;
  4722. return $core.withContext(function($ctx1) {
  4723. return $self._new_(aString);
  4724. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4725. },
  4726. args: ["aString"],
  4727. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4728. referencedClasses: [],
  4729. messageSends: ["new:"]
  4730. }),
  4731. $globals.Date.a$cls);
  4732. $core.addMethod(
  4733. $core.method({
  4734. selector: "millisecondsToRun:",
  4735. protocol: "instance creation",
  4736. fn: function (aBlock){
  4737. var self=this,$self=this;
  4738. var t;
  4739. return $core.withContext(function($ctx1) {
  4740. t=$recv($globals.Date)._now();
  4741. $ctx1.sendIdx["now"]=1;
  4742. $recv(aBlock)._value();
  4743. return $recv($recv($globals.Date)._now()).__minus(t);
  4744. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4745. },
  4746. args: ["aBlock"],
  4747. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4748. referencedClasses: ["Date"],
  4749. messageSends: ["now", "value", "-"]
  4750. }),
  4751. $globals.Date.a$cls);
  4752. $core.addMethod(
  4753. $core.method({
  4754. selector: "new:",
  4755. protocol: "instance creation",
  4756. fn: function (anObject){
  4757. var self=this,$self=this;
  4758. return $core.withContext(function($ctx1) {
  4759. return new Date(anObject);
  4760. return self;
  4761. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4762. },
  4763. args: ["anObject"],
  4764. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4765. referencedClasses: [],
  4766. messageSends: []
  4767. }),
  4768. $globals.Date.a$cls);
  4769. $core.addMethod(
  4770. $core.method({
  4771. selector: "now",
  4772. protocol: "instance creation",
  4773. fn: function (){
  4774. var self=this,$self=this;
  4775. return $core.withContext(function($ctx1) {
  4776. return $self._today();
  4777. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4778. },
  4779. args: [],
  4780. source: "now\x0a\x09^ self today",
  4781. referencedClasses: [],
  4782. messageSends: ["today"]
  4783. }),
  4784. $globals.Date.a$cls);
  4785. $core.addMethod(
  4786. $core.method({
  4787. selector: "today",
  4788. protocol: "instance creation",
  4789. fn: function (){
  4790. var self=this,$self=this;
  4791. return $core.withContext(function($ctx1) {
  4792. return $self._new();
  4793. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4794. },
  4795. args: [],
  4796. source: "today\x0a\x09^ self new",
  4797. referencedClasses: [],
  4798. messageSends: ["new"]
  4799. }),
  4800. $globals.Date.a$cls);
  4801. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4802. $globals.Number.comment="I am the Amber representation for all numbers.\x0aI am directly mapped to JavaScript Number.\x0a\x0a## API\x0a\x0aI provide all necessary methods for arithmetic operations, comparison, conversion and so on with numbers.\x0a\x0aMy instances can also be used to evaluate a block a fixed number of times:\x0a\x0a\x095 timesRepeat: [ Transcript show: 'This will be printed 5 times'; cr ].\x0a\x09\x0a\x091 to: 5 do: [ :aNumber| Transcript show: aNumber asString; cr ].\x0a\x09\x0a\x091 to: 10 by: 2 do: [ :aNumber| Transcript show: aNumber asString; cr ].";
  4803. $core.addMethod(
  4804. $core.method({
  4805. selector: "&",
  4806. protocol: "converting",
  4807. fn: function (aNumber){
  4808. var self=this,$self=this;
  4809. return $core.withContext(function($ctx1) {
  4810. return self & aNumber;
  4811. return self;
  4812. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4813. },
  4814. args: ["aNumber"],
  4815. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4816. referencedClasses: [],
  4817. messageSends: []
  4818. }),
  4819. $globals.Number);
  4820. $core.addMethod(
  4821. $core.method({
  4822. selector: "*",
  4823. protocol: "arithmetic",
  4824. fn: function (aNumber){
  4825. var self=this,$self=this;
  4826. return $core.withContext(function($ctx1) {
  4827. return self * aNumber;
  4828. return self;
  4829. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4830. },
  4831. args: ["aNumber"],
  4832. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4833. referencedClasses: [],
  4834. messageSends: []
  4835. }),
  4836. $globals.Number);
  4837. $core.addMethod(
  4838. $core.method({
  4839. selector: "**",
  4840. protocol: "mathematical functions",
  4841. fn: function (exponent){
  4842. var self=this,$self=this;
  4843. return $core.withContext(function($ctx1) {
  4844. return $self._raisedTo_(exponent);
  4845. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4846. },
  4847. args: ["exponent"],
  4848. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4849. referencedClasses: [],
  4850. messageSends: ["raisedTo:"]
  4851. }),
  4852. $globals.Number);
  4853. $core.addMethod(
  4854. $core.method({
  4855. selector: "+",
  4856. protocol: "arithmetic",
  4857. fn: function (aNumber){
  4858. var self=this,$self=this;
  4859. return $core.withContext(function($ctx1) {
  4860. return self + aNumber;
  4861. return self;
  4862. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4863. },
  4864. args: ["aNumber"],
  4865. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4866. referencedClasses: [],
  4867. messageSends: []
  4868. }),
  4869. $globals.Number);
  4870. $core.addMethod(
  4871. $core.method({
  4872. selector: "-",
  4873. protocol: "arithmetic",
  4874. fn: function (aNumber){
  4875. var self=this,$self=this;
  4876. return $core.withContext(function($ctx1) {
  4877. return self - aNumber;
  4878. return self;
  4879. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4880. },
  4881. args: ["aNumber"],
  4882. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4883. referencedClasses: [],
  4884. messageSends: []
  4885. }),
  4886. $globals.Number);
  4887. $core.addMethod(
  4888. $core.method({
  4889. selector: "/",
  4890. protocol: "arithmetic",
  4891. fn: function (aNumber){
  4892. var self=this,$self=this;
  4893. return $core.withContext(function($ctx1) {
  4894. return self / aNumber;
  4895. return self;
  4896. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4897. },
  4898. args: ["aNumber"],
  4899. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4900. referencedClasses: [],
  4901. messageSends: []
  4902. }),
  4903. $globals.Number);
  4904. $core.addMethod(
  4905. $core.method({
  4906. selector: "//",
  4907. protocol: "arithmetic",
  4908. fn: function (aNumber){
  4909. var self=this,$self=this;
  4910. return $core.withContext(function($ctx1) {
  4911. return $recv($self.__slash(aNumber))._floor();
  4912. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4913. },
  4914. args: ["aNumber"],
  4915. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4916. referencedClasses: [],
  4917. messageSends: ["floor", "/"]
  4918. }),
  4919. $globals.Number);
  4920. $core.addMethod(
  4921. $core.method({
  4922. selector: "<",
  4923. protocol: "comparing",
  4924. fn: function (aNumber){
  4925. var self=this,$self=this;
  4926. return $core.withContext(function($ctx1) {
  4927. return self < aNumber;
  4928. return self;
  4929. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4930. },
  4931. args: ["aNumber"],
  4932. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4933. referencedClasses: [],
  4934. messageSends: []
  4935. }),
  4936. $globals.Number);
  4937. $core.addMethod(
  4938. $core.method({
  4939. selector: "<=",
  4940. protocol: "comparing",
  4941. fn: function (aNumber){
  4942. var self=this,$self=this;
  4943. return $core.withContext(function($ctx1) {
  4944. return self <= aNumber;
  4945. return self;
  4946. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4947. },
  4948. args: ["aNumber"],
  4949. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4950. referencedClasses: [],
  4951. messageSends: []
  4952. }),
  4953. $globals.Number);
  4954. $core.addMethod(
  4955. $core.method({
  4956. selector: "==",
  4957. protocol: "comparing",
  4958. fn: function (aNumber){
  4959. var self=this,$self=this;
  4960. return $core.withContext(function($ctx1) {
  4961. if (typeof aNumber === "number") return Number(self) === aNumber;
  4962. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4963. else return false;;
  4964. return self;
  4965. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4966. },
  4967. args: ["aNumber"],
  4968. source: "== aNumber\x0a<inlineJS: '\x0a\x09if (typeof aNumber === \x22number\x22) return Number(self) === aNumber;\x0a\x09else if (aNumber != null && typeof aNumber === \x22object\x22) return Number(self) === aNumber.valueOf();\x0a\x09else return false;\x0a'>",
  4969. referencedClasses: [],
  4970. messageSends: []
  4971. }),
  4972. $globals.Number);
  4973. $core.addMethod(
  4974. $core.method({
  4975. selector: ">",
  4976. protocol: "comparing",
  4977. fn: function (aNumber){
  4978. var self=this,$self=this;
  4979. return $core.withContext(function($ctx1) {
  4980. return self > aNumber;
  4981. return self;
  4982. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4983. },
  4984. args: ["aNumber"],
  4985. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  4986. referencedClasses: [],
  4987. messageSends: []
  4988. }),
  4989. $globals.Number);
  4990. $core.addMethod(
  4991. $core.method({
  4992. selector: ">=",
  4993. protocol: "comparing",
  4994. fn: function (aNumber){
  4995. var self=this,$self=this;
  4996. return $core.withContext(function($ctx1) {
  4997. return self >= aNumber;
  4998. return self;
  4999. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5000. },
  5001. args: ["aNumber"],
  5002. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5003. referencedClasses: [],
  5004. messageSends: []
  5005. }),
  5006. $globals.Number);
  5007. $core.addMethod(
  5008. $core.method({
  5009. selector: "@",
  5010. protocol: "converting",
  5011. fn: function (aNumber){
  5012. var self=this,$self=this;
  5013. return $core.withContext(function($ctx1) {
  5014. return $recv($globals.Point)._x_y_(self,aNumber);
  5015. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5016. },
  5017. args: ["aNumber"],
  5018. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5019. referencedClasses: ["Point"],
  5020. messageSends: ["x:y:"]
  5021. }),
  5022. $globals.Number);
  5023. $core.addMethod(
  5024. $core.method({
  5025. selector: "\x5c\x5c",
  5026. protocol: "arithmetic",
  5027. fn: function (aNumber){
  5028. var self=this,$self=this;
  5029. return $core.withContext(function($ctx1) {
  5030. return self % aNumber;
  5031. return self;
  5032. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5033. },
  5034. args: ["aNumber"],
  5035. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5036. referencedClasses: [],
  5037. messageSends: []
  5038. }),
  5039. $globals.Number);
  5040. $core.addMethod(
  5041. $core.method({
  5042. selector: "abs",
  5043. protocol: "arithmetic",
  5044. fn: function (){
  5045. var self=this,$self=this;
  5046. return $core.withContext(function($ctx1) {
  5047. return Math.abs(self);;
  5048. return self;
  5049. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5050. },
  5051. args: [],
  5052. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5053. referencedClasses: [],
  5054. messageSends: []
  5055. }),
  5056. $globals.Number);
  5057. $core.addMethod(
  5058. $core.method({
  5059. selector: "arcCos",
  5060. protocol: "mathematical functions",
  5061. fn: function (){
  5062. var self=this,$self=this;
  5063. return $core.withContext(function($ctx1) {
  5064. return Math.acos(self);;
  5065. return self;
  5066. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5067. },
  5068. args: [],
  5069. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5070. referencedClasses: [],
  5071. messageSends: []
  5072. }),
  5073. $globals.Number);
  5074. $core.addMethod(
  5075. $core.method({
  5076. selector: "arcSin",
  5077. protocol: "mathematical functions",
  5078. fn: function (){
  5079. var self=this,$self=this;
  5080. return $core.withContext(function($ctx1) {
  5081. return Math.asin(self);;
  5082. return self;
  5083. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5084. },
  5085. args: [],
  5086. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5087. referencedClasses: [],
  5088. messageSends: []
  5089. }),
  5090. $globals.Number);
  5091. $core.addMethod(
  5092. $core.method({
  5093. selector: "arcTan",
  5094. protocol: "mathematical functions",
  5095. fn: function (){
  5096. var self=this,$self=this;
  5097. return $core.withContext(function($ctx1) {
  5098. return Math.atan(self);;
  5099. return self;
  5100. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5101. },
  5102. args: [],
  5103. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5104. referencedClasses: [],
  5105. messageSends: []
  5106. }),
  5107. $globals.Number);
  5108. $core.addMethod(
  5109. $core.method({
  5110. selector: "arcTan:",
  5111. protocol: "mathematical functions",
  5112. fn: function (aNumber){
  5113. var self=this,$self=this;
  5114. return $core.withContext(function($ctx1) {
  5115. return Math.atan2(self, aNumber);;
  5116. return self;
  5117. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5118. },
  5119. args: ["aNumber"],
  5120. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5121. referencedClasses: [],
  5122. messageSends: []
  5123. }),
  5124. $globals.Number);
  5125. $core.addMethod(
  5126. $core.method({
  5127. selector: "asJavaScriptObject",
  5128. protocol: "converting",
  5129. fn: function (){
  5130. var self=this,$self=this;
  5131. return self;
  5132. },
  5133. args: [],
  5134. source: "asJavaScriptObject\x0a\x09^ self",
  5135. referencedClasses: [],
  5136. messageSends: []
  5137. }),
  5138. $globals.Number);
  5139. $core.addMethod(
  5140. $core.method({
  5141. selector: "asJavaScriptSource",
  5142. protocol: "converting",
  5143. fn: function (){
  5144. var self=this,$self=this;
  5145. return $core.withContext(function($ctx1) {
  5146. var $1;
  5147. $1=$recv("(".__comma($self._printString())).__comma(")");
  5148. $ctx1.sendIdx[","]=1;
  5149. return $1;
  5150. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5151. },
  5152. args: [],
  5153. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5154. referencedClasses: [],
  5155. messageSends: [",", "printString"]
  5156. }),
  5157. $globals.Number);
  5158. $core.addMethod(
  5159. $core.method({
  5160. selector: "asNumber",
  5161. protocol: "converting",
  5162. fn: function (){
  5163. var self=this,$self=this;
  5164. return self;
  5165. },
  5166. args: [],
  5167. source: "asNumber\x0a\x09^ self",
  5168. referencedClasses: [],
  5169. messageSends: []
  5170. }),
  5171. $globals.Number);
  5172. $core.addMethod(
  5173. $core.method({
  5174. selector: "asPoint",
  5175. protocol: "converting",
  5176. fn: function (){
  5177. var self=this,$self=this;
  5178. return $core.withContext(function($ctx1) {
  5179. return $recv($globals.Point)._x_y_(self,self);
  5180. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5181. },
  5182. args: [],
  5183. source: "asPoint\x0a\x09^ Point x: self y: self",
  5184. referencedClasses: ["Point"],
  5185. messageSends: ["x:y:"]
  5186. }),
  5187. $globals.Number);
  5188. $core.addMethod(
  5189. $core.method({
  5190. selector: "asString",
  5191. protocol: "converting",
  5192. fn: function (){
  5193. var self=this,$self=this;
  5194. return $core.withContext(function($ctx1) {
  5195. return String(self);
  5196. return self;
  5197. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5198. },
  5199. args: [],
  5200. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5201. referencedClasses: [],
  5202. messageSends: []
  5203. }),
  5204. $globals.Number);
  5205. $core.addMethod(
  5206. $core.method({
  5207. selector: "atRandom",
  5208. protocol: "converting",
  5209. fn: function (){
  5210. var self=this,$self=this;
  5211. return $core.withContext(function($ctx1) {
  5212. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5213. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5214. },
  5215. args: [],
  5216. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5217. referencedClasses: ["Random"],
  5218. messageSends: ["+", "truncated", "*", "next", "new"]
  5219. }),
  5220. $globals.Number);
  5221. $core.addMethod(
  5222. $core.method({
  5223. selector: "between:and:",
  5224. protocol: "testing",
  5225. fn: function (min,max){
  5226. var self=this,$self=this;
  5227. return $core.withContext(function($ctx1) {
  5228. return $recv($self.__gt_eq(min))._and_((function(){
  5229. return $core.withContext(function($ctx2) {
  5230. return $self.__lt_eq(max);
  5231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5232. }));
  5233. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5234. },
  5235. args: ["min", "max"],
  5236. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5237. referencedClasses: [],
  5238. messageSends: ["and:", ">=", "<="]
  5239. }),
  5240. $globals.Number);
  5241. $core.addMethod(
  5242. $core.method({
  5243. selector: "bitAnd:",
  5244. protocol: "converting",
  5245. fn: function (aNumber){
  5246. var self=this,$self=this;
  5247. return $core.withContext(function($ctx1) {
  5248. return self & aNumber;
  5249. return self;
  5250. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5251. },
  5252. args: ["aNumber"],
  5253. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5254. referencedClasses: [],
  5255. messageSends: []
  5256. }),
  5257. $globals.Number);
  5258. $core.addMethod(
  5259. $core.method({
  5260. selector: "bitNot",
  5261. protocol: "converting",
  5262. fn: function (){
  5263. var self=this,$self=this;
  5264. return $core.withContext(function($ctx1) {
  5265. return ~self;
  5266. return self;
  5267. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5268. },
  5269. args: [],
  5270. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5271. referencedClasses: [],
  5272. messageSends: []
  5273. }),
  5274. $globals.Number);
  5275. $core.addMethod(
  5276. $core.method({
  5277. selector: "bitOr:",
  5278. protocol: "converting",
  5279. fn: function (aNumber){
  5280. var self=this,$self=this;
  5281. return $core.withContext(function($ctx1) {
  5282. return self | aNumber;
  5283. return self;
  5284. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5285. },
  5286. args: ["aNumber"],
  5287. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5288. referencedClasses: [],
  5289. messageSends: []
  5290. }),
  5291. $globals.Number);
  5292. $core.addMethod(
  5293. $core.method({
  5294. selector: "bitXor:",
  5295. protocol: "converting",
  5296. fn: function (aNumber){
  5297. var self=this,$self=this;
  5298. return $core.withContext(function($ctx1) {
  5299. return self ^ aNumber;
  5300. return self;
  5301. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5302. },
  5303. args: ["aNumber"],
  5304. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5305. referencedClasses: [],
  5306. messageSends: []
  5307. }),
  5308. $globals.Number);
  5309. $core.addMethod(
  5310. $core.method({
  5311. selector: "ceiling",
  5312. protocol: "converting",
  5313. fn: function (){
  5314. var self=this,$self=this;
  5315. return $core.withContext(function($ctx1) {
  5316. return Math.ceil(self);;
  5317. return self;
  5318. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5319. },
  5320. args: [],
  5321. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5322. referencedClasses: [],
  5323. messageSends: []
  5324. }),
  5325. $globals.Number);
  5326. $core.addMethod(
  5327. $core.method({
  5328. selector: "copy",
  5329. protocol: "copying",
  5330. fn: function (){
  5331. var self=this,$self=this;
  5332. return self;
  5333. },
  5334. args: [],
  5335. source: "copy\x0a\x09^ self",
  5336. referencedClasses: [],
  5337. messageSends: []
  5338. }),
  5339. $globals.Number);
  5340. $core.addMethod(
  5341. $core.method({
  5342. selector: "cos",
  5343. protocol: "mathematical functions",
  5344. fn: function (){
  5345. var self=this,$self=this;
  5346. return $core.withContext(function($ctx1) {
  5347. return Math.cos(self);;
  5348. return self;
  5349. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5350. },
  5351. args: [],
  5352. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5353. referencedClasses: [],
  5354. messageSends: []
  5355. }),
  5356. $globals.Number);
  5357. $core.addMethod(
  5358. $core.method({
  5359. selector: "deepCopy",
  5360. protocol: "copying",
  5361. fn: function (){
  5362. var self=this,$self=this;
  5363. return $core.withContext(function($ctx1) {
  5364. return $self._copy();
  5365. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5366. },
  5367. args: [],
  5368. source: "deepCopy\x0a\x09^ self copy",
  5369. referencedClasses: [],
  5370. messageSends: ["copy"]
  5371. }),
  5372. $globals.Number);
  5373. $core.addMethod(
  5374. $core.method({
  5375. selector: "degreesToRadians",
  5376. protocol: "converting",
  5377. fn: function (){
  5378. var self=this,$self=this;
  5379. return $core.withContext(function($ctx1) {
  5380. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5381. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5382. },
  5383. args: [],
  5384. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5385. referencedClasses: ["Number"],
  5386. messageSends: ["*", "radiansPerDegree"]
  5387. }),
  5388. $globals.Number);
  5389. $core.addMethod(
  5390. $core.method({
  5391. selector: "even",
  5392. protocol: "testing",
  5393. fn: function (){
  5394. var self=this,$self=this;
  5395. return $core.withContext(function($ctx1) {
  5396. return (0).__eq($self.__backslash_backslash((2)));
  5397. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5398. },
  5399. args: [],
  5400. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5401. referencedClasses: [],
  5402. messageSends: ["=", "\x5c\x5c"]
  5403. }),
  5404. $globals.Number);
  5405. $core.addMethod(
  5406. $core.method({
  5407. selector: "floor",
  5408. protocol: "converting",
  5409. fn: function (){
  5410. var self=this,$self=this;
  5411. return $core.withContext(function($ctx1) {
  5412. return Math.floor(self);;
  5413. return self;
  5414. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5415. },
  5416. args: [],
  5417. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5418. referencedClasses: [],
  5419. messageSends: []
  5420. }),
  5421. $globals.Number);
  5422. $core.addMethod(
  5423. $core.method({
  5424. selector: "isImmutable",
  5425. protocol: "testing",
  5426. fn: function (){
  5427. var self=this,$self=this;
  5428. return true;
  5429. },
  5430. args: [],
  5431. source: "isImmutable\x0a\x09^ true",
  5432. referencedClasses: [],
  5433. messageSends: []
  5434. }),
  5435. $globals.Number);
  5436. $core.addMethod(
  5437. $core.method({
  5438. selector: "isNumber",
  5439. protocol: "testing",
  5440. fn: function (){
  5441. var self=this,$self=this;
  5442. return true;
  5443. },
  5444. args: [],
  5445. source: "isNumber\x0a\x09^ true",
  5446. referencedClasses: [],
  5447. messageSends: []
  5448. }),
  5449. $globals.Number);
  5450. $core.addMethod(
  5451. $core.method({
  5452. selector: "isZero",
  5453. protocol: "testing",
  5454. fn: function (){
  5455. var self=this,$self=this;
  5456. return $core.withContext(function($ctx1) {
  5457. return $self.__eq((0));
  5458. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5459. },
  5460. args: [],
  5461. source: "isZero\x0a\x09^ self = 0",
  5462. referencedClasses: [],
  5463. messageSends: ["="]
  5464. }),
  5465. $globals.Number);
  5466. $core.addMethod(
  5467. $core.method({
  5468. selector: "ln",
  5469. protocol: "mathematical functions",
  5470. fn: function (){
  5471. var self=this,$self=this;
  5472. return $core.withContext(function($ctx1) {
  5473. return Math.log(self);;
  5474. return self;
  5475. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5476. },
  5477. args: [],
  5478. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5479. referencedClasses: [],
  5480. messageSends: []
  5481. }),
  5482. $globals.Number);
  5483. $core.addMethod(
  5484. $core.method({
  5485. selector: "ln1p",
  5486. protocol: "mathematical functions",
  5487. fn: function (){
  5488. var self=this,$self=this;
  5489. return $core.withContext(function($ctx1) {
  5490. return Math.log1p(self);;
  5491. return self;
  5492. }, function($ctx1) {$ctx1.fill(self,"ln1p",{},$globals.Number)});
  5493. },
  5494. args: [],
  5495. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5496. referencedClasses: [],
  5497. messageSends: []
  5498. }),
  5499. $globals.Number);
  5500. $core.addMethod(
  5501. $core.method({
  5502. selector: "log",
  5503. protocol: "mathematical functions",
  5504. fn: function (){
  5505. var self=this,$self=this;
  5506. return $core.withContext(function($ctx1) {
  5507. return Math.log(self) / Math.LN10;;
  5508. return self;
  5509. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5510. },
  5511. args: [],
  5512. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5513. referencedClasses: [],
  5514. messageSends: []
  5515. }),
  5516. $globals.Number);
  5517. $core.addMethod(
  5518. $core.method({
  5519. selector: "log:",
  5520. protocol: "mathematical functions",
  5521. fn: function (aNumber){
  5522. var self=this,$self=this;
  5523. return $core.withContext(function($ctx1) {
  5524. return Math.log(self) / Math.log(aNumber);;
  5525. return self;
  5526. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5527. },
  5528. args: ["aNumber"],
  5529. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5530. referencedClasses: [],
  5531. messageSends: []
  5532. }),
  5533. $globals.Number);
  5534. $core.addMethod(
  5535. $core.method({
  5536. selector: "max:",
  5537. protocol: "arithmetic",
  5538. fn: function (aNumber){
  5539. var self=this,$self=this;
  5540. return $core.withContext(function($ctx1) {
  5541. return Math.max(self, aNumber);;
  5542. return self;
  5543. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5544. },
  5545. args: ["aNumber"],
  5546. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5547. referencedClasses: [],
  5548. messageSends: []
  5549. }),
  5550. $globals.Number);
  5551. $core.addMethod(
  5552. $core.method({
  5553. selector: "min:",
  5554. protocol: "arithmetic",
  5555. fn: function (aNumber){
  5556. var self=this,$self=this;
  5557. return $core.withContext(function($ctx1) {
  5558. return Math.min(self, aNumber);;
  5559. return self;
  5560. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5561. },
  5562. args: ["aNumber"],
  5563. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5564. referencedClasses: [],
  5565. messageSends: []
  5566. }),
  5567. $globals.Number);
  5568. $core.addMethod(
  5569. $core.method({
  5570. selector: "min:max:",
  5571. protocol: "arithmetic",
  5572. fn: function (aMin,aMax){
  5573. var self=this,$self=this;
  5574. return $core.withContext(function($ctx1) {
  5575. return $recv($self._min_(aMin))._max_(aMax);
  5576. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5577. },
  5578. args: ["aMin", "aMax"],
  5579. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5580. referencedClasses: [],
  5581. messageSends: ["max:", "min:"]
  5582. }),
  5583. $globals.Number);
  5584. $core.addMethod(
  5585. $core.method({
  5586. selector: "negated",
  5587. protocol: "arithmetic",
  5588. fn: function (){
  5589. var self=this,$self=this;
  5590. return $core.withContext(function($ctx1) {
  5591. return (0).__minus(self);
  5592. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5593. },
  5594. args: [],
  5595. source: "negated\x0a\x09^ 0 - self",
  5596. referencedClasses: [],
  5597. messageSends: ["-"]
  5598. }),
  5599. $globals.Number);
  5600. $core.addMethod(
  5601. $core.method({
  5602. selector: "negative",
  5603. protocol: "testing",
  5604. fn: function (){
  5605. var self=this,$self=this;
  5606. return $core.withContext(function($ctx1) {
  5607. return $self.__lt((0));
  5608. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5609. },
  5610. args: [],
  5611. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5612. referencedClasses: [],
  5613. messageSends: ["<"]
  5614. }),
  5615. $globals.Number);
  5616. $core.addMethod(
  5617. $core.method({
  5618. selector: "odd",
  5619. protocol: "testing",
  5620. fn: function (){
  5621. var self=this,$self=this;
  5622. return $core.withContext(function($ctx1) {
  5623. return $recv($self._even())._not();
  5624. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5625. },
  5626. args: [],
  5627. source: "odd\x0a\x09^ self even not",
  5628. referencedClasses: [],
  5629. messageSends: ["not", "even"]
  5630. }),
  5631. $globals.Number);
  5632. $core.addMethod(
  5633. $core.method({
  5634. selector: "positive",
  5635. protocol: "testing",
  5636. fn: function (){
  5637. var self=this,$self=this;
  5638. return $core.withContext(function($ctx1) {
  5639. return $self.__gt_eq((0));
  5640. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5641. },
  5642. args: [],
  5643. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5644. referencedClasses: [],
  5645. messageSends: [">="]
  5646. }),
  5647. $globals.Number);
  5648. $core.addMethod(
  5649. $core.method({
  5650. selector: "printOn:",
  5651. protocol: "printing",
  5652. fn: function (aStream){
  5653. var self=this,$self=this;
  5654. return $core.withContext(function($ctx1) {
  5655. $recv(aStream)._nextPutAll_($self._asString());
  5656. return self;
  5657. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5658. },
  5659. args: ["aStream"],
  5660. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5661. referencedClasses: [],
  5662. messageSends: ["nextPutAll:", "asString"]
  5663. }),
  5664. $globals.Number);
  5665. $core.addMethod(
  5666. $core.method({
  5667. selector: "printShowingDecimalPlaces:",
  5668. protocol: "printing",
  5669. fn: function (placesDesired){
  5670. var self=this,$self=this;
  5671. return $core.withContext(function($ctx1) {
  5672. return self.toFixed(placesDesired);
  5673. return self;
  5674. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5675. },
  5676. args: ["placesDesired"],
  5677. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5678. referencedClasses: [],
  5679. messageSends: []
  5680. }),
  5681. $globals.Number);
  5682. $core.addMethod(
  5683. $core.method({
  5684. selector: "printStringBase:",
  5685. protocol: "converting",
  5686. fn: function (aBase){
  5687. var self=this,$self=this;
  5688. return $core.withContext(function($ctx1) {
  5689. return self.toString(aBase);
  5690. return self;
  5691. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5692. },
  5693. args: ["aBase"],
  5694. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5695. referencedClasses: [],
  5696. messageSends: []
  5697. }),
  5698. $globals.Number);
  5699. $core.addMethod(
  5700. $core.method({
  5701. selector: "radiansToDegrees",
  5702. protocol: "converting",
  5703. fn: function (){
  5704. var self=this,$self=this;
  5705. return $core.withContext(function($ctx1) {
  5706. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5707. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5708. },
  5709. args: [],
  5710. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5711. referencedClasses: ["Number"],
  5712. messageSends: ["/", "radiansPerDegree"]
  5713. }),
  5714. $globals.Number);
  5715. $core.addMethod(
  5716. $core.method({
  5717. selector: "raisedTo:",
  5718. protocol: "mathematical functions",
  5719. fn: function (exponent){
  5720. var self=this,$self=this;
  5721. return $core.withContext(function($ctx1) {
  5722. return Math.pow(self, exponent);;
  5723. return self;
  5724. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5725. },
  5726. args: ["exponent"],
  5727. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5728. referencedClasses: [],
  5729. messageSends: []
  5730. }),
  5731. $globals.Number);
  5732. $core.addMethod(
  5733. $core.method({
  5734. selector: "rounded",
  5735. protocol: "converting",
  5736. fn: function (){
  5737. var self=this,$self=this;
  5738. return $core.withContext(function($ctx1) {
  5739. return Math.round(self);;
  5740. return self;
  5741. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5742. },
  5743. args: [],
  5744. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5745. referencedClasses: [],
  5746. messageSends: []
  5747. }),
  5748. $globals.Number);
  5749. $core.addMethod(
  5750. $core.method({
  5751. selector: "sign",
  5752. protocol: "mathematical functions",
  5753. fn: function (){
  5754. var self=this,$self=this;
  5755. return $core.withContext(function($ctx1) {
  5756. var $1,$2;
  5757. $1=$self._isZero();
  5758. if($core.assert($1)){
  5759. return (0);
  5760. }
  5761. $2=$self._positive();
  5762. if($core.assert($2)){
  5763. return (1);
  5764. } else {
  5765. return (-1);
  5766. }
  5767. return self;
  5768. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5769. },
  5770. args: [],
  5771. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5772. referencedClasses: [],
  5773. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5774. }),
  5775. $globals.Number);
  5776. $core.addMethod(
  5777. $core.method({
  5778. selector: "sin",
  5779. protocol: "mathematical functions",
  5780. fn: function (){
  5781. var self=this,$self=this;
  5782. return $core.withContext(function($ctx1) {
  5783. return Math.sin(self);;
  5784. return self;
  5785. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5786. },
  5787. args: [],
  5788. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5789. referencedClasses: [],
  5790. messageSends: []
  5791. }),
  5792. $globals.Number);
  5793. $core.addMethod(
  5794. $core.method({
  5795. selector: "sqrt",
  5796. protocol: "mathematical functions",
  5797. fn: function (){
  5798. var self=this,$self=this;
  5799. return $core.withContext(function($ctx1) {
  5800. return Math.sqrt(self);
  5801. return self;
  5802. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5803. },
  5804. args: [],
  5805. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5806. referencedClasses: [],
  5807. messageSends: []
  5808. }),
  5809. $globals.Number);
  5810. $core.addMethod(
  5811. $core.method({
  5812. selector: "squared",
  5813. protocol: "mathematical functions",
  5814. fn: function (){
  5815. var self=this,$self=this;
  5816. return $core.withContext(function($ctx1) {
  5817. return $self.__star(self);
  5818. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5819. },
  5820. args: [],
  5821. source: "squared\x0a\x09^ self * self",
  5822. referencedClasses: [],
  5823. messageSends: ["*"]
  5824. }),
  5825. $globals.Number);
  5826. $core.addMethod(
  5827. $core.method({
  5828. selector: "tan",
  5829. protocol: "mathematical functions",
  5830. fn: function (){
  5831. var self=this,$self=this;
  5832. return $core.withContext(function($ctx1) {
  5833. return Math.tan(self);;
  5834. return self;
  5835. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5836. },
  5837. args: [],
  5838. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5839. referencedClasses: [],
  5840. messageSends: []
  5841. }),
  5842. $globals.Number);
  5843. $core.addMethod(
  5844. $core.method({
  5845. selector: "timesRepeat:",
  5846. protocol: "enumerating",
  5847. fn: function (aBlock){
  5848. var self=this,$self=this;
  5849. var count;
  5850. return $core.withContext(function($ctx1) {
  5851. count=(1);
  5852. $recv((function(){
  5853. return $core.withContext(function($ctx2) {
  5854. return $recv(count).__gt(self);
  5855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5856. }))._whileFalse_((function(){
  5857. return $core.withContext(function($ctx2) {
  5858. $recv(aBlock)._value();
  5859. count=$recv(count).__plus((1));
  5860. return count;
  5861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5862. }));
  5863. return self;
  5864. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5865. },
  5866. args: ["aBlock"],
  5867. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5868. referencedClasses: [],
  5869. messageSends: ["whileFalse:", ">", "value", "+"]
  5870. }),
  5871. $globals.Number);
  5872. $core.addMethod(
  5873. $core.method({
  5874. selector: "to:",
  5875. protocol: "converting",
  5876. fn: function (aNumber){
  5877. var self=this,$self=this;
  5878. var array,first,last,count;
  5879. return $core.withContext(function($ctx1) {
  5880. first=$self._truncated();
  5881. $ctx1.sendIdx["truncated"]=1;
  5882. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5883. $ctx1.sendIdx["+"]=1;
  5884. count=(1);
  5885. array=$recv($globals.Array)._new();
  5886. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5887. return $core.withContext(function($ctx2) {
  5888. $recv(array)._at_put_(count,first);
  5889. count=$recv(count).__plus((1));
  5890. $ctx2.sendIdx["+"]=2;
  5891. first=$recv(first).__plus((1));
  5892. return first;
  5893. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5894. }));
  5895. return array;
  5896. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5897. },
  5898. args: ["aNumber"],
  5899. source: "to: aNumber\x0a\x09| array first last count |\x0a\x09first := self truncated.\x0a\x09last := aNumber truncated + 1.\x0a\x09count := 1.\x0a\x09array := Array new.\x0a\x09(last - first) timesRepeat: [\x0a\x09\x09array at: count put: first.\x0a\x09\x09count := count + 1.\x0a\x09\x09first := first + 1 ].\x0a\x09^ array",
  5900. referencedClasses: ["Array"],
  5901. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5902. }),
  5903. $globals.Number);
  5904. $core.addMethod(
  5905. $core.method({
  5906. selector: "to:by:",
  5907. protocol: "converting",
  5908. fn: function (stop,step){
  5909. var self=this,$self=this;
  5910. var array,value,pos;
  5911. return $core.withContext(function($ctx1) {
  5912. var $1,$2;
  5913. value=self;
  5914. array=$recv($globals.Array)._new();
  5915. pos=(1);
  5916. $1=$recv(step).__eq((0));
  5917. if($core.assert($1)){
  5918. $self._error_("step must be non-zero");
  5919. }
  5920. $2=$recv(step).__lt((0));
  5921. if($core.assert($2)){
  5922. $recv((function(){
  5923. return $core.withContext(function($ctx2) {
  5924. return $recv(value).__gt_eq(stop);
  5925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5926. }))._whileTrue_((function(){
  5927. return $core.withContext(function($ctx2) {
  5928. $recv(array)._at_put_(pos,value);
  5929. $ctx2.sendIdx["at:put:"]=1;
  5930. pos=$recv(pos).__plus((1));
  5931. $ctx2.sendIdx["+"]=1;
  5932. value=$recv(value).__plus(step);
  5933. $ctx2.sendIdx["+"]=2;
  5934. return value;
  5935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5936. }));
  5937. $ctx1.sendIdx["whileTrue:"]=1;
  5938. } else {
  5939. $recv((function(){
  5940. return $core.withContext(function($ctx2) {
  5941. return $recv(value).__lt_eq(stop);
  5942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5943. }))._whileTrue_((function(){
  5944. return $core.withContext(function($ctx2) {
  5945. $recv(array)._at_put_(pos,value);
  5946. pos=$recv(pos).__plus((1));
  5947. $ctx2.sendIdx["+"]=3;
  5948. value=$recv(value).__plus(step);
  5949. return value;
  5950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5951. }));
  5952. }
  5953. return array;
  5954. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5955. },
  5956. args: ["stop", "step"],
  5957. source: "to: stop by: step\x0a\x09| array value pos |\x0a\x09value := self.\x0a\x09array := Array new.\x0a\x09pos := 1.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09array at: pos put: value.\x0a\x09\x09\x09\x09pos := pos + 1.\x0a\x09\x09\x09\x09\x09value := value + step ]].\x0a\x09^ array",
  5958. referencedClasses: ["Array"],
  5959. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5960. }),
  5961. $globals.Number);
  5962. $core.addMethod(
  5963. $core.method({
  5964. selector: "to:by:do:",
  5965. protocol: "enumerating",
  5966. fn: function (stop,step,aBlock){
  5967. var self=this,$self=this;
  5968. var value;
  5969. return $core.withContext(function($ctx1) {
  5970. var $1,$2;
  5971. value=self;
  5972. $1=$recv(step).__eq((0));
  5973. if($core.assert($1)){
  5974. $self._error_("step must be non-zero");
  5975. }
  5976. $2=$recv(step).__lt((0));
  5977. if($core.assert($2)){
  5978. $recv((function(){
  5979. return $core.withContext(function($ctx2) {
  5980. return $recv(value).__gt_eq(stop);
  5981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5982. }))._whileTrue_((function(){
  5983. return $core.withContext(function($ctx2) {
  5984. $recv(aBlock)._value_(value);
  5985. $ctx2.sendIdx["value:"]=1;
  5986. value=$recv(value).__plus(step);
  5987. $ctx2.sendIdx["+"]=1;
  5988. return value;
  5989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5990. }));
  5991. $ctx1.sendIdx["whileTrue:"]=1;
  5992. } else {
  5993. $recv((function(){
  5994. return $core.withContext(function($ctx2) {
  5995. return $recv(value).__lt_eq(stop);
  5996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5997. }))._whileTrue_((function(){
  5998. return $core.withContext(function($ctx2) {
  5999. $recv(aBlock)._value_(value);
  6000. value=$recv(value).__plus(step);
  6001. return value;
  6002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6003. }));
  6004. }
  6005. return self;
  6006. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6007. },
  6008. args: ["stop", "step", "aBlock"],
  6009. source: "to: stop by: step do: aBlock\x0a\x09| value |\x0a\x09value := self.\x0a\x09step = 0 ifTrue: [ self error: 'step must be non-zero' ].\x0a\x09step < 0\x0a\x09\x09ifTrue: [ [ value >= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]\x0a\x09\x09ifFalse: [ [ value <= stop ] whileTrue: [\x0a\x09\x09\x09\x09\x09aBlock value: value.\x0a\x09\x09\x09\x09\x09value := value + step ]]",
  6010. referencedClasses: [],
  6011. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6012. }),
  6013. $globals.Number);
  6014. $core.addMethod(
  6015. $core.method({
  6016. selector: "to:do:",
  6017. protocol: "enumerating",
  6018. fn: function (stop,aBlock){
  6019. var self=this,$self=this;
  6020. var nextValue;
  6021. return $core.withContext(function($ctx1) {
  6022. nextValue=self;
  6023. $recv((function(){
  6024. return $core.withContext(function($ctx2) {
  6025. return $recv(nextValue).__lt_eq(stop);
  6026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6027. }))._whileTrue_((function(){
  6028. return $core.withContext(function($ctx2) {
  6029. $recv(aBlock)._value_(nextValue);
  6030. nextValue=$recv(nextValue).__plus((1));
  6031. return nextValue;
  6032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6033. }));
  6034. return self;
  6035. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6036. },
  6037. args: ["stop", "aBlock"],
  6038. source: "to: stop do: aBlock\x0a\x09\x22Evaluate aBlock for each number from self to aNumber.\x22\x0a\x09| nextValue |\x0a\x09nextValue := self.\x0a\x09[ nextValue <= stop ]\x0a\x09\x09whileTrue:\x0a\x09\x09\x09[ aBlock value: nextValue.\x0a\x09\x09\x09nextValue := nextValue + 1 ]",
  6039. referencedClasses: [],
  6040. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6041. }),
  6042. $globals.Number);
  6043. $core.addMethod(
  6044. $core.method({
  6045. selector: "truncated",
  6046. protocol: "converting",
  6047. fn: function (){
  6048. var self=this,$self=this;
  6049. return $core.withContext(function($ctx1) {
  6050. if(self >= 0) {
  6051. return Math.floor(self);
  6052. } else {
  6053. return Math.floor(self * (-1)) * (-1);
  6054. };
  6055. ;
  6056. return self;
  6057. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6058. },
  6059. args: [],
  6060. source: "truncated\x0a\x09<inlineJS: '\x0a\x09\x09if(self >= 0) {\x0a\x09\x09\x09return Math.floor(self);\x0a\x09\x09} else {\x0a\x09\x09\x09return Math.floor(self * (-1)) * (-1);\x0a\x09\x09};\x0a\x09'>",
  6061. referencedClasses: [],
  6062. messageSends: []
  6063. }),
  6064. $globals.Number);
  6065. $core.addMethod(
  6066. $core.method({
  6067. selector: "|",
  6068. protocol: "converting",
  6069. fn: function (aNumber){
  6070. var self=this,$self=this;
  6071. return $core.withContext(function($ctx1) {
  6072. return self | aNumber;
  6073. return self;
  6074. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6075. },
  6076. args: ["aNumber"],
  6077. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6078. referencedClasses: [],
  6079. messageSends: []
  6080. }),
  6081. $globals.Number);
  6082. $core.addMethod(
  6083. $core.method({
  6084. selector: "classTag",
  6085. protocol: "accessing",
  6086. fn: function (){
  6087. var self=this,$self=this;
  6088. return "magnitude";
  6089. },
  6090. args: [],
  6091. 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^ 'magnitude'",
  6092. referencedClasses: [],
  6093. messageSends: []
  6094. }),
  6095. $globals.Number.a$cls);
  6096. $core.addMethod(
  6097. $core.method({
  6098. selector: "e",
  6099. protocol: "instance creation",
  6100. fn: function (){
  6101. var self=this,$self=this;
  6102. return $core.withContext(function($ctx1) {
  6103. return Math.E;;
  6104. return self;
  6105. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6106. },
  6107. args: [],
  6108. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6109. referencedClasses: [],
  6110. messageSends: []
  6111. }),
  6112. $globals.Number.a$cls);
  6113. $core.addMethod(
  6114. $core.method({
  6115. selector: "pi",
  6116. protocol: "instance creation",
  6117. fn: function (){
  6118. var self=this,$self=this;
  6119. return $core.withContext(function($ctx1) {
  6120. return Math.PI;
  6121. return self;
  6122. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6123. },
  6124. args: [],
  6125. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6126. referencedClasses: [],
  6127. messageSends: []
  6128. }),
  6129. $globals.Number.a$cls);
  6130. $core.addMethod(
  6131. $core.method({
  6132. selector: "radiansPerDegree",
  6133. protocol: "instance creation",
  6134. fn: function (){
  6135. var self=this,$self=this;
  6136. return $core.withContext(function($ctx1) {
  6137. return $recv($self._pi()).__slash((180));
  6138. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6139. },
  6140. args: [],
  6141. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6142. referencedClasses: [],
  6143. messageSends: ["/", "pi"]
  6144. }),
  6145. $globals.Number.a$cls);
  6146. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6147. $globals.Point.comment="I represent an x-y pair of numbers usually designating a geometric coordinate.\x0a\x0a## API\x0a\x0aInstances are traditionally created using the binary `#@` message to a number:\x0a\x0a\x09100@120\x0a\x0aPoints can then be arithmetically manipulated:\x0a\x0a\x09100@100 + (10@10)\x0a\x0a...or for example:\x0a\x0a\x09(100@100) * 2\x0a\x0a**NOTE:** Creating a point with a negative y-value will need a space after `@` in order to avoid a parsing error:\x0a\x0a\x09100@ -100 \x22but 100@-100 would not parse\x22";
  6148. $core.addMethod(
  6149. $core.method({
  6150. selector: "*",
  6151. protocol: "arithmetic",
  6152. fn: function (aPoint){
  6153. var self=this,$self=this;
  6154. return $core.withContext(function($ctx1) {
  6155. var $2,$4,$3,$1,$6,$5;
  6156. $2=$self._x();
  6157. $ctx1.sendIdx["x"]=1;
  6158. $4=$recv(aPoint)._asPoint();
  6159. $ctx1.sendIdx["asPoint"]=1;
  6160. $3=$recv($4)._x();
  6161. $1=$recv($2).__star($3);
  6162. $ctx1.sendIdx["*"]=1;
  6163. $6=$self._y();
  6164. $ctx1.sendIdx["y"]=1;
  6165. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6166. return $recv($globals.Point)._x_y_($1,$5);
  6167. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6168. },
  6169. args: ["aPoint"],
  6170. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6171. referencedClasses: ["Point"],
  6172. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6173. }),
  6174. $globals.Point);
  6175. $core.addMethod(
  6176. $core.method({
  6177. selector: "+",
  6178. protocol: "arithmetic",
  6179. fn: function (aPoint){
  6180. var self=this,$self=this;
  6181. return $core.withContext(function($ctx1) {
  6182. var $2,$4,$3,$1,$6,$5;
  6183. $2=$self._x();
  6184. $ctx1.sendIdx["x"]=1;
  6185. $4=$recv(aPoint)._asPoint();
  6186. $ctx1.sendIdx["asPoint"]=1;
  6187. $3=$recv($4)._x();
  6188. $1=$recv($2).__plus($3);
  6189. $ctx1.sendIdx["+"]=1;
  6190. $6=$self._y();
  6191. $ctx1.sendIdx["y"]=1;
  6192. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6193. return $recv($globals.Point)._x_y_($1,$5);
  6194. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6195. },
  6196. args: ["aPoint"],
  6197. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6198. referencedClasses: ["Point"],
  6199. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6200. }),
  6201. $globals.Point);
  6202. $core.addMethod(
  6203. $core.method({
  6204. selector: "-",
  6205. protocol: "arithmetic",
  6206. fn: function (aPoint){
  6207. var self=this,$self=this;
  6208. return $core.withContext(function($ctx1) {
  6209. var $2,$4,$3,$1,$6,$5;
  6210. $2=$self._x();
  6211. $ctx1.sendIdx["x"]=1;
  6212. $4=$recv(aPoint)._asPoint();
  6213. $ctx1.sendIdx["asPoint"]=1;
  6214. $3=$recv($4)._x();
  6215. $1=$recv($2).__minus($3);
  6216. $ctx1.sendIdx["-"]=1;
  6217. $6=$self._y();
  6218. $ctx1.sendIdx["y"]=1;
  6219. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6220. return $recv($globals.Point)._x_y_($1,$5);
  6221. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6222. },
  6223. args: ["aPoint"],
  6224. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6225. referencedClasses: ["Point"],
  6226. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6227. }),
  6228. $globals.Point);
  6229. $core.addMethod(
  6230. $core.method({
  6231. selector: "/",
  6232. protocol: "arithmetic",
  6233. fn: function (aPoint){
  6234. var self=this,$self=this;
  6235. return $core.withContext(function($ctx1) {
  6236. var $2,$4,$3,$1,$6,$5;
  6237. $2=$self._x();
  6238. $ctx1.sendIdx["x"]=1;
  6239. $4=$recv(aPoint)._asPoint();
  6240. $ctx1.sendIdx["asPoint"]=1;
  6241. $3=$recv($4)._x();
  6242. $1=$recv($2).__slash($3);
  6243. $ctx1.sendIdx["/"]=1;
  6244. $6=$self._y();
  6245. $ctx1.sendIdx["y"]=1;
  6246. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6247. return $recv($globals.Point)._x_y_($1,$5);
  6248. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6249. },
  6250. args: ["aPoint"],
  6251. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6252. referencedClasses: ["Point"],
  6253. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6254. }),
  6255. $globals.Point);
  6256. $core.addMethod(
  6257. $core.method({
  6258. selector: "<",
  6259. protocol: "comparing",
  6260. fn: function (aPoint){
  6261. var self=this,$self=this;
  6262. return $core.withContext(function($ctx1) {
  6263. var $2,$1,$3;
  6264. $2=$self._x();
  6265. $ctx1.sendIdx["x"]=1;
  6266. $1=$recv($2).__lt($recv(aPoint)._x());
  6267. $ctx1.sendIdx["<"]=1;
  6268. return $recv($1)._and_((function(){
  6269. return $core.withContext(function($ctx2) {
  6270. $3=$self._y();
  6271. $ctx2.sendIdx["y"]=1;
  6272. return $recv($3).__lt($recv(aPoint)._y());
  6273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6274. }));
  6275. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6276. },
  6277. args: ["aPoint"],
  6278. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6279. referencedClasses: [],
  6280. messageSends: ["and:", "<", "x", "y"]
  6281. }),
  6282. $globals.Point);
  6283. $core.addMethod(
  6284. $core.method({
  6285. selector: "<=",
  6286. protocol: "comparing",
  6287. fn: function (aPoint){
  6288. var self=this,$self=this;
  6289. return $core.withContext(function($ctx1) {
  6290. var $2,$1,$3;
  6291. $2=$self._x();
  6292. $ctx1.sendIdx["x"]=1;
  6293. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6294. $ctx1.sendIdx["<="]=1;
  6295. return $recv($1)._and_((function(){
  6296. return $core.withContext(function($ctx2) {
  6297. $3=$self._y();
  6298. $ctx2.sendIdx["y"]=1;
  6299. return $recv($3).__lt_eq($recv(aPoint)._y());
  6300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6301. }));
  6302. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6303. },
  6304. args: ["aPoint"],
  6305. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6306. referencedClasses: [],
  6307. messageSends: ["and:", "<=", "x", "y"]
  6308. }),
  6309. $globals.Point);
  6310. $core.addMethod(
  6311. $core.method({
  6312. selector: "=",
  6313. protocol: "comparing",
  6314. fn: function (aPoint){
  6315. var self=this,$self=this;
  6316. return $core.withContext(function($ctx1) {
  6317. var $2,$1,$4,$3,$6,$5;
  6318. $2=$recv(aPoint)._class();
  6319. $ctx1.sendIdx["class"]=1;
  6320. $1=$recv($2).__eq($self._class());
  6321. $ctx1.sendIdx["="]=1;
  6322. return $recv($1)._and_((function(){
  6323. return $core.withContext(function($ctx2) {
  6324. $4=$recv(aPoint)._x();
  6325. $ctx2.sendIdx["x"]=1;
  6326. $3=$recv($4).__eq($self._x());
  6327. $ctx2.sendIdx["="]=2;
  6328. $6=$recv(aPoint)._y();
  6329. $ctx2.sendIdx["y"]=1;
  6330. $5=$recv($6).__eq($self._y());
  6331. return $recv($3).__and($5);
  6332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6333. }));
  6334. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6335. },
  6336. args: ["aPoint"],
  6337. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6338. referencedClasses: [],
  6339. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6340. }),
  6341. $globals.Point);
  6342. $core.addMethod(
  6343. $core.method({
  6344. selector: ">",
  6345. protocol: "comparing",
  6346. fn: function (aPoint){
  6347. var self=this,$self=this;
  6348. return $core.withContext(function($ctx1) {
  6349. var $2,$1,$3;
  6350. $2=$self._x();
  6351. $ctx1.sendIdx["x"]=1;
  6352. $1=$recv($2).__gt($recv(aPoint)._x());
  6353. $ctx1.sendIdx[">"]=1;
  6354. return $recv($1)._and_((function(){
  6355. return $core.withContext(function($ctx2) {
  6356. $3=$self._y();
  6357. $ctx2.sendIdx["y"]=1;
  6358. return $recv($3).__gt($recv(aPoint)._y());
  6359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6360. }));
  6361. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6362. },
  6363. args: ["aPoint"],
  6364. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6365. referencedClasses: [],
  6366. messageSends: ["and:", ">", "x", "y"]
  6367. }),
  6368. $globals.Point);
  6369. $core.addMethod(
  6370. $core.method({
  6371. selector: ">=",
  6372. protocol: "comparing",
  6373. fn: function (aPoint){
  6374. var self=this,$self=this;
  6375. return $core.withContext(function($ctx1) {
  6376. var $2,$1,$3;
  6377. $2=$self._x();
  6378. $ctx1.sendIdx["x"]=1;
  6379. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6380. $ctx1.sendIdx[">="]=1;
  6381. return $recv($1)._and_((function(){
  6382. return $core.withContext(function($ctx2) {
  6383. $3=$self._y();
  6384. $ctx2.sendIdx["y"]=1;
  6385. return $recv($3).__gt_eq($recv(aPoint)._y());
  6386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6387. }));
  6388. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6389. },
  6390. args: ["aPoint"],
  6391. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6392. referencedClasses: [],
  6393. messageSends: ["and:", ">=", "x", "y"]
  6394. }),
  6395. $globals.Point);
  6396. $core.addMethod(
  6397. $core.method({
  6398. selector: "angle",
  6399. protocol: "geometry",
  6400. fn: function (){
  6401. var self=this,$self=this;
  6402. return $core.withContext(function($ctx1) {
  6403. return $recv($self._y())._arcTan_($self._x());
  6404. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6405. },
  6406. args: [],
  6407. source: "angle\x0a\x09^ self y arcTan: self x",
  6408. referencedClasses: [],
  6409. messageSends: ["arcTan:", "y", "x"]
  6410. }),
  6411. $globals.Point);
  6412. $core.addMethod(
  6413. $core.method({
  6414. selector: "asPoint",
  6415. protocol: "converting",
  6416. fn: function (){
  6417. var self=this,$self=this;
  6418. return self;
  6419. },
  6420. args: [],
  6421. source: "asPoint\x0a\x09^ self",
  6422. referencedClasses: [],
  6423. messageSends: []
  6424. }),
  6425. $globals.Point);
  6426. $core.addMethod(
  6427. $core.method({
  6428. selector: "corner:",
  6429. protocol: "rectangle creation",
  6430. fn: function (aPoint){
  6431. var self=this,$self=this;
  6432. return $core.withContext(function($ctx1) {
  6433. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6434. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6435. },
  6436. args: ["aPoint"],
  6437. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6438. referencedClasses: ["Rectangle"],
  6439. messageSends: ["origin:corner:"]
  6440. }),
  6441. $globals.Point);
  6442. $core.addMethod(
  6443. $core.method({
  6444. selector: "dist:",
  6445. protocol: "transforming",
  6446. fn: function (aPoint){
  6447. var self=this,$self=this;
  6448. var dx,dy;
  6449. return $core.withContext(function($ctx1) {
  6450. var $2,$1;
  6451. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6452. $ctx1.sendIdx["-"]=1;
  6453. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6454. $2=$recv(dx).__star(dx);
  6455. $ctx1.sendIdx["*"]=1;
  6456. $1=$recv($2).__plus($recv(dy).__star(dy));
  6457. return $recv($1)._sqrt();
  6458. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6459. },
  6460. args: ["aPoint"],
  6461. source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
  6462. referencedClasses: [],
  6463. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6464. }),
  6465. $globals.Point);
  6466. $core.addMethod(
  6467. $core.method({
  6468. selector: "dotProduct:",
  6469. protocol: "point functions",
  6470. fn: function (aPoint){
  6471. var self=this,$self=this;
  6472. return $core.withContext(function($ctx1) {
  6473. var $1;
  6474. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6475. $ctx1.sendIdx["*"]=1;
  6476. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6477. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6478. },
  6479. args: ["aPoint"],
  6480. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6481. referencedClasses: [],
  6482. messageSends: ["+", "*", "x", "y"]
  6483. }),
  6484. $globals.Point);
  6485. $core.addMethod(
  6486. $core.method({
  6487. selector: "extent:",
  6488. protocol: "rectangle creation",
  6489. fn: function (aPoint){
  6490. var self=this,$self=this;
  6491. return $core.withContext(function($ctx1) {
  6492. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6493. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6494. },
  6495. args: ["aPoint"],
  6496. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6497. referencedClasses: ["Rectangle"],
  6498. messageSends: ["origin:extent:"]
  6499. }),
  6500. $globals.Point);
  6501. $core.addMethod(
  6502. $core.method({
  6503. selector: "normal",
  6504. protocol: "point functions",
  6505. fn: function (){
  6506. var self=this,$self=this;
  6507. var n,d;
  6508. return $core.withContext(function($ctx1) {
  6509. var $4,$3,$6,$5,$2,$1;
  6510. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6511. $ctx1.sendIdx["@"]=1;
  6512. $4=$recv(n)._x();
  6513. $ctx1.sendIdx["x"]=1;
  6514. $3=$recv($4).__star($recv(n)._x());
  6515. $ctx1.sendIdx["*"]=1;
  6516. $6=$recv(n)._y();
  6517. $ctx1.sendIdx["y"]=1;
  6518. $5=$recv($6).__star($recv(n)._y());
  6519. d=$recv($3).__plus($5);
  6520. $2=d;
  6521. $1=$recv($2).__eq((0));
  6522. if($core.assert($1)){
  6523. return (-1).__at((0));
  6524. }
  6525. return $recv(n).__slash($recv(d)._sqrt());
  6526. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6527. },
  6528. args: [],
  6529. source: "normal\x0a\x09\x22Answer a Point representing the unit vector rotated 90 deg clockwise. For the zero point return -1@0.\x22\x0a\x0a\x09| n d |\x0a\x09n := y negated @ x.\x0a\x09(d := (n x * n x + (n y * n y))) = 0\x0a\x09\x09 ifTrue: [ ^ -1 @0 ].\x0a\x09^ n / d sqrt",
  6530. referencedClasses: [],
  6531. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6532. }),
  6533. $globals.Point);
  6534. $core.addMethod(
  6535. $core.method({
  6536. selector: "normalized",
  6537. protocol: "point functions",
  6538. fn: function (){
  6539. var self=this,$self=this;
  6540. var r;
  6541. return $core.withContext(function($ctx1) {
  6542. var $1,$2,$3;
  6543. r=$self._r();
  6544. $1=$recv(r).__eq((0));
  6545. if($core.assert($1)){
  6546. $2=$recv($globals.Point)._x_y_((0),(0));
  6547. $ctx1.sendIdx["x:y:"]=1;
  6548. return $2;
  6549. } else {
  6550. $3=$recv($self["@x"]).__slash(r);
  6551. $ctx1.sendIdx["/"]=1;
  6552. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6553. }
  6554. return self;
  6555. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6556. },
  6557. args: [],
  6558. source: "normalized\x0a\x09| r |\x0a\x09r := self r.\x0a\x09\x0a\x09r = 0\x0a\x09\x09ifTrue: [ ^ Point x: 0 y: 0 ]\x0a\x09\x09ifFalse: [ ^ Point x: x / r y: y / r ]",
  6559. referencedClasses: ["Point"],
  6560. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6561. }),
  6562. $globals.Point);
  6563. $core.addMethod(
  6564. $core.method({
  6565. selector: "printOn:",
  6566. protocol: "printing",
  6567. fn: function (aStream){
  6568. var self=this,$self=this;
  6569. return $core.withContext(function($ctx1) {
  6570. var $1;
  6571. $recv($self["@x"])._printOn_(aStream);
  6572. $ctx1.sendIdx["printOn:"]=1;
  6573. $recv(aStream)._nextPutAll_("@");
  6574. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6575. return $core.withContext(function($ctx2) {
  6576. return $recv($self["@y"])._negative();
  6577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6578. }));
  6579. if($core.assert($1)){
  6580. $recv(aStream)._space();
  6581. }
  6582. $recv($self["@y"])._printOn_(aStream);
  6583. return self;
  6584. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6585. },
  6586. args: ["aStream"],
  6587. source: "printOn: aStream\x0a\x09\x22Print receiver in classic x@y notation.\x22\x0a\x0a\x09x printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: '@'.\x0a\x09(y notNil and: [ y negative ]) ifTrue: [\x0a\x09\x09\x09\x22Avoid ambiguous @- construct\x22\x0a\x09\x09\x09aStream space ].\x0a\x09\x0a\x09y printOn: aStream",
  6588. referencedClasses: [],
  6589. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6590. }),
  6591. $globals.Point);
  6592. $core.addMethod(
  6593. $core.method({
  6594. selector: "r",
  6595. protocol: "polar coordinates",
  6596. fn: function (){
  6597. var self=this,$self=this;
  6598. return $core.withContext(function($ctx1) {
  6599. var $2,$1;
  6600. $2=$recv($self["@x"]).__star($self["@x"]);
  6601. $ctx1.sendIdx["*"]=1;
  6602. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6603. return $recv($1)._sqrt();
  6604. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6605. },
  6606. args: [],
  6607. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6608. referencedClasses: [],
  6609. messageSends: ["sqrt", "+", "*"]
  6610. }),
  6611. $globals.Point);
  6612. $core.addMethod(
  6613. $core.method({
  6614. selector: "rectangle:",
  6615. protocol: "rectangle creation",
  6616. fn: function (aPoint){
  6617. var self=this,$self=this;
  6618. return $core.withContext(function($ctx1) {
  6619. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6620. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6621. },
  6622. args: ["aPoint"],
  6623. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6624. referencedClasses: ["Rectangle"],
  6625. messageSends: ["point:point:"]
  6626. }),
  6627. $globals.Point);
  6628. $core.addMethod(
  6629. $core.method({
  6630. selector: "translateBy:",
  6631. protocol: "transforming",
  6632. fn: function (delta){
  6633. var self=this,$self=this;
  6634. return $core.withContext(function($ctx1) {
  6635. var $1;
  6636. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6637. $ctx1.sendIdx["+"]=1;
  6638. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6639. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6640. },
  6641. args: ["delta"],
  6642. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6643. referencedClasses: [],
  6644. messageSends: ["@", "+", "x", "y"]
  6645. }),
  6646. $globals.Point);
  6647. $core.addMethod(
  6648. $core.method({
  6649. selector: "x",
  6650. protocol: "accessing",
  6651. fn: function (){
  6652. var self=this,$self=this;
  6653. return $self["@x"];
  6654. },
  6655. args: [],
  6656. source: "x\x0a\x09^ x",
  6657. referencedClasses: [],
  6658. messageSends: []
  6659. }),
  6660. $globals.Point);
  6661. $core.addMethod(
  6662. $core.method({
  6663. selector: "x:",
  6664. protocol: "accessing",
  6665. fn: function (aNumber){
  6666. var self=this,$self=this;
  6667. $self["@x"]=aNumber;
  6668. return self;
  6669. },
  6670. args: ["aNumber"],
  6671. source: "x: aNumber\x0a\x09x := aNumber",
  6672. referencedClasses: [],
  6673. messageSends: []
  6674. }),
  6675. $globals.Point);
  6676. $core.addMethod(
  6677. $core.method({
  6678. selector: "y",
  6679. protocol: "accessing",
  6680. fn: function (){
  6681. var self=this,$self=this;
  6682. return $self["@y"];
  6683. },
  6684. args: [],
  6685. source: "y\x0a\x09^ y",
  6686. referencedClasses: [],
  6687. messageSends: []
  6688. }),
  6689. $globals.Point);
  6690. $core.addMethod(
  6691. $core.method({
  6692. selector: "y:",
  6693. protocol: "accessing",
  6694. fn: function (aNumber){
  6695. var self=this,$self=this;
  6696. $self["@y"]=aNumber;
  6697. return self;
  6698. },
  6699. args: ["aNumber"],
  6700. source: "y: aNumber\x0a\x09y := aNumber",
  6701. referencedClasses: [],
  6702. messageSends: []
  6703. }),
  6704. $globals.Point);
  6705. $core.addMethod(
  6706. $core.method({
  6707. selector: "classTag",
  6708. protocol: "accessing",
  6709. fn: function (){
  6710. var self=this,$self=this;
  6711. return "magnitude";
  6712. },
  6713. args: [],
  6714. 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^ 'magnitude'",
  6715. referencedClasses: [],
  6716. messageSends: []
  6717. }),
  6718. $globals.Point.a$cls);
  6719. $core.addMethod(
  6720. $core.method({
  6721. selector: "x:y:",
  6722. protocol: "instance creation",
  6723. fn: function (aNumber,anotherNumber){
  6724. var self=this,$self=this;
  6725. return $core.withContext(function($ctx1) {
  6726. var $1;
  6727. $1=$self._new();
  6728. $recv($1)._x_(aNumber);
  6729. $recv($1)._y_(anotherNumber);
  6730. return $recv($1)._yourself();
  6731. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6732. },
  6733. args: ["aNumber", "anotherNumber"],
  6734. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6735. referencedClasses: [],
  6736. messageSends: ["x:", "new", "y:", "yourself"]
  6737. }),
  6738. $globals.Point.a$cls);
  6739. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6740. $globals.Random.comment="I an used to generate a random number and I am implemented as a trivial wrapper around javascript `Math.random()`.\x0a\x0a## API\x0a\x0aThe typical use case it to use the `#next` method like the following:\x0a\x0a\x09Random new next\x0a\x0aThis will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use `#atRandom`\x0a\x0a\x0910 atRandom\x0a\x0aA random number in a specific interval can be obtained with the following:\x0a\x0a\x09(3 to: 7) atRandom\x0a\x0aBe aware that `#to:` does not create an Interval as in other Smalltalk implementations but in fact an `Array` of numbers, so it's better to use:\x0a\x0a\x095 atRandom + 2\x0a\x0aSince `#atRandom` is implemented in `SequencableCollection` you can easy pick an element at random:\x0a\x0a\x09#('a' 'b' 'c') atRandom\x0a\x0aAs well as letter from a `String`:\x0a\x0a\x09'abc' atRandom\x0a\x0aSince Amber does not have Characters this will return a `String` of length 1 like for example `'b'`.";
  6741. $core.addMethod(
  6742. $core.method({
  6743. selector: "next",
  6744. protocol: "accessing",
  6745. fn: function (){
  6746. var self=this,$self=this;
  6747. return $core.withContext(function($ctx1) {
  6748. return Math.random();
  6749. return self;
  6750. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6751. },
  6752. args: [],
  6753. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6754. referencedClasses: [],
  6755. messageSends: []
  6756. }),
  6757. $globals.Random);
  6758. $core.addMethod(
  6759. $core.method({
  6760. selector: "next:",
  6761. protocol: "accessing",
  6762. fn: function (anInteger){
  6763. var self=this,$self=this;
  6764. return $core.withContext(function($ctx1) {
  6765. return $recv((1)._to_(anInteger))._collect_((function(each){
  6766. return $core.withContext(function($ctx2) {
  6767. return $self._next();
  6768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6769. }));
  6770. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6771. },
  6772. args: ["anInteger"],
  6773. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6774. referencedClasses: [],
  6775. messageSends: ["collect:", "to:", "next"]
  6776. }),
  6777. $globals.Random);
  6778. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6779. $globals.Rectangle.comment="I represent a Rectangle defined by my two corners.\x0a\x0aThe simplest way to create an instance is using Point methods:\x0a\x0a 1@1 corner: 2@2\x0a\x0aWIll create a rectangle with 1@1 as the top left and 2@2 at the bottom right.\x0a\x0a 1@1 extent: 1@1\x0a\x0aWill create the same rectangle, defining an origin and a size instead of an origin and a corner.";
  6780. $core.addMethod(
  6781. $core.method({
  6782. selector: "=",
  6783. protocol: "testing",
  6784. fn: function (aRectangle){
  6785. var self=this,$self=this;
  6786. return $core.withContext(function($ctx1) {
  6787. var $1;
  6788. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6789. $ctx1.sendIdx["="]=1;
  6790. return $recv($1)._and_((function(){
  6791. return $core.withContext(function($ctx2) {
  6792. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6794. }));
  6795. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6796. },
  6797. args: ["aRectangle"],
  6798. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6799. referencedClasses: [],
  6800. messageSends: ["and:", "=", "origin", "corner"]
  6801. }),
  6802. $globals.Rectangle);
  6803. $core.addMethod(
  6804. $core.method({
  6805. selector: "containsPoint:",
  6806. protocol: "testing",
  6807. fn: function (aPoint){
  6808. var self=this,$self=this;
  6809. return $core.withContext(function($ctx1) {
  6810. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6811. return $core.withContext(function($ctx2) {
  6812. return $recv($self["@corner"]).__gt_eq(aPoint);
  6813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6814. }));
  6815. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6816. },
  6817. args: ["aPoint"],
  6818. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6819. referencedClasses: [],
  6820. messageSends: ["and:", "<=", ">="]
  6821. }),
  6822. $globals.Rectangle);
  6823. $core.addMethod(
  6824. $core.method({
  6825. selector: "containsRect:",
  6826. protocol: "testing",
  6827. fn: function (aRect){
  6828. var self=this,$self=this;
  6829. return $core.withContext(function($ctx1) {
  6830. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6831. return $core.withContext(function($ctx2) {
  6832. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6834. }));
  6835. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6836. },
  6837. args: ["aRect"],
  6838. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6839. referencedClasses: [],
  6840. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6841. }),
  6842. $globals.Rectangle);
  6843. $core.addMethod(
  6844. $core.method({
  6845. selector: "corner",
  6846. protocol: "accessing",
  6847. fn: function (){
  6848. var self=this,$self=this;
  6849. return $self["@corner"];
  6850. },
  6851. args: [],
  6852. source: "corner\x0a\x09^ corner",
  6853. referencedClasses: [],
  6854. messageSends: []
  6855. }),
  6856. $globals.Rectangle);
  6857. $core.addMethod(
  6858. $core.method({
  6859. selector: "origin",
  6860. protocol: "accessing",
  6861. fn: function (){
  6862. var self=this,$self=this;
  6863. return $self["@origin"];
  6864. },
  6865. args: [],
  6866. source: "origin\x0a\x09^ origin",
  6867. referencedClasses: [],
  6868. messageSends: []
  6869. }),
  6870. $globals.Rectangle);
  6871. $core.addMethod(
  6872. $core.method({
  6873. selector: "printOn:",
  6874. protocol: "testing",
  6875. fn: function (aStream){
  6876. var self=this,$self=this;
  6877. return $core.withContext(function($ctx1) {
  6878. $recv($self["@origin"])._printOn_(aStream);
  6879. $ctx1.sendIdx["printOn:"]=1;
  6880. $recv(aStream)._nextPutAll_(" corner: ");
  6881. $recv($self["@corner"])._printOn_(aStream);
  6882. return self;
  6883. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6884. },
  6885. args: ["aStream"],
  6886. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6887. referencedClasses: [],
  6888. messageSends: ["printOn:", "nextPutAll:"]
  6889. }),
  6890. $globals.Rectangle);
  6891. $core.addMethod(
  6892. $core.method({
  6893. selector: "setPoint:point:",
  6894. protocol: "private",
  6895. fn: function (pt1,pt2){
  6896. var self=this,$self=this;
  6897. return $core.withContext(function($ctx1) {
  6898. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6899. $2=$recv(pt1)._x();
  6900. $ctx1.sendIdx["x"]=1;
  6901. $3=$recv(pt2)._x();
  6902. $ctx1.sendIdx["x"]=2;
  6903. $1=$recv($2)._min_($3);
  6904. $ctx1.sendIdx["min:"]=1;
  6905. $5=$recv(pt1)._y();
  6906. $ctx1.sendIdx["y"]=1;
  6907. $6=$recv(pt2)._y();
  6908. $ctx1.sendIdx["y"]=2;
  6909. $4=$recv($5)._min_($6);
  6910. $self["@origin"]=$recv($1).__at($4);
  6911. $ctx1.sendIdx["@"]=1;
  6912. $8=$recv(pt1)._x();
  6913. $ctx1.sendIdx["x"]=3;
  6914. $7=$recv($8)._max_($recv(pt2)._x());
  6915. $ctx1.sendIdx["max:"]=1;
  6916. $10=$recv(pt1)._y();
  6917. $ctx1.sendIdx["y"]=3;
  6918. $9=$recv($10)._max_($recv(pt2)._y());
  6919. $self["@corner"]=$recv($7).__at($9);
  6920. return self;
  6921. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6922. },
  6923. args: ["pt1", "pt2"],
  6924. source: "setPoint: pt1 point: pt2\x0a\x0a\x09origin := (pt1 x min: pt2 x)@(pt1 y min: pt2 y).\x0a\x09corner := (pt1 x max: pt2 x)@(pt1 y max: pt2 y).",
  6925. referencedClasses: [],
  6926. messageSends: ["@", "min:", "x", "y", "max:"]
  6927. }),
  6928. $globals.Rectangle);
  6929. $core.addMethod(
  6930. $core.method({
  6931. selector: "origin:corner:",
  6932. protocol: "instance creation",
  6933. fn: function (anOrigin,aCorner){
  6934. var self=this,$self=this;
  6935. return $core.withContext(function($ctx1) {
  6936. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6937. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6938. },
  6939. args: ["anOrigin", "aCorner"],
  6940. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6941. referencedClasses: [],
  6942. messageSends: ["setPoint:point:", "basicNew"]
  6943. }),
  6944. $globals.Rectangle.a$cls);
  6945. $core.addMethod(
  6946. $core.method({
  6947. selector: "origin:extent:",
  6948. protocol: "instance creation",
  6949. fn: function (anOrigin,anExtent){
  6950. var self=this,$self=this;
  6951. return $core.withContext(function($ctx1) {
  6952. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  6953. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  6954. },
  6955. args: ["anOrigin", "anExtent"],
  6956. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  6957. referencedClasses: [],
  6958. messageSends: ["setPoint:point:", "basicNew", "+"]
  6959. }),
  6960. $globals.Rectangle.a$cls);
  6961. $core.addMethod(
  6962. $core.method({
  6963. selector: "point:point:",
  6964. protocol: "instance creation",
  6965. fn: function (anOrigin,aCorner){
  6966. var self=this,$self=this;
  6967. return $core.withContext(function($ctx1) {
  6968. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6969. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6970. },
  6971. args: ["anOrigin", "aCorner"],
  6972. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6973. referencedClasses: [],
  6974. messageSends: ["setPoint:point:", "basicNew"]
  6975. }),
  6976. $globals.Rectangle.a$cls);
  6977. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  6978. $globals.UndefinedObject.comment="I describe the behavior of my sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.\x0a\x0a`nil` is the Smalltalk equivalent of the `undefined` JavaScript object.\x0a\x0a__note:__ When sending messages to the `undefined` JavaScript object, it will be replaced by `nil`.";
  6979. $core.addMethod(
  6980. $core.method({
  6981. selector: "==",
  6982. protocol: "testing",
  6983. fn: function (anObject){
  6984. var self=this,$self=this;
  6985. return $core.withContext(function($ctx1) {
  6986. return $recv(anObject)._isNil();
  6987. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  6988. },
  6989. args: ["anObject"],
  6990. source: "== anObject\x0a\x09^ anObject isNil",
  6991. referencedClasses: [],
  6992. messageSends: ["isNil"]
  6993. }),
  6994. $globals.UndefinedObject);
  6995. $core.addMethod(
  6996. $core.method({
  6997. selector: "asJavaScriptObject",
  6998. protocol: "converting",
  6999. fn: function (){
  7000. var self=this,$self=this;
  7001. return null;
  7002. },
  7003. args: [],
  7004. source: "asJavaScriptObject\x0a\x09^ null",
  7005. referencedClasses: [],
  7006. messageSends: []
  7007. }),
  7008. $globals.UndefinedObject);
  7009. $core.addMethod(
  7010. $core.method({
  7011. selector: "deepCopy",
  7012. protocol: "copying",
  7013. fn: function (){
  7014. var self=this,$self=this;
  7015. return self;
  7016. },
  7017. args: [],
  7018. source: "deepCopy\x0a\x09^ self",
  7019. referencedClasses: [],
  7020. messageSends: []
  7021. }),
  7022. $globals.UndefinedObject);
  7023. $core.addMethod(
  7024. $core.method({
  7025. selector: "identityHash",
  7026. protocol: "accessing",
  7027. fn: function (){
  7028. var self=this,$self=this;
  7029. return "NIL";
  7030. },
  7031. args: [],
  7032. source: "identityHash\x0a\x09^ 'NIL'",
  7033. referencedClasses: [],
  7034. messageSends: []
  7035. }),
  7036. $globals.UndefinedObject);
  7037. $core.addMethod(
  7038. $core.method({
  7039. selector: "ifNil:",
  7040. protocol: "testing",
  7041. fn: function (aBlock){
  7042. var self=this,$self=this;
  7043. return $core.withContext(function($ctx1) {
  7044. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7045. }));
  7046. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7047. },
  7048. args: ["aBlock"],
  7049. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7050. referencedClasses: [],
  7051. messageSends: ["ifNil:ifNotNil:"]
  7052. }),
  7053. $globals.UndefinedObject);
  7054. $core.addMethod(
  7055. $core.method({
  7056. selector: "ifNil:ifNotNil:",
  7057. protocol: "testing",
  7058. fn: function (aBlock,anotherBlock){
  7059. var self=this,$self=this;
  7060. return $core.withContext(function($ctx1) {
  7061. return $recv(aBlock)._value();
  7062. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7063. },
  7064. args: ["aBlock", "anotherBlock"],
  7065. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7066. referencedClasses: [],
  7067. messageSends: ["value"]
  7068. }),
  7069. $globals.UndefinedObject);
  7070. $core.addMethod(
  7071. $core.method({
  7072. selector: "ifNotNil:",
  7073. protocol: "testing",
  7074. fn: function (aBlock){
  7075. var self=this,$self=this;
  7076. return self;
  7077. },
  7078. args: ["aBlock"],
  7079. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7080. referencedClasses: [],
  7081. messageSends: []
  7082. }),
  7083. $globals.UndefinedObject);
  7084. $core.addMethod(
  7085. $core.method({
  7086. selector: "ifNotNil:ifNil:",
  7087. protocol: "testing",
  7088. fn: function (aBlock,anotherBlock){
  7089. var self=this,$self=this;
  7090. return $core.withContext(function($ctx1) {
  7091. return $recv(anotherBlock)._value();
  7092. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7093. },
  7094. args: ["aBlock", "anotherBlock"],
  7095. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7096. referencedClasses: [],
  7097. messageSends: ["value"]
  7098. }),
  7099. $globals.UndefinedObject);
  7100. $core.addMethod(
  7101. $core.method({
  7102. selector: "isImmutable",
  7103. protocol: "testing",
  7104. fn: function (){
  7105. var self=this,$self=this;
  7106. return true;
  7107. },
  7108. args: [],
  7109. source: "isImmutable\x0a\x09^ true",
  7110. referencedClasses: [],
  7111. messageSends: []
  7112. }),
  7113. $globals.UndefinedObject);
  7114. $core.addMethod(
  7115. $core.method({
  7116. selector: "isNil",
  7117. protocol: "testing",
  7118. fn: function (){
  7119. var self=this,$self=this;
  7120. return true;
  7121. },
  7122. args: [],
  7123. source: "isNil\x0a\x09^ true",
  7124. referencedClasses: [],
  7125. messageSends: []
  7126. }),
  7127. $globals.UndefinedObject);
  7128. $core.addMethod(
  7129. $core.method({
  7130. selector: "notNil",
  7131. protocol: "testing",
  7132. fn: function (){
  7133. var self=this,$self=this;
  7134. return false;
  7135. },
  7136. args: [],
  7137. source: "notNil\x0a\x09^ false",
  7138. referencedClasses: [],
  7139. messageSends: []
  7140. }),
  7141. $globals.UndefinedObject);
  7142. $core.addMethod(
  7143. $core.method({
  7144. selector: "printOn:",
  7145. protocol: "printing",
  7146. fn: function (aStream){
  7147. var self=this,$self=this;
  7148. return $core.withContext(function($ctx1) {
  7149. $recv(aStream)._nextPutAll_("nil");
  7150. return self;
  7151. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7152. },
  7153. args: ["aStream"],
  7154. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7155. referencedClasses: [],
  7156. messageSends: ["nextPutAll:"]
  7157. }),
  7158. $globals.UndefinedObject);
  7159. $core.addMethod(
  7160. $core.method({
  7161. selector: "shallowCopy",
  7162. protocol: "copying",
  7163. fn: function (){
  7164. var self=this,$self=this;
  7165. return self;
  7166. },
  7167. args: [],
  7168. source: "shallowCopy\x0a\x09^ self",
  7169. referencedClasses: [],
  7170. messageSends: []
  7171. }),
  7172. $globals.UndefinedObject);
  7173. $core.addMethod(
  7174. $core.method({
  7175. selector: "value",
  7176. protocol: "evaluating",
  7177. fn: function (){
  7178. var self=this,$self=this;
  7179. return $core.withContext(function($ctx1) {
  7180. return null;
  7181. return self;
  7182. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7183. },
  7184. args: [],
  7185. source: "value\x0a\x09<inlineJS: 'return null'>",
  7186. referencedClasses: [],
  7187. messageSends: []
  7188. }),
  7189. $globals.UndefinedObject);
  7190. $core.addMethod(
  7191. $core.method({
  7192. selector: "new",
  7193. protocol: "instance creation",
  7194. fn: function (){
  7195. var self=this,$self=this;
  7196. return $core.withContext(function($ctx1) {
  7197. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7198. return self;
  7199. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7200. },
  7201. args: [],
  7202. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7203. referencedClasses: [],
  7204. messageSends: ["error:"]
  7205. }),
  7206. $globals.UndefinedObject.a$cls);
  7207. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7208. });
  7209. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7210. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7211. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7212. $core.addPackage("Kernel-Collections");
  7213. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  7214. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7215. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7216. $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:`";
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "=",
  7220. protocol: "comparing",
  7221. fn: function (anAssociation){
  7222. var self=this,$self=this;
  7223. return $core.withContext(function($ctx1) {
  7224. var $3,$2,$5,$4,$6,$1;
  7225. $3=$self._class();
  7226. $ctx1.sendIdx["class"]=1;
  7227. $2=$recv($3).__eq($recv(anAssociation)._class());
  7228. $ctx1.sendIdx["="]=1;
  7229. $1=$recv($2)._and_((function(){
  7230. return $core.withContext(function($ctx2) {
  7231. $5=$self._key();
  7232. $ctx2.sendIdx["key"]=1;
  7233. $4=$recv($5).__eq($recv(anAssociation)._key());
  7234. $ctx2.sendIdx["="]=2;
  7235. return $recv($4)._and_((function(){
  7236. return $core.withContext(function($ctx3) {
  7237. $6=$self._value();
  7238. $ctx3.sendIdx["value"]=1;
  7239. return $recv($6).__eq($recv(anAssociation)._value());
  7240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7241. }));
  7242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7243. }));
  7244. $ctx1.sendIdx["and:"]=1;
  7245. return $1;
  7246. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7247. },
  7248. args: ["anAssociation"],
  7249. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7250. referencedClasses: [],
  7251. messageSends: ["and:", "=", "class", "key", "value"]
  7252. }),
  7253. $globals.Association);
  7254. $core.addMethod(
  7255. $core.method({
  7256. selector: "key",
  7257. protocol: "accessing",
  7258. fn: function (){
  7259. var self=this,$self=this;
  7260. return $self["@key"];
  7261. },
  7262. args: [],
  7263. source: "key\x0a\x09^ key",
  7264. referencedClasses: [],
  7265. messageSends: []
  7266. }),
  7267. $globals.Association);
  7268. $core.addMethod(
  7269. $core.method({
  7270. selector: "key:",
  7271. protocol: "accessing",
  7272. fn: function (aKey){
  7273. var self=this,$self=this;
  7274. $self["@key"]=aKey;
  7275. return self;
  7276. },
  7277. args: ["aKey"],
  7278. source: "key: aKey\x0a\x09key := aKey",
  7279. referencedClasses: [],
  7280. messageSends: []
  7281. }),
  7282. $globals.Association);
  7283. $core.addMethod(
  7284. $core.method({
  7285. selector: "printOn:",
  7286. protocol: "printing",
  7287. fn: function (aStream){
  7288. var self=this,$self=this;
  7289. return $core.withContext(function($ctx1) {
  7290. $recv($self._key())._printOn_(aStream);
  7291. $ctx1.sendIdx["printOn:"]=1;
  7292. $recv(aStream)._nextPutAll_(" -> ");
  7293. $recv($self._value())._printOn_(aStream);
  7294. return self;
  7295. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7296. },
  7297. args: ["aStream"],
  7298. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7299. referencedClasses: [],
  7300. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7301. }),
  7302. $globals.Association);
  7303. $core.addMethod(
  7304. $core.method({
  7305. selector: "value",
  7306. protocol: "accessing",
  7307. fn: function (){
  7308. var self=this,$self=this;
  7309. return $self["@value"];
  7310. },
  7311. args: [],
  7312. source: "value\x0a\x09^ value",
  7313. referencedClasses: [],
  7314. messageSends: []
  7315. }),
  7316. $globals.Association);
  7317. $core.addMethod(
  7318. $core.method({
  7319. selector: "value:",
  7320. protocol: "accessing",
  7321. fn: function (aValue){
  7322. var self=this,$self=this;
  7323. $self["@value"]=aValue;
  7324. return self;
  7325. },
  7326. args: ["aValue"],
  7327. source: "value: aValue\x0a\x09value := aValue",
  7328. referencedClasses: [],
  7329. messageSends: []
  7330. }),
  7331. $globals.Association);
  7332. $core.addMethod(
  7333. $core.method({
  7334. selector: "key:value:",
  7335. protocol: "instance creation",
  7336. fn: function (aKey,aValue){
  7337. var self=this,$self=this;
  7338. return $core.withContext(function($ctx1) {
  7339. var $1;
  7340. $1=$self._new();
  7341. $recv($1)._key_(aKey);
  7342. $recv($1)._value_(aValue);
  7343. return $recv($1)._yourself();
  7344. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7345. },
  7346. args: ["aKey", "aValue"],
  7347. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7348. referencedClasses: [],
  7349. messageSends: ["key:", "new", "value:", "yourself"]
  7350. }),
  7351. $globals.Association.a$cls);
  7352. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7353. $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`.";
  7354. $core.addMethod(
  7355. $core.method({
  7356. selector: "bucketOfElement:",
  7357. protocol: "accessing",
  7358. fn: function (anObject){
  7359. var self=this,$self=this;
  7360. return $core.withContext(function($ctx1) {
  7361. var hash = $self['@hashBlock'](anObject);
  7362. if (!hash) return null;
  7363. var buckets = $self['@buckets'],
  7364. bucket = buckets[hash];
  7365. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7366. return bucket;
  7367. ;
  7368. return self;
  7369. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7370. },
  7371. args: ["anObject"],
  7372. 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'>",
  7373. referencedClasses: [],
  7374. messageSends: []
  7375. }),
  7376. $globals.BucketStore);
  7377. $core.addMethod(
  7378. $core.method({
  7379. selector: "do:",
  7380. protocol: "enumerating",
  7381. fn: function (aBlock){
  7382. var self=this,$self=this;
  7383. return $core.withContext(function($ctx1) {
  7384. var buckets = $self['@buckets'];
  7385. var keys = Object.keys(buckets);
  7386. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7387. ;
  7388. return self;
  7389. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7390. },
  7391. args: ["aBlock"],
  7392. 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'>",
  7393. referencedClasses: [],
  7394. messageSends: []
  7395. }),
  7396. $globals.BucketStore);
  7397. $core.addMethod(
  7398. $core.method({
  7399. selector: "hashBlock:",
  7400. protocol: "accessing",
  7401. fn: function (aBlock){
  7402. var self=this,$self=this;
  7403. $self["@hashBlock"]=aBlock;
  7404. return self;
  7405. },
  7406. args: ["aBlock"],
  7407. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7408. referencedClasses: [],
  7409. messageSends: []
  7410. }),
  7411. $globals.BucketStore);
  7412. $core.addMethod(
  7413. $core.method({
  7414. selector: "initialize",
  7415. protocol: "initialization",
  7416. fn: function (){
  7417. var self=this,$self=this;
  7418. return $core.withContext(function($ctx1) {
  7419. (
  7420. $ctx1.supercall = true,
  7421. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7422. $ctx1.supercall = false;
  7423. $self._removeAll();
  7424. return self;
  7425. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7426. },
  7427. args: [],
  7428. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7429. referencedClasses: [],
  7430. messageSends: ["initialize", "removeAll"]
  7431. }),
  7432. $globals.BucketStore);
  7433. $core.addMethod(
  7434. $core.method({
  7435. selector: "newBucket",
  7436. protocol: "private",
  7437. fn: function (){
  7438. var self=this,$self=this;
  7439. return $core.withContext(function($ctx1) {
  7440. $self._subclassResponsibility();
  7441. return self;
  7442. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7443. },
  7444. args: [],
  7445. source: "newBucket\x0a\x09self subclassResponsibility",
  7446. referencedClasses: [],
  7447. messageSends: ["subclassResponsibility"]
  7448. }),
  7449. $globals.BucketStore);
  7450. $core.addMethod(
  7451. $core.method({
  7452. selector: "removeAll",
  7453. protocol: "adding/removing",
  7454. fn: function (){
  7455. var self=this,$self=this;
  7456. return $core.withContext(function($ctx1) {
  7457. $self['@buckets'] = Object.create(null);;
  7458. return self;
  7459. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7460. },
  7461. args: [],
  7462. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7463. referencedClasses: [],
  7464. messageSends: []
  7465. }),
  7466. $globals.BucketStore);
  7467. $core.addMethod(
  7468. $core.method({
  7469. selector: "hashBlock:",
  7470. protocol: "instance creation",
  7471. fn: function (aBlock){
  7472. var self=this,$self=this;
  7473. return $core.withContext(function($ctx1) {
  7474. var $1;
  7475. $1=$self._new();
  7476. $recv($1)._hashBlock_(aBlock);
  7477. return $recv($1)._yourself();
  7478. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7479. },
  7480. args: ["aBlock"],
  7481. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7482. referencedClasses: [],
  7483. messageSends: ["hashBlock:", "new", "yourself"]
  7484. }),
  7485. $globals.BucketStore.a$cls);
  7486. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7487. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7488. $core.addMethod(
  7489. $core.method({
  7490. selector: "newBucket",
  7491. protocol: "private",
  7492. fn: function (){
  7493. var self=this,$self=this;
  7494. return [];
  7495. },
  7496. args: [],
  7497. source: "newBucket\x0a\x09^ #()",
  7498. referencedClasses: [],
  7499. messageSends: []
  7500. }),
  7501. $globals.ArrayBucketStore);
  7502. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7503. $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.";
  7504. $core.addMethod(
  7505. $core.method({
  7506. selector: ",",
  7507. protocol: "copying",
  7508. fn: function (aCollection){
  7509. var self=this,$self=this;
  7510. return $core.withContext(function($ctx1) {
  7511. var $1;
  7512. $1=$self._copy();
  7513. $recv($1)._addAll_(aCollection);
  7514. return $recv($1)._yourself();
  7515. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7516. },
  7517. args: ["aCollection"],
  7518. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7519. referencedClasses: [],
  7520. messageSends: ["addAll:", "copy", "yourself"]
  7521. }),
  7522. $globals.Collection);
  7523. $core.addMethod(
  7524. $core.method({
  7525. selector: "add:",
  7526. protocol: "adding/removing",
  7527. fn: function (anObject){
  7528. var self=this,$self=this;
  7529. return $core.withContext(function($ctx1) {
  7530. $self._subclassResponsibility();
  7531. return self;
  7532. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7533. },
  7534. args: ["anObject"],
  7535. source: "add: anObject\x0a\x09self subclassResponsibility",
  7536. referencedClasses: [],
  7537. messageSends: ["subclassResponsibility"]
  7538. }),
  7539. $globals.Collection);
  7540. $core.addMethod(
  7541. $core.method({
  7542. selector: "addAll:",
  7543. protocol: "adding/removing",
  7544. fn: function (aCollection){
  7545. var self=this,$self=this;
  7546. return $core.withContext(function($ctx1) {
  7547. $recv(aCollection)._do_((function(each){
  7548. return $core.withContext(function($ctx2) {
  7549. return $self._add_(each);
  7550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7551. }));
  7552. return aCollection;
  7553. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7554. },
  7555. args: ["aCollection"],
  7556. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7557. referencedClasses: [],
  7558. messageSends: ["do:", "add:"]
  7559. }),
  7560. $globals.Collection);
  7561. $core.addMethod(
  7562. $core.method({
  7563. selector: "allSatisfy:",
  7564. protocol: "enumerating",
  7565. fn: function (aBlock){
  7566. var self=this,$self=this;
  7567. return $core.withContext(function($ctx1) {
  7568. var $1;
  7569. var $early={};
  7570. try {
  7571. $self._do_((function(each){
  7572. return $core.withContext(function($ctx2) {
  7573. $1=$recv(aBlock)._value_(each);
  7574. if(!$core.assert($1)){
  7575. throw $early=[false];
  7576. }
  7577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7578. }));
  7579. return true;
  7580. }
  7581. catch(e) {if(e===$early)return e[0]; throw e}
  7582. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7583. },
  7584. args: ["aBlock"],
  7585. 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",
  7586. referencedClasses: [],
  7587. messageSends: ["do:", "ifFalse:", "value:"]
  7588. }),
  7589. $globals.Collection);
  7590. $core.addMethod(
  7591. $core.method({
  7592. selector: "anyOne",
  7593. protocol: "accessing",
  7594. fn: function (){
  7595. var self=this,$self=this;
  7596. return $core.withContext(function($ctx1) {
  7597. var $early={};
  7598. try {
  7599. $self._ifEmpty_((function(){
  7600. return $core.withContext(function($ctx2) {
  7601. return $self._error_("Collection is empty");
  7602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7603. }));
  7604. $self._do_((function(each){
  7605. throw $early=[each];
  7606. }));
  7607. return self;
  7608. }
  7609. catch(e) {if(e===$early)return e[0]; throw e}
  7610. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7611. },
  7612. args: [],
  7613. 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 ]",
  7614. referencedClasses: [],
  7615. messageSends: ["ifEmpty:", "error:", "do:"]
  7616. }),
  7617. $globals.Collection);
  7618. $core.addMethod(
  7619. $core.method({
  7620. selector: "anySatisfy:",
  7621. protocol: "enumerating",
  7622. fn: function (aBlock){
  7623. var self=this,$self=this;
  7624. return $core.withContext(function($ctx1) {
  7625. var $1;
  7626. var $early={};
  7627. try {
  7628. $self._do_((function(each){
  7629. return $core.withContext(function($ctx2) {
  7630. $1=$recv(aBlock)._value_(each);
  7631. if($core.assert($1)){
  7632. throw $early=[true];
  7633. }
  7634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7635. }));
  7636. return false;
  7637. }
  7638. catch(e) {if(e===$early)return e[0]; throw e}
  7639. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7640. },
  7641. args: ["aBlock"],
  7642. 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",
  7643. referencedClasses: [],
  7644. messageSends: ["do:", "ifTrue:", "value:"]
  7645. }),
  7646. $globals.Collection);
  7647. $core.addMethod(
  7648. $core.method({
  7649. selector: "asArray",
  7650. protocol: "converting",
  7651. fn: function (){
  7652. var self=this,$self=this;
  7653. return $core.withContext(function($ctx1) {
  7654. return $recv($globals.Array)._withAll_(self);
  7655. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7656. },
  7657. args: [],
  7658. source: "asArray\x0a\x09^ Array withAll: self",
  7659. referencedClasses: ["Array"],
  7660. messageSends: ["withAll:"]
  7661. }),
  7662. $globals.Collection);
  7663. $core.addMethod(
  7664. $core.method({
  7665. selector: "asJavaScriptObject",
  7666. protocol: "converting",
  7667. fn: function (){
  7668. var self=this,$self=this;
  7669. return $core.withContext(function($ctx1) {
  7670. return $recv($self._asArray())._collect_((function(each){
  7671. return $core.withContext(function($ctx2) {
  7672. return $recv(each)._asJavaScriptObject();
  7673. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7674. }));
  7675. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7676. },
  7677. args: [],
  7678. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7679. referencedClasses: [],
  7680. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7681. }),
  7682. $globals.Collection);
  7683. $core.addMethod(
  7684. $core.method({
  7685. selector: "asOrderedCollection",
  7686. protocol: "converting",
  7687. fn: function (){
  7688. var self=this,$self=this;
  7689. return $core.withContext(function($ctx1) {
  7690. return $self._asArray();
  7691. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7692. },
  7693. args: [],
  7694. source: "asOrderedCollection\x0a\x09^ self asArray",
  7695. referencedClasses: [],
  7696. messageSends: ["asArray"]
  7697. }),
  7698. $globals.Collection);
  7699. $core.addMethod(
  7700. $core.method({
  7701. selector: "asSet",
  7702. protocol: "converting",
  7703. fn: function (){
  7704. var self=this,$self=this;
  7705. return $core.withContext(function($ctx1) {
  7706. return $recv($globals.Set)._withAll_(self);
  7707. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7708. },
  7709. args: [],
  7710. source: "asSet\x0a\x09^ Set withAll: self",
  7711. referencedClasses: ["Set"],
  7712. messageSends: ["withAll:"]
  7713. }),
  7714. $globals.Collection);
  7715. $core.addMethod(
  7716. $core.method({
  7717. selector: "collect:",
  7718. protocol: "enumerating",
  7719. fn: function (aBlock){
  7720. var self=this,$self=this;
  7721. var stream;
  7722. return $core.withContext(function($ctx1) {
  7723. stream=$recv($recv($self._class())._new())._writeStream();
  7724. $self._do_((function(each){
  7725. return $core.withContext(function($ctx2) {
  7726. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7727. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7728. }));
  7729. return $recv(stream)._contents();
  7730. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7731. },
  7732. args: ["aBlock"],
  7733. 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",
  7734. referencedClasses: [],
  7735. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7736. }),
  7737. $globals.Collection);
  7738. $core.addMethod(
  7739. $core.method({
  7740. selector: "copyWith:",
  7741. protocol: "copying",
  7742. fn: function (anObject){
  7743. var self=this,$self=this;
  7744. return $core.withContext(function($ctx1) {
  7745. var $1;
  7746. $1=$self._copy();
  7747. $recv($1)._add_(anObject);
  7748. return $recv($1)._yourself();
  7749. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7750. },
  7751. args: ["anObject"],
  7752. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7753. referencedClasses: [],
  7754. messageSends: ["add:", "copy", "yourself"]
  7755. }),
  7756. $globals.Collection);
  7757. $core.addMethod(
  7758. $core.method({
  7759. selector: "copyWithAll:",
  7760. protocol: "copying",
  7761. fn: function (aCollection){
  7762. var self=this,$self=this;
  7763. return $core.withContext(function($ctx1) {
  7764. var $1;
  7765. $1=$self._copy();
  7766. $recv($1)._addAll_(aCollection);
  7767. return $recv($1)._yourself();
  7768. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7769. },
  7770. args: ["aCollection"],
  7771. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  7772. referencedClasses: [],
  7773. messageSends: ["addAll:", "copy", "yourself"]
  7774. }),
  7775. $globals.Collection);
  7776. $core.addMethod(
  7777. $core.method({
  7778. selector: "copyWithout:",
  7779. protocol: "copying",
  7780. fn: function (anObject){
  7781. var self=this,$self=this;
  7782. return $core.withContext(function($ctx1) {
  7783. return $self._reject_((function(each){
  7784. return $core.withContext(function($ctx2) {
  7785. return $recv(each).__eq(anObject);
  7786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7787. }));
  7788. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7789. },
  7790. args: ["anObject"],
  7791. 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 ]",
  7792. referencedClasses: [],
  7793. messageSends: ["reject:", "="]
  7794. }),
  7795. $globals.Collection);
  7796. $core.addMethod(
  7797. $core.method({
  7798. selector: "copyWithoutAll:",
  7799. protocol: "copying",
  7800. fn: function (aCollection){
  7801. var self=this,$self=this;
  7802. return $core.withContext(function($ctx1) {
  7803. return $self._reject_((function(each){
  7804. return $core.withContext(function($ctx2) {
  7805. return $recv(aCollection)._includes_(each);
  7806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7807. }));
  7808. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7809. },
  7810. args: ["aCollection"],
  7811. 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 ]",
  7812. referencedClasses: [],
  7813. messageSends: ["reject:", "includes:"]
  7814. }),
  7815. $globals.Collection);
  7816. $core.addMethod(
  7817. $core.method({
  7818. selector: "deepCopy",
  7819. protocol: "copying",
  7820. fn: function (){
  7821. var self=this,$self=this;
  7822. return $core.withContext(function($ctx1) {
  7823. return $self._collect_((function(each){
  7824. return $core.withContext(function($ctx2) {
  7825. return $recv(each)._deepCopy();
  7826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7827. }));
  7828. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7829. },
  7830. args: [],
  7831. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7832. referencedClasses: [],
  7833. messageSends: ["collect:", "deepCopy"]
  7834. }),
  7835. $globals.Collection);
  7836. $core.addMethod(
  7837. $core.method({
  7838. selector: "detect:",
  7839. protocol: "enumerating",
  7840. fn: function (aBlock){
  7841. var self=this,$self=this;
  7842. return $core.withContext(function($ctx1) {
  7843. return $self._detect_ifNone_(aBlock,(function(){
  7844. return $core.withContext(function($ctx2) {
  7845. return $self._errorNotFound();
  7846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7847. }));
  7848. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7849. },
  7850. args: ["aBlock"],
  7851. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7852. referencedClasses: [],
  7853. messageSends: ["detect:ifNone:", "errorNotFound"]
  7854. }),
  7855. $globals.Collection);
  7856. $core.addMethod(
  7857. $core.method({
  7858. selector: "detect:ifNone:",
  7859. protocol: "enumerating",
  7860. fn: function (aBlock,anotherBlock){
  7861. var self=this,$self=this;
  7862. return $core.withContext(function($ctx1) {
  7863. $self._subclassResponsibility();
  7864. return self;
  7865. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7866. },
  7867. args: ["aBlock", "anotherBlock"],
  7868. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  7869. referencedClasses: [],
  7870. messageSends: ["subclassResponsibility"]
  7871. }),
  7872. $globals.Collection);
  7873. $core.addMethod(
  7874. $core.method({
  7875. selector: "do:",
  7876. protocol: "enumerating",
  7877. fn: function (aBlock){
  7878. var self=this,$self=this;
  7879. return $core.withContext(function($ctx1) {
  7880. $self._subclassResponsibility();
  7881. return self;
  7882. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7883. },
  7884. args: ["aBlock"],
  7885. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7886. referencedClasses: [],
  7887. messageSends: ["subclassResponsibility"]
  7888. }),
  7889. $globals.Collection);
  7890. $core.addMethod(
  7891. $core.method({
  7892. selector: "do:separatedBy:",
  7893. protocol: "enumerating",
  7894. fn: function (aBlock,anotherBlock){
  7895. var self=this,$self=this;
  7896. var actionBeforeElement;
  7897. return $core.withContext(function($ctx1) {
  7898. actionBeforeElement=(function(){
  7899. actionBeforeElement=anotherBlock;
  7900. return actionBeforeElement;
  7901. });
  7902. $self._do_((function(each){
  7903. return $core.withContext(function($ctx2) {
  7904. $recv(actionBeforeElement)._value();
  7905. return $recv(aBlock)._value_(each);
  7906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7907. }));
  7908. return self;
  7909. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7910. },
  7911. args: ["aBlock", "anotherBlock"],
  7912. 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 ]",
  7913. referencedClasses: [],
  7914. messageSends: ["do:", "value", "value:"]
  7915. }),
  7916. $globals.Collection);
  7917. $core.addMethod(
  7918. $core.method({
  7919. selector: "errorNotFound",
  7920. protocol: "error handling",
  7921. fn: function (){
  7922. var self=this,$self=this;
  7923. return $core.withContext(function($ctx1) {
  7924. $self._error_("Object is not in the collection");
  7925. return self;
  7926. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7927. },
  7928. args: [],
  7929. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7930. referencedClasses: [],
  7931. messageSends: ["error:"]
  7932. }),
  7933. $globals.Collection);
  7934. $core.addMethod(
  7935. $core.method({
  7936. selector: "ifEmpty:",
  7937. protocol: "testing",
  7938. fn: function (aBlock){
  7939. var self=this,$self=this;
  7940. return $core.withContext(function($ctx1) {
  7941. var $1;
  7942. $1=$self._isEmpty();
  7943. if($core.assert($1)){
  7944. return $recv(aBlock)._value();
  7945. } else {
  7946. return self;
  7947. }
  7948. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  7949. },
  7950. args: ["aBlock"],
  7951. 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 ]",
  7952. referencedClasses: [],
  7953. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  7954. }),
  7955. $globals.Collection);
  7956. $core.addMethod(
  7957. $core.method({
  7958. selector: "ifEmpty:ifNotEmpty:",
  7959. protocol: "testing",
  7960. fn: function (aBlock,anotherBlock){
  7961. var self=this,$self=this;
  7962. return $core.withContext(function($ctx1) {
  7963. var $1;
  7964. $1=$self._isEmpty();
  7965. if($core.assert($1)){
  7966. return $recv(aBlock)._value();
  7967. } else {
  7968. return $recv(anotherBlock)._value_(self);
  7969. }
  7970. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7971. },
  7972. args: ["aBlock", "anotherBlock"],
  7973. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  7974. referencedClasses: [],
  7975. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  7976. }),
  7977. $globals.Collection);
  7978. $core.addMethod(
  7979. $core.method({
  7980. selector: "ifNotEmpty:",
  7981. protocol: "testing",
  7982. fn: function (aBlock){
  7983. var self=this,$self=this;
  7984. return $core.withContext(function($ctx1) {
  7985. var $1;
  7986. $1=$self._notEmpty();
  7987. if($core.assert($1)){
  7988. return $recv(aBlock)._value_(self);
  7989. } else {
  7990. return self;
  7991. }
  7992. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  7993. },
  7994. args: ["aBlock"],
  7995. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  7996. referencedClasses: [],
  7997. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  7998. }),
  7999. $globals.Collection);
  8000. $core.addMethod(
  8001. $core.method({
  8002. selector: "ifNotEmpty:ifEmpty:",
  8003. protocol: "testing",
  8004. fn: function (aBlock,anotherBlock){
  8005. var self=this,$self=this;
  8006. return $core.withContext(function($ctx1) {
  8007. var $1;
  8008. $1=$self._notEmpty();
  8009. if($core.assert($1)){
  8010. return $recv(aBlock)._value_(self);
  8011. } else {
  8012. return $recv(anotherBlock)._value();
  8013. }
  8014. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8015. },
  8016. args: ["aBlock", "anotherBlock"],
  8017. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8018. referencedClasses: [],
  8019. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8020. }),
  8021. $globals.Collection);
  8022. $core.addMethod(
  8023. $core.method({
  8024. selector: "includes:",
  8025. protocol: "testing",
  8026. fn: function (anObject){
  8027. var self=this,$self=this;
  8028. return $core.withContext(function($ctx1) {
  8029. return $self._anySatisfy_((function(each){
  8030. return $core.withContext(function($ctx2) {
  8031. return $recv(each).__eq(anObject);
  8032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8033. }));
  8034. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8035. },
  8036. args: ["anObject"],
  8037. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8038. referencedClasses: [],
  8039. messageSends: ["anySatisfy:", "="]
  8040. }),
  8041. $globals.Collection);
  8042. $core.addMethod(
  8043. $core.method({
  8044. selector: "inject:into:",
  8045. protocol: "enumerating",
  8046. fn: function (anObject,aBlock){
  8047. var self=this,$self=this;
  8048. var result;
  8049. return $core.withContext(function($ctx1) {
  8050. result=anObject;
  8051. $self._do_((function(each){
  8052. return $core.withContext(function($ctx2) {
  8053. result=$recv(aBlock)._value_value_(result,each);
  8054. return result;
  8055. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8056. }));
  8057. return result;
  8058. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8059. },
  8060. args: ["anObject", "aBlock"],
  8061. 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",
  8062. referencedClasses: [],
  8063. messageSends: ["do:", "value:value:"]
  8064. }),
  8065. $globals.Collection);
  8066. $core.addMethod(
  8067. $core.method({
  8068. selector: "intersection:",
  8069. protocol: "enumerating",
  8070. fn: function (aCollection){
  8071. var self=this,$self=this;
  8072. var set,outputSet;
  8073. return $core.withContext(function($ctx1) {
  8074. var $2,$1;
  8075. set=$self._asSet();
  8076. outputSet=$recv($globals.Set)._new();
  8077. $recv(aCollection)._do_((function(each){
  8078. return $core.withContext(function($ctx2) {
  8079. $2=$recv(set)._includes_(each);
  8080. $ctx2.sendIdx["includes:"]=1;
  8081. $1=$recv($2)._and_((function(){
  8082. return $core.withContext(function($ctx3) {
  8083. return $recv($recv(outputSet)._includes_(each))._not();
  8084. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8085. }));
  8086. if($core.assert($1)){
  8087. return $recv(outputSet)._add_(each);
  8088. }
  8089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8090. }));
  8091. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8092. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8093. },
  8094. args: ["aCollection"],
  8095. 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",
  8096. referencedClasses: ["Set"],
  8097. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8098. }),
  8099. $globals.Collection);
  8100. $core.addMethod(
  8101. $core.method({
  8102. selector: "isEmpty",
  8103. protocol: "testing",
  8104. fn: function (){
  8105. var self=this,$self=this;
  8106. return $core.withContext(function($ctx1) {
  8107. return $recv($self._size()).__eq((0));
  8108. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8109. },
  8110. args: [],
  8111. source: "isEmpty\x0a\x09^ self size = 0",
  8112. referencedClasses: [],
  8113. messageSends: ["=", "size"]
  8114. }),
  8115. $globals.Collection);
  8116. $core.addMethod(
  8117. $core.method({
  8118. selector: "noneSatisfy:",
  8119. protocol: "enumerating",
  8120. fn: function (aBlock){
  8121. var self=this,$self=this;
  8122. return $core.withContext(function($ctx1) {
  8123. var $1;
  8124. var $early={};
  8125. try {
  8126. $self._do_((function(item){
  8127. return $core.withContext(function($ctx2) {
  8128. $1=$recv(aBlock)._value_(item);
  8129. if($core.assert($1)){
  8130. throw $early=[false];
  8131. }
  8132. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8133. }));
  8134. return true;
  8135. }
  8136. catch(e) {if(e===$early)return e[0]; throw e}
  8137. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8138. },
  8139. args: ["aBlock"],
  8140. 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",
  8141. referencedClasses: [],
  8142. messageSends: ["do:", "ifTrue:", "value:"]
  8143. }),
  8144. $globals.Collection);
  8145. $core.addMethod(
  8146. $core.method({
  8147. selector: "notEmpty",
  8148. protocol: "testing",
  8149. fn: function (){
  8150. var self=this,$self=this;
  8151. return $core.withContext(function($ctx1) {
  8152. return $recv($self._isEmpty())._not();
  8153. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8154. },
  8155. args: [],
  8156. source: "notEmpty\x0a\x09^ self isEmpty not",
  8157. referencedClasses: [],
  8158. messageSends: ["not", "isEmpty"]
  8159. }),
  8160. $globals.Collection);
  8161. $core.addMethod(
  8162. $core.method({
  8163. selector: "occurrencesOf:",
  8164. protocol: "accessing",
  8165. fn: function (anObject){
  8166. var self=this,$self=this;
  8167. var tally;
  8168. return $core.withContext(function($ctx1) {
  8169. var $1;
  8170. tally=(0);
  8171. $self._do_((function(each){
  8172. return $core.withContext(function($ctx2) {
  8173. $1=$recv(anObject).__eq(each);
  8174. if($core.assert($1)){
  8175. tally=$recv(tally).__plus((1));
  8176. return tally;
  8177. }
  8178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8179. }));
  8180. return tally;
  8181. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8182. },
  8183. args: ["anObject"],
  8184. 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",
  8185. referencedClasses: [],
  8186. messageSends: ["do:", "ifTrue:", "=", "+"]
  8187. }),
  8188. $globals.Collection);
  8189. $core.addMethod(
  8190. $core.method({
  8191. selector: "putOn:",
  8192. protocol: "streaming",
  8193. fn: function (aStream){
  8194. var self=this,$self=this;
  8195. return $core.withContext(function($ctx1) {
  8196. $self._do_((function(each){
  8197. return $core.withContext(function($ctx2) {
  8198. return $recv(each)._putOn_(aStream);
  8199. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8200. }));
  8201. return self;
  8202. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8203. },
  8204. args: ["aStream"],
  8205. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8206. referencedClasses: [],
  8207. messageSends: ["do:", "putOn:"]
  8208. }),
  8209. $globals.Collection);
  8210. $core.addMethod(
  8211. $core.method({
  8212. selector: "reject:",
  8213. protocol: "enumerating",
  8214. fn: function (aBlock){
  8215. var self=this,$self=this;
  8216. return $core.withContext(function($ctx1) {
  8217. return $self._select_((function(each){
  8218. return $core.withContext(function($ctx2) {
  8219. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8221. }));
  8222. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8223. },
  8224. args: ["aBlock"],
  8225. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8226. referencedClasses: [],
  8227. messageSends: ["select:", "=", "value:"]
  8228. }),
  8229. $globals.Collection);
  8230. $core.addMethod(
  8231. $core.method({
  8232. selector: "remove:",
  8233. protocol: "adding/removing",
  8234. fn: function (anObject){
  8235. var self=this,$self=this;
  8236. return $core.withContext(function($ctx1) {
  8237. return $self._remove_ifAbsent_(anObject,(function(){
  8238. return $core.withContext(function($ctx2) {
  8239. return $self._errorNotFound();
  8240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8241. }));
  8242. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8243. },
  8244. args: ["anObject"],
  8245. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8246. referencedClasses: [],
  8247. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8248. }),
  8249. $globals.Collection);
  8250. $core.addMethod(
  8251. $core.method({
  8252. selector: "remove:ifAbsent:",
  8253. protocol: "adding/removing",
  8254. fn: function (anObject,aBlock){
  8255. var self=this,$self=this;
  8256. return $core.withContext(function($ctx1) {
  8257. $self._subclassResponsibility();
  8258. return self;
  8259. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8260. },
  8261. args: ["anObject", "aBlock"],
  8262. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8263. referencedClasses: [],
  8264. messageSends: ["subclassResponsibility"]
  8265. }),
  8266. $globals.Collection);
  8267. $core.addMethod(
  8268. $core.method({
  8269. selector: "removeAll",
  8270. protocol: "adding/removing",
  8271. fn: function (){
  8272. var self=this,$self=this;
  8273. return $core.withContext(function($ctx1) {
  8274. $self._subclassResponsibility();
  8275. return self;
  8276. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8277. },
  8278. args: [],
  8279. source: "removeAll\x0a\x09self subclassResponsibility",
  8280. referencedClasses: [],
  8281. messageSends: ["subclassResponsibility"]
  8282. }),
  8283. $globals.Collection);
  8284. $core.addMethod(
  8285. $core.method({
  8286. selector: "select:",
  8287. protocol: "enumerating",
  8288. fn: function (aBlock){
  8289. var self=this,$self=this;
  8290. var stream;
  8291. return $core.withContext(function($ctx1) {
  8292. var $1;
  8293. stream=$recv($recv($self._class())._new())._writeStream();
  8294. $self._do_((function(each){
  8295. return $core.withContext(function($ctx2) {
  8296. $1=$recv(aBlock)._value_(each);
  8297. if($core.assert($1)){
  8298. return $recv(stream)._nextPut_(each);
  8299. }
  8300. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8301. }));
  8302. return $recv(stream)._contents();
  8303. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8304. },
  8305. args: ["aBlock"],
  8306. 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",
  8307. referencedClasses: [],
  8308. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8309. }),
  8310. $globals.Collection);
  8311. $core.addMethod(
  8312. $core.method({
  8313. selector: "select:thenCollect:",
  8314. protocol: "enumerating",
  8315. fn: function (selectBlock,collectBlock){
  8316. var self=this,$self=this;
  8317. var stream;
  8318. return $core.withContext(function($ctx1) {
  8319. var $1;
  8320. stream=$recv($recv($self._class())._new())._writeStream();
  8321. $self._do_((function(each){
  8322. return $core.withContext(function($ctx2) {
  8323. $1=$recv(selectBlock)._value_(each);
  8324. $ctx2.sendIdx["value:"]=1;
  8325. if($core.assert($1)){
  8326. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8327. }
  8328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8329. }));
  8330. return $recv(stream)._contents();
  8331. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8332. },
  8333. args: ["selectBlock", "collectBlock"],
  8334. 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",
  8335. referencedClasses: [],
  8336. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8337. }),
  8338. $globals.Collection);
  8339. $core.addMethod(
  8340. $core.method({
  8341. selector: "shallowCopy",
  8342. protocol: "copying",
  8343. fn: function (){
  8344. var self=this,$self=this;
  8345. return $core.withContext(function($ctx1) {
  8346. return $self._collect_((function(each){
  8347. return each;
  8348. }));
  8349. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8350. },
  8351. args: [],
  8352. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8353. referencedClasses: [],
  8354. messageSends: ["collect:"]
  8355. }),
  8356. $globals.Collection);
  8357. $core.addMethod(
  8358. $core.method({
  8359. selector: "single",
  8360. protocol: "accessing",
  8361. fn: function (){
  8362. var self=this,$self=this;
  8363. return $core.withContext(function($ctx1) {
  8364. var $1;
  8365. $self._ifEmpty_((function(){
  8366. return $core.withContext(function($ctx2) {
  8367. return $self._error_("Collection is empty");
  8368. $ctx2.sendIdx["error:"]=1;
  8369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8370. }));
  8371. $1=$recv($self._size()).__gt((1));
  8372. if($core.assert($1)){
  8373. $self._error_("Collection holds more than one element");
  8374. }
  8375. return $self._anyOne();
  8376. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8377. },
  8378. args: [],
  8379. 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",
  8380. referencedClasses: [],
  8381. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8382. }),
  8383. $globals.Collection);
  8384. $core.addMethod(
  8385. $core.method({
  8386. selector: "size",
  8387. protocol: "accessing",
  8388. fn: function (){
  8389. var self=this,$self=this;
  8390. return $core.withContext(function($ctx1) {
  8391. $self._subclassResponsibility();
  8392. return self;
  8393. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8394. },
  8395. args: [],
  8396. source: "size\x0a\x09self subclassResponsibility",
  8397. referencedClasses: [],
  8398. messageSends: ["subclassResponsibility"]
  8399. }),
  8400. $globals.Collection);
  8401. $core.addMethod(
  8402. $core.method({
  8403. selector: "classTag",
  8404. protocol: "accessing",
  8405. fn: function (){
  8406. var self=this,$self=this;
  8407. return "collection";
  8408. },
  8409. args: [],
  8410. 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'",
  8411. referencedClasses: [],
  8412. messageSends: []
  8413. }),
  8414. $globals.Collection.a$cls);
  8415. $core.addMethod(
  8416. $core.method({
  8417. selector: "new:",
  8418. protocol: "instance creation",
  8419. fn: function (anInteger){
  8420. var self=this,$self=this;
  8421. return $core.withContext(function($ctx1) {
  8422. return $self._new();
  8423. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8424. },
  8425. args: ["anInteger"],
  8426. source: "new: anInteger\x0a\x09^ self new",
  8427. referencedClasses: [],
  8428. messageSends: ["new"]
  8429. }),
  8430. $globals.Collection.a$cls);
  8431. $core.addMethod(
  8432. $core.method({
  8433. selector: "with:",
  8434. protocol: "instance creation",
  8435. fn: function (anObject){
  8436. var self=this,$self=this;
  8437. return $core.withContext(function($ctx1) {
  8438. var $1;
  8439. $1=$self._new();
  8440. $recv($1)._add_(anObject);
  8441. return $recv($1)._yourself();
  8442. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8443. },
  8444. args: ["anObject"],
  8445. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8446. referencedClasses: [],
  8447. messageSends: ["add:", "new", "yourself"]
  8448. }),
  8449. $globals.Collection.a$cls);
  8450. $core.addMethod(
  8451. $core.method({
  8452. selector: "with:with:",
  8453. protocol: "instance creation",
  8454. fn: function (anObject,anotherObject){
  8455. var self=this,$self=this;
  8456. return $core.withContext(function($ctx1) {
  8457. var $1;
  8458. $1=$self._new();
  8459. $recv($1)._add_(anObject);
  8460. $ctx1.sendIdx["add:"]=1;
  8461. $recv($1)._add_(anotherObject);
  8462. return $recv($1)._yourself();
  8463. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8464. },
  8465. args: ["anObject", "anotherObject"],
  8466. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8467. referencedClasses: [],
  8468. messageSends: ["add:", "new", "yourself"]
  8469. }),
  8470. $globals.Collection.a$cls);
  8471. $core.addMethod(
  8472. $core.method({
  8473. selector: "with:with:with:",
  8474. protocol: "instance creation",
  8475. fn: function (firstObject,secondObject,thirdObject){
  8476. var self=this,$self=this;
  8477. return $core.withContext(function($ctx1) {
  8478. var $1;
  8479. $1=$self._new();
  8480. $recv($1)._add_(firstObject);
  8481. $ctx1.sendIdx["add:"]=1;
  8482. $recv($1)._add_(secondObject);
  8483. $ctx1.sendIdx["add:"]=2;
  8484. $recv($1)._add_(thirdObject);
  8485. return $recv($1)._yourself();
  8486. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8487. },
  8488. args: ["firstObject", "secondObject", "thirdObject"],
  8489. 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",
  8490. referencedClasses: [],
  8491. messageSends: ["add:", "new", "yourself"]
  8492. }),
  8493. $globals.Collection.a$cls);
  8494. $core.addMethod(
  8495. $core.method({
  8496. selector: "withAll:",
  8497. protocol: "instance creation",
  8498. fn: function (aCollection){
  8499. var self=this,$self=this;
  8500. return $core.withContext(function($ctx1) {
  8501. var $1;
  8502. $1=$self._new();
  8503. $recv($1)._addAll_(aCollection);
  8504. return $recv($1)._yourself();
  8505. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8506. },
  8507. args: ["aCollection"],
  8508. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8509. referencedClasses: [],
  8510. messageSends: ["addAll:", "new", "yourself"]
  8511. }),
  8512. $globals.Collection.a$cls);
  8513. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  8514. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  8515. $core.addMethod(
  8516. $core.method({
  8517. selector: "at:",
  8518. protocol: "accessing",
  8519. fn: function (anIndex){
  8520. var self=this,$self=this;
  8521. return $core.withContext(function($ctx1) {
  8522. return $self._at_ifAbsent_(anIndex,(function(){
  8523. return $core.withContext(function($ctx2) {
  8524. return $self._errorNotFound();
  8525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8526. }));
  8527. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  8528. },
  8529. args: ["anIndex"],
  8530. 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 ]",
  8531. referencedClasses: [],
  8532. messageSends: ["at:ifAbsent:", "errorNotFound"]
  8533. }),
  8534. $globals.IndexableCollection);
  8535. $core.addMethod(
  8536. $core.method({
  8537. selector: "at:ifAbsent:",
  8538. protocol: "accessing",
  8539. fn: function (anIndex,aBlock){
  8540. var self=this,$self=this;
  8541. return $core.withContext(function($ctx1) {
  8542. $self._subclassResponsibility();
  8543. return self;
  8544. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8545. },
  8546. args: ["anIndex", "aBlock"],
  8547. 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",
  8548. referencedClasses: [],
  8549. messageSends: ["subclassResponsibility"]
  8550. }),
  8551. $globals.IndexableCollection);
  8552. $core.addMethod(
  8553. $core.method({
  8554. selector: "at:ifAbsentPut:",
  8555. protocol: "accessing",
  8556. fn: function (aKey,aBlock){
  8557. var self=this,$self=this;
  8558. return $core.withContext(function($ctx1) {
  8559. return $self._at_ifAbsent_(aKey,(function(){
  8560. return $core.withContext(function($ctx2) {
  8561. return $self._at_put_(aKey,$recv(aBlock)._value());
  8562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8563. }));
  8564. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  8565. },
  8566. args: ["aKey", "aBlock"],
  8567. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  8568. referencedClasses: [],
  8569. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  8570. }),
  8571. $globals.IndexableCollection);
  8572. $core.addMethod(
  8573. $core.method({
  8574. selector: "at:ifPresent:",
  8575. protocol: "accessing",
  8576. fn: function (anIndex,aBlock){
  8577. var self=this,$self=this;
  8578. return $core.withContext(function($ctx1) {
  8579. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  8580. return nil;
  8581. }));
  8582. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8583. },
  8584. args: ["anIndex", "aBlock"],
  8585. 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 ]",
  8586. referencedClasses: [],
  8587. messageSends: ["at:ifPresent:ifAbsent:"]
  8588. }),
  8589. $globals.IndexableCollection);
  8590. $core.addMethod(
  8591. $core.method({
  8592. selector: "at:ifPresent:ifAbsent:",
  8593. protocol: "accessing",
  8594. fn: function (anIndex,aBlock,anotherBlock){
  8595. var self=this,$self=this;
  8596. return $core.withContext(function($ctx1) {
  8597. $self._subclassResponsibility();
  8598. return self;
  8599. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  8600. },
  8601. args: ["anIndex", "aBlock", "anotherBlock"],
  8602. 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",
  8603. referencedClasses: [],
  8604. messageSends: ["subclassResponsibility"]
  8605. }),
  8606. $globals.IndexableCollection);
  8607. $core.addMethod(
  8608. $core.method({
  8609. selector: "at:put:",
  8610. protocol: "accessing",
  8611. fn: function (anIndex,anObject){
  8612. var self=this,$self=this;
  8613. return $core.withContext(function($ctx1) {
  8614. $self._subclassResponsibility();
  8615. return self;
  8616. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  8617. },
  8618. args: ["anIndex", "anObject"],
  8619. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  8620. referencedClasses: [],
  8621. messageSends: ["subclassResponsibility"]
  8622. }),
  8623. $globals.IndexableCollection);
  8624. $core.addMethod(
  8625. $core.method({
  8626. selector: "indexOf:",
  8627. protocol: "accessing",
  8628. fn: function (anObject){
  8629. var self=this,$self=this;
  8630. return $core.withContext(function($ctx1) {
  8631. return $self._indexOf_ifAbsent_(anObject,(function(){
  8632. return $core.withContext(function($ctx2) {
  8633. return $self._errorNotFound();
  8634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8635. }));
  8636. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  8637. },
  8638. args: ["anObject"],
  8639. 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 ]",
  8640. referencedClasses: [],
  8641. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  8642. }),
  8643. $globals.IndexableCollection);
  8644. $core.addMethod(
  8645. $core.method({
  8646. selector: "indexOf:ifAbsent:",
  8647. protocol: "accessing",
  8648. fn: function (anObject,aBlock){
  8649. var self=this,$self=this;
  8650. return $core.withContext(function($ctx1) {
  8651. $self._subclassResponsibility();
  8652. return self;
  8653. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  8654. },
  8655. args: ["anObject", "aBlock"],
  8656. 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",
  8657. referencedClasses: [],
  8658. messageSends: ["subclassResponsibility"]
  8659. }),
  8660. $globals.IndexableCollection);
  8661. $core.addMethod(
  8662. $core.method({
  8663. selector: "with:do:",
  8664. protocol: "enumerating",
  8665. fn: function (anotherCollection,aBlock){
  8666. var self=this,$self=this;
  8667. return $core.withContext(function($ctx1) {
  8668. $self._withIndexDo_((function(each,index){
  8669. return $core.withContext(function($ctx2) {
  8670. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  8671. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  8672. }));
  8673. return self;
  8674. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  8675. },
  8676. args: ["anotherCollection", "aBlock"],
  8677. 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) ]",
  8678. referencedClasses: [],
  8679. messageSends: ["withIndexDo:", "value:value:", "at:"]
  8680. }),
  8681. $globals.IndexableCollection);
  8682. $core.addMethod(
  8683. $core.method({
  8684. selector: "withIndexDo:",
  8685. protocol: "enumerating",
  8686. fn: function (aBlock){
  8687. var self=this,$self=this;
  8688. return $core.withContext(function($ctx1) {
  8689. $self._subclassResponsibility();
  8690. return self;
  8691. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  8692. },
  8693. args: ["aBlock"],
  8694. 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",
  8695. referencedClasses: [],
  8696. messageSends: ["subclassResponsibility"]
  8697. }),
  8698. $globals.IndexableCollection);
  8699. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8700. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8701. $core.addMethod(
  8702. $core.method({
  8703. selector: "=",
  8704. protocol: "comparing",
  8705. fn: function (anAssocitativeCollection){
  8706. var self=this,$self=this;
  8707. return $core.withContext(function($ctx1) {
  8708. var $2,$1,$4,$3,$5;
  8709. $2=$self._class();
  8710. $ctx1.sendIdx["class"]=1;
  8711. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8712. $ctx1.sendIdx["="]=1;
  8713. if(!$core.assert($1)){
  8714. return false;
  8715. }
  8716. $4=$self._size();
  8717. $ctx1.sendIdx["size"]=1;
  8718. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8719. $ctx1.sendIdx["="]=2;
  8720. if(!$core.assert($3)){
  8721. return false;
  8722. }
  8723. $5=$self._associations();
  8724. $ctx1.sendIdx["associations"]=1;
  8725. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8726. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8727. },
  8728. args: ["anAssocitativeCollection"],
  8729. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8730. referencedClasses: [],
  8731. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8732. }),
  8733. $globals.AssociativeCollection);
  8734. $core.addMethod(
  8735. $core.method({
  8736. selector: "add:",
  8737. protocol: "adding/removing",
  8738. fn: function (anAssociation){
  8739. var self=this,$self=this;
  8740. return $core.withContext(function($ctx1) {
  8741. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8742. return self;
  8743. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8744. },
  8745. args: ["anAssociation"],
  8746. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8747. referencedClasses: [],
  8748. messageSends: ["at:put:", "key", "value"]
  8749. }),
  8750. $globals.AssociativeCollection);
  8751. $core.addMethod(
  8752. $core.method({
  8753. selector: "addAll:",
  8754. protocol: "adding/removing",
  8755. fn: function (anAssociativeCollection){
  8756. var self=this,$self=this;
  8757. return $core.withContext(function($ctx1) {
  8758. (
  8759. $ctx1.supercall = true,
  8760. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8761. $ctx1.supercall = false;
  8762. return anAssociativeCollection;
  8763. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8764. },
  8765. args: ["anAssociativeCollection"],
  8766. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8767. referencedClasses: [],
  8768. messageSends: ["addAll:", "associations"]
  8769. }),
  8770. $globals.AssociativeCollection);
  8771. $core.addMethod(
  8772. $core.method({
  8773. selector: "asDictionary",
  8774. protocol: "converting",
  8775. fn: function (){
  8776. var self=this,$self=this;
  8777. return $core.withContext(function($ctx1) {
  8778. return $recv($globals.Dictionary)._from_($self._associations());
  8779. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8780. },
  8781. args: [],
  8782. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8783. referencedClasses: ["Dictionary"],
  8784. messageSends: ["from:", "associations"]
  8785. }),
  8786. $globals.AssociativeCollection);
  8787. $core.addMethod(
  8788. $core.method({
  8789. selector: "asHashedCollection",
  8790. protocol: "converting",
  8791. fn: function (){
  8792. var self=this,$self=this;
  8793. return $core.withContext(function($ctx1) {
  8794. return $recv($globals.HashedCollection)._from_($self._associations());
  8795. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8796. },
  8797. args: [],
  8798. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8799. referencedClasses: ["HashedCollection"],
  8800. messageSends: ["from:", "associations"]
  8801. }),
  8802. $globals.AssociativeCollection);
  8803. $core.addMethod(
  8804. $core.method({
  8805. selector: "asJavaScriptObject",
  8806. protocol: "converting",
  8807. fn: function (){
  8808. var self=this,$self=this;
  8809. var hash;
  8810. return $core.withContext(function($ctx1) {
  8811. hash=$recv($globals.HashedCollection)._new();
  8812. $self._keysAndValuesDo_((function(key,value){
  8813. return $core.withContext(function($ctx2) {
  8814. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8815. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8816. }));
  8817. return hash;
  8818. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8819. },
  8820. args: [],
  8821. 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",
  8822. referencedClasses: ["HashedCollection"],
  8823. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8824. }),
  8825. $globals.AssociativeCollection);
  8826. $core.addMethod(
  8827. $core.method({
  8828. selector: "associations",
  8829. protocol: "accessing",
  8830. fn: function (){
  8831. var self=this,$self=this;
  8832. var associations;
  8833. return $core.withContext(function($ctx1) {
  8834. associations=[];
  8835. $self._associationsDo_((function(each){
  8836. return $core.withContext(function($ctx2) {
  8837. return $recv(associations)._add_(each);
  8838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8839. }));
  8840. return associations;
  8841. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8842. },
  8843. args: [],
  8844. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8845. referencedClasses: [],
  8846. messageSends: ["associationsDo:", "add:"]
  8847. }),
  8848. $globals.AssociativeCollection);
  8849. $core.addMethod(
  8850. $core.method({
  8851. selector: "associationsDo:",
  8852. protocol: "enumerating",
  8853. fn: function (aBlock){
  8854. var self=this,$self=this;
  8855. return $core.withContext(function($ctx1) {
  8856. $self._keysAndValuesDo_((function(key,value){
  8857. return $core.withContext(function($ctx2) {
  8858. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8859. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8860. }));
  8861. return self;
  8862. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8863. },
  8864. args: ["aBlock"],
  8865. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8866. referencedClasses: ["Association"],
  8867. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8868. }),
  8869. $globals.AssociativeCollection);
  8870. $core.addMethod(
  8871. $core.method({
  8872. selector: "at:ifPresent:ifAbsent:",
  8873. protocol: "accessing",
  8874. fn: function (aKey,aBlock,anotherBlock){
  8875. var self=this,$self=this;
  8876. return $core.withContext(function($ctx1) {
  8877. var $1;
  8878. $1=$self._includesKey_(aKey);
  8879. if($core.assert($1)){
  8880. return $recv(aBlock)._value_($self._at_(aKey));
  8881. } else {
  8882. return $recv(anotherBlock)._value();
  8883. }
  8884. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8885. },
  8886. args: ["aKey", "aBlock", "anotherBlock"],
  8887. 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 ]",
  8888. referencedClasses: [],
  8889. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8890. }),
  8891. $globals.AssociativeCollection);
  8892. $core.addMethod(
  8893. $core.method({
  8894. selector: "collect:",
  8895. protocol: "enumerating",
  8896. fn: function (aBlock){
  8897. var self=this,$self=this;
  8898. var newDict;
  8899. return $core.withContext(function($ctx1) {
  8900. newDict=$recv($self._class())._new();
  8901. $self._keysAndValuesDo_((function(key,value){
  8902. return $core.withContext(function($ctx2) {
  8903. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8904. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8905. }));
  8906. return newDict;
  8907. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8908. },
  8909. args: ["aBlock"],
  8910. 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",
  8911. referencedClasses: [],
  8912. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8913. }),
  8914. $globals.AssociativeCollection);
  8915. $core.addMethod(
  8916. $core.method({
  8917. selector: "deepCopy",
  8918. protocol: "copying",
  8919. fn: function (){
  8920. var self=this,$self=this;
  8921. var copy;
  8922. return $core.withContext(function($ctx1) {
  8923. copy=$recv($self._class())._new();
  8924. $self._keysAndValuesDo_((function(key,value){
  8925. return $core.withContext(function($ctx2) {
  8926. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8927. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8928. }));
  8929. return copy;
  8930. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8931. },
  8932. args: [],
  8933. 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",
  8934. referencedClasses: [],
  8935. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8936. }),
  8937. $globals.AssociativeCollection);
  8938. $core.addMethod(
  8939. $core.method({
  8940. selector: "detect:ifNone:",
  8941. protocol: "enumerating",
  8942. fn: function (aBlock,anotherBlock){
  8943. var self=this,$self=this;
  8944. return $core.withContext(function($ctx1) {
  8945. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8946. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8947. },
  8948. args: ["aBlock", "anotherBlock"],
  8949. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8950. referencedClasses: [],
  8951. messageSends: ["detect:ifNone:", "values"]
  8952. }),
  8953. $globals.AssociativeCollection);
  8954. $core.addMethod(
  8955. $core.method({
  8956. selector: "do:",
  8957. protocol: "enumerating",
  8958. fn: function (aBlock){
  8959. var self=this,$self=this;
  8960. return $core.withContext(function($ctx1) {
  8961. $self._valuesDo_(aBlock);
  8962. return self;
  8963. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8964. },
  8965. args: ["aBlock"],
  8966. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8967. referencedClasses: [],
  8968. messageSends: ["valuesDo:"]
  8969. }),
  8970. $globals.AssociativeCollection);
  8971. $core.addMethod(
  8972. $core.method({
  8973. selector: "includes:",
  8974. protocol: "enumerating",
  8975. fn: function (anObject){
  8976. var self=this,$self=this;
  8977. return $core.withContext(function($ctx1) {
  8978. return $recv($self._values())._includes_(anObject);
  8979. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8980. },
  8981. args: ["anObject"],
  8982. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8983. referencedClasses: [],
  8984. messageSends: ["includes:", "values"]
  8985. }),
  8986. $globals.AssociativeCollection);
  8987. $core.addMethod(
  8988. $core.method({
  8989. selector: "includesKey:",
  8990. protocol: "testing",
  8991. fn: function (aKey){
  8992. var self=this,$self=this;
  8993. return $core.withContext(function($ctx1) {
  8994. $self._subclassResponsibility();
  8995. return self;
  8996. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8997. },
  8998. args: ["aKey"],
  8999. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  9000. referencedClasses: [],
  9001. messageSends: ["subclassResponsibility"]
  9002. }),
  9003. $globals.AssociativeCollection);
  9004. $core.addMethod(
  9005. $core.method({
  9006. selector: "indexOf:ifAbsent:",
  9007. protocol: "accessing",
  9008. fn: function (anObject,aBlock){
  9009. var self=this,$self=this;
  9010. return $core.withContext(function($ctx1) {
  9011. return $recv($self._keys())._detect_ifNone_((function(each){
  9012. return $core.withContext(function($ctx2) {
  9013. return $recv($self._at_(each)).__eq(anObject);
  9014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9015. }),aBlock);
  9016. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9017. },
  9018. args: ["anObject", "aBlock"],
  9019. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  9020. referencedClasses: [],
  9021. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  9022. }),
  9023. $globals.AssociativeCollection);
  9024. $core.addMethod(
  9025. $core.method({
  9026. selector: "keyAtValue:",
  9027. protocol: "accessing",
  9028. fn: function (anObject){
  9029. var self=this,$self=this;
  9030. return $core.withContext(function($ctx1) {
  9031. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  9032. return $core.withContext(function($ctx2) {
  9033. return $self._errorNotFound();
  9034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9035. }));
  9036. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  9037. },
  9038. args: ["anObject"],
  9039. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  9040. referencedClasses: [],
  9041. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  9042. }),
  9043. $globals.AssociativeCollection);
  9044. $core.addMethod(
  9045. $core.method({
  9046. selector: "keyAtValue:ifAbsent:",
  9047. protocol: "accessing",
  9048. fn: function (anObject,aBlock){
  9049. var self=this,$self=this;
  9050. return $core.withContext(function($ctx1) {
  9051. return $self._indexOf_ifAbsent_(anObject,aBlock);
  9052. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9053. },
  9054. args: ["anObject", "aBlock"],
  9055. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  9056. referencedClasses: [],
  9057. messageSends: ["indexOf:ifAbsent:"]
  9058. }),
  9059. $globals.AssociativeCollection);
  9060. $core.addMethod(
  9061. $core.method({
  9062. selector: "keys",
  9063. protocol: "accessing",
  9064. fn: function (){
  9065. var self=this,$self=this;
  9066. return $core.withContext(function($ctx1) {
  9067. $self._subclassResponsibility();
  9068. return self;
  9069. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  9070. },
  9071. args: [],
  9072. source: "keys\x0a\x09self subclassResponsibility",
  9073. referencedClasses: [],
  9074. messageSends: ["subclassResponsibility"]
  9075. }),
  9076. $globals.AssociativeCollection);
  9077. $core.addMethod(
  9078. $core.method({
  9079. selector: "keysAndValuesDo:",
  9080. protocol: "enumerating",
  9081. fn: function (aBlock){
  9082. var self=this,$self=this;
  9083. return $core.withContext(function($ctx1) {
  9084. $self._keysDo_((function(each){
  9085. return $core.withContext(function($ctx2) {
  9086. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9088. }));
  9089. return self;
  9090. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9091. },
  9092. args: ["aBlock"],
  9093. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9094. referencedClasses: [],
  9095. messageSends: ["keysDo:", "value:value:", "at:"]
  9096. }),
  9097. $globals.AssociativeCollection);
  9098. $core.addMethod(
  9099. $core.method({
  9100. selector: "keysDo:",
  9101. protocol: "enumerating",
  9102. fn: function (aBlock){
  9103. var self=this,$self=this;
  9104. return $core.withContext(function($ctx1) {
  9105. $self._subclassResponsibility();
  9106. return self;
  9107. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9108. },
  9109. args: ["aBlock"],
  9110. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9111. referencedClasses: [],
  9112. messageSends: ["subclassResponsibility"]
  9113. }),
  9114. $globals.AssociativeCollection);
  9115. $core.addMethod(
  9116. $core.method({
  9117. selector: "printOn:",
  9118. protocol: "printing",
  9119. fn: function (aStream){
  9120. var self=this,$self=this;
  9121. return $core.withContext(function($ctx1) {
  9122. (
  9123. $ctx1.supercall = true,
  9124. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9125. $ctx1.supercall = false;
  9126. $ctx1.sendIdx["printOn:"]=1;
  9127. $recv(aStream)._nextPutAll_(" (");
  9128. $ctx1.sendIdx["nextPutAll:"]=1;
  9129. $recv($self._associations())._do_separatedBy_((function(each){
  9130. return $core.withContext(function($ctx2) {
  9131. return $recv(each)._printOn_(aStream);
  9132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9133. }),(function(){
  9134. return $core.withContext(function($ctx2) {
  9135. return $recv(aStream)._nextPutAll_(" , ");
  9136. $ctx2.sendIdx["nextPutAll:"]=2;
  9137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9138. }));
  9139. $recv(aStream)._nextPutAll_(")");
  9140. return self;
  9141. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9142. },
  9143. args: ["aStream"],
  9144. 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: ')'",
  9145. referencedClasses: [],
  9146. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9147. }),
  9148. $globals.AssociativeCollection);
  9149. $core.addMethod(
  9150. $core.method({
  9151. selector: "remove:ifAbsent:",
  9152. protocol: "adding/removing",
  9153. fn: function (aKey,aBlock){
  9154. var self=this,$self=this;
  9155. return $core.withContext(function($ctx1) {
  9156. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9157. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9158. },
  9159. args: ["aKey", "aBlock"],
  9160. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9161. referencedClasses: [],
  9162. messageSends: ["removeKey:ifAbsent:"]
  9163. }),
  9164. $globals.AssociativeCollection);
  9165. $core.addMethod(
  9166. $core.method({
  9167. selector: "removeAll",
  9168. protocol: "adding/removing",
  9169. fn: function (){
  9170. var self=this,$self=this;
  9171. return $core.withContext(function($ctx1) {
  9172. return $recv($self._keys())._do_((function(each){
  9173. return $core.withContext(function($ctx2) {
  9174. return $self._removeKey_(each);
  9175. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9176. }));
  9177. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9178. },
  9179. args: [],
  9180. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9181. referencedClasses: [],
  9182. messageSends: ["do:", "keys", "removeKey:"]
  9183. }),
  9184. $globals.AssociativeCollection);
  9185. $core.addMethod(
  9186. $core.method({
  9187. selector: "removeKey:",
  9188. protocol: "adding/removing",
  9189. fn: function (aKey){
  9190. var self=this,$self=this;
  9191. return $core.withContext(function($ctx1) {
  9192. return $self._remove_(aKey);
  9193. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9194. },
  9195. args: ["aKey"],
  9196. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9197. referencedClasses: [],
  9198. messageSends: ["remove:"]
  9199. }),
  9200. $globals.AssociativeCollection);
  9201. $core.addMethod(
  9202. $core.method({
  9203. selector: "removeKey:ifAbsent:",
  9204. protocol: "adding/removing",
  9205. fn: function (aKey,aBlock){
  9206. var self=this,$self=this;
  9207. return $core.withContext(function($ctx1) {
  9208. $self._subclassResponsibility();
  9209. return self;
  9210. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9211. },
  9212. args: ["aKey", "aBlock"],
  9213. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9214. referencedClasses: [],
  9215. messageSends: ["subclassResponsibility"]
  9216. }),
  9217. $globals.AssociativeCollection);
  9218. $core.addMethod(
  9219. $core.method({
  9220. selector: "select:",
  9221. protocol: "enumerating",
  9222. fn: function (aBlock){
  9223. var self=this,$self=this;
  9224. var newDict;
  9225. return $core.withContext(function($ctx1) {
  9226. var $1;
  9227. newDict=$recv($self._class())._new();
  9228. $self._keysAndValuesDo_((function(key,value){
  9229. return $core.withContext(function($ctx2) {
  9230. $1=$recv(aBlock)._value_(value);
  9231. if($core.assert($1)){
  9232. return $recv(newDict)._at_put_(key,value);
  9233. }
  9234. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9235. }));
  9236. return newDict;
  9237. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9238. },
  9239. args: ["aBlock"],
  9240. 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",
  9241. referencedClasses: [],
  9242. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9243. }),
  9244. $globals.AssociativeCollection);
  9245. $core.addMethod(
  9246. $core.method({
  9247. selector: "select:thenCollect:",
  9248. protocol: "enumerating",
  9249. fn: function (selectBlock,collectBlock){
  9250. var self=this,$self=this;
  9251. var newDict;
  9252. return $core.withContext(function($ctx1) {
  9253. var $1;
  9254. newDict=$recv($self._class())._new();
  9255. $self._keysAndValuesDo_((function(key,value){
  9256. return $core.withContext(function($ctx2) {
  9257. $1=$recv(selectBlock)._value_(value);
  9258. $ctx2.sendIdx["value:"]=1;
  9259. if($core.assert($1)){
  9260. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9261. }
  9262. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9263. }));
  9264. return newDict;
  9265. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9266. },
  9267. args: ["selectBlock", "collectBlock"],
  9268. 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",
  9269. referencedClasses: [],
  9270. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9271. }),
  9272. $globals.AssociativeCollection);
  9273. $core.addMethod(
  9274. $core.method({
  9275. selector: "shallowCopy",
  9276. protocol: "copying",
  9277. fn: function (){
  9278. var self=this,$self=this;
  9279. var copy;
  9280. return $core.withContext(function($ctx1) {
  9281. copy=$recv($self._class())._new();
  9282. $self._keysAndValuesDo_((function(key,value){
  9283. return $core.withContext(function($ctx2) {
  9284. return $recv(copy)._at_put_(key,value);
  9285. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9286. }));
  9287. return copy;
  9288. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9289. },
  9290. args: [],
  9291. 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",
  9292. referencedClasses: [],
  9293. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9294. }),
  9295. $globals.AssociativeCollection);
  9296. $core.addMethod(
  9297. $core.method({
  9298. selector: "size",
  9299. protocol: "accessing",
  9300. fn: function (){
  9301. var self=this,$self=this;
  9302. return $core.withContext(function($ctx1) {
  9303. return $recv($self._keys())._size();
  9304. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9305. },
  9306. args: [],
  9307. source: "size\x0a\x09^ self keys size",
  9308. referencedClasses: [],
  9309. messageSends: ["size", "keys"]
  9310. }),
  9311. $globals.AssociativeCollection);
  9312. $core.addMethod(
  9313. $core.method({
  9314. selector: "values",
  9315. protocol: "accessing",
  9316. fn: function (){
  9317. var self=this,$self=this;
  9318. return $core.withContext(function($ctx1) {
  9319. $self._subclassResponsibility();
  9320. return self;
  9321. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9322. },
  9323. args: [],
  9324. source: "values\x0a\x09self subclassResponsibility",
  9325. referencedClasses: [],
  9326. messageSends: ["subclassResponsibility"]
  9327. }),
  9328. $globals.AssociativeCollection);
  9329. $core.addMethod(
  9330. $core.method({
  9331. selector: "valuesDo:",
  9332. protocol: "enumerating",
  9333. fn: function (aBlock){
  9334. var self=this,$self=this;
  9335. return $core.withContext(function($ctx1) {
  9336. $self._subclassResponsibility();
  9337. return self;
  9338. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9339. },
  9340. args: ["aBlock"],
  9341. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9342. referencedClasses: [],
  9343. messageSends: ["subclassResponsibility"]
  9344. }),
  9345. $globals.AssociativeCollection);
  9346. $core.addMethod(
  9347. $core.method({
  9348. selector: "withIndexDo:",
  9349. protocol: "enumerating",
  9350. fn: function (aBlock){
  9351. var self=this,$self=this;
  9352. return $core.withContext(function($ctx1) {
  9353. $self._keysAndValuesDo_((function(key,value){
  9354. return $core.withContext(function($ctx2) {
  9355. return $recv(aBlock)._value_value_(value,key);
  9356. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9357. }));
  9358. return self;
  9359. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9360. },
  9361. args: ["aBlock"],
  9362. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9363. referencedClasses: [],
  9364. messageSends: ["keysAndValuesDo:", "value:value:"]
  9365. }),
  9366. $globals.AssociativeCollection);
  9367. $core.addMethod(
  9368. $core.method({
  9369. selector: "from:",
  9370. protocol: "instance creation",
  9371. fn: function (aCollection){
  9372. var self=this,$self=this;
  9373. var newCollection;
  9374. return $core.withContext(function($ctx1) {
  9375. newCollection=$self._new();
  9376. $recv(aCollection)._do_((function(each){
  9377. return $core.withContext(function($ctx2) {
  9378. return $recv(newCollection)._add_(each);
  9379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9380. }));
  9381. return newCollection;
  9382. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9383. },
  9384. args: ["aCollection"],
  9385. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9386. referencedClasses: [],
  9387. messageSends: ["new", "do:", "add:"]
  9388. }),
  9389. $globals.AssociativeCollection.a$cls);
  9390. $core.addMethod(
  9391. $core.method({
  9392. selector: "fromPairs:",
  9393. protocol: "instance creation",
  9394. fn: function (aCollection){
  9395. var self=this,$self=this;
  9396. return $core.withContext(function($ctx1) {
  9397. return $self._from_(aCollection);
  9398. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9399. },
  9400. args: ["aCollection"],
  9401. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9402. referencedClasses: [],
  9403. messageSends: ["from:"]
  9404. }),
  9405. $globals.AssociativeCollection.a$cls);
  9406. $core.addMethod(
  9407. $core.method({
  9408. selector: "newFromPairs:",
  9409. protocol: "instance creation",
  9410. fn: function (aCollection){
  9411. var self=this,$self=this;
  9412. var newCollection;
  9413. return $core.withContext(function($ctx1) {
  9414. var $2,$1,$3,$4;
  9415. $2=$recv(aCollection)._size();
  9416. $ctx1.sendIdx["size"]=1;
  9417. $1=$recv($2)._even();
  9418. if(!$core.assert($1)){
  9419. $self._error_("#newFromPairs only accepts arrays of an even length");
  9420. }
  9421. newCollection=$self._new();
  9422. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9423. return $core.withContext(function($ctx2) {
  9424. $3=newCollection;
  9425. $4=$recv(aCollection)._at_(each);
  9426. $ctx2.sendIdx["at:"]=1;
  9427. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9429. }));
  9430. return newCollection;
  9431. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9432. },
  9433. args: ["aCollection"],
  9434. 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",
  9435. referencedClasses: [],
  9436. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9437. }),
  9438. $globals.AssociativeCollection.a$cls);
  9439. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9440. $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.";
  9441. $core.addMethod(
  9442. $core.method({
  9443. selector: "at:ifAbsent:",
  9444. protocol: "accessing",
  9445. fn: function (aKey,aBlock){
  9446. var self=this,$self=this;
  9447. return $core.withContext(function($ctx1) {
  9448. var index = $self._positionOfKey_(aKey);
  9449. return index >=0 ? $self['@values'][index] : aBlock._value();
  9450. ;
  9451. return self;
  9452. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9453. },
  9454. args: ["aKey", "aBlock"],
  9455. 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'>",
  9456. referencedClasses: [],
  9457. messageSends: []
  9458. }),
  9459. $globals.Dictionary);
  9460. $core.addMethod(
  9461. $core.method({
  9462. selector: "at:put:",
  9463. protocol: "accessing",
  9464. fn: function (aKey,aValue){
  9465. var self=this,$self=this;
  9466. return $core.withContext(function($ctx1) {
  9467. var index = $self._positionOfKey_(aKey);
  9468. if(index === -1) {
  9469. var keys = $self['@keys'];
  9470. index = keys.length;
  9471. keys.push(aKey);
  9472. }
  9473. return $self['@values'][index] = aValue;
  9474. ;
  9475. return self;
  9476. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9477. },
  9478. args: ["aKey", "aValue"],
  9479. 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'>",
  9480. referencedClasses: [],
  9481. messageSends: []
  9482. }),
  9483. $globals.Dictionary);
  9484. $core.addMethod(
  9485. $core.method({
  9486. selector: "includesKey:",
  9487. protocol: "testing",
  9488. fn: function (aKey){
  9489. var self=this,$self=this;
  9490. return $core.withContext(function($ctx1) {
  9491. return $self._positionOfKey_(aKey) >= 0;;
  9492. return self;
  9493. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9494. },
  9495. args: ["aKey"],
  9496. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9497. referencedClasses: [],
  9498. messageSends: []
  9499. }),
  9500. $globals.Dictionary);
  9501. $core.addMethod(
  9502. $core.method({
  9503. selector: "indexOf:ifAbsent:",
  9504. protocol: "accessing",
  9505. fn: function (anObject,aBlock){
  9506. var self=this,$self=this;
  9507. var index;
  9508. return $core.withContext(function($ctx1) {
  9509. var $1;
  9510. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9511. return (0);
  9512. }));
  9513. $1=$recv(index).__eq((0));
  9514. if($core.assert($1)){
  9515. return $recv(aBlock)._value();
  9516. } else {
  9517. return $recv($self["@keys"])._at_(index);
  9518. }
  9519. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9520. },
  9521. args: ["anObject", "aBlock"],
  9522. 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 ]",
  9523. referencedClasses: [],
  9524. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9525. }),
  9526. $globals.Dictionary);
  9527. $core.addMethod(
  9528. $core.method({
  9529. selector: "initialize",
  9530. protocol: "initialization",
  9531. fn: function (){
  9532. var self=this,$self=this;
  9533. return $core.withContext(function($ctx1) {
  9534. (
  9535. $ctx1.supercall = true,
  9536. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9537. $ctx1.supercall = false;
  9538. $self["@keys"]=[];
  9539. $self["@values"]=[];
  9540. return self;
  9541. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9542. },
  9543. args: [],
  9544. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9545. referencedClasses: [],
  9546. messageSends: ["initialize"]
  9547. }),
  9548. $globals.Dictionary);
  9549. $core.addMethod(
  9550. $core.method({
  9551. selector: "keys",
  9552. protocol: "accessing",
  9553. fn: function (){
  9554. var self=this,$self=this;
  9555. return $core.withContext(function($ctx1) {
  9556. return $recv($self["@keys"])._copy();
  9557. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9558. },
  9559. args: [],
  9560. source: "keys\x0a\x09^ keys copy",
  9561. referencedClasses: [],
  9562. messageSends: ["copy"]
  9563. }),
  9564. $globals.Dictionary);
  9565. $core.addMethod(
  9566. $core.method({
  9567. selector: "keysAndValuesDo:",
  9568. protocol: "enumerating",
  9569. fn: function (aBlock){
  9570. var self=this,$self=this;
  9571. return $core.withContext(function($ctx1) {
  9572. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9573. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9574. },
  9575. args: ["aBlock"],
  9576. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9577. referencedClasses: [],
  9578. messageSends: ["with:do:"]
  9579. }),
  9580. $globals.Dictionary);
  9581. $core.addMethod(
  9582. $core.method({
  9583. selector: "keysDo:",
  9584. protocol: "enumerating",
  9585. fn: function (aBlock){
  9586. var self=this,$self=this;
  9587. return $core.withContext(function($ctx1) {
  9588. return $recv($self["@keys"])._do_(aBlock);
  9589. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9590. },
  9591. args: ["aBlock"],
  9592. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9593. referencedClasses: [],
  9594. messageSends: ["do:"]
  9595. }),
  9596. $globals.Dictionary);
  9597. $core.addMethod(
  9598. $core.method({
  9599. selector: "positionOfKey:",
  9600. protocol: "private",
  9601. fn: function (anObject){
  9602. var self=this,$self=this;
  9603. return $core.withContext(function($ctx1) {
  9604. var keys = $self['@keys'];
  9605. for(var i=0;i<keys.length;i++){
  9606. if(keys[i].__eq(anObject)) { return i;}
  9607. }
  9608. return -1;
  9609. ;
  9610. return self;
  9611. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9612. },
  9613. args: ["anObject"],
  9614. 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'>",
  9615. referencedClasses: [],
  9616. messageSends: []
  9617. }),
  9618. $globals.Dictionary);
  9619. $core.addMethod(
  9620. $core.method({
  9621. selector: "removeAll",
  9622. protocol: "adding/removing",
  9623. fn: function (){
  9624. var self=this,$self=this;
  9625. return $core.withContext(function($ctx1) {
  9626. $recv($self["@keys"])._removeAll();
  9627. $ctx1.sendIdx["removeAll"]=1;
  9628. $recv($self["@values"])._removeAll();
  9629. return self;
  9630. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9631. },
  9632. args: [],
  9633. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9634. referencedClasses: [],
  9635. messageSends: ["removeAll"]
  9636. }),
  9637. $globals.Dictionary);
  9638. $core.addMethod(
  9639. $core.method({
  9640. selector: "removeKey:ifAbsent:",
  9641. protocol: "adding/removing",
  9642. fn: function (aKey,aBlock){
  9643. var self=this,$self=this;
  9644. return $core.withContext(function($ctx1) {
  9645. var index = $self._positionOfKey_(aKey);
  9646. if(index === -1) {
  9647. return aBlock._value()
  9648. } else {
  9649. var keys = $self['@keys'], values = $self['@values'];
  9650. var value = values[index], l = keys.length;
  9651. keys[index] = keys[l-1];
  9652. keys.pop();
  9653. values[index] = values[l-1];
  9654. values.pop();
  9655. return value;
  9656. }
  9657. ;
  9658. return self;
  9659. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9660. },
  9661. args: ["aKey", "aBlock"],
  9662. 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'>",
  9663. referencedClasses: [],
  9664. messageSends: []
  9665. }),
  9666. $globals.Dictionary);
  9667. $core.addMethod(
  9668. $core.method({
  9669. selector: "values",
  9670. protocol: "accessing",
  9671. fn: function (){
  9672. var self=this,$self=this;
  9673. return $self["@values"];
  9674. },
  9675. args: [],
  9676. source: "values\x0a\x09^ values",
  9677. referencedClasses: [],
  9678. messageSends: []
  9679. }),
  9680. $globals.Dictionary);
  9681. $core.addMethod(
  9682. $core.method({
  9683. selector: "valuesDo:",
  9684. protocol: "enumerating",
  9685. fn: function (aBlock){
  9686. var self=this,$self=this;
  9687. return $core.withContext(function($ctx1) {
  9688. return $recv($self["@values"])._do_(aBlock);
  9689. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9690. },
  9691. args: ["aBlock"],
  9692. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9693. referencedClasses: [],
  9694. messageSends: ["do:"]
  9695. }),
  9696. $globals.Dictionary);
  9697. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9698. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9699. $core.addMethod(
  9700. $core.method({
  9701. selector: "at:ifAbsent:",
  9702. protocol: "accessing",
  9703. fn: function (aKey,aBlock){
  9704. var self=this,$self=this;
  9705. return $core.withContext(function($ctx1) {
  9706. var $1;
  9707. $1=$self._includesKey_(aKey);
  9708. if($core.assert($1)){
  9709. return $self._basicAt_(aKey);
  9710. } else {
  9711. return $recv(aBlock)._value();
  9712. }
  9713. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9714. },
  9715. args: ["aKey", "aBlock"],
  9716. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9717. referencedClasses: [],
  9718. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9719. }),
  9720. $globals.HashedCollection);
  9721. $core.addMethod(
  9722. $core.method({
  9723. selector: "at:put:",
  9724. protocol: "accessing",
  9725. fn: function (aKey,aValue){
  9726. var self=this,$self=this;
  9727. return $core.withContext(function($ctx1) {
  9728. return $self._basicAt_put_(aKey,aValue);
  9729. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9730. },
  9731. args: ["aKey", "aValue"],
  9732. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9733. referencedClasses: [],
  9734. messageSends: ["basicAt:put:"]
  9735. }),
  9736. $globals.HashedCollection);
  9737. $core.addMethod(
  9738. $core.method({
  9739. selector: "includesKey:",
  9740. protocol: "testing",
  9741. fn: function (aKey){
  9742. var self=this,$self=this;
  9743. return $core.withContext(function($ctx1) {
  9744. return self.hasOwnProperty(aKey);
  9745. return self;
  9746. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9747. },
  9748. args: ["aKey"],
  9749. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9750. referencedClasses: [],
  9751. messageSends: []
  9752. }),
  9753. $globals.HashedCollection);
  9754. $core.addMethod(
  9755. $core.method({
  9756. selector: "keys",
  9757. protocol: "accessing",
  9758. fn: function (){
  9759. var self=this,$self=this;
  9760. return $core.withContext(function($ctx1) {
  9761. return Object.keys(self);
  9762. return self;
  9763. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9764. },
  9765. args: [],
  9766. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9767. referencedClasses: [],
  9768. messageSends: []
  9769. }),
  9770. $globals.HashedCollection);
  9771. $core.addMethod(
  9772. $core.method({
  9773. selector: "keysDo:",
  9774. protocol: "enumerating",
  9775. fn: function (aBlock){
  9776. var self=this,$self=this;
  9777. return $core.withContext(function($ctx1) {
  9778. $recv($self._keys())._do_(aBlock);
  9779. return self;
  9780. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9781. },
  9782. args: ["aBlock"],
  9783. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9784. referencedClasses: [],
  9785. messageSends: ["do:", "keys"]
  9786. }),
  9787. $globals.HashedCollection);
  9788. $core.addMethod(
  9789. $core.method({
  9790. selector: "removeKey:ifAbsent:",
  9791. protocol: "adding/removing",
  9792. fn: function (aKey,aBlock){
  9793. var self=this,$self=this;
  9794. return $core.withContext(function($ctx1) {
  9795. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9796. return $core.withContext(function($ctx2) {
  9797. $self._basicDelete_(aKey);
  9798. return removed;
  9799. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9800. }),(function(){
  9801. return $core.withContext(function($ctx2) {
  9802. return $recv(aBlock)._value();
  9803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9804. }));
  9805. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9806. },
  9807. args: ["aKey", "aBlock"],
  9808. 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 ]",
  9809. referencedClasses: [],
  9810. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9811. }),
  9812. $globals.HashedCollection);
  9813. $core.addMethod(
  9814. $core.method({
  9815. selector: "values",
  9816. protocol: "accessing",
  9817. fn: function (){
  9818. var self=this,$self=this;
  9819. return $core.withContext(function($ctx1) {
  9820. return $self._keys().map(function(key){
  9821. return $self._at_(key);
  9822. });
  9823. ;
  9824. return self;
  9825. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9826. },
  9827. args: [],
  9828. 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'>",
  9829. referencedClasses: [],
  9830. messageSends: []
  9831. }),
  9832. $globals.HashedCollection);
  9833. $core.addMethod(
  9834. $core.method({
  9835. selector: "valuesDo:",
  9836. protocol: "enumerating",
  9837. fn: function (aBlock){
  9838. var self=this,$self=this;
  9839. return $core.withContext(function($ctx1) {
  9840. $recv($self._values())._do_(aBlock);
  9841. return self;
  9842. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9843. },
  9844. args: ["aBlock"],
  9845. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9846. referencedClasses: [],
  9847. messageSends: ["do:", "values"]
  9848. }),
  9849. $globals.HashedCollection);
  9850. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  9851. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9852. $core.addMethod(
  9853. $core.method({
  9854. selector: "=",
  9855. protocol: "comparing",
  9856. fn: function (aCollection){
  9857. var self=this,$self=this;
  9858. return $core.withContext(function($ctx1) {
  9859. var $3,$2,$4,$1,$5;
  9860. var $early={};
  9861. try {
  9862. $3=$self._class();
  9863. $ctx1.sendIdx["class"]=1;
  9864. $2=$recv($3).__eq($recv(aCollection)._class());
  9865. $ctx1.sendIdx["="]=1;
  9866. $1=$recv($2)._and_((function(){
  9867. return $core.withContext(function($ctx2) {
  9868. $4=$self._size();
  9869. $ctx2.sendIdx["size"]=1;
  9870. return $recv($4).__eq($recv(aCollection)._size());
  9871. $ctx2.sendIdx["="]=2;
  9872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9873. }));
  9874. if(!$core.assert($1)){
  9875. return false;
  9876. }
  9877. $self._withIndexDo_((function(each,i){
  9878. return $core.withContext(function($ctx2) {
  9879. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9880. if(!$core.assert($5)){
  9881. throw $early=[false];
  9882. }
  9883. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9884. }));
  9885. return true;
  9886. }
  9887. catch(e) {if(e===$early)return e[0]; throw e}
  9888. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9889. },
  9890. args: ["aCollection"],
  9891. 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",
  9892. referencedClasses: [],
  9893. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9894. }),
  9895. $globals.SequenceableCollection);
  9896. $core.addMethod(
  9897. $core.method({
  9898. selector: "addLast:",
  9899. protocol: "adding/removing",
  9900. fn: function (anObject){
  9901. var self=this,$self=this;
  9902. return $core.withContext(function($ctx1) {
  9903. $self._add_(anObject);
  9904. return self;
  9905. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9906. },
  9907. args: ["anObject"],
  9908. source: "addLast: anObject\x0a\x09self add: anObject",
  9909. referencedClasses: [],
  9910. messageSends: ["add:"]
  9911. }),
  9912. $globals.SequenceableCollection);
  9913. $core.addMethod(
  9914. $core.method({
  9915. selector: "allButFirst",
  9916. protocol: "accessing",
  9917. fn: function (){
  9918. var self=this,$self=this;
  9919. return $core.withContext(function($ctx1) {
  9920. return $self._copyFrom_to_((2),$self._size());
  9921. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9922. },
  9923. args: [],
  9924. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9925. referencedClasses: [],
  9926. messageSends: ["copyFrom:to:", "size"]
  9927. }),
  9928. $globals.SequenceableCollection);
  9929. $core.addMethod(
  9930. $core.method({
  9931. selector: "allButLast",
  9932. protocol: "accessing",
  9933. fn: function (){
  9934. var self=this,$self=this;
  9935. return $core.withContext(function($ctx1) {
  9936. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9937. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9938. },
  9939. args: [],
  9940. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9941. referencedClasses: [],
  9942. messageSends: ["copyFrom:to:", "-", "size"]
  9943. }),
  9944. $globals.SequenceableCollection);
  9945. $core.addMethod(
  9946. $core.method({
  9947. selector: "anyOne",
  9948. protocol: "accessing",
  9949. fn: function (){
  9950. var self=this,$self=this;
  9951. return $core.withContext(function($ctx1) {
  9952. return $self._at_((1));
  9953. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9954. },
  9955. args: [],
  9956. source: "anyOne\x0a\x09^ self at: 1",
  9957. referencedClasses: [],
  9958. messageSends: ["at:"]
  9959. }),
  9960. $globals.SequenceableCollection);
  9961. $core.addMethod(
  9962. $core.method({
  9963. selector: "atRandom",
  9964. protocol: "accessing",
  9965. fn: function (){
  9966. var self=this,$self=this;
  9967. return $core.withContext(function($ctx1) {
  9968. return $self._at_($recv($self._size())._atRandom());
  9969. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9970. },
  9971. args: [],
  9972. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9973. referencedClasses: [],
  9974. messageSends: ["at:", "atRandom", "size"]
  9975. }),
  9976. $globals.SequenceableCollection);
  9977. $core.addMethod(
  9978. $core.method({
  9979. selector: "beginsWith:",
  9980. protocol: "testing",
  9981. fn: function (prefix){
  9982. var self=this,$self=this;
  9983. return $core.withContext(function($ctx1) {
  9984. var $2,$3,$1;
  9985. $2=$self._size();
  9986. $ctx1.sendIdx["size"]=1;
  9987. $3=$recv(prefix)._size();
  9988. $ctx1.sendIdx["size"]=2;
  9989. $1=$recv($2).__lt($3);
  9990. if($core.assert($1)){
  9991. return false;
  9992. }
  9993. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9994. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9995. },
  9996. args: ["prefix"],
  9997. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9998. referencedClasses: [],
  9999. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  10000. }),
  10001. $globals.SequenceableCollection);
  10002. $core.addMethod(
  10003. $core.method({
  10004. selector: "copyFrom:to:",
  10005. protocol: "copying",
  10006. fn: function (anIndex,anotherIndex){
  10007. var self=this,$self=this;
  10008. return $core.withContext(function($ctx1) {
  10009. $self._subclassResponsibility();
  10010. return self;
  10011. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  10012. },
  10013. args: ["anIndex", "anotherIndex"],
  10014. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  10015. referencedClasses: [],
  10016. messageSends: ["subclassResponsibility"]
  10017. }),
  10018. $globals.SequenceableCollection);
  10019. $core.addMethod(
  10020. $core.method({
  10021. selector: "detect:ifNone:",
  10022. protocol: "enumerating",
  10023. fn: function (aBlock,anotherBlock){
  10024. var self=this,$self=this;
  10025. return $core.withContext(function($ctx1) {
  10026. var nself = $self._numericallyIndexable();
  10027. for(var i = 0; i < nself.length; i++)
  10028. if(aBlock._value_(nself[i]))
  10029. return nself[i];
  10030. return anotherBlock._value();
  10031. ;
  10032. return self;
  10033. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  10034. },
  10035. args: ["aBlock", "anotherBlock"],
  10036. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < nself.length; i++)\x0a\x09\x09\x09if(aBlock._value_(nself[i]))\x0a\x09\x09\x09\x09return nself[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09'>",
  10037. referencedClasses: [],
  10038. messageSends: []
  10039. }),
  10040. $globals.SequenceableCollection);
  10041. $core.addMethod(
  10042. $core.method({
  10043. selector: "do:",
  10044. protocol: "enumerating",
  10045. fn: function (aBlock){
  10046. var self=this,$self=this;
  10047. return $core.withContext(function($ctx1) {
  10048. var nself = $self._numericallyIndexable();
  10049. for(var i=0; i < nself.length; i++) {
  10050. aBlock._value_(nself[i]);
  10051. }
  10052. ;
  10053. return self;
  10054. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10055. },
  10056. args: ["aBlock"],
  10057. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_(nself[i]);\x0a\x09\x09}\x0a\x09'>",
  10058. referencedClasses: [],
  10059. messageSends: []
  10060. }),
  10061. $globals.SequenceableCollection);
  10062. $core.addMethod(
  10063. $core.method({
  10064. selector: "endsWith:",
  10065. protocol: "testing",
  10066. fn: function (suffix){
  10067. var self=this,$self=this;
  10068. return $core.withContext(function($ctx1) {
  10069. var $2,$3,$1;
  10070. $2=$self._size();
  10071. $ctx1.sendIdx["size"]=1;
  10072. $3=$recv(suffix)._size();
  10073. $ctx1.sendIdx["size"]=2;
  10074. $1=$recv($2).__lt($3);
  10075. if($core.assert($1)){
  10076. return false;
  10077. }
  10078. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  10079. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  10080. },
  10081. args: ["suffix"],
  10082. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  10083. referencedClasses: [],
  10084. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  10085. }),
  10086. $globals.SequenceableCollection);
  10087. $core.addMethod(
  10088. $core.method({
  10089. selector: "first",
  10090. protocol: "accessing",
  10091. fn: function (){
  10092. var self=this,$self=this;
  10093. return $core.withContext(function($ctx1) {
  10094. return $self._at_((1));
  10095. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  10096. },
  10097. args: [],
  10098. source: "first\x0a\x09^ self at: 1",
  10099. referencedClasses: [],
  10100. messageSends: ["at:"]
  10101. }),
  10102. $globals.SequenceableCollection);
  10103. $core.addMethod(
  10104. $core.method({
  10105. selector: "first:",
  10106. protocol: "accessing",
  10107. fn: function (aNumber){
  10108. var self=this,$self=this;
  10109. return $core.withContext(function($ctx1) {
  10110. var $1;
  10111. $1=$recv($self._size()).__lt(aNumber);
  10112. if($core.assert($1)){
  10113. $self._error_("Invalid number of elements");
  10114. }
  10115. return $self._copyFrom_to_((1),aNumber);
  10116. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10117. },
  10118. args: ["aNumber"],
  10119. 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",
  10120. referencedClasses: [],
  10121. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10122. }),
  10123. $globals.SequenceableCollection);
  10124. $core.addMethod(
  10125. $core.method({
  10126. selector: "fourth",
  10127. protocol: "accessing",
  10128. fn: function (){
  10129. var self=this,$self=this;
  10130. return $core.withContext(function($ctx1) {
  10131. return $self._at_((4));
  10132. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  10133. },
  10134. args: [],
  10135. source: "fourth\x0a\x09^ self at: 4",
  10136. referencedClasses: [],
  10137. messageSends: ["at:"]
  10138. }),
  10139. $globals.SequenceableCollection);
  10140. $core.addMethod(
  10141. $core.method({
  10142. selector: "includes:",
  10143. protocol: "testing",
  10144. fn: function (anObject){
  10145. var self=this,$self=this;
  10146. return $core.withContext(function($ctx1) {
  10147. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10148. return nil;
  10149. })))._notNil();
  10150. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  10151. },
  10152. args: ["anObject"],
  10153. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10154. referencedClasses: [],
  10155. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10156. }),
  10157. $globals.SequenceableCollection);
  10158. $core.addMethod(
  10159. $core.method({
  10160. selector: "indexOf:ifAbsent:",
  10161. protocol: "accessing",
  10162. fn: function (anObject,aBlock){
  10163. var self=this,$self=this;
  10164. return $core.withContext(function($ctx1) {
  10165. var nself = $self._numericallyIndexable();
  10166. for(var i=0; i < nself.length; i++) {
  10167. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10168. };
  10169. return aBlock._value();
  10170. ;
  10171. return self;
  10172. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  10173. },
  10174. args: ["anObject", "aBlock"],
  10175. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  10176. referencedClasses: [],
  10177. messageSends: []
  10178. }),
  10179. $globals.SequenceableCollection);
  10180. $core.addMethod(
  10181. $core.method({
  10182. selector: "indexOf:startingAt:",
  10183. protocol: "accessing",
  10184. fn: function (anObject,start){
  10185. var self=this,$self=this;
  10186. return $core.withContext(function($ctx1) {
  10187. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10188. return (0);
  10189. }));
  10190. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10191. },
  10192. args: ["anObject", "start"],
  10193. 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 ]",
  10194. referencedClasses: [],
  10195. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10196. }),
  10197. $globals.SequenceableCollection);
  10198. $core.addMethod(
  10199. $core.method({
  10200. selector: "indexOf:startingAt:ifAbsent:",
  10201. protocol: "accessing",
  10202. fn: function (anObject,start,aBlock){
  10203. var self=this,$self=this;
  10204. return $core.withContext(function($ctx1) {
  10205. var nself = $self._numericallyIndexable();
  10206. for(var i=start - 1; i < nself.length; i++){
  10207. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10208. }
  10209. return aBlock._value();
  10210. ;
  10211. return self;
  10212. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10213. },
  10214. args: ["anObject", "start", "aBlock"],
  10215. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < nself.length; i++){\x0a\x09\x09\x09if($recv(nself[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09'>",
  10216. referencedClasses: [],
  10217. messageSends: []
  10218. }),
  10219. $globals.SequenceableCollection);
  10220. $core.addMethod(
  10221. $core.method({
  10222. selector: "last",
  10223. protocol: "accessing",
  10224. fn: function (){
  10225. var self=this,$self=this;
  10226. return $core.withContext(function($ctx1) {
  10227. return $self._at_($self._size());
  10228. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10229. },
  10230. args: [],
  10231. source: "last\x0a\x09^ self at: self size",
  10232. referencedClasses: [],
  10233. messageSends: ["at:", "size"]
  10234. }),
  10235. $globals.SequenceableCollection);
  10236. $core.addMethod(
  10237. $core.method({
  10238. selector: "last:",
  10239. protocol: "accessing",
  10240. fn: function (aNumber){
  10241. var self=this,$self=this;
  10242. return $core.withContext(function($ctx1) {
  10243. var $2,$1,$5,$4,$3;
  10244. $2=$self._size();
  10245. $ctx1.sendIdx["size"]=1;
  10246. $1=$recv($2).__lt(aNumber);
  10247. if($core.assert($1)){
  10248. $self._error_("Invalid number of elements");
  10249. }
  10250. $5=$self._size();
  10251. $ctx1.sendIdx["size"]=2;
  10252. $4=$recv($5).__minus(aNumber);
  10253. $3=$recv($4).__plus((1));
  10254. return $self._copyFrom_to_($3,$self._size());
  10255. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10256. },
  10257. args: ["aNumber"],
  10258. 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",
  10259. referencedClasses: [],
  10260. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10261. }),
  10262. $globals.SequenceableCollection);
  10263. $core.addMethod(
  10264. $core.method({
  10265. selector: "newStream",
  10266. protocol: "streaming",
  10267. fn: function (){
  10268. var self=this,$self=this;
  10269. return $core.withContext(function($ctx1) {
  10270. return $recv($self._streamClass())._on_(self);
  10271. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10272. },
  10273. args: [],
  10274. source: "newStream\x0a\x09^ self streamClass on: self",
  10275. referencedClasses: [],
  10276. messageSends: ["on:", "streamClass"]
  10277. }),
  10278. $globals.SequenceableCollection);
  10279. $core.addMethod(
  10280. $core.method({
  10281. selector: "numericallyIndexable",
  10282. protocol: "private",
  10283. fn: function (){
  10284. var self=this,$self=this;
  10285. return $core.withContext(function($ctx1) {
  10286. $self._subclassResponsibility();
  10287. return self;
  10288. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  10289. },
  10290. args: [],
  10291. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  10292. referencedClasses: [],
  10293. messageSends: ["subclassResponsibility"]
  10294. }),
  10295. $globals.SequenceableCollection);
  10296. $core.addMethod(
  10297. $core.method({
  10298. selector: "readStream",
  10299. protocol: "streaming",
  10300. fn: function (){
  10301. var self=this,$self=this;
  10302. return $core.withContext(function($ctx1) {
  10303. return $self._stream();
  10304. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10305. },
  10306. args: [],
  10307. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10308. referencedClasses: [],
  10309. messageSends: ["stream"]
  10310. }),
  10311. $globals.SequenceableCollection);
  10312. $core.addMethod(
  10313. $core.method({
  10314. selector: "removeLast",
  10315. protocol: "adding/removing",
  10316. fn: function (){
  10317. var self=this,$self=this;
  10318. return $core.withContext(function($ctx1) {
  10319. return $self._remove_($self._last());
  10320. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10321. },
  10322. args: [],
  10323. source: "removeLast\x0a\x09^ self remove: self last",
  10324. referencedClasses: [],
  10325. messageSends: ["remove:", "last"]
  10326. }),
  10327. $globals.SequenceableCollection);
  10328. $core.addMethod(
  10329. $core.method({
  10330. selector: "reverseDo:",
  10331. protocol: "enumerating",
  10332. fn: function (aBlock){
  10333. var self=this,$self=this;
  10334. return $core.withContext(function($ctx1) {
  10335. $recv($self._reversed())._do_(aBlock);
  10336. return self;
  10337. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10338. },
  10339. args: ["aBlock"],
  10340. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10341. referencedClasses: [],
  10342. messageSends: ["do:", "reversed"]
  10343. }),
  10344. $globals.SequenceableCollection);
  10345. $core.addMethod(
  10346. $core.method({
  10347. selector: "reversed",
  10348. protocol: "converting",
  10349. fn: function (){
  10350. var self=this,$self=this;
  10351. return $core.withContext(function($ctx1) {
  10352. $self._subclassResponsibility();
  10353. return self;
  10354. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10355. },
  10356. args: [],
  10357. source: "reversed\x0a\x09self subclassResponsibility",
  10358. referencedClasses: [],
  10359. messageSends: ["subclassResponsibility"]
  10360. }),
  10361. $globals.SequenceableCollection);
  10362. $core.addMethod(
  10363. $core.method({
  10364. selector: "second",
  10365. protocol: "accessing",
  10366. fn: function (){
  10367. var self=this,$self=this;
  10368. return $core.withContext(function($ctx1) {
  10369. return $self._at_((2));
  10370. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10371. },
  10372. args: [],
  10373. source: "second\x0a\x09^ self at: 2",
  10374. referencedClasses: [],
  10375. messageSends: ["at:"]
  10376. }),
  10377. $globals.SequenceableCollection);
  10378. $core.addMethod(
  10379. $core.method({
  10380. selector: "single",
  10381. protocol: "accessing",
  10382. fn: function (){
  10383. var self=this,$self=this;
  10384. return $core.withContext(function($ctx1) {
  10385. if (self.length == 0) throw new Error("Collection is empty");
  10386. if (self.length > 1) throw new Error("Collection holds more than one element.");
  10387. return $self._numericallyIndexable()[0];;
  10388. return self;
  10389. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  10390. },
  10391. args: [],
  10392. 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._numericallyIndexable()[0];\x0a'>",
  10393. referencedClasses: [],
  10394. messageSends: []
  10395. }),
  10396. $globals.SequenceableCollection);
  10397. $core.addMethod(
  10398. $core.method({
  10399. selector: "stream",
  10400. protocol: "streaming",
  10401. fn: function (){
  10402. var self=this,$self=this;
  10403. return $core.withContext(function($ctx1) {
  10404. return $self._newStream();
  10405. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10406. },
  10407. args: [],
  10408. source: "stream\x0a\x09^ self newStream",
  10409. referencedClasses: [],
  10410. messageSends: ["newStream"]
  10411. }),
  10412. $globals.SequenceableCollection);
  10413. $core.addMethod(
  10414. $core.method({
  10415. selector: "streamClass",
  10416. protocol: "streaming",
  10417. fn: function (){
  10418. var self=this,$self=this;
  10419. return $core.withContext(function($ctx1) {
  10420. return $recv($self._class())._streamClass();
  10421. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10422. },
  10423. args: [],
  10424. source: "streamClass\x0a\x09^ self class streamClass",
  10425. referencedClasses: [],
  10426. messageSends: ["streamClass", "class"]
  10427. }),
  10428. $globals.SequenceableCollection);
  10429. $core.addMethod(
  10430. $core.method({
  10431. selector: "third",
  10432. protocol: "accessing",
  10433. fn: function (){
  10434. var self=this,$self=this;
  10435. return $core.withContext(function($ctx1) {
  10436. return $self._at_((3));
  10437. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10438. },
  10439. args: [],
  10440. source: "third\x0a\x09^ self at: 3",
  10441. referencedClasses: [],
  10442. messageSends: ["at:"]
  10443. }),
  10444. $globals.SequenceableCollection);
  10445. $core.addMethod(
  10446. $core.method({
  10447. selector: "with:do:",
  10448. protocol: "enumerating",
  10449. fn: function (anotherCollection,aBlock){
  10450. var self=this,$self=this;
  10451. return $core.withContext(function($ctx1) {
  10452. var nself = $self._numericallyIndexable();
  10453. anotherCollection = anotherCollection._numericallyIndexable();
  10454. for(var i=0; i<nself.length; i++) {
  10455. aBlock._value_value_(nself[i], anotherCollection[i]);
  10456. }
  10457. ;
  10458. return self;
  10459. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  10460. },
  10461. args: ["anotherCollection", "aBlock"],
  10462. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09'>",
  10463. referencedClasses: [],
  10464. messageSends: []
  10465. }),
  10466. $globals.SequenceableCollection);
  10467. $core.addMethod(
  10468. $core.method({
  10469. selector: "withIndexDo:",
  10470. protocol: "enumerating",
  10471. fn: function (aBlock){
  10472. var self=this,$self=this;
  10473. return $core.withContext(function($ctx1) {
  10474. var nself = $self._numericallyIndexable();
  10475. for(var i=0; i < nself.length; i++) {
  10476. aBlock._value_value_(nself[i], i+1);
  10477. }
  10478. ;
  10479. return self;
  10480. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10481. },
  10482. args: ["aBlock"],
  10483. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var nself = $self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < nself.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(nself[i], i+1);\x0a\x09\x09}\x0a\x09'>",
  10484. referencedClasses: [],
  10485. messageSends: []
  10486. }),
  10487. $globals.SequenceableCollection);
  10488. $core.addMethod(
  10489. $core.method({
  10490. selector: "writeStream",
  10491. protocol: "streaming",
  10492. fn: function (){
  10493. var self=this,$self=this;
  10494. return $core.withContext(function($ctx1) {
  10495. return $self._stream();
  10496. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10497. },
  10498. args: [],
  10499. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10500. referencedClasses: [],
  10501. messageSends: ["stream"]
  10502. }),
  10503. $globals.SequenceableCollection);
  10504. $core.addMethod(
  10505. $core.method({
  10506. selector: "streamClass",
  10507. protocol: "accessing",
  10508. fn: function (){
  10509. var self=this,$self=this;
  10510. return $globals.Stream;
  10511. },
  10512. args: [],
  10513. source: "streamClass\x0a\x09\x09^ Stream",
  10514. referencedClasses: ["Stream"],
  10515. messageSends: []
  10516. }),
  10517. $globals.SequenceableCollection.a$cls);
  10518. $core.addMethod(
  10519. $core.method({
  10520. selector: "streamContents:",
  10521. protocol: "streaming",
  10522. fn: function (aBlock){
  10523. var self=this,$self=this;
  10524. var stream;
  10525. return $core.withContext(function($ctx1) {
  10526. stream=$recv($self._streamClass())._on_($self._new());
  10527. $recv(aBlock)._value_(stream);
  10528. return $recv(stream)._contents();
  10529. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10530. },
  10531. args: ["aBlock"],
  10532. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10533. referencedClasses: [],
  10534. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10535. }),
  10536. $globals.SequenceableCollection.a$cls);
  10537. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10538. $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`.";
  10539. $core.addMethod(
  10540. $core.method({
  10541. selector: "add:",
  10542. protocol: "adding/removing",
  10543. fn: function (anObject){
  10544. var self=this,$self=this;
  10545. return $core.withContext(function($ctx1) {
  10546. self.push(anObject); return anObject;;
  10547. return self;
  10548. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10549. },
  10550. args: ["anObject"],
  10551. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10552. referencedClasses: [],
  10553. messageSends: []
  10554. }),
  10555. $globals.Array);
  10556. $core.addMethod(
  10557. $core.method({
  10558. selector: "addAll:",
  10559. protocol: "adding/removing",
  10560. fn: function (aCollection){
  10561. var self=this,$self=this;
  10562. return $core.withContext(function($ctx1) {
  10563. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10564. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10565. return aCollection;;
  10566. return self;
  10567. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10568. },
  10569. args: ["aCollection"],
  10570. 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'>",
  10571. referencedClasses: [],
  10572. messageSends: []
  10573. }),
  10574. $globals.Array);
  10575. $core.addMethod(
  10576. $core.method({
  10577. selector: "addFirst:",
  10578. protocol: "adding/removing",
  10579. fn: function (anObject){
  10580. var self=this,$self=this;
  10581. return $core.withContext(function($ctx1) {
  10582. self.unshift(anObject); return anObject;;
  10583. return self;
  10584. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10585. },
  10586. args: ["anObject"],
  10587. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10588. referencedClasses: [],
  10589. messageSends: []
  10590. }),
  10591. $globals.Array);
  10592. $core.addMethod(
  10593. $core.method({
  10594. selector: "asJavaScriptSource",
  10595. protocol: "converting",
  10596. fn: function (){
  10597. var self=this,$self=this;
  10598. return $core.withContext(function($ctx1) {
  10599. var $1;
  10600. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10601. return $core.withContext(function($ctx2) {
  10602. return $recv(each)._asJavaScriptSource();
  10603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10604. })))._join_(", "))).__comma("]");
  10605. $ctx1.sendIdx[","]=1;
  10606. return $1;
  10607. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10608. },
  10609. args: [],
  10610. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10611. referencedClasses: [],
  10612. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10613. }),
  10614. $globals.Array);
  10615. $core.addMethod(
  10616. $core.method({
  10617. selector: "at:ifAbsent:",
  10618. protocol: "accessing",
  10619. fn: function (anIndex,aBlock){
  10620. var self=this,$self=this;
  10621. return $core.withContext(function($ctx1) {
  10622. return anIndex >= 1 && anIndex <= self.length
  10623. ? self[anIndex - 1]
  10624. : aBlock._value()
  10625. ;
  10626. return self;
  10627. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  10628. },
  10629. args: ["anIndex", "aBlock"],
  10630. 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'>",
  10631. referencedClasses: [],
  10632. messageSends: []
  10633. }),
  10634. $globals.Array);
  10635. $core.addMethod(
  10636. $core.method({
  10637. selector: "at:ifPresent:ifAbsent:",
  10638. protocol: "accessing",
  10639. fn: function (anIndex,aBlock,anotherBlock){
  10640. var self=this,$self=this;
  10641. return $core.withContext(function($ctx1) {
  10642. return anIndex >= 1 && anIndex <= self.length
  10643. ? aBlock._value_(self[anIndex - 1])
  10644. : anotherBlock._value()
  10645. ;
  10646. return self;
  10647. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  10648. },
  10649. args: ["anIndex", "aBlock", "anotherBlock"],
  10650. 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'>",
  10651. referencedClasses: [],
  10652. messageSends: []
  10653. }),
  10654. $globals.Array);
  10655. $core.addMethod(
  10656. $core.method({
  10657. selector: "at:put:",
  10658. protocol: "accessing",
  10659. fn: function (anIndex,anObject){
  10660. var self=this,$self=this;
  10661. return $core.withContext(function($ctx1) {
  10662. return self[anIndex - 1] = anObject;
  10663. return self;
  10664. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10665. },
  10666. args: ["anIndex", "anObject"],
  10667. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10668. referencedClasses: [],
  10669. messageSends: []
  10670. }),
  10671. $globals.Array);
  10672. $core.addMethod(
  10673. $core.method({
  10674. selector: "collect:",
  10675. protocol: "enumerating",
  10676. fn: function (aBlock){
  10677. var self=this,$self=this;
  10678. return $core.withContext(function($ctx1) {
  10679. return self.map(function(each) {return aBlock._value_(each)});
  10680. return self;
  10681. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10682. },
  10683. args: ["aBlock"],
  10684. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10685. referencedClasses: [],
  10686. messageSends: []
  10687. }),
  10688. $globals.Array);
  10689. $core.addMethod(
  10690. $core.method({
  10691. selector: "copyFrom:to:",
  10692. protocol: "copying",
  10693. fn: function (anIndex,anotherIndex){
  10694. var self=this,$self=this;
  10695. return $core.withContext(function($ctx1) {
  10696. if (anIndex >= 1 && anotherIndex <= self.length) {
  10697. return self.slice(anIndex - 1, anotherIndex);
  10698. } else {
  10699. self._at_(anIndex);
  10700. self._at_(self.length + 1);
  10701. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10702. };
  10703. return self;
  10704. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10705. },
  10706. args: ["anIndex", "anotherIndex"],
  10707. 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'>",
  10708. referencedClasses: [],
  10709. messageSends: []
  10710. }),
  10711. $globals.Array);
  10712. $core.addMethod(
  10713. $core.method({
  10714. selector: "join:",
  10715. protocol: "enumerating",
  10716. fn: function (aString){
  10717. var self=this,$self=this;
  10718. return $core.withContext(function($ctx1) {
  10719. return self.join(aString);
  10720. return self;
  10721. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10722. },
  10723. args: ["aString"],
  10724. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10725. referencedClasses: [],
  10726. messageSends: []
  10727. }),
  10728. $globals.Array);
  10729. $core.addMethod(
  10730. $core.method({
  10731. selector: "numericallyIndexable",
  10732. protocol: "private",
  10733. fn: function (){
  10734. var self=this,$self=this;
  10735. return self;
  10736. },
  10737. args: [],
  10738. source: "numericallyIndexable\x0a\x09^ self",
  10739. referencedClasses: [],
  10740. messageSends: []
  10741. }),
  10742. $globals.Array);
  10743. $core.addMethod(
  10744. $core.method({
  10745. selector: "printOn:",
  10746. protocol: "printing",
  10747. fn: function (aStream){
  10748. var self=this,$self=this;
  10749. return $core.withContext(function($ctx1) {
  10750. (
  10751. $ctx1.supercall = true,
  10752. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10753. $ctx1.supercall = false;
  10754. $ctx1.sendIdx["printOn:"]=1;
  10755. $recv(aStream)._nextPutAll_(" (");
  10756. $ctx1.sendIdx["nextPutAll:"]=1;
  10757. $self._do_separatedBy_((function(each){
  10758. return $core.withContext(function($ctx2) {
  10759. return $recv(each)._printOn_(aStream);
  10760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10761. }),(function(){
  10762. return $core.withContext(function($ctx2) {
  10763. return $recv(aStream)._nextPutAll_(" ");
  10764. $ctx2.sendIdx["nextPutAll:"]=2;
  10765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10766. }));
  10767. $recv(aStream)._nextPutAll_(")");
  10768. return self;
  10769. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10770. },
  10771. args: ["aStream"],
  10772. 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: ')'",
  10773. referencedClasses: [],
  10774. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10775. }),
  10776. $globals.Array);
  10777. $core.addMethod(
  10778. $core.method({
  10779. selector: "remove:ifAbsent:",
  10780. protocol: "adding/removing",
  10781. fn: function (anObject,aBlock){
  10782. var self=this,$self=this;
  10783. var index;
  10784. return $core.withContext(function($ctx1) {
  10785. var $1;
  10786. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10787. return (0);
  10788. }));
  10789. $1=$recv(index).__eq((0));
  10790. if($core.assert($1)){
  10791. return $recv(aBlock)._value();
  10792. } else {
  10793. $self._removeIndex_(index);
  10794. return anObject;
  10795. }
  10796. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10797. },
  10798. args: ["anObject", "aBlock"],
  10799. 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 ]",
  10800. referencedClasses: [],
  10801. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10802. }),
  10803. $globals.Array);
  10804. $core.addMethod(
  10805. $core.method({
  10806. selector: "removeAll",
  10807. protocol: "adding/removing",
  10808. fn: function (){
  10809. var self=this,$self=this;
  10810. return $core.withContext(function($ctx1) {
  10811. self.length = 0;
  10812. return self;
  10813. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10814. },
  10815. args: [],
  10816. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10817. referencedClasses: [],
  10818. messageSends: []
  10819. }),
  10820. $globals.Array);
  10821. $core.addMethod(
  10822. $core.method({
  10823. selector: "removeFrom:to:",
  10824. protocol: "adding/removing",
  10825. fn: function (aNumber,anotherNumber){
  10826. var self=this,$self=this;
  10827. return $core.withContext(function($ctx1) {
  10828. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10829. return self;
  10830. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10831. },
  10832. args: ["aNumber", "anotherNumber"],
  10833. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10834. referencedClasses: [],
  10835. messageSends: []
  10836. }),
  10837. $globals.Array);
  10838. $core.addMethod(
  10839. $core.method({
  10840. selector: "removeIndex:",
  10841. protocol: "adding/removing",
  10842. fn: function (anInteger){
  10843. var self=this,$self=this;
  10844. return $core.withContext(function($ctx1) {
  10845. self.splice(anInteger - 1, 1);
  10846. return self;
  10847. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10848. },
  10849. args: ["anInteger"],
  10850. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10851. referencedClasses: [],
  10852. messageSends: []
  10853. }),
  10854. $globals.Array);
  10855. $core.addMethod(
  10856. $core.method({
  10857. selector: "removeLast",
  10858. protocol: "adding/removing",
  10859. fn: function (){
  10860. var self=this,$self=this;
  10861. return $core.withContext(function($ctx1) {
  10862. return self.pop();;
  10863. return self;
  10864. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10865. },
  10866. args: [],
  10867. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10868. referencedClasses: [],
  10869. messageSends: []
  10870. }),
  10871. $globals.Array);
  10872. $core.addMethod(
  10873. $core.method({
  10874. selector: "reversed",
  10875. protocol: "converting",
  10876. fn: function (){
  10877. var self=this,$self=this;
  10878. return $core.withContext(function($ctx1) {
  10879. return self.slice().reverse();
  10880. return self;
  10881. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10882. },
  10883. args: [],
  10884. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10885. referencedClasses: [],
  10886. messageSends: []
  10887. }),
  10888. $globals.Array);
  10889. $core.addMethod(
  10890. $core.method({
  10891. selector: "select:",
  10892. protocol: "enumerating",
  10893. fn: function (aBlock){
  10894. var self=this,$self=this;
  10895. return $core.withContext(function($ctx1) {
  10896. return self.filter(function(each) {return aBlock._value_(each)});
  10897. return self;
  10898. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10899. },
  10900. args: ["aBlock"],
  10901. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10902. referencedClasses: [],
  10903. messageSends: []
  10904. }),
  10905. $globals.Array);
  10906. $core.addMethod(
  10907. $core.method({
  10908. selector: "shallowCopy",
  10909. protocol: "copying",
  10910. fn: function (){
  10911. var self=this,$self=this;
  10912. return $core.withContext(function($ctx1) {
  10913. return self.slice();
  10914. return self;
  10915. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10916. },
  10917. args: [],
  10918. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10919. referencedClasses: [],
  10920. messageSends: []
  10921. }),
  10922. $globals.Array);
  10923. $core.addMethod(
  10924. $core.method({
  10925. selector: "size",
  10926. protocol: "accessing",
  10927. fn: function (){
  10928. var self=this,$self=this;
  10929. return $core.withContext(function($ctx1) {
  10930. return self.length;
  10931. return self;
  10932. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  10933. },
  10934. args: [],
  10935. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  10936. referencedClasses: [],
  10937. messageSends: []
  10938. }),
  10939. $globals.Array);
  10940. $core.addMethod(
  10941. $core.method({
  10942. selector: "sort",
  10943. protocol: "enumerating",
  10944. fn: function (){
  10945. var self=this,$self=this;
  10946. return $core.withContext(function($ctx1) {
  10947. return $self._sort_((function(a,b){
  10948. return $core.withContext(function($ctx2) {
  10949. return $recv(a).__lt(b);
  10950. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10951. }));
  10952. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10953. },
  10954. args: [],
  10955. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10956. referencedClasses: [],
  10957. messageSends: ["sort:", "<"]
  10958. }),
  10959. $globals.Array);
  10960. $core.addMethod(
  10961. $core.method({
  10962. selector: "sort:",
  10963. protocol: "enumerating",
  10964. fn: function (aBlock){
  10965. var self=this,$self=this;
  10966. return $core.withContext(function($ctx1) {
  10967. return self.sort(function(a, b) {
  10968. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10969. })
  10970. ;
  10971. return self;
  10972. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10973. },
  10974. args: ["aBlock"],
  10975. 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'>",
  10976. referencedClasses: [],
  10977. messageSends: []
  10978. }),
  10979. $globals.Array);
  10980. $core.addMethod(
  10981. $core.method({
  10982. selector: "sorted",
  10983. protocol: "enumerating",
  10984. fn: function (){
  10985. var self=this,$self=this;
  10986. return $core.withContext(function($ctx1) {
  10987. return $recv($self._copy())._sort();
  10988. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10989. },
  10990. args: [],
  10991. source: "sorted\x0a\x09^ self copy sort",
  10992. referencedClasses: [],
  10993. messageSends: ["sort", "copy"]
  10994. }),
  10995. $globals.Array);
  10996. $core.addMethod(
  10997. $core.method({
  10998. selector: "sorted:",
  10999. protocol: "enumerating",
  11000. fn: function (aBlock){
  11001. var self=this,$self=this;
  11002. return $core.withContext(function($ctx1) {
  11003. return $recv($self._copy())._sort_(aBlock);
  11004. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  11005. },
  11006. args: ["aBlock"],
  11007. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  11008. referencedClasses: [],
  11009. messageSends: ["sort:", "copy"]
  11010. }),
  11011. $globals.Array);
  11012. $core.addMethod(
  11013. $core.method({
  11014. selector: "new:",
  11015. protocol: "instance creation",
  11016. fn: function (anInteger){
  11017. var self=this,$self=this;
  11018. return $core.withContext(function($ctx1) {
  11019. return new Array(anInteger);
  11020. return self;
  11021. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  11022. },
  11023. args: ["anInteger"],
  11024. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  11025. referencedClasses: [],
  11026. messageSends: []
  11027. }),
  11028. $globals.Array.a$cls);
  11029. $core.addMethod(
  11030. $core.method({
  11031. selector: "with:",
  11032. protocol: "instance creation",
  11033. fn: function (anObject){
  11034. var self=this,$self=this;
  11035. return $core.withContext(function($ctx1) {
  11036. var $1;
  11037. $1=$self._new_((1));
  11038. $recv($1)._at_put_((1),anObject);
  11039. return $recv($1)._yourself();
  11040. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  11041. },
  11042. args: ["anObject"],
  11043. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  11044. referencedClasses: [],
  11045. messageSends: ["at:put:", "new:", "yourself"]
  11046. }),
  11047. $globals.Array.a$cls);
  11048. $core.addMethod(
  11049. $core.method({
  11050. selector: "with:with:",
  11051. protocol: "instance creation",
  11052. fn: function (anObject,anObject2){
  11053. var self=this,$self=this;
  11054. return $core.withContext(function($ctx1) {
  11055. var $1;
  11056. $1=$self._new_((2));
  11057. $recv($1)._at_put_((1),anObject);
  11058. $ctx1.sendIdx["at:put:"]=1;
  11059. $recv($1)._at_put_((2),anObject2);
  11060. return $recv($1)._yourself();
  11061. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  11062. },
  11063. args: ["anObject", "anObject2"],
  11064. 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",
  11065. referencedClasses: [],
  11066. messageSends: ["at:put:", "new:", "yourself"]
  11067. }),
  11068. $globals.Array.a$cls);
  11069. $core.addMethod(
  11070. $core.method({
  11071. selector: "with:with:with:",
  11072. protocol: "instance creation",
  11073. fn: function (anObject,anObject2,anObject3){
  11074. var self=this,$self=this;
  11075. return $core.withContext(function($ctx1) {
  11076. var $1;
  11077. $1=$self._new_((3));
  11078. $recv($1)._at_put_((1),anObject);
  11079. $ctx1.sendIdx["at:put:"]=1;
  11080. $recv($1)._at_put_((2),anObject2);
  11081. $ctx1.sendIdx["at:put:"]=2;
  11082. $recv($1)._at_put_((3),anObject3);
  11083. return $recv($1)._yourself();
  11084. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  11085. },
  11086. args: ["anObject", "anObject2", "anObject3"],
  11087. 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",
  11088. referencedClasses: [],
  11089. messageSends: ["at:put:", "new:", "yourself"]
  11090. }),
  11091. $globals.Array.a$cls);
  11092. $core.addMethod(
  11093. $core.method({
  11094. selector: "withAll:",
  11095. protocol: "instance creation",
  11096. fn: function (aCollection){
  11097. var self=this,$self=this;
  11098. var instance,index;
  11099. return $core.withContext(function($ctx1) {
  11100. index=(1);
  11101. instance=$self._new_($recv(aCollection)._size());
  11102. $recv(aCollection)._do_((function(each){
  11103. return $core.withContext(function($ctx2) {
  11104. $recv(instance)._at_put_(index,each);
  11105. index=$recv(index).__plus((1));
  11106. return index;
  11107. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11108. }));
  11109. return instance;
  11110. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  11111. },
  11112. args: ["aCollection"],
  11113. 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",
  11114. referencedClasses: [],
  11115. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  11116. }),
  11117. $globals.Array.a$cls);
  11118. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  11119. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  11120. $core.addMethod(
  11121. $core.method({
  11122. selector: ",",
  11123. protocol: "copying",
  11124. fn: function (aString){
  11125. var self=this,$self=this;
  11126. return $core.withContext(function($ctx1) {
  11127. var $1;
  11128. $1=$self._asString();
  11129. $ctx1.sendIdx["asString"]=1;
  11130. return $recv($1).__comma($recv(aString)._asString());
  11131. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  11132. },
  11133. args: ["aString"],
  11134. source: ", aString\x0a\x09^ self asString, aString asString",
  11135. referencedClasses: [],
  11136. messageSends: [",", "asString"]
  11137. }),
  11138. $globals.CharacterArray);
  11139. $core.addMethod(
  11140. $core.method({
  11141. selector: "add:",
  11142. protocol: "adding/removing",
  11143. fn: function (anObject){
  11144. var self=this,$self=this;
  11145. return $core.withContext(function($ctx1) {
  11146. $self._errorReadOnly();
  11147. return self;
  11148. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  11149. },
  11150. args: ["anObject"],
  11151. source: "add: anObject\x0a\x09self errorReadOnly",
  11152. referencedClasses: [],
  11153. messageSends: ["errorReadOnly"]
  11154. }),
  11155. $globals.CharacterArray);
  11156. $core.addMethod(
  11157. $core.method({
  11158. selector: "asLowercase",
  11159. protocol: "converting",
  11160. fn: function (){
  11161. var self=this,$self=this;
  11162. return $core.withContext(function($ctx1) {
  11163. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  11164. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  11165. },
  11166. args: [],
  11167. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  11168. referencedClasses: [],
  11169. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  11170. }),
  11171. $globals.CharacterArray);
  11172. $core.addMethod(
  11173. $core.method({
  11174. selector: "asNumber",
  11175. protocol: "converting",
  11176. fn: function (){
  11177. var self=this,$self=this;
  11178. return $core.withContext(function($ctx1) {
  11179. return $recv($self._asString())._asNumber();
  11180. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  11181. },
  11182. args: [],
  11183. source: "asNumber\x0a\x09^ self asString asNumber",
  11184. referencedClasses: [],
  11185. messageSends: ["asNumber", "asString"]
  11186. }),
  11187. $globals.CharacterArray);
  11188. $core.addMethod(
  11189. $core.method({
  11190. selector: "asString",
  11191. protocol: "converting",
  11192. fn: function (){
  11193. var self=this,$self=this;
  11194. return $core.withContext(function($ctx1) {
  11195. return $self._subclassResponsibility();
  11196. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  11197. },
  11198. args: [],
  11199. source: "asString\x0a\x09^ self subclassResponsibility",
  11200. referencedClasses: [],
  11201. messageSends: ["subclassResponsibility"]
  11202. }),
  11203. $globals.CharacterArray);
  11204. $core.addMethod(
  11205. $core.method({
  11206. selector: "asSymbol",
  11207. protocol: "converting",
  11208. fn: function (){
  11209. var self=this,$self=this;
  11210. return $core.withContext(function($ctx1) {
  11211. return $self._asString();
  11212. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  11213. },
  11214. args: [],
  11215. source: "asSymbol\x0a\x09^ self asString",
  11216. referencedClasses: [],
  11217. messageSends: ["asString"]
  11218. }),
  11219. $globals.CharacterArray);
  11220. $core.addMethod(
  11221. $core.method({
  11222. selector: "asSymbolPrintOn:",
  11223. protocol: "printing",
  11224. fn: function (aStream){
  11225. var self=this,$self=this;
  11226. return $core.withContext(function($ctx1) {
  11227. var $1;
  11228. $recv(aStream)._nextPutAll_("#");
  11229. $1=$recv($self._asString())._isSelector();
  11230. if($core.assert($1)){
  11231. $recv(aStream)._nextPut_(self);
  11232. } else {
  11233. $self._printOn_(aStream);
  11234. }
  11235. return self;
  11236. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  11237. },
  11238. args: ["aStream"],
  11239. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11240. referencedClasses: [],
  11241. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11242. }),
  11243. $globals.CharacterArray);
  11244. $core.addMethod(
  11245. $core.method({
  11246. selector: "asUppercase",
  11247. protocol: "converting",
  11248. fn: function (){
  11249. var self=this,$self=this;
  11250. return $core.withContext(function($ctx1) {
  11251. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  11252. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  11253. },
  11254. args: [],
  11255. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  11256. referencedClasses: [],
  11257. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  11258. }),
  11259. $globals.CharacterArray);
  11260. $core.addMethod(
  11261. $core.method({
  11262. selector: "at:put:",
  11263. protocol: "accessing",
  11264. fn: function (anIndex,anObject){
  11265. var self=this,$self=this;
  11266. return $core.withContext(function($ctx1) {
  11267. $self._errorReadOnly();
  11268. return self;
  11269. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  11270. },
  11271. args: ["anIndex", "anObject"],
  11272. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11273. referencedClasses: [],
  11274. messageSends: ["errorReadOnly"]
  11275. }),
  11276. $globals.CharacterArray);
  11277. $core.addMethod(
  11278. $core.method({
  11279. selector: "errorReadOnly",
  11280. protocol: "error handling",
  11281. fn: function (){
  11282. var self=this,$self=this;
  11283. return $core.withContext(function($ctx1) {
  11284. $self._error_("Object is read-only");
  11285. return self;
  11286. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  11287. },
  11288. args: [],
  11289. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11290. referencedClasses: [],
  11291. messageSends: ["error:"]
  11292. }),
  11293. $globals.CharacterArray);
  11294. $core.addMethod(
  11295. $core.method({
  11296. selector: "printOn:",
  11297. protocol: "printing",
  11298. fn: function (aStream){
  11299. var self=this,$self=this;
  11300. return $core.withContext(function($ctx1) {
  11301. $recv($self._asString())._printOn_(aStream);
  11302. return self;
  11303. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  11304. },
  11305. args: ["aStream"],
  11306. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  11307. referencedClasses: [],
  11308. messageSends: ["printOn:", "asString"]
  11309. }),
  11310. $globals.CharacterArray);
  11311. $core.addMethod(
  11312. $core.method({
  11313. selector: "putOn:",
  11314. protocol: "streaming",
  11315. fn: function (aStream){
  11316. var self=this,$self=this;
  11317. return $core.withContext(function($ctx1) {
  11318. $recv(aStream)._nextPutString_(self);
  11319. return self;
  11320. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  11321. },
  11322. args: ["aStream"],
  11323. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11324. referencedClasses: [],
  11325. messageSends: ["nextPutString:"]
  11326. }),
  11327. $globals.CharacterArray);
  11328. $core.addMethod(
  11329. $core.method({
  11330. selector: "remove:",
  11331. protocol: "adding/removing",
  11332. fn: function (anObject){
  11333. var self=this,$self=this;
  11334. return $core.withContext(function($ctx1) {
  11335. $self._errorReadOnly();
  11336. return self;
  11337. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  11338. },
  11339. args: ["anObject"],
  11340. source: "remove: anObject\x0a\x09self errorReadOnly",
  11341. referencedClasses: [],
  11342. messageSends: ["errorReadOnly"]
  11343. }),
  11344. $globals.CharacterArray);
  11345. $core.addMethod(
  11346. $core.method({
  11347. selector: "remove:ifAbsent:",
  11348. protocol: "adding/removing",
  11349. fn: function (anObject,aBlock){
  11350. var self=this,$self=this;
  11351. return $core.withContext(function($ctx1) {
  11352. $self._errorReadOnly();
  11353. return self;
  11354. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.CharacterArray)});
  11355. },
  11356. args: ["anObject", "aBlock"],
  11357. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11358. referencedClasses: [],
  11359. messageSends: ["errorReadOnly"]
  11360. }),
  11361. $globals.CharacterArray);
  11362. $core.addMethod(
  11363. $core.method({
  11364. selector: "symbolPrintString",
  11365. protocol: "printing",
  11366. fn: function (){
  11367. var self=this,$self=this;
  11368. return $core.withContext(function($ctx1) {
  11369. return $recv($globals.String)._streamContents_((function(str){
  11370. return $core.withContext(function($ctx2) {
  11371. return $self._asSymbolPrintOn_(str);
  11372. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11373. }));
  11374. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  11375. },
  11376. args: [],
  11377. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11378. referencedClasses: ["String"],
  11379. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11380. }),
  11381. $globals.CharacterArray);
  11382. $core.addMethod(
  11383. $core.method({
  11384. selector: "fromString:",
  11385. protocol: "instance creation",
  11386. fn: function (aString){
  11387. var self=this,$self=this;
  11388. return $core.withContext(function($ctx1) {
  11389. $self._subclassResponsibility();
  11390. return self;
  11391. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  11392. },
  11393. args: ["aString"],
  11394. source: "fromString: aString\x0a\x09self subclassResponsibility",
  11395. referencedClasses: [],
  11396. messageSends: ["subclassResponsibility"]
  11397. }),
  11398. $globals.CharacterArray.a$cls);
  11399. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  11400. $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 >> #,`";
  11401. $core.addMethod(
  11402. $core.method({
  11403. selector: ",",
  11404. protocol: "copying",
  11405. fn: function (aString){
  11406. var self=this,$self=this;
  11407. return $core.withContext(function($ctx1) {
  11408. return String(self) + aString;
  11409. return self;
  11410. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  11411. },
  11412. args: ["aString"],
  11413. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  11414. referencedClasses: [],
  11415. messageSends: []
  11416. }),
  11417. $globals.String);
  11418. $core.addMethod(
  11419. $core.method({
  11420. selector: "<",
  11421. protocol: "comparing",
  11422. fn: function (aString){
  11423. var self=this,$self=this;
  11424. return $core.withContext(function($ctx1) {
  11425. return String(self) < aString._asString();
  11426. return self;
  11427. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  11428. },
  11429. args: ["aString"],
  11430. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  11431. referencedClasses: [],
  11432. messageSends: []
  11433. }),
  11434. $globals.String);
  11435. $core.addMethod(
  11436. $core.method({
  11437. selector: "<=",
  11438. protocol: "comparing",
  11439. fn: function (aString){
  11440. var self=this,$self=this;
  11441. return $core.withContext(function($ctx1) {
  11442. return String(self) <= aString._asString();
  11443. return self;
  11444. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  11445. },
  11446. args: ["aString"],
  11447. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  11448. referencedClasses: [],
  11449. messageSends: []
  11450. }),
  11451. $globals.String);
  11452. $core.addMethod(
  11453. $core.method({
  11454. selector: "=",
  11455. protocol: "comparing",
  11456. fn: function (aString){
  11457. var self=this,$self=this;
  11458. return $core.withContext(function($ctx1) {
  11459. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  11460. return self;
  11461. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  11462. },
  11463. args: ["aString"],
  11464. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  11465. referencedClasses: [],
  11466. messageSends: []
  11467. }),
  11468. $globals.String);
  11469. $core.addMethod(
  11470. $core.method({
  11471. selector: "==",
  11472. protocol: "comparing",
  11473. fn: function (aString){
  11474. var self=this,$self=this;
  11475. return $core.withContext(function($ctx1) {
  11476. if (typeof aString === "string") return String(self) === aString;
  11477. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  11478. else return false;;
  11479. return self;
  11480. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  11481. },
  11482. args: ["aString"],
  11483. 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'>",
  11484. referencedClasses: [],
  11485. messageSends: []
  11486. }),
  11487. $globals.String);
  11488. $core.addMethod(
  11489. $core.method({
  11490. selector: ">",
  11491. protocol: "comparing",
  11492. fn: function (aString){
  11493. var self=this,$self=this;
  11494. return $core.withContext(function($ctx1) {
  11495. return String(self) > aString._asString();
  11496. return self;
  11497. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  11498. },
  11499. args: ["aString"],
  11500. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11501. referencedClasses: [],
  11502. messageSends: []
  11503. }),
  11504. $globals.String);
  11505. $core.addMethod(
  11506. $core.method({
  11507. selector: ">=",
  11508. protocol: "comparing",
  11509. fn: function (aString){
  11510. var self=this,$self=this;
  11511. return $core.withContext(function($ctx1) {
  11512. return String(self) >= aString._asString();
  11513. return self;
  11514. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  11515. },
  11516. args: ["aString"],
  11517. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11518. referencedClasses: [],
  11519. messageSends: []
  11520. }),
  11521. $globals.String);
  11522. $core.addMethod(
  11523. $core.method({
  11524. selector: "asJavaScriptMethodName",
  11525. protocol: "converting",
  11526. fn: function (){
  11527. var self=this,$self=this;
  11528. return $core.withContext(function($ctx1) {
  11529. return $core.st2js(self);
  11530. return self;
  11531. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  11532. },
  11533. args: [],
  11534. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11535. referencedClasses: [],
  11536. messageSends: []
  11537. }),
  11538. $globals.String);
  11539. $core.addMethod(
  11540. $core.method({
  11541. selector: "asJavaScriptObject",
  11542. protocol: "converting",
  11543. fn: function (){
  11544. var self=this,$self=this;
  11545. return self;
  11546. },
  11547. args: [],
  11548. source: "asJavaScriptObject\x0a\x09^ self",
  11549. referencedClasses: [],
  11550. messageSends: []
  11551. }),
  11552. $globals.String);
  11553. $core.addMethod(
  11554. $core.method({
  11555. selector: "asJavaScriptSource",
  11556. protocol: "converting",
  11557. fn: function (){
  11558. var self=this,$self=this;
  11559. return $core.withContext(function($ctx1) {
  11560. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11561. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11562. else
  11563. return "\"" + self + "\"";
  11564. ;
  11565. return self;
  11566. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  11567. },
  11568. args: [],
  11569. 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'>",
  11570. referencedClasses: [],
  11571. messageSends: []
  11572. }),
  11573. $globals.String);
  11574. $core.addMethod(
  11575. $core.method({
  11576. selector: "asLowercase",
  11577. protocol: "converting",
  11578. fn: function (){
  11579. var self=this,$self=this;
  11580. return $core.withContext(function($ctx1) {
  11581. return self.toLowerCase();
  11582. return self;
  11583. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  11584. },
  11585. args: [],
  11586. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11587. referencedClasses: [],
  11588. messageSends: []
  11589. }),
  11590. $globals.String);
  11591. $core.addMethod(
  11592. $core.method({
  11593. selector: "asMutator",
  11594. protocol: "converting",
  11595. fn: function (){
  11596. var self=this,$self=this;
  11597. return $core.withContext(function($ctx1) {
  11598. var $1;
  11599. $1=$recv($self._last()).__eq(":");
  11600. if(!$core.assert($1)){
  11601. return $self.__comma(":");
  11602. }
  11603. return self;
  11604. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11605. },
  11606. args: [],
  11607. 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",
  11608. referencedClasses: [],
  11609. messageSends: ["ifFalse:", "=", "last", ","]
  11610. }),
  11611. $globals.String);
  11612. $core.addMethod(
  11613. $core.method({
  11614. selector: "asNumber",
  11615. protocol: "converting",
  11616. fn: function (){
  11617. var self=this,$self=this;
  11618. return $core.withContext(function($ctx1) {
  11619. return Number(self);
  11620. return self;
  11621. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11622. },
  11623. args: [],
  11624. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11625. referencedClasses: [],
  11626. messageSends: []
  11627. }),
  11628. $globals.String);
  11629. $core.addMethod(
  11630. $core.method({
  11631. selector: "asRegexp",
  11632. protocol: "converting",
  11633. fn: function (){
  11634. var self=this,$self=this;
  11635. return $core.withContext(function($ctx1) {
  11636. return $recv($globals.RegularExpression)._fromString_(self);
  11637. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11638. },
  11639. args: [],
  11640. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11641. referencedClasses: ["RegularExpression"],
  11642. messageSends: ["fromString:"]
  11643. }),
  11644. $globals.String);
  11645. $core.addMethod(
  11646. $core.method({
  11647. selector: "asString",
  11648. protocol: "converting",
  11649. fn: function (){
  11650. var self=this,$self=this;
  11651. return self;
  11652. },
  11653. args: [],
  11654. source: "asString\x0a\x09^ self",
  11655. referencedClasses: [],
  11656. messageSends: []
  11657. }),
  11658. $globals.String);
  11659. $core.addMethod(
  11660. $core.method({
  11661. selector: "asSymbol",
  11662. protocol: "converting",
  11663. fn: function (){
  11664. var self=this,$self=this;
  11665. return self;
  11666. },
  11667. args: [],
  11668. source: "asSymbol\x0a\x09^ self",
  11669. referencedClasses: [],
  11670. messageSends: []
  11671. }),
  11672. $globals.String);
  11673. $core.addMethod(
  11674. $core.method({
  11675. selector: "asUppercase",
  11676. protocol: "converting",
  11677. fn: function (){
  11678. var self=this,$self=this;
  11679. return $core.withContext(function($ctx1) {
  11680. return self.toUpperCase();
  11681. return self;
  11682. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11683. },
  11684. args: [],
  11685. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11686. referencedClasses: [],
  11687. messageSends: []
  11688. }),
  11689. $globals.String);
  11690. $core.addMethod(
  11691. $core.method({
  11692. selector: "asciiValue",
  11693. protocol: "accessing",
  11694. fn: function (){
  11695. var self=this,$self=this;
  11696. return $core.withContext(function($ctx1) {
  11697. return self.charCodeAt(0);;
  11698. return self;
  11699. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11700. },
  11701. args: [],
  11702. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11703. referencedClasses: [],
  11704. messageSends: []
  11705. }),
  11706. $globals.String);
  11707. $core.addMethod(
  11708. $core.method({
  11709. selector: "at:ifAbsent:",
  11710. protocol: "accessing",
  11711. fn: function (anIndex,aBlock){
  11712. var self=this,$self=this;
  11713. return $core.withContext(function($ctx1) {
  11714. return String(self)[anIndex - 1] || aBlock._value();
  11715. return self;
  11716. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11717. },
  11718. args: ["anIndex", "aBlock"],
  11719. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11720. referencedClasses: [],
  11721. messageSends: []
  11722. }),
  11723. $globals.String);
  11724. $core.addMethod(
  11725. $core.method({
  11726. selector: "at:ifPresent:ifAbsent:",
  11727. protocol: "accessing",
  11728. fn: function (anIndex,aBlock,anotherBlock){
  11729. var self=this,$self=this;
  11730. return $core.withContext(function($ctx1) {
  11731. var result = String(self)[anIndex - 1];
  11732. return result ? aBlock._value_(result) : anotherBlock._value();
  11733. ;
  11734. return self;
  11735. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11736. },
  11737. args: ["anIndex", "aBlock", "anotherBlock"],
  11738. 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'>",
  11739. referencedClasses: [],
  11740. messageSends: []
  11741. }),
  11742. $globals.String);
  11743. $core.addMethod(
  11744. $core.method({
  11745. selector: "capitalized",
  11746. protocol: "converting",
  11747. fn: function (){
  11748. var self=this,$self=this;
  11749. return $core.withContext(function($ctx1) {
  11750. return $self._ifNotEmpty_((function(){
  11751. return $core.withContext(function($ctx2) {
  11752. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11753. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11754. }));
  11755. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11756. },
  11757. args: [],
  11758. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11759. referencedClasses: [],
  11760. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11761. }),
  11762. $globals.String);
  11763. $core.addMethod(
  11764. $core.method({
  11765. selector: "charCodeAt:",
  11766. protocol: "accessing",
  11767. fn: function (anInteger){
  11768. var self=this,$self=this;
  11769. return $core.withContext(function($ctx1) {
  11770. return self.charCodeAt(anInteger - 1);
  11771. return self;
  11772. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11773. },
  11774. args: ["anInteger"],
  11775. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11776. referencedClasses: [],
  11777. messageSends: []
  11778. }),
  11779. $globals.String);
  11780. $core.addMethod(
  11781. $core.method({
  11782. selector: "copyFrom:to:",
  11783. protocol: "copying",
  11784. fn: function (anIndex,anotherIndex){
  11785. var self=this,$self=this;
  11786. return $core.withContext(function($ctx1) {
  11787. return self.substring(anIndex - 1, anotherIndex);
  11788. return self;
  11789. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11790. },
  11791. args: ["anIndex", "anotherIndex"],
  11792. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11793. referencedClasses: [],
  11794. messageSends: []
  11795. }),
  11796. $globals.String);
  11797. $core.addMethod(
  11798. $core.method({
  11799. selector: "crlfSanitized",
  11800. protocol: "converting",
  11801. fn: function (){
  11802. var self=this,$self=this;
  11803. return $core.withContext(function($ctx1) {
  11804. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11805. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11806. },
  11807. args: [],
  11808. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11809. referencedClasses: ["String"],
  11810. messageSends: ["join:", "lines", "lf"]
  11811. }),
  11812. $globals.String);
  11813. $core.addMethod(
  11814. $core.method({
  11815. selector: "deepCopy",
  11816. protocol: "copying",
  11817. fn: function (){
  11818. var self=this,$self=this;
  11819. return $core.withContext(function($ctx1) {
  11820. return $self._shallowCopy();
  11821. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11822. },
  11823. args: [],
  11824. source: "deepCopy\x0a\x09^ self shallowCopy",
  11825. referencedClasses: [],
  11826. messageSends: ["shallowCopy"]
  11827. }),
  11828. $globals.String);
  11829. $core.addMethod(
  11830. $core.method({
  11831. selector: "escaped",
  11832. protocol: "converting",
  11833. fn: function (){
  11834. var self=this,$self=this;
  11835. return $core.withContext(function($ctx1) {
  11836. return escape(self);
  11837. return self;
  11838. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11839. },
  11840. args: [],
  11841. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11842. referencedClasses: [],
  11843. messageSends: []
  11844. }),
  11845. $globals.String);
  11846. $core.addMethod(
  11847. $core.method({
  11848. selector: "includesSubString:",
  11849. protocol: "testing",
  11850. fn: function (subString){
  11851. var self=this,$self=this;
  11852. return $core.withContext(function($ctx1) {
  11853. return self.indexOf(subString) != -1;
  11854. return self;
  11855. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11856. },
  11857. args: ["subString"],
  11858. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11859. referencedClasses: [],
  11860. messageSends: []
  11861. }),
  11862. $globals.String);
  11863. $core.addMethod(
  11864. $core.method({
  11865. selector: "isCapitalized",
  11866. protocol: "testing",
  11867. fn: function (){
  11868. var self=this,$self=this;
  11869. return $core.withContext(function($ctx1) {
  11870. var $2,$1;
  11871. $2=$self._first();
  11872. $ctx1.sendIdx["first"]=1;
  11873. $1=$recv($2)._asUppercase();
  11874. return $recv($1).__eq_eq($self._first());
  11875. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11876. },
  11877. args: [],
  11878. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11879. referencedClasses: [],
  11880. messageSends: ["==", "asUppercase", "first"]
  11881. }),
  11882. $globals.String);
  11883. $core.addMethod(
  11884. $core.method({
  11885. selector: "isImmutable",
  11886. protocol: "testing",
  11887. fn: function (){
  11888. var self=this,$self=this;
  11889. return true;
  11890. },
  11891. args: [],
  11892. source: "isImmutable\x0a\x09^ true",
  11893. referencedClasses: [],
  11894. messageSends: []
  11895. }),
  11896. $globals.String);
  11897. $core.addMethod(
  11898. $core.method({
  11899. selector: "isSelector",
  11900. protocol: "testing",
  11901. fn: function (){
  11902. var self=this,$self=this;
  11903. return $core.withContext(function($ctx1) {
  11904. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11905. return self;
  11906. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11907. },
  11908. args: [],
  11909. 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>",
  11910. referencedClasses: [],
  11911. messageSends: []
  11912. }),
  11913. $globals.String);
  11914. $core.addMethod(
  11915. $core.method({
  11916. selector: "isString",
  11917. protocol: "testing",
  11918. fn: function (){
  11919. var self=this,$self=this;
  11920. return true;
  11921. },
  11922. args: [],
  11923. source: "isString\x0a\x09^ true",
  11924. referencedClasses: [],
  11925. messageSends: []
  11926. }),
  11927. $globals.String);
  11928. $core.addMethod(
  11929. $core.method({
  11930. selector: "isVowel",
  11931. protocol: "testing",
  11932. fn: function (){
  11933. var self=this,$self=this;
  11934. return $core.withContext(function($ctx1) {
  11935. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11936. return $core.withContext(function($ctx2) {
  11937. return "aeiou"._includes_($self._asLowercase());
  11938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11939. }));
  11940. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11941. },
  11942. args: [],
  11943. 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 ]",
  11944. referencedClasses: [],
  11945. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11946. }),
  11947. $globals.String);
  11948. $core.addMethod(
  11949. $core.method({
  11950. selector: "join:",
  11951. protocol: "split join",
  11952. fn: function (aCollection){
  11953. var self=this,$self=this;
  11954. return $core.withContext(function($ctx1) {
  11955. return $recv($globals.String)._streamContents_((function(stream){
  11956. return $core.withContext(function($ctx2) {
  11957. return $recv(aCollection)._do_separatedBy_((function(each){
  11958. return $core.withContext(function($ctx3) {
  11959. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11960. $ctx3.sendIdx["nextPutAll:"]=1;
  11961. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11962. }),(function(){
  11963. return $core.withContext(function($ctx3) {
  11964. return $recv(stream)._nextPutAll_(self);
  11965. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11966. }));
  11967. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11968. }));
  11969. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11970. },
  11971. args: ["aCollection"],
  11972. 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 ]]",
  11973. referencedClasses: ["String"],
  11974. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11975. }),
  11976. $globals.String);
  11977. $core.addMethod(
  11978. $core.method({
  11979. selector: "lineIndicesDo:",
  11980. protocol: "split join",
  11981. fn: function (aBlock){
  11982. var self=this,$self=this;
  11983. var cr,lf,start,sz,nextLF,nextCR;
  11984. return $core.withContext(function($ctx1) {
  11985. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11986. var $early={};
  11987. try {
  11988. start=(1);
  11989. sz=$self._size();
  11990. cr=$recv($globals.String)._cr();
  11991. nextCR=$self._indexOf_startingAt_(cr,(1));
  11992. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11993. lf=$recv($globals.String)._lf();
  11994. nextLF=$self._indexOf_startingAt_(lf,(1));
  11995. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11996. $recv((function(){
  11997. return $core.withContext(function($ctx2) {
  11998. return $recv(start).__lt_eq(sz);
  11999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12000. }))._whileTrue_((function(){
  12001. return $core.withContext(function($ctx2) {
  12002. $2=$recv(nextLF).__eq((0));
  12003. $ctx2.sendIdx["="]=1;
  12004. $1=$recv($2)._and_((function(){
  12005. return $core.withContext(function($ctx3) {
  12006. return $recv(nextCR).__eq((0));
  12007. $ctx3.sendIdx["="]=2;
  12008. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  12009. }));
  12010. $ctx2.sendIdx["and:"]=1;
  12011. if($core.assert($1)){
  12012. $recv(aBlock)._value_value_value_(start,sz,sz);
  12013. $ctx2.sendIdx["value:value:value:"]=1;
  12014. throw $early=[self];
  12015. }
  12016. $4=$recv(nextCR).__eq((0));
  12017. $ctx2.sendIdx["="]=3;
  12018. $3=$recv($4)._or_((function(){
  12019. return $core.withContext(function($ctx3) {
  12020. $5=(0).__lt(nextLF);
  12021. $ctx3.sendIdx["<"]=1;
  12022. return $recv($5)._and_((function(){
  12023. return $core.withContext(function($ctx4) {
  12024. return $recv(nextLF).__lt(nextCR);
  12025. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  12026. }));
  12027. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  12028. }));
  12029. if($core.assert($3)){
  12030. $6=start;
  12031. $7=$recv(nextLF).__minus((1));
  12032. $ctx2.sendIdx["-"]=1;
  12033. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  12034. $ctx2.sendIdx["value:value:value:"]=2;
  12035. start=(1).__plus(nextLF);
  12036. $ctx2.sendIdx["+"]=1;
  12037. nextLF=$self._indexOf_startingAt_(lf,start);
  12038. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  12039. return nextLF;
  12040. } else {
  12041. $9=(1).__plus(nextCR);
  12042. $ctx2.sendIdx["+"]=2;
  12043. $8=$recv($9).__eq(nextLF);
  12044. if($core.assert($8)){
  12045. $10=start;
  12046. $11=$recv(nextCR).__minus((1));
  12047. $ctx2.sendIdx["-"]=2;
  12048. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  12049. $ctx2.sendIdx["value:value:value:"]=3;
  12050. start=(1).__plus(nextLF);
  12051. $ctx2.sendIdx["+"]=3;
  12052. nextCR=$self._indexOf_startingAt_(cr,start);
  12053. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  12054. nextLF=$self._indexOf_startingAt_(lf,start);
  12055. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  12056. return nextLF;
  12057. } else {
  12058. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  12059. start=(1).__plus(nextCR);
  12060. nextCR=$self._indexOf_startingAt_(cr,start);
  12061. return nextCR;
  12062. }
  12063. }
  12064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12065. }));
  12066. return self;
  12067. }
  12068. catch(e) {if(e===$early)return e[0]; throw e}
  12069. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  12070. },
  12071. args: ["aBlock"],
  12072. 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 ] ]]",
  12073. referencedClasses: ["String"],
  12074. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  12075. }),
  12076. $globals.String);
  12077. $core.addMethod(
  12078. $core.method({
  12079. selector: "lineNumber:",
  12080. protocol: "split join",
  12081. fn: function (anIndex){
  12082. var self=this,$self=this;
  12083. var lineCount;
  12084. return $core.withContext(function($ctx1) {
  12085. var $2,$1;
  12086. var $early={};
  12087. try {
  12088. lineCount=(0);
  12089. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12090. return $core.withContext(function($ctx2) {
  12091. lineCount=$recv(lineCount).__plus((1));
  12092. $2=lineCount;
  12093. $1=$recv($2).__eq(anIndex);
  12094. if($core.assert($1)){
  12095. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  12096. }
  12097. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  12098. }));
  12099. return nil;
  12100. }
  12101. catch(e) {if(e===$early)return e[0]; throw e}
  12102. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  12103. },
  12104. args: ["anIndex"],
  12105. 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",
  12106. referencedClasses: [],
  12107. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  12108. }),
  12109. $globals.String);
  12110. $core.addMethod(
  12111. $core.method({
  12112. selector: "lines",
  12113. protocol: "split join",
  12114. fn: function (){
  12115. var self=this,$self=this;
  12116. return $core.withContext(function($ctx1) {
  12117. var result = self.split(/\r\n|\r|\n/);
  12118. if (!result[result.length-1]) result.pop();
  12119. return result;;
  12120. return self;
  12121. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  12122. },
  12123. args: [],
  12124. 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'>",
  12125. referencedClasses: [],
  12126. messageSends: []
  12127. }),
  12128. $globals.String);
  12129. $core.addMethod(
  12130. $core.method({
  12131. selector: "linesDo:",
  12132. protocol: "split join",
  12133. fn: function (aBlock){
  12134. var self=this,$self=this;
  12135. return $core.withContext(function($ctx1) {
  12136. $recv($self._lines())._do_(aBlock);
  12137. return self;
  12138. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  12139. },
  12140. args: ["aBlock"],
  12141. 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",
  12142. referencedClasses: [],
  12143. messageSends: ["do:", "lines"]
  12144. }),
  12145. $globals.String);
  12146. $core.addMethod(
  12147. $core.method({
  12148. selector: "match:",
  12149. protocol: "regular expressions",
  12150. fn: function (aRegexp){
  12151. var self=this,$self=this;
  12152. return $core.withContext(function($ctx1) {
  12153. return self.search(aRegexp) != -1;
  12154. return self;
  12155. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  12156. },
  12157. args: ["aRegexp"],
  12158. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  12159. referencedClasses: [],
  12160. messageSends: []
  12161. }),
  12162. $globals.String);
  12163. $core.addMethod(
  12164. $core.method({
  12165. selector: "matchesOf:",
  12166. protocol: "regular expressions",
  12167. fn: function (aRegularExpression){
  12168. var self=this,$self=this;
  12169. return $core.withContext(function($ctx1) {
  12170. return self.match(aRegularExpression);
  12171. return self;
  12172. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  12173. },
  12174. args: ["aRegularExpression"],
  12175. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  12176. referencedClasses: [],
  12177. messageSends: []
  12178. }),
  12179. $globals.String);
  12180. $core.addMethod(
  12181. $core.method({
  12182. selector: "numericallyIndexable",
  12183. protocol: "private",
  12184. fn: function (){
  12185. var self=this,$self=this;
  12186. return $core.withContext(function($ctx1) {
  12187. return String(self);
  12188. return self;
  12189. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  12190. },
  12191. args: [],
  12192. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  12193. referencedClasses: [],
  12194. messageSends: []
  12195. }),
  12196. $globals.String);
  12197. $core.addMethod(
  12198. $core.method({
  12199. selector: "printNl",
  12200. protocol: "printing",
  12201. fn: function (){
  12202. var self=this,$self=this;
  12203. return $core.withContext(function($ctx1) {
  12204. console.log(self);
  12205. return self;
  12206. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  12207. },
  12208. args: [],
  12209. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  12210. referencedClasses: [],
  12211. messageSends: []
  12212. }),
  12213. $globals.String);
  12214. $core.addMethod(
  12215. $core.method({
  12216. selector: "printOn:",
  12217. protocol: "printing",
  12218. fn: function (aStream){
  12219. var self=this,$self=this;
  12220. return $core.withContext(function($ctx1) {
  12221. $recv(aStream)._nextPutAll_("'");
  12222. $ctx1.sendIdx["nextPutAll:"]=1;
  12223. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  12224. $ctx1.sendIdx["nextPutAll:"]=2;
  12225. $recv(aStream)._nextPutAll_("'");
  12226. return self;
  12227. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  12228. },
  12229. args: ["aStream"],
  12230. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  12231. referencedClasses: [],
  12232. messageSends: ["nextPutAll:", "replace:with:"]
  12233. }),
  12234. $globals.String);
  12235. $core.addMethod(
  12236. $core.method({
  12237. selector: "replace:with:",
  12238. protocol: "regular expressions",
  12239. fn: function (aString,anotherString){
  12240. var self=this,$self=this;
  12241. return $core.withContext(function($ctx1) {
  12242. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  12243. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  12244. },
  12245. args: ["aString", "anotherString"],
  12246. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12247. referencedClasses: ["RegularExpression"],
  12248. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  12249. }),
  12250. $globals.String);
  12251. $core.addMethod(
  12252. $core.method({
  12253. selector: "replaceRegexp:with:",
  12254. protocol: "regular expressions",
  12255. fn: function (aRegexp,aString){
  12256. var self=this,$self=this;
  12257. return $core.withContext(function($ctx1) {
  12258. return self.replace(aRegexp, aString);
  12259. return self;
  12260. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  12261. },
  12262. args: ["aRegexp", "aString"],
  12263. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  12264. referencedClasses: [],
  12265. messageSends: []
  12266. }),
  12267. $globals.String);
  12268. $core.addMethod(
  12269. $core.method({
  12270. selector: "reversed",
  12271. protocol: "converting",
  12272. fn: function (){
  12273. var self=this,$self=this;
  12274. return $core.withContext(function($ctx1) {
  12275. return self.split("").reverse().join("");
  12276. return self;
  12277. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  12278. },
  12279. args: [],
  12280. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  12281. referencedClasses: [],
  12282. messageSends: []
  12283. }),
  12284. $globals.String);
  12285. $core.addMethod(
  12286. $core.method({
  12287. selector: "shallowCopy",
  12288. protocol: "copying",
  12289. fn: function (){
  12290. var self=this,$self=this;
  12291. return self;
  12292. },
  12293. args: [],
  12294. source: "shallowCopy\x0a\x09^ self",
  12295. referencedClasses: [],
  12296. messageSends: []
  12297. }),
  12298. $globals.String);
  12299. $core.addMethod(
  12300. $core.method({
  12301. selector: "size",
  12302. protocol: "accessing",
  12303. fn: function (){
  12304. var self=this,$self=this;
  12305. return $core.withContext(function($ctx1) {
  12306. return self.length;
  12307. return self;
  12308. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  12309. },
  12310. args: [],
  12311. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  12312. referencedClasses: [],
  12313. messageSends: []
  12314. }),
  12315. $globals.String);
  12316. $core.addMethod(
  12317. $core.method({
  12318. selector: "subStrings:",
  12319. protocol: "split join",
  12320. fn: function (aString){
  12321. var self=this,$self=this;
  12322. return $core.withContext(function($ctx1) {
  12323. return $self._tokenize_(aString);
  12324. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  12325. },
  12326. args: ["aString"],
  12327. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12328. referencedClasses: [],
  12329. messageSends: ["tokenize:"]
  12330. }),
  12331. $globals.String);
  12332. $core.addMethod(
  12333. $core.method({
  12334. selector: "tokenize:",
  12335. protocol: "split join",
  12336. fn: function (aString){
  12337. var self=this,$self=this;
  12338. return $core.withContext(function($ctx1) {
  12339. return self.split(aString);
  12340. return self;
  12341. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  12342. },
  12343. args: ["aString"],
  12344. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12345. referencedClasses: [],
  12346. messageSends: []
  12347. }),
  12348. $globals.String);
  12349. $core.addMethod(
  12350. $core.method({
  12351. selector: "trimBoth",
  12352. protocol: "regular expressions",
  12353. fn: function (){
  12354. var self=this,$self=this;
  12355. return $core.withContext(function($ctx1) {
  12356. return $self._trimBoth_("\x5cs");
  12357. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  12358. },
  12359. args: [],
  12360. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12361. referencedClasses: [],
  12362. messageSends: ["trimBoth:"]
  12363. }),
  12364. $globals.String);
  12365. $core.addMethod(
  12366. $core.method({
  12367. selector: "trimBoth:",
  12368. protocol: "regular expressions",
  12369. fn: function (separators){
  12370. var self=this,$self=this;
  12371. return $core.withContext(function($ctx1) {
  12372. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12373. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  12374. },
  12375. args: ["separators"],
  12376. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12377. referencedClasses: [],
  12378. messageSends: ["trimRight:", "trimLeft:"]
  12379. }),
  12380. $globals.String);
  12381. $core.addMethod(
  12382. $core.method({
  12383. selector: "trimLeft",
  12384. protocol: "regular expressions",
  12385. fn: function (){
  12386. var self=this,$self=this;
  12387. return $core.withContext(function($ctx1) {
  12388. return $self._trimLeft_("\x5cs");
  12389. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  12390. },
  12391. args: [],
  12392. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12393. referencedClasses: [],
  12394. messageSends: ["trimLeft:"]
  12395. }),
  12396. $globals.String);
  12397. $core.addMethod(
  12398. $core.method({
  12399. selector: "trimLeft:",
  12400. protocol: "regular expressions",
  12401. fn: function (separators){
  12402. var self=this,$self=this;
  12403. return $core.withContext(function($ctx1) {
  12404. var $2,$1;
  12405. $2=$recv("^[".__comma(separators)).__comma("]+");
  12406. $ctx1.sendIdx[","]=1;
  12407. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12408. return $self._replaceRegexp_with_($1,"");
  12409. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  12410. },
  12411. args: ["separators"],
  12412. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12413. referencedClasses: ["RegularExpression"],
  12414. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12415. }),
  12416. $globals.String);
  12417. $core.addMethod(
  12418. $core.method({
  12419. selector: "trimRight",
  12420. protocol: "regular expressions",
  12421. fn: function (){
  12422. var self=this,$self=this;
  12423. return $core.withContext(function($ctx1) {
  12424. return $self._trimRight_("\x5cs");
  12425. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  12426. },
  12427. args: [],
  12428. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12429. referencedClasses: [],
  12430. messageSends: ["trimRight:"]
  12431. }),
  12432. $globals.String);
  12433. $core.addMethod(
  12434. $core.method({
  12435. selector: "trimRight:",
  12436. protocol: "regular expressions",
  12437. fn: function (separators){
  12438. var self=this,$self=this;
  12439. return $core.withContext(function($ctx1) {
  12440. var $2,$1;
  12441. $2=$recv("[".__comma(separators)).__comma("]+$");
  12442. $ctx1.sendIdx[","]=1;
  12443. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12444. return $self._replaceRegexp_with_($1,"");
  12445. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  12446. },
  12447. args: ["separators"],
  12448. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12449. referencedClasses: ["RegularExpression"],
  12450. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12451. }),
  12452. $globals.String);
  12453. $core.addMethod(
  12454. $core.method({
  12455. selector: "unescaped",
  12456. protocol: "converting",
  12457. fn: function (){
  12458. var self=this,$self=this;
  12459. return $core.withContext(function($ctx1) {
  12460. return unescape(self);
  12461. return self;
  12462. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  12463. },
  12464. args: [],
  12465. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12466. referencedClasses: [],
  12467. messageSends: []
  12468. }),
  12469. $globals.String);
  12470. $core.addMethod(
  12471. $core.method({
  12472. selector: "uriComponentDecoded",
  12473. protocol: "converting",
  12474. fn: function (){
  12475. var self=this,$self=this;
  12476. return $core.withContext(function($ctx1) {
  12477. return decodeURIComponent(self);
  12478. return self;
  12479. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  12480. },
  12481. args: [],
  12482. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12483. referencedClasses: [],
  12484. messageSends: []
  12485. }),
  12486. $globals.String);
  12487. $core.addMethod(
  12488. $core.method({
  12489. selector: "uriComponentEncoded",
  12490. protocol: "converting",
  12491. fn: function (){
  12492. var self=this,$self=this;
  12493. return $core.withContext(function($ctx1) {
  12494. return encodeURIComponent(self);
  12495. return self;
  12496. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  12497. },
  12498. args: [],
  12499. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12500. referencedClasses: [],
  12501. messageSends: []
  12502. }),
  12503. $globals.String);
  12504. $core.addMethod(
  12505. $core.method({
  12506. selector: "uriDecoded",
  12507. protocol: "converting",
  12508. fn: function (){
  12509. var self=this,$self=this;
  12510. return $core.withContext(function($ctx1) {
  12511. return decodeURI(self);
  12512. return self;
  12513. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12514. },
  12515. args: [],
  12516. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12517. referencedClasses: [],
  12518. messageSends: []
  12519. }),
  12520. $globals.String);
  12521. $core.addMethod(
  12522. $core.method({
  12523. selector: "uriEncoded",
  12524. protocol: "converting",
  12525. fn: function (){
  12526. var self=this,$self=this;
  12527. return $core.withContext(function($ctx1) {
  12528. return encodeURI(self);
  12529. return self;
  12530. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12531. },
  12532. args: [],
  12533. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12534. referencedClasses: [],
  12535. messageSends: []
  12536. }),
  12537. $globals.String);
  12538. $core.addMethod(
  12539. $core.method({
  12540. selector: "value:",
  12541. protocol: "evaluating",
  12542. fn: function (anObject){
  12543. var self=this,$self=this;
  12544. return $core.withContext(function($ctx1) {
  12545. return $recv(anObject)._perform_(self);
  12546. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12547. },
  12548. args: ["anObject"],
  12549. source: "value: anObject \x0a\x09^ anObject perform: self",
  12550. referencedClasses: [],
  12551. messageSends: ["perform:"]
  12552. }),
  12553. $globals.String);
  12554. $core.addMethod(
  12555. $core.method({
  12556. selector: "cr",
  12557. protocol: "accessing",
  12558. fn: function (){
  12559. var self=this,$self=this;
  12560. return $core.withContext(function($ctx1) {
  12561. return "\r";
  12562. return self;
  12563. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12564. },
  12565. args: [],
  12566. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12567. referencedClasses: [],
  12568. messageSends: []
  12569. }),
  12570. $globals.String.a$cls);
  12571. $core.addMethod(
  12572. $core.method({
  12573. selector: "crlf",
  12574. protocol: "accessing",
  12575. fn: function (){
  12576. var self=this,$self=this;
  12577. return $core.withContext(function($ctx1) {
  12578. return "\r\n";
  12579. return self;
  12580. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12581. },
  12582. args: [],
  12583. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12584. referencedClasses: [],
  12585. messageSends: []
  12586. }),
  12587. $globals.String.a$cls);
  12588. $core.addMethod(
  12589. $core.method({
  12590. selector: "esc",
  12591. protocol: "accessing",
  12592. fn: function (){
  12593. var self=this,$self=this;
  12594. return $core.withContext(function($ctx1) {
  12595. return $self._fromCharCode_((27));
  12596. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12597. },
  12598. args: [],
  12599. source: "esc\x0a\x09^ self fromCharCode: 27",
  12600. referencedClasses: [],
  12601. messageSends: ["fromCharCode:"]
  12602. }),
  12603. $globals.String.a$cls);
  12604. $core.addMethod(
  12605. $core.method({
  12606. selector: "fromCharCode:",
  12607. protocol: "instance creation",
  12608. fn: function (anInteger){
  12609. var self=this,$self=this;
  12610. return $core.withContext(function($ctx1) {
  12611. return String.fromCharCode(anInteger);
  12612. return self;
  12613. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12614. },
  12615. args: ["anInteger"],
  12616. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12617. referencedClasses: [],
  12618. messageSends: []
  12619. }),
  12620. $globals.String.a$cls);
  12621. $core.addMethod(
  12622. $core.method({
  12623. selector: "fromString:",
  12624. protocol: "instance creation",
  12625. fn: function (aString){
  12626. var self=this,$self=this;
  12627. return $core.withContext(function($ctx1) {
  12628. return String(aString);
  12629. return self;
  12630. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12631. },
  12632. args: ["aString"],
  12633. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12634. referencedClasses: [],
  12635. messageSends: []
  12636. }),
  12637. $globals.String.a$cls);
  12638. $core.addMethod(
  12639. $core.method({
  12640. selector: "lf",
  12641. protocol: "accessing",
  12642. fn: function (){
  12643. var self=this,$self=this;
  12644. return $core.withContext(function($ctx1) {
  12645. return "\n";
  12646. return self;
  12647. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12648. },
  12649. args: [],
  12650. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12651. referencedClasses: [],
  12652. messageSends: []
  12653. }),
  12654. $globals.String.a$cls);
  12655. $core.addMethod(
  12656. $core.method({
  12657. selector: "random",
  12658. protocol: "random",
  12659. fn: function (){
  12660. var self=this,$self=this;
  12661. return $core.withContext(function($ctx1) {
  12662. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  12663. return self;
  12664. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12665. },
  12666. args: [],
  12667. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  12668. referencedClasses: [],
  12669. messageSends: []
  12670. }),
  12671. $globals.String.a$cls);
  12672. $core.addMethod(
  12673. $core.method({
  12674. selector: "randomNotIn:",
  12675. protocol: "random",
  12676. fn: function (aString){
  12677. var self=this,$self=this;
  12678. var result;
  12679. return $core.withContext(function($ctx1) {
  12680. $recv((function(){
  12681. return $core.withContext(function($ctx2) {
  12682. result=$self._random();
  12683. return $recv(aString)._includesSubString_(result);
  12684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12685. }))._whileTrue();
  12686. return result;
  12687. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12688. },
  12689. args: ["aString"],
  12690. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12691. referencedClasses: [],
  12692. messageSends: ["whileTrue", "random", "includesSubString:"]
  12693. }),
  12694. $globals.String.a$cls);
  12695. $core.addMethod(
  12696. $core.method({
  12697. selector: "space",
  12698. protocol: "accessing",
  12699. fn: function (){
  12700. var self=this,$self=this;
  12701. return $core.withContext(function($ctx1) {
  12702. return " ";
  12703. return self;
  12704. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12705. },
  12706. args: [],
  12707. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12708. referencedClasses: [],
  12709. messageSends: []
  12710. }),
  12711. $globals.String.a$cls);
  12712. $core.addMethod(
  12713. $core.method({
  12714. selector: "streamClass",
  12715. protocol: "accessing",
  12716. fn: function (){
  12717. var self=this,$self=this;
  12718. return $globals.StringStream;
  12719. },
  12720. args: [],
  12721. source: "streamClass\x0a\x09\x09^ StringStream",
  12722. referencedClasses: ["StringStream"],
  12723. messageSends: []
  12724. }),
  12725. $globals.String.a$cls);
  12726. $core.addMethod(
  12727. $core.method({
  12728. selector: "tab",
  12729. protocol: "accessing",
  12730. fn: function (){
  12731. var self=this,$self=this;
  12732. return $core.withContext(function($ctx1) {
  12733. return "\t";
  12734. return self;
  12735. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12736. },
  12737. args: [],
  12738. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12739. referencedClasses: [],
  12740. messageSends: []
  12741. }),
  12742. $globals.String.a$cls);
  12743. $core.addMethod(
  12744. $core.method({
  12745. selector: "value:",
  12746. protocol: "instance creation",
  12747. fn: function (aUTFCharCode){
  12748. var self=this,$self=this;
  12749. return $core.withContext(function($ctx1) {
  12750. return String.fromCharCode(aUTFCharCode);;
  12751. return self;
  12752. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12753. },
  12754. args: ["aUTFCharCode"],
  12755. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12756. referencedClasses: [],
  12757. messageSends: []
  12758. }),
  12759. $globals.String.a$cls);
  12760. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12761. $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`.";
  12762. $core.addMethod(
  12763. $core.method({
  12764. selector: "=",
  12765. protocol: "comparing",
  12766. fn: function (aCollection){
  12767. var self=this,$self=this;
  12768. return $core.withContext(function($ctx1) {
  12769. var $2,$1,$4,$3,$5;
  12770. var $early={};
  12771. try {
  12772. $2=$self._class();
  12773. $ctx1.sendIdx["class"]=1;
  12774. $1=$recv($2).__eq($recv(aCollection)._class());
  12775. $ctx1.sendIdx["="]=1;
  12776. if(!$core.assert($1)){
  12777. return false;
  12778. }
  12779. $4=$self._size();
  12780. $ctx1.sendIdx["size"]=1;
  12781. $3=$recv($4).__eq($recv(aCollection)._size());
  12782. if(!$core.assert($3)){
  12783. return false;
  12784. }
  12785. $self._do_((function(each){
  12786. return $core.withContext(function($ctx2) {
  12787. $5=$recv(aCollection)._includes_(each);
  12788. if(!$core.assert($5)){
  12789. throw $early=[false];
  12790. }
  12791. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12792. }));
  12793. return true;
  12794. }
  12795. catch(e) {if(e===$early)return e[0]; throw e}
  12796. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12797. },
  12798. args: ["aCollection"],
  12799. 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",
  12800. referencedClasses: [],
  12801. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12802. }),
  12803. $globals.Set);
  12804. $core.addMethod(
  12805. $core.method({
  12806. selector: "add:",
  12807. protocol: "adding/removing",
  12808. fn: function (anObject){
  12809. var self=this,$self=this;
  12810. var bucket;
  12811. return $core.withContext(function($ctx1) {
  12812. var $1,$receiver;
  12813. bucket=$self._bucketsOfElement_(anObject);
  12814. $1=$recv(bucket)._second();
  12815. if(($receiver = $1) == null || $receiver.a$nil){
  12816. var object,slowBucket;
  12817. object=$recv(bucket)._first();
  12818. $ctx1.sendIdx["first"]=1;
  12819. slowBucket=$recv(bucket)._third();
  12820. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12821. return $core.withContext(function($ctx2) {
  12822. $recv(slowBucket)._add_(object);
  12823. $self["@size"]=$recv($self["@size"]).__plus((1));
  12824. return $self["@size"];
  12825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12826. }));
  12827. return object;
  12828. } else {
  12829. var primitiveBucket;
  12830. primitiveBucket=$receiver;
  12831. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12832. }
  12833. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12834. },
  12835. args: ["anObject"],
  12836. 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 ]",
  12837. referencedClasses: [],
  12838. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12839. }),
  12840. $globals.Set);
  12841. $core.addMethod(
  12842. $core.method({
  12843. selector: "add:in:",
  12844. protocol: "private",
  12845. fn: function (anObject,anotherObject){
  12846. var self=this,$self=this;
  12847. return $core.withContext(function($ctx1) {
  12848. if (anObject in anotherObject.store) { return false; }
  12849. $self['@size']++;
  12850. anotherObject.store[anObject] = true;
  12851. return anObject;
  12852. ;
  12853. return self;
  12854. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12855. },
  12856. args: ["anObject", "anotherObject"],
  12857. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09$self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  12858. referencedClasses: [],
  12859. messageSends: []
  12860. }),
  12861. $globals.Set);
  12862. $core.addMethod(
  12863. $core.method({
  12864. selector: "bucketsOfElement:",
  12865. protocol: "private",
  12866. fn: function (anObject){
  12867. var self=this,$self=this;
  12868. return $core.withContext(function($ctx1) {
  12869. // include nil to well-known objects under "boolean" fastBucket
  12870. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12871. var prim = anObject.valueOf();
  12872. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12873. var bucket = null;
  12874. $self['@slowBucketStores'].some(function (store) {
  12875. return bucket = store._bucketOfElement_(anObject);
  12876. });
  12877. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12878. }
  12879. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12880. ;
  12881. return self;
  12882. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12883. },
  12884. args: ["anObject"],
  12885. 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'>",
  12886. referencedClasses: [],
  12887. messageSends: []
  12888. }),
  12889. $globals.Set);
  12890. $core.addMethod(
  12891. $core.method({
  12892. selector: "classNameOf:",
  12893. protocol: "private",
  12894. fn: function (anObject){
  12895. var self=this,$self=this;
  12896. return $core.withContext(function($ctx1) {
  12897. return anObject.a$cls != null && anObject.a$cls.name;
  12898. return self;
  12899. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12900. },
  12901. args: ["anObject"],
  12902. 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'>",
  12903. referencedClasses: [],
  12904. messageSends: []
  12905. }),
  12906. $globals.Set);
  12907. $core.addMethod(
  12908. $core.method({
  12909. selector: "collect:",
  12910. protocol: "enumerating",
  12911. fn: function (aBlock){
  12912. var self=this,$self=this;
  12913. var collection;
  12914. return $core.withContext(function($ctx1) {
  12915. collection=$recv($self._class())._new();
  12916. $self._do_((function(each){
  12917. return $core.withContext(function($ctx2) {
  12918. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12919. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12920. }));
  12921. return collection;
  12922. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12923. },
  12924. args: ["aBlock"],
  12925. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12926. referencedClasses: [],
  12927. messageSends: ["new", "class", "do:", "add:", "value:"]
  12928. }),
  12929. $globals.Set);
  12930. $core.addMethod(
  12931. $core.method({
  12932. selector: "detect:ifNone:",
  12933. protocol: "enumerating",
  12934. fn: function (aBlock,anotherBlock){
  12935. var self=this,$self=this;
  12936. return $core.withContext(function($ctx1) {
  12937. var $1;
  12938. var $early={};
  12939. try {
  12940. $self._do_((function(each){
  12941. return $core.withContext(function($ctx2) {
  12942. $1=$recv(aBlock)._value_(each);
  12943. if($core.assert($1)){
  12944. throw $early=[each];
  12945. }
  12946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12947. }));
  12948. return $recv(anotherBlock)._value();
  12949. }
  12950. catch(e) {if(e===$early)return e[0]; throw e}
  12951. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  12952. },
  12953. args: ["aBlock", "anotherBlock"],
  12954. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  12955. referencedClasses: [],
  12956. messageSends: ["do:", "ifTrue:", "value:", "value"]
  12957. }),
  12958. $globals.Set);
  12959. $core.addMethod(
  12960. $core.method({
  12961. selector: "do:",
  12962. protocol: "enumerating",
  12963. fn: function (aBlock){
  12964. var self=this,$self=this;
  12965. return $core.withContext(function($ctx1) {
  12966. var el, keys, i;
  12967. el = $self['@fastBuckets'];
  12968. keys = Object.keys(el);
  12969. for (i = 0; i < keys.length; ++i) {
  12970. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12971. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12972. else { store._do_(aBlock); }
  12973. }
  12974. el = $self['@slowBucketStores'];
  12975. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12976. $self['@defaultBucket']._do_(aBlock);
  12977. ;
  12978. return self;
  12979. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12980. },
  12981. args: ["aBlock"],
  12982. 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'>",
  12983. referencedClasses: [],
  12984. messageSends: []
  12985. }),
  12986. $globals.Set);
  12987. $core.addMethod(
  12988. $core.method({
  12989. selector: "includes:",
  12990. protocol: "testing",
  12991. fn: function (anObject){
  12992. var self=this,$self=this;
  12993. var bucket;
  12994. return $core.withContext(function($ctx1) {
  12995. var $1,$2,$3,$receiver;
  12996. bucket=$self._bucketsOfElement_(anObject);
  12997. $1=$recv(bucket)._second();
  12998. if(($receiver = $1) == null || $receiver.a$nil){
  12999. $2=$recv(bucket)._third();
  13000. $3=$recv(bucket)._first();
  13001. $ctx1.sendIdx["first"]=1;
  13002. return $recv($2)._includes_($3);
  13003. } else {
  13004. var primitiveBucket;
  13005. primitiveBucket=$receiver;
  13006. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  13007. }
  13008. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  13009. },
  13010. args: ["anObject"],
  13011. 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 ]",
  13012. referencedClasses: [],
  13013. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  13014. }),
  13015. $globals.Set);
  13016. $core.addMethod(
  13017. $core.method({
  13018. selector: "includes:in:",
  13019. protocol: "private",
  13020. fn: function (anObject,anotherObject){
  13021. var self=this,$self=this;
  13022. return $core.withContext(function($ctx1) {
  13023. return anObject in anotherObject.store;
  13024. return self;
  13025. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13026. },
  13027. args: ["anObject", "anotherObject"],
  13028. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  13029. referencedClasses: [],
  13030. messageSends: []
  13031. }),
  13032. $globals.Set);
  13033. $core.addMethod(
  13034. $core.method({
  13035. selector: "initialize",
  13036. protocol: "initialization",
  13037. fn: function (){
  13038. var self=this,$self=this;
  13039. return $core.withContext(function($ctx1) {
  13040. (
  13041. $ctx1.supercall = true,
  13042. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13043. $ctx1.supercall = false;
  13044. $self["@defaultBucket"]=[];
  13045. $self._initializeSlowBucketStores();
  13046. $self._removeAll();
  13047. return self;
  13048. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  13049. },
  13050. args: [],
  13051. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  13052. referencedClasses: [],
  13053. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  13054. }),
  13055. $globals.Set);
  13056. $core.addMethod(
  13057. $core.method({
  13058. selector: "initializeSlowBucketStores",
  13059. protocol: "initialization",
  13060. fn: function (){
  13061. var self=this,$self=this;
  13062. return $core.withContext(function($ctx1) {
  13063. var $1;
  13064. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13065. return $core.withContext(function($ctx2) {
  13066. return $self._classNameOf_(x);
  13067. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  13068. }));
  13069. $ctx1.sendIdx["hashBlock:"]=1;
  13070. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13071. return $core.withContext(function($ctx2) {
  13072. return $self._jsConstructorNameOf_(x);
  13073. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  13074. }))];
  13075. return self;
  13076. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  13077. },
  13078. args: [],
  13079. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  13080. referencedClasses: ["ArrayBucketStore"],
  13081. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  13082. }),
  13083. $globals.Set);
  13084. $core.addMethod(
  13085. $core.method({
  13086. selector: "jsConstructorNameOf:",
  13087. protocol: "private",
  13088. fn: function (anObject){
  13089. var self=this,$self=this;
  13090. return $core.withContext(function($ctx1) {
  13091. return anObject.constructor && anObject.constructor.name;
  13092. return self;
  13093. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  13094. },
  13095. args: ["anObject"],
  13096. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  13097. referencedClasses: [],
  13098. messageSends: []
  13099. }),
  13100. $globals.Set);
  13101. $core.addMethod(
  13102. $core.method({
  13103. selector: "printOn:",
  13104. protocol: "printing",
  13105. fn: function (aStream){
  13106. var self=this,$self=this;
  13107. return $core.withContext(function($ctx1) {
  13108. (
  13109. $ctx1.supercall = true,
  13110. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  13111. $ctx1.supercall = false;
  13112. $ctx1.sendIdx["printOn:"]=1;
  13113. $recv(aStream)._nextPutAll_(" (");
  13114. $ctx1.sendIdx["nextPutAll:"]=1;
  13115. $self._do_separatedBy_((function(each){
  13116. return $core.withContext(function($ctx2) {
  13117. return $recv(each)._printOn_(aStream);
  13118. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13119. }),(function(){
  13120. return $core.withContext(function($ctx2) {
  13121. return $recv(aStream)._nextPutAll_(" ");
  13122. $ctx2.sendIdx["nextPutAll:"]=2;
  13123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13124. }));
  13125. $recv(aStream)._nextPutAll_(")");
  13126. return self;
  13127. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  13128. },
  13129. args: ["aStream"],
  13130. 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: ')'",
  13131. referencedClasses: [],
  13132. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13133. }),
  13134. $globals.Set);
  13135. $core.addMethod(
  13136. $core.method({
  13137. selector: "remove:ifAbsent:",
  13138. protocol: "adding/removing",
  13139. fn: function (anObject,aBlock){
  13140. var self=this,$self=this;
  13141. var bucket;
  13142. return $core.withContext(function($ctx1) {
  13143. var $1,$2,$3,$receiver;
  13144. var $early={};
  13145. try {
  13146. bucket=$self._bucketsOfElement_(anObject);
  13147. $1=$recv(bucket)._second();
  13148. if(($receiver = $1) == null || $receiver.a$nil){
  13149. $2=$recv(bucket)._third();
  13150. $3=$recv(bucket)._first();
  13151. $ctx1.sendIdx["first"]=1;
  13152. $recv($2)._remove_ifAbsent_($3,(function(){
  13153. return $core.withContext(function($ctx2) {
  13154. throw $early=[$recv(aBlock)._value()];
  13155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13156. }));
  13157. $self["@size"]=$recv($self["@size"]).__minus((1));
  13158. return $self["@size"];
  13159. } else {
  13160. var primitiveBucket;
  13161. primitiveBucket=$receiver;
  13162. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  13163. }
  13164. }
  13165. catch(e) {if(e===$early)return e[0]; throw e}
  13166. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  13167. },
  13168. args: ["anObject", "aBlock"],
  13169. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  13170. referencedClasses: [],
  13171. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  13172. }),
  13173. $globals.Set);
  13174. $core.addMethod(
  13175. $core.method({
  13176. selector: "remove:in:",
  13177. protocol: "private",
  13178. fn: function (anObject,anotherObject){
  13179. var self=this,$self=this;
  13180. return $core.withContext(function($ctx1) {
  13181. if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self['@size']--; };
  13182. return self;
  13183. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13184. },
  13185. args: ["anObject", "anotherObject"],
  13186. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self[''@size'']--; }'>",
  13187. referencedClasses: [],
  13188. messageSends: []
  13189. }),
  13190. $globals.Set);
  13191. $core.addMethod(
  13192. $core.method({
  13193. selector: "removeAll",
  13194. protocol: "adding/removing",
  13195. fn: function (){
  13196. var self=this,$self=this;
  13197. return $core.withContext(function($ctx1) {
  13198. $self['@fastBuckets'] = {
  13199. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  13200. "number": { store: Object.create(null), fn: Number },
  13201. "string": { store: Object.create(null) }
  13202. };
  13203. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  13204. $self['@defaultBucket']._removeAll();
  13205. $self['@size'] = 0;
  13206. ;
  13207. return self;
  13208. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  13209. },
  13210. args: [],
  13211. 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'>",
  13212. referencedClasses: [],
  13213. messageSends: []
  13214. }),
  13215. $globals.Set);
  13216. $core.addMethod(
  13217. $core.method({
  13218. selector: "select:",
  13219. protocol: "enumerating",
  13220. fn: function (aBlock){
  13221. var self=this,$self=this;
  13222. var collection;
  13223. return $core.withContext(function($ctx1) {
  13224. var $1;
  13225. collection=$recv($self._class())._new();
  13226. $self._do_((function(each){
  13227. return $core.withContext(function($ctx2) {
  13228. $1=$recv(aBlock)._value_(each);
  13229. if($core.assert($1)){
  13230. return $recv(collection)._add_(each);
  13231. }
  13232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13233. }));
  13234. return collection;
  13235. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  13236. },
  13237. args: ["aBlock"],
  13238. 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",
  13239. referencedClasses: [],
  13240. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13241. }),
  13242. $globals.Set);
  13243. $core.addMethod(
  13244. $core.method({
  13245. selector: "select:thenCollect:",
  13246. protocol: "enumerating",
  13247. fn: function (selectBlock,collectBlock){
  13248. var self=this,$self=this;
  13249. var collection;
  13250. return $core.withContext(function($ctx1) {
  13251. var $1;
  13252. collection=$recv($self._class())._new();
  13253. $self._do_((function(each){
  13254. return $core.withContext(function($ctx2) {
  13255. $1=$recv(selectBlock)._value_(each);
  13256. $ctx2.sendIdx["value:"]=1;
  13257. if($core.assert($1)){
  13258. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  13259. }
  13260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13261. }));
  13262. return collection;
  13263. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  13264. },
  13265. args: ["selectBlock", "collectBlock"],
  13266. 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",
  13267. referencedClasses: [],
  13268. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13269. }),
  13270. $globals.Set);
  13271. $core.addMethod(
  13272. $core.method({
  13273. selector: "size",
  13274. protocol: "accessing",
  13275. fn: function (){
  13276. var self=this,$self=this;
  13277. return $self["@size"];
  13278. },
  13279. args: [],
  13280. source: "size\x0a\x09^ size",
  13281. referencedClasses: [],
  13282. messageSends: []
  13283. }),
  13284. $globals.Set);
  13285. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  13286. $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.";
  13287. $core.addMethod(
  13288. $core.method({
  13289. selector: "<<",
  13290. protocol: "writing",
  13291. fn: function (anObject){
  13292. var self=this,$self=this;
  13293. return $core.withContext(function($ctx1) {
  13294. $self._write_(anObject);
  13295. return self;
  13296. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  13297. },
  13298. args: ["anObject"],
  13299. source: "<< anObject\x0a\x09self write: anObject",
  13300. referencedClasses: [],
  13301. messageSends: ["write:"]
  13302. }),
  13303. $globals.ProtoStream);
  13304. $core.addMethod(
  13305. $core.method({
  13306. selector: "atEnd",
  13307. protocol: "testing",
  13308. fn: function (){
  13309. var self=this,$self=this;
  13310. return $core.withContext(function($ctx1) {
  13311. $self._subclassResponsibility();
  13312. return self;
  13313. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  13314. },
  13315. args: [],
  13316. source: "atEnd\x0a\x09self subclassResponsibility",
  13317. referencedClasses: [],
  13318. messageSends: ["subclassResponsibility"]
  13319. }),
  13320. $globals.ProtoStream);
  13321. $core.addMethod(
  13322. $core.method({
  13323. selector: "atStart",
  13324. protocol: "testing",
  13325. fn: function (){
  13326. var self=this,$self=this;
  13327. return $core.withContext(function($ctx1) {
  13328. $self._subclassResponsibility();
  13329. return self;
  13330. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  13331. },
  13332. args: [],
  13333. source: "atStart\x0a\x09self subclassResponsibility",
  13334. referencedClasses: [],
  13335. messageSends: ["subclassResponsibility"]
  13336. }),
  13337. $globals.ProtoStream);
  13338. $core.addMethod(
  13339. $core.method({
  13340. selector: "contents",
  13341. protocol: "accessing",
  13342. fn: function (){
  13343. var self=this,$self=this;
  13344. return $core.withContext(function($ctx1) {
  13345. $self._subclassResponsibility();
  13346. return self;
  13347. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  13348. },
  13349. args: [],
  13350. source: "contents\x0a\x09self subclassResponsibility",
  13351. referencedClasses: [],
  13352. messageSends: ["subclassResponsibility"]
  13353. }),
  13354. $globals.ProtoStream);
  13355. $core.addMethod(
  13356. $core.method({
  13357. selector: "do:",
  13358. protocol: "enumerating",
  13359. fn: function (aBlock){
  13360. var self=this,$self=this;
  13361. return $core.withContext(function($ctx1) {
  13362. $recv((function(){
  13363. return $core.withContext(function($ctx2) {
  13364. return $self._atEnd();
  13365. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13366. }))._whileFalse_((function(){
  13367. return $core.withContext(function($ctx2) {
  13368. return $recv(aBlock)._value_($self._next());
  13369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13370. }));
  13371. return self;
  13372. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  13373. },
  13374. args: ["aBlock"],
  13375. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13376. referencedClasses: [],
  13377. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13378. }),
  13379. $globals.ProtoStream);
  13380. $core.addMethod(
  13381. $core.method({
  13382. selector: "isEmpty",
  13383. protocol: "testing",
  13384. fn: function (){
  13385. var self=this,$self=this;
  13386. return $core.withContext(function($ctx1) {
  13387. return $recv($self._atStart())._and_((function(){
  13388. return $core.withContext(function($ctx2) {
  13389. return $self._atEnd();
  13390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13391. }));
  13392. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  13393. },
  13394. args: [],
  13395. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13396. referencedClasses: [],
  13397. messageSends: ["and:", "atStart", "atEnd"]
  13398. }),
  13399. $globals.ProtoStream);
  13400. $core.addMethod(
  13401. $core.method({
  13402. selector: "next",
  13403. protocol: "reading",
  13404. fn: function (){
  13405. var self=this,$self=this;
  13406. return $core.withContext(function($ctx1) {
  13407. var $1;
  13408. $1=$self._atEnd();
  13409. if($core.assert($1)){
  13410. return nil;
  13411. } else {
  13412. return $self._subclassResponsibility();
  13413. }
  13414. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  13415. },
  13416. args: [],
  13417. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13418. referencedClasses: [],
  13419. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13420. }),
  13421. $globals.ProtoStream);
  13422. $core.addMethod(
  13423. $core.method({
  13424. selector: "nextPut:",
  13425. protocol: "writing",
  13426. fn: function (anObject){
  13427. var self=this,$self=this;
  13428. return $core.withContext(function($ctx1) {
  13429. $self._subclassResponsibility();
  13430. return self;
  13431. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  13432. },
  13433. args: ["anObject"],
  13434. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13435. referencedClasses: [],
  13436. messageSends: ["subclassResponsibility"]
  13437. }),
  13438. $globals.ProtoStream);
  13439. $core.addMethod(
  13440. $core.method({
  13441. selector: "nextPutAll:",
  13442. protocol: "writing",
  13443. fn: function (aCollection){
  13444. var self=this,$self=this;
  13445. return $core.withContext(function($ctx1) {
  13446. $recv(aCollection)._do_((function(each){
  13447. return $core.withContext(function($ctx2) {
  13448. return $self._nextPut_(each);
  13449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13450. }));
  13451. return self;
  13452. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  13453. },
  13454. args: ["aCollection"],
  13455. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13456. referencedClasses: [],
  13457. messageSends: ["do:", "nextPut:"]
  13458. }),
  13459. $globals.ProtoStream);
  13460. $core.addMethod(
  13461. $core.method({
  13462. selector: "nextPutString:",
  13463. protocol: "writing",
  13464. fn: function (aString){
  13465. var self=this,$self=this;
  13466. return $core.withContext(function($ctx1) {
  13467. $self._nextPut_(aString);
  13468. return self;
  13469. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  13470. },
  13471. args: ["aString"],
  13472. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13473. referencedClasses: [],
  13474. messageSends: ["nextPut:"]
  13475. }),
  13476. $globals.ProtoStream);
  13477. $core.addMethod(
  13478. $core.method({
  13479. selector: "peek",
  13480. protocol: "reading",
  13481. fn: function (){
  13482. var self=this,$self=this;
  13483. return $core.withContext(function($ctx1) {
  13484. var $1;
  13485. $1=$self._atEnd();
  13486. if($core.assert($1)){
  13487. return nil;
  13488. } else {
  13489. return $self._subclassResponsibility();
  13490. }
  13491. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  13492. },
  13493. args: [],
  13494. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13495. referencedClasses: [],
  13496. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13497. }),
  13498. $globals.ProtoStream);
  13499. $core.addMethod(
  13500. $core.method({
  13501. selector: "reset",
  13502. protocol: "actions",
  13503. fn: function (){
  13504. var self=this,$self=this;
  13505. return $core.withContext(function($ctx1) {
  13506. $self._subclassResponsibility();
  13507. return self;
  13508. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  13509. },
  13510. args: [],
  13511. source: "reset\x0a\x09self subclassResponsibility",
  13512. referencedClasses: [],
  13513. messageSends: ["subclassResponsibility"]
  13514. }),
  13515. $globals.ProtoStream);
  13516. $core.addMethod(
  13517. $core.method({
  13518. selector: "resetContents",
  13519. protocol: "actions",
  13520. fn: function (){
  13521. var self=this,$self=this;
  13522. return $core.withContext(function($ctx1) {
  13523. $self._subclassResponsibility();
  13524. return self;
  13525. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  13526. },
  13527. args: [],
  13528. source: "resetContents\x0a\x09self subclassResponsibility",
  13529. referencedClasses: [],
  13530. messageSends: ["subclassResponsibility"]
  13531. }),
  13532. $globals.ProtoStream);
  13533. $core.addMethod(
  13534. $core.method({
  13535. selector: "setToEnd",
  13536. protocol: "positioning",
  13537. fn: function (){
  13538. var self=this,$self=this;
  13539. return $core.withContext(function($ctx1) {
  13540. $self._subclassResponsibility();
  13541. return self;
  13542. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13543. },
  13544. args: [],
  13545. source: "setToEnd\x0a\x09self subclassResponsibility",
  13546. referencedClasses: [],
  13547. messageSends: ["subclassResponsibility"]
  13548. }),
  13549. $globals.ProtoStream);
  13550. $core.addMethod(
  13551. $core.method({
  13552. selector: "setToStart",
  13553. protocol: "positioning",
  13554. fn: function (){
  13555. var self=this,$self=this;
  13556. return $core.withContext(function($ctx1) {
  13557. $self._reset();
  13558. return self;
  13559. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13560. },
  13561. args: [],
  13562. source: "setToStart\x0a\x09self reset",
  13563. referencedClasses: [],
  13564. messageSends: ["reset"]
  13565. }),
  13566. $globals.ProtoStream);
  13567. $core.addMethod(
  13568. $core.method({
  13569. selector: "write:",
  13570. protocol: "writing",
  13571. fn: function (anObject){
  13572. var self=this,$self=this;
  13573. return $core.withContext(function($ctx1) {
  13574. $recv(anObject)._putOn_(self);
  13575. return self;
  13576. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13577. },
  13578. args: ["anObject"],
  13579. source: "write: anObject\x0a\x09anObject putOn: self",
  13580. referencedClasses: [],
  13581. messageSends: ["putOn:"]
  13582. }),
  13583. $globals.ProtoStream);
  13584. $core.addMethod(
  13585. $core.method({
  13586. selector: "on:",
  13587. protocol: "instance creation",
  13588. fn: function (aCollection){
  13589. var self=this,$self=this;
  13590. return $core.withContext(function($ctx1) {
  13591. var $1;
  13592. $1=$self._new();
  13593. $recv($1)._setCollection_(aCollection);
  13594. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13595. return $recv($1)._yourself();
  13596. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13597. },
  13598. args: ["aCollection"],
  13599. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13600. referencedClasses: [],
  13601. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13602. }),
  13603. $globals.ProtoStream.a$cls);
  13604. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13605. $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.";
  13606. $core.addMethod(
  13607. $core.method({
  13608. selector: "atEnd",
  13609. protocol: "testing",
  13610. fn: function (){
  13611. var self=this,$self=this;
  13612. return $core.withContext(function($ctx1) {
  13613. return $recv($self._position()).__eq($self._size());
  13614. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13615. },
  13616. args: [],
  13617. source: "atEnd\x0a\x09^ self position = self size",
  13618. referencedClasses: [],
  13619. messageSends: ["=", "position", "size"]
  13620. }),
  13621. $globals.Stream);
  13622. $core.addMethod(
  13623. $core.method({
  13624. selector: "atStart",
  13625. protocol: "testing",
  13626. fn: function (){
  13627. var self=this,$self=this;
  13628. return $core.withContext(function($ctx1) {
  13629. return $recv($self._position()).__eq((0));
  13630. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13631. },
  13632. args: [],
  13633. source: "atStart\x0a\x09^ self position = 0",
  13634. referencedClasses: [],
  13635. messageSends: ["=", "position"]
  13636. }),
  13637. $globals.Stream);
  13638. $core.addMethod(
  13639. $core.method({
  13640. selector: "close",
  13641. protocol: "actions",
  13642. fn: function (){
  13643. var self=this,$self=this;
  13644. return self;
  13645. },
  13646. args: [],
  13647. source: "close",
  13648. referencedClasses: [],
  13649. messageSends: []
  13650. }),
  13651. $globals.Stream);
  13652. $core.addMethod(
  13653. $core.method({
  13654. selector: "collection",
  13655. protocol: "accessing",
  13656. fn: function (){
  13657. var self=this,$self=this;
  13658. return $self["@collection"];
  13659. },
  13660. args: [],
  13661. source: "collection\x0a\x09^ collection",
  13662. referencedClasses: [],
  13663. messageSends: []
  13664. }),
  13665. $globals.Stream);
  13666. $core.addMethod(
  13667. $core.method({
  13668. selector: "contents",
  13669. protocol: "accessing",
  13670. fn: function (){
  13671. var self=this,$self=this;
  13672. return $core.withContext(function($ctx1) {
  13673. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13674. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13675. },
  13676. args: [],
  13677. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13678. referencedClasses: [],
  13679. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13680. }),
  13681. $globals.Stream);
  13682. $core.addMethod(
  13683. $core.method({
  13684. selector: "flush",
  13685. protocol: "actions",
  13686. fn: function (){
  13687. var self=this,$self=this;
  13688. return self;
  13689. },
  13690. args: [],
  13691. source: "flush",
  13692. referencedClasses: [],
  13693. messageSends: []
  13694. }),
  13695. $globals.Stream);
  13696. $core.addMethod(
  13697. $core.method({
  13698. selector: "isEmpty",
  13699. protocol: "testing",
  13700. fn: function (){
  13701. var self=this,$self=this;
  13702. return $core.withContext(function($ctx1) {
  13703. return $recv($self._size()).__eq((0));
  13704. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13705. },
  13706. args: [],
  13707. source: "isEmpty\x0a\x09^ self size = 0",
  13708. referencedClasses: [],
  13709. messageSends: ["=", "size"]
  13710. }),
  13711. $globals.Stream);
  13712. $core.addMethod(
  13713. $core.method({
  13714. selector: "next",
  13715. protocol: "reading",
  13716. fn: function (){
  13717. var self=this,$self=this;
  13718. return $core.withContext(function($ctx1) {
  13719. var $1,$3,$2;
  13720. $1=$self._atEnd();
  13721. if($core.assert($1)){
  13722. return nil;
  13723. } else {
  13724. $3=$self._position();
  13725. $ctx1.sendIdx["position"]=1;
  13726. $2=$recv($3).__plus((1));
  13727. $self._position_($2);
  13728. return $recv($self["@collection"])._at_($self._position());
  13729. }
  13730. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13731. },
  13732. args: [],
  13733. 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 ]",
  13734. referencedClasses: [],
  13735. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13736. }),
  13737. $globals.Stream);
  13738. $core.addMethod(
  13739. $core.method({
  13740. selector: "next:",
  13741. protocol: "reading",
  13742. fn: function (anInteger){
  13743. var self=this,$self=this;
  13744. var tempCollection;
  13745. return $core.withContext(function($ctx1) {
  13746. var $1;
  13747. tempCollection=$recv($recv($self._collection())._class())._new();
  13748. $recv(anInteger)._timesRepeat_((function(){
  13749. return $core.withContext(function($ctx2) {
  13750. $1=$self._atEnd();
  13751. if(!$core.assert($1)){
  13752. return $recv(tempCollection)._add_($self._next());
  13753. }
  13754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13755. }));
  13756. return tempCollection;
  13757. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13758. },
  13759. args: ["anInteger"],
  13760. 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",
  13761. referencedClasses: [],
  13762. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13763. }),
  13764. $globals.Stream);
  13765. $core.addMethod(
  13766. $core.method({
  13767. selector: "nextPut:",
  13768. protocol: "writing",
  13769. fn: function (anObject){
  13770. var self=this,$self=this;
  13771. return $core.withContext(function($ctx1) {
  13772. var $2,$1,$3,$4;
  13773. $2=$self._position();
  13774. $ctx1.sendIdx["position"]=1;
  13775. $1=$recv($2).__plus((1));
  13776. $self._position_($1);
  13777. $3=$self._collection();
  13778. $4=$self._position();
  13779. $ctx1.sendIdx["position"]=2;
  13780. $recv($3)._at_put_($4,anObject);
  13781. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13782. return self;
  13783. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13784. },
  13785. args: ["anObject"],
  13786. 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)",
  13787. referencedClasses: [],
  13788. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13789. }),
  13790. $globals.Stream);
  13791. $core.addMethod(
  13792. $core.method({
  13793. selector: "peek",
  13794. protocol: "reading",
  13795. fn: function (){
  13796. var self=this,$self=this;
  13797. return $core.withContext(function($ctx1) {
  13798. var $1;
  13799. $1=$self._atEnd();
  13800. if(!$core.assert($1)){
  13801. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13802. }
  13803. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13804. },
  13805. args: [],
  13806. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13807. referencedClasses: [],
  13808. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13809. }),
  13810. $globals.Stream);
  13811. $core.addMethod(
  13812. $core.method({
  13813. selector: "position",
  13814. protocol: "accessing",
  13815. fn: function (){
  13816. var self=this,$self=this;
  13817. return $core.withContext(function($ctx1) {
  13818. var $1,$receiver;
  13819. $1=$self["@position"];
  13820. if(($receiver = $1) == null || $receiver.a$nil){
  13821. $self["@position"]=(0);
  13822. return $self["@position"];
  13823. } else {
  13824. return $1;
  13825. }
  13826. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13827. },
  13828. args: [],
  13829. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13830. referencedClasses: [],
  13831. messageSends: ["ifNil:"]
  13832. }),
  13833. $globals.Stream);
  13834. $core.addMethod(
  13835. $core.method({
  13836. selector: "position:",
  13837. protocol: "accessing",
  13838. fn: function (anInteger){
  13839. var self=this,$self=this;
  13840. $self["@position"]=anInteger;
  13841. return self;
  13842. },
  13843. args: ["anInteger"],
  13844. source: "position: anInteger\x0a\x09position := anInteger",
  13845. referencedClasses: [],
  13846. messageSends: []
  13847. }),
  13848. $globals.Stream);
  13849. $core.addMethod(
  13850. $core.method({
  13851. selector: "reset",
  13852. protocol: "actions",
  13853. fn: function (){
  13854. var self=this,$self=this;
  13855. return $core.withContext(function($ctx1) {
  13856. $self._position_((0));
  13857. return self;
  13858. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13859. },
  13860. args: [],
  13861. source: "reset\x0a\x09self position: 0",
  13862. referencedClasses: [],
  13863. messageSends: ["position:"]
  13864. }),
  13865. $globals.Stream);
  13866. $core.addMethod(
  13867. $core.method({
  13868. selector: "resetContents",
  13869. protocol: "actions",
  13870. fn: function (){
  13871. var self=this,$self=this;
  13872. return $core.withContext(function($ctx1) {
  13873. $self._reset();
  13874. $self._setStreamSize_((0));
  13875. return self;
  13876. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13877. },
  13878. args: [],
  13879. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13880. referencedClasses: [],
  13881. messageSends: ["reset", "setStreamSize:"]
  13882. }),
  13883. $globals.Stream);
  13884. $core.addMethod(
  13885. $core.method({
  13886. selector: "setCollection:",
  13887. protocol: "accessing",
  13888. fn: function (aCollection){
  13889. var self=this,$self=this;
  13890. $self["@collection"]=aCollection;
  13891. return self;
  13892. },
  13893. args: ["aCollection"],
  13894. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13895. referencedClasses: [],
  13896. messageSends: []
  13897. }),
  13898. $globals.Stream);
  13899. $core.addMethod(
  13900. $core.method({
  13901. selector: "setStreamSize:",
  13902. protocol: "accessing",
  13903. fn: function (anInteger){
  13904. var self=this,$self=this;
  13905. $self["@streamSize"]=anInteger;
  13906. return self;
  13907. },
  13908. args: ["anInteger"],
  13909. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13910. referencedClasses: [],
  13911. messageSends: []
  13912. }),
  13913. $globals.Stream);
  13914. $core.addMethod(
  13915. $core.method({
  13916. selector: "setToEnd",
  13917. protocol: "positioning",
  13918. fn: function (){
  13919. var self=this,$self=this;
  13920. return $core.withContext(function($ctx1) {
  13921. $self._position_($self._size());
  13922. return self;
  13923. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13924. },
  13925. args: [],
  13926. source: "setToEnd\x0a\x09self position: self size",
  13927. referencedClasses: [],
  13928. messageSends: ["position:", "size"]
  13929. }),
  13930. $globals.Stream);
  13931. $core.addMethod(
  13932. $core.method({
  13933. selector: "size",
  13934. protocol: "accessing",
  13935. fn: function (){
  13936. var self=this,$self=this;
  13937. return $core.withContext(function($ctx1) {
  13938. return $self._streamSize();
  13939. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13940. },
  13941. args: [],
  13942. source: "size\x0a\x09^ self streamSize",
  13943. referencedClasses: [],
  13944. messageSends: ["streamSize"]
  13945. }),
  13946. $globals.Stream);
  13947. $core.addMethod(
  13948. $core.method({
  13949. selector: "skip:",
  13950. protocol: "positioning",
  13951. fn: function (anInteger){
  13952. var self=this,$self=this;
  13953. return $core.withContext(function($ctx1) {
  13954. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13955. return self;
  13956. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13957. },
  13958. args: ["anInteger"],
  13959. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13960. referencedClasses: [],
  13961. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13962. }),
  13963. $globals.Stream);
  13964. $core.addMethod(
  13965. $core.method({
  13966. selector: "streamSize",
  13967. protocol: "accessing",
  13968. fn: function (){
  13969. var self=this,$self=this;
  13970. return $self["@streamSize"];
  13971. },
  13972. args: [],
  13973. source: "streamSize\x0a\x09^ streamSize",
  13974. referencedClasses: [],
  13975. messageSends: []
  13976. }),
  13977. $globals.Stream);
  13978. $core.addMethod(
  13979. $core.method({
  13980. selector: "on:",
  13981. protocol: "instance creation",
  13982. fn: function (aCollection){
  13983. var self=this,$self=this;
  13984. return $core.withContext(function($ctx1) {
  13985. var $1;
  13986. $1=$self._new();
  13987. $recv($1)._setCollection_(aCollection);
  13988. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13989. return $recv($1)._yourself();
  13990. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13991. },
  13992. args: ["aCollection"],
  13993. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13994. referencedClasses: [],
  13995. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13996. }),
  13997. $globals.Stream.a$cls);
  13998. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13999. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  14000. $core.addMethod(
  14001. $core.method({
  14002. selector: "cr",
  14003. protocol: "writing",
  14004. fn: function (){
  14005. var self=this,$self=this;
  14006. return $core.withContext(function($ctx1) {
  14007. return $self._nextPutAll_($recv($globals.String)._cr());
  14008. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  14009. },
  14010. args: [],
  14011. source: "cr\x0a\x09^ self nextPutAll: String cr",
  14012. referencedClasses: ["String"],
  14013. messageSends: ["nextPutAll:", "cr"]
  14014. }),
  14015. $globals.StringStream);
  14016. $core.addMethod(
  14017. $core.method({
  14018. selector: "crlf",
  14019. protocol: "writing",
  14020. fn: function (){
  14021. var self=this,$self=this;
  14022. return $core.withContext(function($ctx1) {
  14023. return $self._nextPutAll_($recv($globals.String)._crlf());
  14024. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  14025. },
  14026. args: [],
  14027. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  14028. referencedClasses: ["String"],
  14029. messageSends: ["nextPutAll:", "crlf"]
  14030. }),
  14031. $globals.StringStream);
  14032. $core.addMethod(
  14033. $core.method({
  14034. selector: "lf",
  14035. protocol: "writing",
  14036. fn: function (){
  14037. var self=this,$self=this;
  14038. return $core.withContext(function($ctx1) {
  14039. return $self._nextPutAll_($recv($globals.String)._lf());
  14040. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  14041. },
  14042. args: [],
  14043. source: "lf\x0a\x09^ self nextPutAll: String lf",
  14044. referencedClasses: ["String"],
  14045. messageSends: ["nextPutAll:", "lf"]
  14046. }),
  14047. $globals.StringStream);
  14048. $core.addMethod(
  14049. $core.method({
  14050. selector: "next:",
  14051. protocol: "reading",
  14052. fn: function (anInteger){
  14053. var self=this,$self=this;
  14054. var tempCollection;
  14055. return $core.withContext(function($ctx1) {
  14056. var $1;
  14057. tempCollection=$recv($recv($self._collection())._class())._new();
  14058. $recv(anInteger)._timesRepeat_((function(){
  14059. return $core.withContext(function($ctx2) {
  14060. $1=$self._atEnd();
  14061. if(!$core.assert($1)){
  14062. tempCollection=$recv(tempCollection).__comma($self._next());
  14063. return tempCollection;
  14064. }
  14065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14066. }));
  14067. return tempCollection;
  14068. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  14069. },
  14070. args: ["anInteger"],
  14071. 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",
  14072. referencedClasses: [],
  14073. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  14074. }),
  14075. $globals.StringStream);
  14076. $core.addMethod(
  14077. $core.method({
  14078. selector: "nextPut:",
  14079. protocol: "writing",
  14080. fn: function (aString){
  14081. var self=this,$self=this;
  14082. return $core.withContext(function($ctx1) {
  14083. $self._nextPutAll_(aString);
  14084. return self;
  14085. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  14086. },
  14087. args: ["aString"],
  14088. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14089. referencedClasses: [],
  14090. messageSends: ["nextPutAll:"]
  14091. }),
  14092. $globals.StringStream);
  14093. $core.addMethod(
  14094. $core.method({
  14095. selector: "nextPutAll:",
  14096. protocol: "writing",
  14097. fn: function (aString){
  14098. var self=this,$self=this;
  14099. var pre,post;
  14100. return $core.withContext(function($ctx1) {
  14101. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  14102. $1=$self._atEnd();
  14103. if($core.assert($1)){
  14104. $3=$self._collection();
  14105. $ctx1.sendIdx["collection"]=1;
  14106. $2=$recv($3).__comma(aString);
  14107. $ctx1.sendIdx[","]=1;
  14108. $self._setCollection_($2);
  14109. $ctx1.sendIdx["setCollection:"]=1;
  14110. } else {
  14111. $4=$self._collection();
  14112. $ctx1.sendIdx["collection"]=2;
  14113. $5=$self._position();
  14114. $ctx1.sendIdx["position"]=1;
  14115. pre=$recv($4)._copyFrom_to_((1),$5);
  14116. $ctx1.sendIdx["copyFrom:to:"]=1;
  14117. $6=$self._collection();
  14118. $ctx1.sendIdx["collection"]=3;
  14119. $9=$self._position();
  14120. $ctx1.sendIdx["position"]=2;
  14121. $8=$recv($9).__plus((1));
  14122. $ctx1.sendIdx["+"]=2;
  14123. $10=$recv(aString)._size();
  14124. $ctx1.sendIdx["size"]=1;
  14125. $7=$recv($8).__plus($10);
  14126. $ctx1.sendIdx["+"]=1;
  14127. $11=$recv($self._collection())._size();
  14128. $ctx1.sendIdx["size"]=2;
  14129. post=$recv($6)._copyFrom_to_($7,$11);
  14130. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  14131. $ctx1.sendIdx[","]=2;
  14132. $self._setCollection_($12);
  14133. }
  14134. $14=$self._position();
  14135. $ctx1.sendIdx["position"]=3;
  14136. $13=$recv($14).__plus($recv(aString)._size());
  14137. $self._position_($13);
  14138. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  14139. return self;
  14140. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  14141. },
  14142. args: ["aString"],
  14143. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  14144. referencedClasses: [],
  14145. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  14146. }),
  14147. $globals.StringStream);
  14148. $core.addMethod(
  14149. $core.method({
  14150. selector: "nextPutString:",
  14151. protocol: "writing",
  14152. fn: function (aString){
  14153. var self=this,$self=this;
  14154. return $core.withContext(function($ctx1) {
  14155. $self._nextPutAll_(aString);
  14156. return self;
  14157. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  14158. },
  14159. args: ["aString"],
  14160. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14161. referencedClasses: [],
  14162. messageSends: ["nextPutAll:"]
  14163. }),
  14164. $globals.StringStream);
  14165. $core.addMethod(
  14166. $core.method({
  14167. selector: "print:",
  14168. protocol: "writing",
  14169. fn: function (anObject){
  14170. var self=this,$self=this;
  14171. return $core.withContext(function($ctx1) {
  14172. $recv(anObject)._printOn_(self);
  14173. return self;
  14174. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  14175. },
  14176. args: ["anObject"],
  14177. source: "print: anObject\x0a\x09anObject printOn: self",
  14178. referencedClasses: [],
  14179. messageSends: ["printOn:"]
  14180. }),
  14181. $globals.StringStream);
  14182. $core.addMethod(
  14183. $core.method({
  14184. selector: "printSymbol:",
  14185. protocol: "writing",
  14186. fn: function (anObject){
  14187. var self=this,$self=this;
  14188. return $core.withContext(function($ctx1) {
  14189. $recv(anObject)._asSymbolPrintOn_(self);
  14190. return self;
  14191. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  14192. },
  14193. args: ["anObject"],
  14194. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  14195. referencedClasses: [],
  14196. messageSends: ["asSymbolPrintOn:"]
  14197. }),
  14198. $globals.StringStream);
  14199. $core.addMethod(
  14200. $core.method({
  14201. selector: "space",
  14202. protocol: "writing",
  14203. fn: function (){
  14204. var self=this,$self=this;
  14205. return $core.withContext(function($ctx1) {
  14206. $self._nextPut_(" ");
  14207. return self;
  14208. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  14209. },
  14210. args: [],
  14211. source: "space\x0a\x09self nextPut: ' '",
  14212. referencedClasses: [],
  14213. messageSends: ["nextPut:"]
  14214. }),
  14215. $globals.StringStream);
  14216. $core.addMethod(
  14217. $core.method({
  14218. selector: "tab",
  14219. protocol: "writing",
  14220. fn: function (){
  14221. var self=this,$self=this;
  14222. return $core.withContext(function($ctx1) {
  14223. return $self._nextPutAll_($recv($globals.String)._tab());
  14224. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  14225. },
  14226. args: [],
  14227. source: "tab\x0a\x09^ self nextPutAll: String tab",
  14228. referencedClasses: ["String"],
  14229. messageSends: ["nextPutAll:", "tab"]
  14230. }),
  14231. $globals.StringStream);
  14232. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  14233. $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.";
  14234. $core.addMethod(
  14235. $core.method({
  14236. selector: "initialize",
  14237. protocol: "initialization",
  14238. fn: function (){
  14239. var self=this,$self=this;
  14240. return $core.withContext(function($ctx1) {
  14241. (
  14242. $ctx1.supercall = true,
  14243. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  14244. $ctx1.supercall = false;
  14245. $self["@read"]=$recv($globals.OrderedCollection)._new();
  14246. $ctx1.sendIdx["new"]=1;
  14247. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14248. $self["@readIndex"]=(1);
  14249. return self;
  14250. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  14251. },
  14252. args: [],
  14253. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14254. referencedClasses: ["OrderedCollection"],
  14255. messageSends: ["initialize", "new"]
  14256. }),
  14257. $globals.Queue);
  14258. $core.addMethod(
  14259. $core.method({
  14260. selector: "next",
  14261. protocol: "accessing",
  14262. fn: function (){
  14263. var self=this,$self=this;
  14264. return $core.withContext(function($ctx1) {
  14265. return $self._nextIfAbsent_((function(){
  14266. return $core.withContext(function($ctx2) {
  14267. return $self._error_("Cannot read from empty Queue.");
  14268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14269. }));
  14270. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  14271. },
  14272. args: [],
  14273. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14274. referencedClasses: [],
  14275. messageSends: ["nextIfAbsent:", "error:"]
  14276. }),
  14277. $globals.Queue);
  14278. $core.addMethod(
  14279. $core.method({
  14280. selector: "nextIfAbsent:",
  14281. protocol: "accessing",
  14282. fn: function (aBlock){
  14283. var self=this,$self=this;
  14284. var result;
  14285. return $core.withContext(function($ctx1) {
  14286. var $1;
  14287. var $early={};
  14288. try {
  14289. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  14290. return $core.withContext(function($ctx2) {
  14291. $recv($self["@write"])._ifEmpty_((function(){
  14292. return $core.withContext(function($ctx3) {
  14293. $1=$recv($self["@readIndex"]).__gt((1));
  14294. if($core.assert($1)){
  14295. $self["@read"]=[];
  14296. $self["@readIndex"]=(1);
  14297. $self["@readIndex"];
  14298. }
  14299. throw $early=[$recv(aBlock)._value()];
  14300. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14301. }));
  14302. $self["@read"]=$self["@write"];
  14303. $self["@readIndex"]=(1);
  14304. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14305. return $recv($self["@read"])._first();
  14306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14307. }));
  14308. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  14309. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  14310. return result;
  14311. }
  14312. catch(e) {if(e===$early)return e[0]; throw e}
  14313. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  14314. },
  14315. args: ["aBlock"],
  14316. 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",
  14317. referencedClasses: ["OrderedCollection"],
  14318. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  14319. }),
  14320. $globals.Queue);
  14321. $core.addMethod(
  14322. $core.method({
  14323. selector: "nextPut:",
  14324. protocol: "accessing",
  14325. fn: function (anObject){
  14326. var self=this,$self=this;
  14327. return $core.withContext(function($ctx1) {
  14328. $recv($self["@write"])._add_(anObject);
  14329. return self;
  14330. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  14331. },
  14332. args: ["anObject"],
  14333. source: "nextPut: anObject\x0a\x09write add: anObject",
  14334. referencedClasses: [],
  14335. messageSends: ["add:"]
  14336. }),
  14337. $globals.Queue);
  14338. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  14339. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14340. $core.addMethod(
  14341. $core.method({
  14342. selector: "compile:",
  14343. protocol: "evaluating",
  14344. fn: function (aString){
  14345. var self=this,$self=this;
  14346. return $core.withContext(function($ctx1) {
  14347. return self.compile(aString);
  14348. return self;
  14349. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  14350. },
  14351. args: ["aString"],
  14352. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  14353. referencedClasses: [],
  14354. messageSends: []
  14355. }),
  14356. $globals.RegularExpression);
  14357. $core.addMethod(
  14358. $core.method({
  14359. selector: "exec:",
  14360. protocol: "evaluating",
  14361. fn: function (aString){
  14362. var self=this,$self=this;
  14363. return $core.withContext(function($ctx1) {
  14364. return self.exec(aString) || nil;
  14365. return self;
  14366. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  14367. },
  14368. args: ["aString"],
  14369. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  14370. referencedClasses: [],
  14371. messageSends: []
  14372. }),
  14373. $globals.RegularExpression);
  14374. $core.addMethod(
  14375. $core.method({
  14376. selector: "test:",
  14377. protocol: "evaluating",
  14378. fn: function (aString){
  14379. var self=this,$self=this;
  14380. return $core.withContext(function($ctx1) {
  14381. return self.test(aString);
  14382. return self;
  14383. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  14384. },
  14385. args: ["aString"],
  14386. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14387. referencedClasses: [],
  14388. messageSends: []
  14389. }),
  14390. $globals.RegularExpression);
  14391. $core.addMethod(
  14392. $core.method({
  14393. selector: "fromString:",
  14394. protocol: "instance creation",
  14395. fn: function (aString){
  14396. var self=this,$self=this;
  14397. return $core.withContext(function($ctx1) {
  14398. return $self._fromString_flag_(aString,"");
  14399. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  14400. },
  14401. args: ["aString"],
  14402. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14403. referencedClasses: [],
  14404. messageSends: ["fromString:flag:"]
  14405. }),
  14406. $globals.RegularExpression.a$cls);
  14407. $core.addMethod(
  14408. $core.method({
  14409. selector: "fromString:flag:",
  14410. protocol: "instance creation",
  14411. fn: function (aString,anotherString){
  14412. var self=this,$self=this;
  14413. return $core.withContext(function($ctx1) {
  14414. return new RegExp(aString, anotherString);
  14415. return self;
  14416. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  14417. },
  14418. args: ["aString", "anotherString"],
  14419. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14420. referencedClasses: [],
  14421. messageSends: []
  14422. }),
  14423. $globals.RegularExpression.a$cls);
  14424. });
  14425. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14426. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14427. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14428. $core.addPackage("Kernel-Classes");
  14429. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  14430. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  14431. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14432. $globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aIn addition to BehaviorBody, I define superclass/subclass relationships and instantiation.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes and contain the description that instances are created from.\x0a\x0aI also provide iterating over the class hierarchy.";
  14433. $core.addMethod(
  14434. $core.method({
  14435. selector: "allInstanceVariableNames",
  14436. protocol: "accessing",
  14437. fn: function (){
  14438. var self=this,$self=this;
  14439. var result;
  14440. return $core.withContext(function($ctx1) {
  14441. var $1,$receiver;
  14442. result=$recv($self._instanceVariableNames())._copy();
  14443. $1=$self._superclass();
  14444. $ctx1.sendIdx["superclass"]=1;
  14445. if(($receiver = $1) == null || $receiver.a$nil){
  14446. $1;
  14447. } else {
  14448. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14449. }
  14450. return result;
  14451. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14452. },
  14453. args: [],
  14454. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14455. referencedClasses: [],
  14456. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14457. }),
  14458. $globals.Behavior);
  14459. $core.addMethod(
  14460. $core.method({
  14461. selector: "allSelectors",
  14462. protocol: "accessing",
  14463. fn: function (){
  14464. var self=this,$self=this;
  14465. return $core.withContext(function($ctx1) {
  14466. var $1,$2;
  14467. $1=$self._allSuperclasses();
  14468. $2=$self._selectors();
  14469. $ctx1.sendIdx["selectors"]=1;
  14470. return $recv($1)._inject_into_($2,(function(acc,each){
  14471. return $core.withContext(function($ctx2) {
  14472. $recv(acc)._addAll_($recv(each)._selectors());
  14473. return $recv(acc)._yourself();
  14474. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14475. }));
  14476. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14477. },
  14478. args: [],
  14479. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14480. referencedClasses: [],
  14481. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14482. }),
  14483. $globals.Behavior);
  14484. $core.addMethod(
  14485. $core.method({
  14486. selector: "allSubclasses",
  14487. protocol: "accessing",
  14488. fn: function (){
  14489. var self=this,$self=this;
  14490. return $core.withContext(function($ctx1) {
  14491. return $recv($globals.Array)._streamContents_((function(str){
  14492. return $core.withContext(function($ctx2) {
  14493. return $self._allSubclassesDo_((function(each){
  14494. return $core.withContext(function($ctx3) {
  14495. return $recv(str)._nextPut_(each);
  14496. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14497. }));
  14498. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14499. }));
  14500. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14501. },
  14502. args: [],
  14503. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09^ Array streamContents: [ :str | self allSubclassesDo: [ :each | str nextPut: each ] ]",
  14504. referencedClasses: ["Array"],
  14505. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14506. }),
  14507. $globals.Behavior);
  14508. $core.addMethod(
  14509. $core.method({
  14510. selector: "allSubclassesDo:",
  14511. protocol: "enumerating",
  14512. fn: function (aBlock){
  14513. var self=this,$self=this;
  14514. return $core.withContext(function($ctx1) {
  14515. $core.traverseClassTree(self, function(subclass) {
  14516. if (subclass !== self) aBlock._value_(subclass);
  14517. });
  14518. return self;
  14519. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14520. },
  14521. args: ["aBlock"],
  14522. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<inlineJS: '$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})'>",
  14523. referencedClasses: [],
  14524. messageSends: []
  14525. }),
  14526. $globals.Behavior);
  14527. $core.addMethod(
  14528. $core.method({
  14529. selector: "allSuperclasses",
  14530. protocol: "accessing",
  14531. fn: function (){
  14532. var self=this,$self=this;
  14533. return $core.withContext(function($ctx1) {
  14534. var $1,$3,$2,$receiver;
  14535. $1=$self._superclass();
  14536. $ctx1.sendIdx["superclass"]=1;
  14537. if(($receiver = $1) == null || $receiver.a$nil){
  14538. return [];
  14539. } else {
  14540. $1;
  14541. }
  14542. $3=$self._superclass();
  14543. $ctx1.sendIdx["superclass"]=2;
  14544. $2=$recv($globals.OrderedCollection)._with_($3);
  14545. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14546. return $recv($2)._yourself();
  14547. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14548. },
  14549. args: [],
  14550. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  14551. referencedClasses: ["OrderedCollection"],
  14552. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14553. }),
  14554. $globals.Behavior);
  14555. $core.addMethod(
  14556. $core.method({
  14557. selector: "basicNew",
  14558. protocol: "instance creation",
  14559. fn: function (){
  14560. var self=this,$self=this;
  14561. return $core.withContext(function($ctx1) {
  14562. return new self.fn();
  14563. return self;
  14564. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14565. },
  14566. args: [],
  14567. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14568. referencedClasses: [],
  14569. messageSends: []
  14570. }),
  14571. $globals.Behavior);
  14572. $core.addMethod(
  14573. $core.method({
  14574. selector: "basicOrganization",
  14575. protocol: "accessing",
  14576. fn: function (){
  14577. var self=this,$self=this;
  14578. return $self["@organization"];
  14579. },
  14580. args: [],
  14581. source: "basicOrganization\x0a\x09^ organization",
  14582. referencedClasses: [],
  14583. messageSends: []
  14584. }),
  14585. $globals.Behavior);
  14586. $core.addMethod(
  14587. $core.method({
  14588. selector: "basicOrganization:",
  14589. protocol: "accessing",
  14590. fn: function (aClassOrganizer){
  14591. var self=this,$self=this;
  14592. $self["@organization"]=aClassOrganizer;
  14593. return self;
  14594. },
  14595. args: ["aClassOrganizer"],
  14596. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14597. referencedClasses: [],
  14598. messageSends: []
  14599. }),
  14600. $globals.Behavior);
  14601. $core.addMethod(
  14602. $core.method({
  14603. selector: "canUnderstand:",
  14604. protocol: "testing",
  14605. fn: function (aSelector){
  14606. var self=this,$self=this;
  14607. return $core.withContext(function($ctx1) {
  14608. var $2,$1;
  14609. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14610. return $core.withContext(function($ctx2) {
  14611. $2=$self._superclass();
  14612. $ctx2.sendIdx["superclass"]=1;
  14613. $1=$recv($2)._notNil();
  14614. return $recv($1)._and_((function(){
  14615. return $core.withContext(function($ctx3) {
  14616. return $recv($self._superclass())._canUnderstand_(aSelector);
  14617. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14618. }));
  14619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14620. }));
  14621. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14622. },
  14623. args: ["aSelector"],
  14624. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14625. referencedClasses: [],
  14626. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14627. }),
  14628. $globals.Behavior);
  14629. $core.addMethod(
  14630. $core.method({
  14631. selector: "includesBehavior:",
  14632. protocol: "testing",
  14633. fn: function (aClass){
  14634. var self=this,$self=this;
  14635. return $core.withContext(function($ctx1) {
  14636. return $recv($self.__eq_eq(aClass))._or_((function(){
  14637. return $core.withContext(function($ctx2) {
  14638. return $self._inheritsFrom_(aClass);
  14639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14640. }));
  14641. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14642. },
  14643. args: ["aClass"],
  14644. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14645. referencedClasses: [],
  14646. messageSends: ["or:", "==", "inheritsFrom:"]
  14647. }),
  14648. $globals.Behavior);
  14649. $core.addMethod(
  14650. $core.method({
  14651. selector: "inheritsFrom:",
  14652. protocol: "testing",
  14653. fn: function (aClass){
  14654. var self=this,$self=this;
  14655. return $core.withContext(function($ctx1) {
  14656. var $1,$3,$2,$receiver;
  14657. $1=$self._superclass();
  14658. $ctx1.sendIdx["superclass"]=1;
  14659. if(($receiver = $1) == null || $receiver.a$nil){
  14660. return false;
  14661. } else {
  14662. $1;
  14663. }
  14664. $3=$self._superclass();
  14665. $ctx1.sendIdx["superclass"]=2;
  14666. $2=$recv(aClass).__eq_eq($3);
  14667. return $recv($2)._or_((function(){
  14668. return $core.withContext(function($ctx2) {
  14669. return $recv($self._superclass())._inheritsFrom_(aClass);
  14670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14671. }));
  14672. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14673. },
  14674. args: ["aClass"],
  14675. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14676. referencedClasses: [],
  14677. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14678. }),
  14679. $globals.Behavior);
  14680. $core.addMethod(
  14681. $core.method({
  14682. selector: "instanceVariableNames",
  14683. protocol: "accessing",
  14684. fn: function (){
  14685. var self=this,$self=this;
  14686. return $core.withContext(function($ctx1) {
  14687. return self.iVarNames;
  14688. return self;
  14689. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14690. },
  14691. args: [],
  14692. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14693. referencedClasses: [],
  14694. messageSends: []
  14695. }),
  14696. $globals.Behavior);
  14697. $core.addMethod(
  14698. $core.method({
  14699. selector: "isBehavior",
  14700. protocol: "testing",
  14701. fn: function (){
  14702. var self=this,$self=this;
  14703. return true;
  14704. },
  14705. args: [],
  14706. source: "isBehavior\x0a\x09^ true",
  14707. referencedClasses: [],
  14708. messageSends: []
  14709. }),
  14710. $globals.Behavior);
  14711. $core.addMethod(
  14712. $core.method({
  14713. selector: "javascriptConstructor",
  14714. protocol: "accessing",
  14715. fn: function (){
  14716. var self=this,$self=this;
  14717. return $core.withContext(function($ctx1) {
  14718. return self.fn;
  14719. return self;
  14720. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14721. },
  14722. args: [],
  14723. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14724. referencedClasses: [],
  14725. messageSends: []
  14726. }),
  14727. $globals.Behavior);
  14728. $core.addMethod(
  14729. $core.method({
  14730. selector: "javascriptConstructor:",
  14731. protocol: "accessing",
  14732. fn: function (aJavaScriptFunction){
  14733. var self=this,$self=this;
  14734. return $core.withContext(function($ctx1) {
  14735. $core.setClassConstructor(self, aJavaScriptFunction);;
  14736. return self;
  14737. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14738. },
  14739. args: ["aJavaScriptFunction"],
  14740. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `$core.setClassConstructor'\x22\x0a\x09\x0a\x09<inlineJS: '$core.setClassConstructor(self, aJavaScriptFunction);'>",
  14741. referencedClasses: [],
  14742. messageSends: []
  14743. }),
  14744. $globals.Behavior);
  14745. $core.addMethod(
  14746. $core.method({
  14747. selector: "lookupSelector:",
  14748. protocol: "accessing",
  14749. fn: function (selector){
  14750. var self=this,$self=this;
  14751. var lookupClass;
  14752. return $core.withContext(function($ctx1) {
  14753. var $1;
  14754. var $early={};
  14755. try {
  14756. lookupClass=self;
  14757. $recv((function(){
  14758. return $core.withContext(function($ctx2) {
  14759. return $recv(lookupClass).__eq(nil);
  14760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14761. }))._whileFalse_((function(){
  14762. return $core.withContext(function($ctx2) {
  14763. $1=$recv(lookupClass)._includesSelector_(selector);
  14764. if($core.assert($1)){
  14765. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14766. }
  14767. lookupClass=$recv(lookupClass)._superclass();
  14768. return lookupClass;
  14769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14770. }));
  14771. return nil;
  14772. }
  14773. catch(e) {if(e===$early)return e[0]; throw e}
  14774. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14775. },
  14776. args: ["selector"],
  14777. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  14778. referencedClasses: [],
  14779. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14780. }),
  14781. $globals.Behavior);
  14782. $core.addMethod(
  14783. $core.method({
  14784. selector: "new",
  14785. protocol: "instance creation",
  14786. fn: function (){
  14787. var self=this,$self=this;
  14788. return $core.withContext(function($ctx1) {
  14789. return $recv($self._basicNew())._initialize();
  14790. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14791. },
  14792. args: [],
  14793. source: "new\x0a\x09^ self basicNew initialize",
  14794. referencedClasses: [],
  14795. messageSends: ["initialize", "basicNew"]
  14796. }),
  14797. $globals.Behavior);
  14798. $core.addMethod(
  14799. $core.method({
  14800. selector: "prototype",
  14801. protocol: "accessing",
  14802. fn: function (){
  14803. var self=this,$self=this;
  14804. return $core.withContext(function($ctx1) {
  14805. return self.fn.prototype;
  14806. return self;
  14807. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14808. },
  14809. args: [],
  14810. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14811. referencedClasses: [],
  14812. messageSends: []
  14813. }),
  14814. $globals.Behavior);
  14815. $core.addMethod(
  14816. $core.method({
  14817. selector: "subclasses",
  14818. protocol: "accessing",
  14819. fn: function (){
  14820. var self=this,$self=this;
  14821. return $core.withContext(function($ctx1) {
  14822. $self._subclassResponsibility();
  14823. return self;
  14824. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14825. },
  14826. args: [],
  14827. source: "subclasses\x0a\x09self subclassResponsibility",
  14828. referencedClasses: [],
  14829. messageSends: ["subclassResponsibility"]
  14830. }),
  14831. $globals.Behavior);
  14832. $core.addMethod(
  14833. $core.method({
  14834. selector: "superclass",
  14835. protocol: "accessing",
  14836. fn: function (){
  14837. var self=this,$self=this;
  14838. return $core.withContext(function($ctx1) {
  14839. return self.superclass;
  14840. return self;
  14841. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14842. },
  14843. args: [],
  14844. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14845. referencedClasses: [],
  14846. messageSends: []
  14847. }),
  14848. $globals.Behavior);
  14849. $core.addMethod(
  14850. $core.method({
  14851. selector: "theMetaClass",
  14852. protocol: "accessing",
  14853. fn: function (){
  14854. var self=this,$self=this;
  14855. return $core.withContext(function($ctx1) {
  14856. $self._subclassResponsibility();
  14857. return self;
  14858. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14859. },
  14860. args: [],
  14861. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14862. referencedClasses: [],
  14863. messageSends: ["subclassResponsibility"]
  14864. }),
  14865. $globals.Behavior);
  14866. $core.addMethod(
  14867. $core.method({
  14868. selector: "theNonMetaClass",
  14869. protocol: "accessing",
  14870. fn: function (){
  14871. var self=this,$self=this;
  14872. return $core.withContext(function($ctx1) {
  14873. $self._subclassResponsibility();
  14874. return self;
  14875. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14876. },
  14877. args: [],
  14878. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14879. referencedClasses: [],
  14880. messageSends: ["subclassResponsibility"]
  14881. }),
  14882. $globals.Behavior);
  14883. $core.addMethod(
  14884. $core.method({
  14885. selector: "withAllSubclasses",
  14886. protocol: "accessing",
  14887. fn: function (){
  14888. var self=this,$self=this;
  14889. return $core.withContext(function($ctx1) {
  14890. var $1;
  14891. $1=$recv($globals.Array)._with_(self);
  14892. $recv($1)._addAll_($self._allSubclasses());
  14893. return $recv($1)._yourself();
  14894. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14895. },
  14896. args: [],
  14897. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14898. referencedClasses: ["Array"],
  14899. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14900. }),
  14901. $globals.Behavior);
  14902. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14903. $globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  14904. $core.addMethod(
  14905. $core.method({
  14906. selector: "basicPackage:",
  14907. protocol: "accessing",
  14908. fn: function (aPackage){
  14909. var self=this,$self=this;
  14910. $self["@package"]=aPackage;
  14911. return self;
  14912. },
  14913. args: ["aPackage"],
  14914. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14915. referencedClasses: [],
  14916. messageSends: []
  14917. }),
  14918. $globals.Class);
  14919. $core.addMethod(
  14920. $core.method({
  14921. selector: "classTag",
  14922. protocol: "accessing",
  14923. fn: function (){
  14924. var self=this,$self=this;
  14925. return "class";
  14926. },
  14927. args: [],
  14928. 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^ 'class'",
  14929. referencedClasses: [],
  14930. messageSends: []
  14931. }),
  14932. $globals.Class);
  14933. $core.addMethod(
  14934. $core.method({
  14935. selector: "definition",
  14936. protocol: "accessing",
  14937. fn: function (){
  14938. var self=this,$self=this;
  14939. return $core.withContext(function($ctx1) {
  14940. var $1,$2;
  14941. return $recv($globals.String)._streamContents_((function(stream){
  14942. return $core.withContext(function($ctx2) {
  14943. $recv(stream)._print_($self._superclass());
  14944. $ctx2.sendIdx["print:"]=1;
  14945. $recv(stream)._write_(" subclass: ");
  14946. $ctx2.sendIdx["write:"]=1;
  14947. $recv(stream)._printSymbol_($self._name());
  14948. $recv(stream)._lf();
  14949. $ctx2.sendIdx["lf"]=1;
  14950. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14951. return $core.withContext(function($ctx3) {
  14952. $1=$recv($globals.String)._tab();
  14953. $ctx3.sendIdx["tab"]=1;
  14954. $2=$recv($globals.String)._lf();
  14955. $ctx3.sendIdx["lf"]=2;
  14956. return [$1,"uses: ",tcd,$2];
  14957. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14958. })));
  14959. $ctx2.sendIdx["write:"]=2;
  14960. $recv(stream)._tab();
  14961. $ctx2.sendIdx["tab"]=2;
  14962. $recv(stream)._write_("instanceVariableNames: ");
  14963. $ctx2.sendIdx["write:"]=3;
  14964. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14965. $ctx2.sendIdx["print:"]=2;
  14966. $recv(stream)._lf();
  14967. $recv(stream)._tab();
  14968. $recv(stream)._write_("package: ");
  14969. return $recv(stream)._print_($self._category());
  14970. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14971. }));
  14972. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14973. },
  14974. args: [],
  14975. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self superclass; write: ' subclass: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'instanceVariableNames: '; print: (' ' join: self instanceVariableNames); lf;\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  14976. referencedClasses: ["String"],
  14977. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14978. }),
  14979. $globals.Class);
  14980. $core.addMethod(
  14981. $core.method({
  14982. selector: "isClass",
  14983. protocol: "testing",
  14984. fn: function (){
  14985. var self=this,$self=this;
  14986. return true;
  14987. },
  14988. args: [],
  14989. source: "isClass\x0a\x09^ true",
  14990. referencedClasses: [],
  14991. messageSends: []
  14992. }),
  14993. $globals.Class);
  14994. $core.addMethod(
  14995. $core.method({
  14996. selector: "package",
  14997. protocol: "accessing",
  14998. fn: function (){
  14999. var self=this,$self=this;
  15000. return $self["@package"];
  15001. },
  15002. args: [],
  15003. source: "package\x0a\x09^ package",
  15004. referencedClasses: [],
  15005. messageSends: []
  15006. }),
  15007. $globals.Class);
  15008. $core.addMethod(
  15009. $core.method({
  15010. selector: "rename:",
  15011. protocol: "accessing",
  15012. fn: function (aString){
  15013. var self=this,$self=this;
  15014. return $core.withContext(function($ctx1) {
  15015. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  15016. return self;
  15017. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  15018. },
  15019. args: ["aString"],
  15020. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  15021. referencedClasses: ["ClassBuilder"],
  15022. messageSends: ["renameClass:to:", "new"]
  15023. }),
  15024. $globals.Class);
  15025. $core.addMethod(
  15026. $core.method({
  15027. selector: "subclasses",
  15028. protocol: "accessing",
  15029. fn: function (){
  15030. var self=this,$self=this;
  15031. return $core.withContext(function($ctx1) {
  15032. return self.subclasses._copy();
  15033. return self;
  15034. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  15035. },
  15036. args: [],
  15037. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  15038. referencedClasses: [],
  15039. messageSends: []
  15040. }),
  15041. $globals.Class);
  15042. $core.addMethod(
  15043. $core.method({
  15044. selector: "theMetaClass",
  15045. protocol: "accessing",
  15046. fn: function (){
  15047. var self=this,$self=this;
  15048. return $core.withContext(function($ctx1) {
  15049. return $self._class();
  15050. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  15051. },
  15052. args: [],
  15053. source: "theMetaClass\x0a\x09^ self class",
  15054. referencedClasses: [],
  15055. messageSends: ["class"]
  15056. }),
  15057. $globals.Class);
  15058. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  15059. $globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  15060. $core.addMethod(
  15061. $core.method({
  15062. selector: "asJavaScriptSource",
  15063. protocol: "converting",
  15064. fn: function (){
  15065. var self=this,$self=this;
  15066. return $core.withContext(function($ctx1) {
  15067. var $1;
  15068. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15069. $ctx1.sendIdx[","]=1;
  15070. return $1;
  15071. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  15072. },
  15073. args: [],
  15074. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15075. referencedClasses: [],
  15076. messageSends: [",", "name", "instanceClass"]
  15077. }),
  15078. $globals.Metaclass);
  15079. $core.addMethod(
  15080. $core.method({
  15081. selector: "definition",
  15082. protocol: "accessing",
  15083. fn: function (){
  15084. var self=this,$self=this;
  15085. return $core.withContext(function($ctx1) {
  15086. var $1,$2;
  15087. return $recv($globals.String)._streamContents_((function(stream){
  15088. return $core.withContext(function($ctx2) {
  15089. $recv(stream)._print_(self);
  15090. $ctx2.sendIdx["print:"]=1;
  15091. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15092. return " ";
  15093. }),(function(tcd){
  15094. return $core.withContext(function($ctx3) {
  15095. $1=$recv($globals.String)._lf();
  15096. $ctx3.sendIdx["lf"]=1;
  15097. $2=$recv($globals.String)._tab();
  15098. $ctx3.sendIdx["tab"]=1;
  15099. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15100. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15101. })));
  15102. $ctx2.sendIdx["write:"]=1;
  15103. $recv(stream)._write_("instanceVariableNames: ");
  15104. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15105. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15106. }));
  15107. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  15108. },
  15109. args: [],
  15110. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09print: self;\x0a\x09\x09write: (self traitCompositionDefinition\x0a\x09\x09\x09ifEmpty: [' ']\x0a\x09\x09\x09ifNotEmpty: [ :tcd | { String lf. String tab. 'uses: '. tcd. String lf. String tab }]);\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: self instanceVariableNames) ]",
  15111. referencedClasses: ["String"],
  15112. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  15113. }),
  15114. $globals.Metaclass);
  15115. $core.addMethod(
  15116. $core.method({
  15117. selector: "instanceClass",
  15118. protocol: "accessing",
  15119. fn: function (){
  15120. var self=this,$self=this;
  15121. return $core.withContext(function($ctx1) {
  15122. return self.instanceClass;
  15123. return self;
  15124. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  15125. },
  15126. args: [],
  15127. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15128. referencedClasses: [],
  15129. messageSends: []
  15130. }),
  15131. $globals.Metaclass);
  15132. $core.addMethod(
  15133. $core.method({
  15134. selector: "instanceVariableNames:",
  15135. protocol: "accessing",
  15136. fn: function (aCollection){
  15137. var self=this,$self=this;
  15138. return $core.withContext(function($ctx1) {
  15139. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15140. return self;
  15141. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15142. },
  15143. args: ["aCollection"],
  15144. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15145. referencedClasses: ["ClassBuilder"],
  15146. messageSends: ["class:instanceVariableNames:", "new"]
  15147. }),
  15148. $globals.Metaclass);
  15149. $core.addMethod(
  15150. $core.method({
  15151. selector: "isMetaclass",
  15152. protocol: "testing",
  15153. fn: function (){
  15154. var self=this,$self=this;
  15155. return true;
  15156. },
  15157. args: [],
  15158. source: "isMetaclass\x0a\x09^ true",
  15159. referencedClasses: [],
  15160. messageSends: []
  15161. }),
  15162. $globals.Metaclass);
  15163. $core.addMethod(
  15164. $core.method({
  15165. selector: "name",
  15166. protocol: "accessing",
  15167. fn: function (){
  15168. var self=this,$self=this;
  15169. return $core.withContext(function($ctx1) {
  15170. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15171. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15172. },
  15173. args: [],
  15174. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15175. referencedClasses: [],
  15176. messageSends: [",", "name", "instanceClass"]
  15177. }),
  15178. $globals.Metaclass);
  15179. $core.addMethod(
  15180. $core.method({
  15181. selector: "package",
  15182. protocol: "accessing",
  15183. fn: function (){
  15184. var self=this,$self=this;
  15185. return $core.withContext(function($ctx1) {
  15186. return $recv($self._instanceClass())._package();
  15187. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15188. },
  15189. args: [],
  15190. source: "package\x0a\x09^ self instanceClass package",
  15191. referencedClasses: [],
  15192. messageSends: ["package", "instanceClass"]
  15193. }),
  15194. $globals.Metaclass);
  15195. $core.addMethod(
  15196. $core.method({
  15197. selector: "subclasses",
  15198. protocol: "accessing",
  15199. fn: function (){
  15200. var self=this,$self=this;
  15201. return $core.withContext(function($ctx1) {
  15202. return $core.metaSubclasses(self);
  15203. return self;
  15204. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15205. },
  15206. args: [],
  15207. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15208. referencedClasses: [],
  15209. messageSends: []
  15210. }),
  15211. $globals.Metaclass);
  15212. $core.addMethod(
  15213. $core.method({
  15214. selector: "theMetaClass",
  15215. protocol: "accessing",
  15216. fn: function (){
  15217. var self=this,$self=this;
  15218. return self;
  15219. },
  15220. args: [],
  15221. source: "theMetaClass\x0a\x09^ self",
  15222. referencedClasses: [],
  15223. messageSends: []
  15224. }),
  15225. $globals.Metaclass);
  15226. $core.addMethod(
  15227. $core.method({
  15228. selector: "theNonMetaClass",
  15229. protocol: "accessing",
  15230. fn: function (){
  15231. var self=this,$self=this;
  15232. return $core.withContext(function($ctx1) {
  15233. return $self._instanceClass();
  15234. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15235. },
  15236. args: [],
  15237. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15238. referencedClasses: [],
  15239. messageSends: ["instanceClass"]
  15240. }),
  15241. $globals.Metaclass);
  15242. $core.addMethod(
  15243. $core.method({
  15244. selector: "uses:instanceVariableNames:",
  15245. protocol: "accessing",
  15246. fn: function (aTraitCompositionDescription,aCollection){
  15247. var self=this,$self=this;
  15248. var metaclass;
  15249. return $core.withContext(function($ctx1) {
  15250. metaclass=$self._instanceVariableNames_(aCollection);
  15251. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15252. return metaclass;
  15253. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15254. },
  15255. args: ["aTraitCompositionDescription", "aCollection"],
  15256. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15257. referencedClasses: [],
  15258. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15259. }),
  15260. $globals.Metaclass);
  15261. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15262. $globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  15263. $core.addMethod(
  15264. $core.method({
  15265. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15266. protocol: "class definition",
  15267. fn: function (aClass,className,aCollection,packageName){
  15268. var self=this,$self=this;
  15269. var theClass,thePackage;
  15270. return $core.withContext(function($ctx1) {
  15271. var $1,$2,$3,$receiver;
  15272. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15273. thePackage=$recv($globals.Package)._named_(packageName);
  15274. $1=theClass;
  15275. if(($receiver = $1) == null || $receiver.a$nil){
  15276. $1;
  15277. } else {
  15278. $recv(theClass)._package_(thePackage);
  15279. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15280. if(!$core.assert($2)){
  15281. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15282. }
  15283. }
  15284. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15285. $recv($3)._recompile();
  15286. return $recv($3)._yourself();
  15287. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15288. },
  15289. args: ["aClass", "className", "aCollection", "packageName"],
  15290. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass\x0a\x09\x09\x09ifFalse: [ ^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ (self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName) recompile; yourself",
  15291. referencedClasses: ["Smalltalk", "Package"],
  15292. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15293. }),
  15294. $globals.ClassBuilder);
  15295. $core.addMethod(
  15296. $core.method({
  15297. selector: "addTraitNamed:package:",
  15298. protocol: "class definition",
  15299. fn: function (traitName,packageName){
  15300. var self=this,$self=this;
  15301. var theTrait,thePackage;
  15302. return $core.withContext(function($ctx1) {
  15303. var $1,$2,$receiver;
  15304. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15305. thePackage=$recv($globals.Package)._named_(packageName);
  15306. $1=theTrait;
  15307. if(($receiver = $1) == null || $receiver.a$nil){
  15308. $1;
  15309. } else {
  15310. $2=theTrait;
  15311. $recv($2)._package_(thePackage);
  15312. $recv($2)._recompile();
  15313. return $recv($2)._yourself();
  15314. }
  15315. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15316. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15317. },
  15318. args: ["traitName", "packageName"],
  15319. source: "addTraitNamed: traitName package: packageName\x0a\x09| theTrait thePackage |\x0a\x09\x0a\x09theTrait := Smalltalk globals at: traitName.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theTrait ifNotNil: [ ^ theTrait package: thePackage; recompile; yourself ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddTraitNamed: traitName\x0a\x09\x09package: packageName",
  15320. referencedClasses: ["Smalltalk", "Package"],
  15321. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15322. }),
  15323. $globals.ClassBuilder);
  15324. $core.addMethod(
  15325. $core.method({
  15326. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15327. protocol: "private",
  15328. fn: function (aClass,aString,aCollection,packageName){
  15329. var self=this,$self=this;
  15330. return $core.withContext(function($ctx1) {
  15331. return $core.addClass(aString, aClass, aCollection, packageName);
  15332. ;
  15333. return self;
  15334. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15335. },
  15336. args: ["aClass", "aString", "aCollection", "packageName"],
  15337. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15338. referencedClasses: [],
  15339. messageSends: []
  15340. }),
  15341. $globals.ClassBuilder);
  15342. $core.addMethod(
  15343. $core.method({
  15344. selector: "basicAddTraitNamed:package:",
  15345. protocol: "private",
  15346. fn: function (aString,anotherString){
  15347. var self=this,$self=this;
  15348. return $core.withContext(function($ctx1) {
  15349. return $core.addTrait(aString, anotherString);
  15350. return self;
  15351. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15352. },
  15353. args: ["aString", "anotherString"],
  15354. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15355. referencedClasses: [],
  15356. messageSends: []
  15357. }),
  15358. $globals.ClassBuilder);
  15359. $core.addMethod(
  15360. $core.method({
  15361. selector: "basicClass:instanceVariables:",
  15362. protocol: "private",
  15363. fn: function (aClass,aCollection){
  15364. var self=this,$self=this;
  15365. return $core.withContext(function($ctx1) {
  15366. var $1;
  15367. $1=$recv(aClass)._isMetaclass();
  15368. if(!$core.assert($1)){
  15369. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15370. }
  15371. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15372. return self;
  15373. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15374. },
  15375. args: ["aClass", "aCollection"],
  15376. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15377. referencedClasses: [],
  15378. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15379. }),
  15380. $globals.ClassBuilder);
  15381. $core.addMethod(
  15382. $core.method({
  15383. selector: "basicRemoveClass:",
  15384. protocol: "private",
  15385. fn: function (aClass){
  15386. var self=this,$self=this;
  15387. return $core.withContext(function($ctx1) {
  15388. $core.removeClass(aClass);
  15389. return self;
  15390. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15391. },
  15392. args: ["aClass"],
  15393. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15394. referencedClasses: [],
  15395. messageSends: []
  15396. }),
  15397. $globals.ClassBuilder);
  15398. $core.addMethod(
  15399. $core.method({
  15400. selector: "basicRenameClass:to:",
  15401. protocol: "private",
  15402. fn: function (aClass,aString){
  15403. var self=this,$self=this;
  15404. return $core.withContext(function($ctx1) {
  15405. $globals[aString] = aClass;
  15406. delete $globals[aClass.name];
  15407. aClass.name = aString;
  15408. ;
  15409. return self;
  15410. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15411. },
  15412. args: ["aClass", "aString"],
  15413. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09'>",
  15414. referencedClasses: [],
  15415. messageSends: []
  15416. }),
  15417. $globals.ClassBuilder);
  15418. $core.addMethod(
  15419. $core.method({
  15420. selector: "basicSwapClassNames:with:",
  15421. protocol: "private",
  15422. fn: function (aClass,anotherClass){
  15423. var self=this,$self=this;
  15424. return $core.withContext(function($ctx1) {
  15425. var tmp = aClass.name;
  15426. aClass.name = anotherClass.name;
  15427. anotherClass.name = tmp;
  15428. ;
  15429. return self;
  15430. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15431. },
  15432. args: ["aClass", "anotherClass"],
  15433. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09'>",
  15434. referencedClasses: [],
  15435. messageSends: []
  15436. }),
  15437. $globals.ClassBuilder);
  15438. $core.addMethod(
  15439. $core.method({
  15440. selector: "class:instanceVariableNames:",
  15441. protocol: "class definition",
  15442. fn: function (aClass,ivarNames){
  15443. var self=this,$self=this;
  15444. return $core.withContext(function($ctx1) {
  15445. $self._class_instanceVariables_(aClass,$self._instanceVariableNamesFor_(ivarNames));
  15446. return self;
  15447. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15448. },
  15449. args: ["aClass", "ivarNames"],
  15450. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self class: aClass instanceVariables: (self instanceVariableNamesFor: ivarNames)",
  15451. referencedClasses: [],
  15452. messageSends: ["class:instanceVariables:", "instanceVariableNamesFor:"]
  15453. }),
  15454. $globals.ClassBuilder);
  15455. $core.addMethod(
  15456. $core.method({
  15457. selector: "class:instanceVariables:",
  15458. protocol: "class definition",
  15459. fn: function (aClass,aCollection){
  15460. var self=this,$self=this;
  15461. return $core.withContext(function($ctx1) {
  15462. var $1,$3,$2;
  15463. $self._basicClass_instanceVariables_(aClass,aCollection);
  15464. $1=$recv($globals.SystemAnnouncer)._current();
  15465. $3=$recv($globals.ClassDefinitionChanged)._new();
  15466. $recv($3)._theClass_(aClass);
  15467. $2=$recv($3)._yourself();
  15468. $recv($1)._announce_($2);
  15469. return self;
  15470. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15471. },
  15472. args: ["aClass", "aCollection"],
  15473. source: "class: aClass instanceVariables: aCollection\x0a\x09self basicClass: aClass instanceVariables: aCollection.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15474. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15475. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15476. }),
  15477. $globals.ClassBuilder);
  15478. $core.addMethod(
  15479. $core.method({
  15480. selector: "copyClass:named:",
  15481. protocol: "copying",
  15482. fn: function (aClass,className){
  15483. var self=this,$self=this;
  15484. var newClass;
  15485. return $core.withContext(function($ctx1) {
  15486. var $1,$3,$2;
  15487. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15488. $self._copyClass_to_(aClass,newClass);
  15489. $1=$recv($globals.SystemAnnouncer)._current();
  15490. $3=$recv($globals.ClassAdded)._new();
  15491. $recv($3)._theClass_(newClass);
  15492. $2=$recv($3)._yourself();
  15493. $recv($1)._announce_($2);
  15494. return newClass;
  15495. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15496. },
  15497. args: ["aClass", "className"],
  15498. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15499. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15500. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15501. }),
  15502. $globals.ClassBuilder);
  15503. $core.addMethod(
  15504. $core.method({
  15505. selector: "copyClass:to:",
  15506. protocol: "copying",
  15507. fn: function (aClass,anotherClass){
  15508. var self=this,$self=this;
  15509. return $core.withContext(function($ctx1) {
  15510. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15511. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15512. $1=$recv(aClass)._methodDictionary();
  15513. $ctx1.sendIdx["methodDictionary"]=1;
  15514. $recv($1)._valuesDo_((function(each){
  15515. return $core.withContext(function($ctx2) {
  15516. $3=$recv(each)._methodClass();
  15517. $ctx2.sendIdx["methodClass"]=1;
  15518. $2=$recv($3).__eq(aClass);
  15519. $ctx2.sendIdx["="]=1;
  15520. if($core.assert($2)){
  15521. $4=$recv($globals.Compiler)._new();
  15522. $ctx2.sendIdx["new"]=1;
  15523. $5=$recv(each)._source();
  15524. $ctx2.sendIdx["source"]=1;
  15525. $6=$recv(each)._protocol();
  15526. $ctx2.sendIdx["protocol"]=1;
  15527. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15528. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15529. }
  15530. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15531. }));
  15532. $ctx1.sendIdx["valuesDo:"]=1;
  15533. $7=$recv(aClass)._traitComposition();
  15534. $ctx1.sendIdx["traitComposition"]=1;
  15535. $recv(anotherClass)._setTraitComposition_($7);
  15536. $ctx1.sendIdx["setTraitComposition:"]=1;
  15537. $8=$recv(anotherClass)._class();
  15538. $ctx1.sendIdx["class"]=1;
  15539. $10=$recv(aClass)._class();
  15540. $ctx1.sendIdx["class"]=2;
  15541. $9=$recv($10)._instanceVariableNames();
  15542. $self._basicClass_instanceVariables_($8,$9);
  15543. $12=$recv(aClass)._class();
  15544. $ctx1.sendIdx["class"]=3;
  15545. $11=$recv($12)._methodDictionary();
  15546. $recv($11)._valuesDo_((function(each){
  15547. return $core.withContext(function($ctx2) {
  15548. $14=$recv(each)._methodClass();
  15549. $15=$recv(aClass)._class();
  15550. $ctx2.sendIdx["class"]=4;
  15551. $13=$recv($14).__eq($15);
  15552. if($core.assert($13)){
  15553. $16=$recv($globals.Compiler)._new();
  15554. $17=$recv(each)._source();
  15555. $18=$recv(anotherClass)._class();
  15556. $ctx2.sendIdx["class"]=5;
  15557. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15558. }
  15559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15560. }));
  15561. $19=$recv(anotherClass)._class();
  15562. $ctx1.sendIdx["class"]=6;
  15563. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15564. return self;
  15565. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15566. },
  15567. args: ["aClass", "anotherClass"],
  15568. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ] ].\x0a\x09anotherClass setTraitComposition: aClass traitComposition.\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09each methodClass = aClass class ifTrue: [\x0a\x09\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ] ].\x0a\x09anotherClass class setTraitComposition: aClass class traitComposition",
  15569. referencedClasses: ["Compiler"],
  15570. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15571. }),
  15572. $globals.ClassBuilder);
  15573. $core.addMethod(
  15574. $core.method({
  15575. selector: "installMethod:forClass:protocol:",
  15576. protocol: "method definition",
  15577. fn: function (aCompiledMethod,aBehavior,aString){
  15578. var self=this,$self=this;
  15579. return $core.withContext(function($ctx1) {
  15580. $recv(aCompiledMethod)._protocol_(aString);
  15581. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15582. return aCompiledMethod;
  15583. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15584. },
  15585. args: ["aCompiledMethod", "aBehavior", "aString"],
  15586. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15587. referencedClasses: [],
  15588. messageSends: ["protocol:", "addCompiledMethod:"]
  15589. }),
  15590. $globals.ClassBuilder);
  15591. $core.addMethod(
  15592. $core.method({
  15593. selector: "instanceVariableNamesFor:",
  15594. protocol: "accessing",
  15595. fn: function (aString){
  15596. var self=this,$self=this;
  15597. return $core.withContext(function($ctx1) {
  15598. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15599. return $core.withContext(function($ctx2) {
  15600. return $recv(each)._isEmpty();
  15601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15602. }));
  15603. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15604. },
  15605. args: ["aString"],
  15606. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15607. referencedClasses: [],
  15608. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15609. }),
  15610. $globals.ClassBuilder);
  15611. $core.addMethod(
  15612. $core.method({
  15613. selector: "migrateClass:superclass:",
  15614. protocol: "class migration",
  15615. fn: function (aClass,anotherClass){
  15616. var self=this,$self=this;
  15617. return $core.withContext(function($ctx1) {
  15618. var $1;
  15619. $1=$recv(aClass)._name();
  15620. $ctx1.sendIdx["name"]=1;
  15621. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15622. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15623. },
  15624. args: ["aClass", "anotherClass"],
  15625. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  15626. referencedClasses: [],
  15627. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15628. }),
  15629. $globals.ClassBuilder);
  15630. $core.addMethod(
  15631. $core.method({
  15632. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15633. protocol: "class migration",
  15634. fn: function (className,aClass,aCollection,packageName){
  15635. var self=this,$self=this;
  15636. var oldClass,newClass,tmp;
  15637. return $core.withContext(function($ctx1) {
  15638. var $1,$2,$4,$3;
  15639. tmp="new*".__comma(className);
  15640. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15641. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15642. $self._basicSwapClassNames_with_(oldClass,newClass);
  15643. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15644. $recv((function(){
  15645. return $core.withContext(function($ctx2) {
  15646. return $self._copyClass_to_(oldClass,newClass);
  15647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15648. }))._on_do_($globals.Error,(function(exception){
  15649. return $core.withContext(function($ctx2) {
  15650. $self._basicSwapClassNames_with_(oldClass,newClass);
  15651. $1=$self._basicRemoveClass_(newClass);
  15652. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15653. return $recv(exception)._resignal();
  15654. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15655. }));
  15656. $self._rawRenameClass_to_(oldClass,tmp);
  15657. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15658. $self._rawRenameClass_to_(newClass,className);
  15659. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15660. return $core.withContext(function($ctx2) {
  15661. return $self._migrateClass_superclass_(each,newClass);
  15662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15663. }));
  15664. $self._basicRemoveClass_(oldClass);
  15665. $2=$recv($globals.SystemAnnouncer)._current();
  15666. $4=$recv($globals.ClassMigrated)._new();
  15667. $recv($4)._theClass_(newClass);
  15668. $recv($4)._oldClass_(oldClass);
  15669. $3=$recv($4)._yourself();
  15670. $recv($2)._announce_($3);
  15671. return newClass;
  15672. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},$globals.ClassBuilder)});
  15673. },
  15674. args: ["className", "aClass", "aCollection", "packageName"],
  15675. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09\x09exception resignal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15676. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15677. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "resignal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15678. }),
  15679. $globals.ClassBuilder);
  15680. $core.addMethod(
  15681. $core.method({
  15682. selector: "rawRenameClass:to:",
  15683. protocol: "private",
  15684. fn: function (aClass,aString){
  15685. var self=this,$self=this;
  15686. return $core.withContext(function($ctx1) {
  15687. $globals[aString] = aClass;
  15688. ;
  15689. return self;
  15690. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15691. },
  15692. args: ["aClass", "aString"],
  15693. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15694. referencedClasses: [],
  15695. messageSends: []
  15696. }),
  15697. $globals.ClassBuilder);
  15698. $core.addMethod(
  15699. $core.method({
  15700. selector: "renameClass:to:",
  15701. protocol: "class migration",
  15702. fn: function (aClass,className){
  15703. var self=this,$self=this;
  15704. return $core.withContext(function($ctx1) {
  15705. var $1,$3,$2;
  15706. $self._basicRenameClass_to_(aClass,className);
  15707. $recv(aClass)._recompile();
  15708. $1=$recv($globals.SystemAnnouncer)._current();
  15709. $3=$recv($globals.ClassRenamed)._new();
  15710. $recv($3)._theClass_(aClass);
  15711. $2=$recv($3)._yourself();
  15712. $recv($1)._announce_($2);
  15713. return self;
  15714. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15715. },
  15716. args: ["aClass", "className"],
  15717. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15718. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15719. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15720. }),
  15721. $globals.ClassBuilder);
  15722. $core.addMethod(
  15723. $core.method({
  15724. selector: "superclass:subclass:",
  15725. protocol: "class definition",
  15726. fn: function (aClass,className){
  15727. var self=this,$self=this;
  15728. return $core.withContext(function($ctx1) {
  15729. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15730. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15731. },
  15732. args: ["aClass", "className"],
  15733. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15734. referencedClasses: [],
  15735. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15736. }),
  15737. $globals.ClassBuilder);
  15738. $core.addMethod(
  15739. $core.method({
  15740. selector: "superclass:subclass:instanceVariableNames:package:",
  15741. protocol: "class definition",
  15742. fn: function (aClass,className,ivarNames,packageName){
  15743. var self=this,$self=this;
  15744. var newClass;
  15745. return $core.withContext(function($ctx1) {
  15746. var $1,$2,$3,$5,$4,$receiver;
  15747. $1=$self._instanceVariableNamesFor_(ivarNames);
  15748. if(($receiver = packageName) == null || $receiver.a$nil){
  15749. $2="unclassified";
  15750. } else {
  15751. $2=packageName;
  15752. }
  15753. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15754. $3=$recv($globals.SystemAnnouncer)._current();
  15755. $5=$recv($globals.ClassAdded)._new();
  15756. $recv($5)._theClass_(newClass);
  15757. $4=$recv($5)._yourself();
  15758. $recv($3)._announce_($4);
  15759. return newClass;
  15760. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15761. },
  15762. args: ["aClass", "className", "ivarNames", "packageName"],
  15763. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  15764. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15765. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15766. }),
  15767. $globals.ClassBuilder);
  15768. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15769. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15770. $core.addMethod(
  15771. $core.method({
  15772. selector: "getNodesFrom:",
  15773. protocol: "accessing",
  15774. fn: function (aCollection){
  15775. var self=this,$self=this;
  15776. var children,others;
  15777. return $core.withContext(function($ctx1) {
  15778. var $1;
  15779. children=[];
  15780. others=[];
  15781. $recv(aCollection)._do_((function(each){
  15782. return $core.withContext(function($ctx2) {
  15783. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15784. if($core.assert($1)){
  15785. return $recv(children)._add_(each);
  15786. $ctx2.sendIdx["add:"]=1;
  15787. } else {
  15788. return $recv(others)._add_(each);
  15789. }
  15790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15791. }));
  15792. $self["@nodes"]=$recv(children)._collect_((function(each){
  15793. return $core.withContext(function($ctx2) {
  15794. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15795. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15796. }));
  15797. return self;
  15798. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15799. },
  15800. args: ["aCollection"],
  15801. source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]",
  15802. referencedClasses: ["ClassSorterNode"],
  15803. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15804. }),
  15805. $globals.ClassSorterNode);
  15806. $core.addMethod(
  15807. $core.method({
  15808. selector: "level",
  15809. protocol: "accessing",
  15810. fn: function (){
  15811. var self=this,$self=this;
  15812. return $self["@level"];
  15813. },
  15814. args: [],
  15815. source: "level\x0a\x09^ level",
  15816. referencedClasses: [],
  15817. messageSends: []
  15818. }),
  15819. $globals.ClassSorterNode);
  15820. $core.addMethod(
  15821. $core.method({
  15822. selector: "level:",
  15823. protocol: "accessing",
  15824. fn: function (anInteger){
  15825. var self=this,$self=this;
  15826. $self["@level"]=anInteger;
  15827. return self;
  15828. },
  15829. args: ["anInteger"],
  15830. source: "level: anInteger\x0a\x09level := anInteger",
  15831. referencedClasses: [],
  15832. messageSends: []
  15833. }),
  15834. $globals.ClassSorterNode);
  15835. $core.addMethod(
  15836. $core.method({
  15837. selector: "nodes",
  15838. protocol: "accessing",
  15839. fn: function (){
  15840. var self=this,$self=this;
  15841. return $self["@nodes"];
  15842. },
  15843. args: [],
  15844. source: "nodes\x0a\x09^ nodes",
  15845. referencedClasses: [],
  15846. messageSends: []
  15847. }),
  15848. $globals.ClassSorterNode);
  15849. $core.addMethod(
  15850. $core.method({
  15851. selector: "theClass",
  15852. protocol: "accessing",
  15853. fn: function (){
  15854. var self=this,$self=this;
  15855. return $self["@theClass"];
  15856. },
  15857. args: [],
  15858. source: "theClass\x0a\x09^ theClass",
  15859. referencedClasses: [],
  15860. messageSends: []
  15861. }),
  15862. $globals.ClassSorterNode);
  15863. $core.addMethod(
  15864. $core.method({
  15865. selector: "theClass:",
  15866. protocol: "accessing",
  15867. fn: function (aClass){
  15868. var self=this,$self=this;
  15869. $self["@theClass"]=aClass;
  15870. return self;
  15871. },
  15872. args: ["aClass"],
  15873. source: "theClass: aClass\x0a\x09theClass := aClass",
  15874. referencedClasses: [],
  15875. messageSends: []
  15876. }),
  15877. $globals.ClassSorterNode);
  15878. $core.addMethod(
  15879. $core.method({
  15880. selector: "traverseClassesWith:",
  15881. protocol: "visiting",
  15882. fn: function (aCollection){
  15883. var self=this,$self=this;
  15884. return $core.withContext(function($ctx1) {
  15885. var $1,$3,$2;
  15886. $1=$self._theClass();
  15887. $ctx1.sendIdx["theClass"]=1;
  15888. $recv(aCollection)._add_($1);
  15889. $recv($recv($self._nodes())._sorted_((function(a,b){
  15890. return $core.withContext(function($ctx2) {
  15891. $3=$recv(a)._theClass();
  15892. $ctx2.sendIdx["theClass"]=2;
  15893. $2=$recv($3)._name();
  15894. $ctx2.sendIdx["name"]=1;
  15895. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15896. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15897. })))._do_((function(aNode){
  15898. return $core.withContext(function($ctx2) {
  15899. return $recv(aNode)._traverseClassesWith_(aCollection);
  15900. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15901. }));
  15902. return self;
  15903. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15904. },
  15905. args: ["aCollection"],
  15906. source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
  15907. referencedClasses: [],
  15908. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15909. }),
  15910. $globals.ClassSorterNode);
  15911. $core.addMethod(
  15912. $core.method({
  15913. selector: "on:classes:level:",
  15914. protocol: "instance creation",
  15915. fn: function (aClass,aCollection,anInteger){
  15916. var self=this,$self=this;
  15917. return $core.withContext(function($ctx1) {
  15918. var $1;
  15919. $1=$self._new();
  15920. $recv($1)._theClass_(aClass);
  15921. $recv($1)._level_(anInteger);
  15922. $recv($1)._getNodesFrom_(aCollection);
  15923. return $recv($1)._yourself();
  15924. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15925. },
  15926. args: ["aClass", "aCollection", "anInteger"],
  15927. source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
  15928. referencedClasses: [],
  15929. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15930. }),
  15931. $globals.ClassSorterNode.a$cls);
  15932. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15933. $core.addMethod(
  15934. $core.method({
  15935. selector: "allInstanceVariableNames",
  15936. protocol: "accessing",
  15937. fn: function (){
  15938. var self=this,$self=this;
  15939. return [];
  15940. },
  15941. args: [],
  15942. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15943. referencedClasses: [],
  15944. messageSends: []
  15945. }),
  15946. $globals.TBehaviorDefaults);
  15947. $core.addMethod(
  15948. $core.method({
  15949. selector: "allSubclassesDo:",
  15950. protocol: "enumerating",
  15951. fn: function (aBlock){
  15952. var self=this,$self=this;
  15953. return self;
  15954. },
  15955. args: ["aBlock"],
  15956. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15957. referencedClasses: [],
  15958. messageSends: []
  15959. }),
  15960. $globals.TBehaviorDefaults);
  15961. $core.addMethod(
  15962. $core.method({
  15963. selector: "name",
  15964. protocol: "accessing",
  15965. fn: function (){
  15966. var self=this,$self=this;
  15967. return nil;
  15968. },
  15969. args: [],
  15970. source: "name\x0a\x09^ nil",
  15971. referencedClasses: [],
  15972. messageSends: []
  15973. }),
  15974. $globals.TBehaviorDefaults);
  15975. $core.addMethod(
  15976. $core.method({
  15977. selector: "printOn:",
  15978. protocol: "printing",
  15979. fn: function (aStream){
  15980. var self=this,$self=this;
  15981. return $core.withContext(function($ctx1) {
  15982. var $1,$receiver;
  15983. $1=$self._name();
  15984. if(($receiver = $1) == null || $receiver.a$nil){
  15985. (
  15986. $ctx1.supercall = true,
  15987. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15988. $ctx1.supercall = false;
  15989. } else {
  15990. var name;
  15991. name=$receiver;
  15992. $recv(aStream)._nextPutAll_(name);
  15993. }
  15994. return self;
  15995. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15996. },
  15997. args: ["aStream"],
  15998. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15999. referencedClasses: [],
  16000. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  16001. }),
  16002. $globals.TBehaviorDefaults);
  16003. $core.addMethod(
  16004. $core.method({
  16005. selector: "superclass",
  16006. protocol: "accessing",
  16007. fn: function (){
  16008. var self=this,$self=this;
  16009. return nil;
  16010. },
  16011. args: [],
  16012. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  16013. referencedClasses: [],
  16014. messageSends: []
  16015. }),
  16016. $globals.TBehaviorDefaults);
  16017. $core.addMethod(
  16018. $core.method({
  16019. selector: "traitUsers",
  16020. protocol: "accessing",
  16021. fn: function (){
  16022. var self=this,$self=this;
  16023. return [];
  16024. },
  16025. args: [],
  16026. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  16027. referencedClasses: [],
  16028. messageSends: []
  16029. }),
  16030. $globals.TBehaviorDefaults);
  16031. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16032. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16033. $core.addMethod(
  16034. $core.method({
  16035. selector: ">>",
  16036. protocol: "accessing",
  16037. fn: function (aString){
  16038. var self=this,$self=this;
  16039. return $core.withContext(function($ctx1) {
  16040. return $self._methodAt_(aString);
  16041. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  16042. },
  16043. args: ["aString"],
  16044. source: ">> aString\x0a\x09^ self methodAt: aString",
  16045. referencedClasses: [],
  16046. messageSends: ["methodAt:"]
  16047. }),
  16048. $globals.TBehaviorProvider);
  16049. $core.addMethod(
  16050. $core.method({
  16051. selector: "addCompiledMethod:",
  16052. protocol: "compiling",
  16053. fn: function (aMethod){
  16054. var self=this,$self=this;
  16055. var oldMethod,announcement;
  16056. return $core.withContext(function($ctx1) {
  16057. var $1,$2,$3,$4,$receiver;
  16058. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16059. return nil;
  16060. }));
  16061. $self._basicAddCompiledMethod_(aMethod);
  16062. $1=oldMethod;
  16063. if(($receiver = $1) == null || $receiver.a$nil){
  16064. $2=$recv($globals.MethodAdded)._new();
  16065. $ctx1.sendIdx["new"]=1;
  16066. $recv($2)._method_(aMethod);
  16067. $ctx1.sendIdx["method:"]=1;
  16068. $3=$recv($2)._yourself();
  16069. $ctx1.sendIdx["yourself"]=1;
  16070. announcement=$3;
  16071. } else {
  16072. $4=$recv($globals.MethodModified)._new();
  16073. $recv($4)._oldMethod_(oldMethod);
  16074. $recv($4)._method_(aMethod);
  16075. announcement=$recv($4)._yourself();
  16076. }
  16077. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16078. return self;
  16079. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  16080. },
  16081. args: ["aMethod"],
  16082. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  16083. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16084. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16085. }),
  16086. $globals.TBehaviorProvider);
  16087. $core.addMethod(
  16088. $core.method({
  16089. selector: "basicAddCompiledMethod:",
  16090. protocol: "private",
  16091. fn: function (aMethod){
  16092. var self=this,$self=this;
  16093. return $core.withContext(function($ctx1) {
  16094. $core.addMethod(aMethod, self);
  16095. return self;
  16096. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16097. },
  16098. args: ["aMethod"],
  16099. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16100. referencedClasses: [],
  16101. messageSends: []
  16102. }),
  16103. $globals.TBehaviorProvider);
  16104. $core.addMethod(
  16105. $core.method({
  16106. selector: "basicRemoveCompiledMethod:",
  16107. protocol: "private",
  16108. fn: function (aMethod){
  16109. var self=this,$self=this;
  16110. return $core.withContext(function($ctx1) {
  16111. $core.removeMethod(aMethod,self);
  16112. return self;
  16113. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16114. },
  16115. args: ["aMethod"],
  16116. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16117. referencedClasses: [],
  16118. messageSends: []
  16119. }),
  16120. $globals.TBehaviorProvider);
  16121. $core.addMethod(
  16122. $core.method({
  16123. selector: "compile:protocol:",
  16124. protocol: "compiling",
  16125. fn: function (aString,anotherString){
  16126. var self=this,$self=this;
  16127. return $core.withContext(function($ctx1) {
  16128. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16129. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16130. },
  16131. args: ["aString", "anotherString"],
  16132. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16133. referencedClasses: ["Compiler"],
  16134. messageSends: ["install:forClass:protocol:", "new"]
  16135. }),
  16136. $globals.TBehaviorProvider);
  16137. $core.addMethod(
  16138. $core.method({
  16139. selector: "includesSelector:",
  16140. protocol: "testing",
  16141. fn: function (aString){
  16142. var self=this,$self=this;
  16143. return $core.withContext(function($ctx1) {
  16144. return $recv($self._methodDictionary())._includesKey_(aString);
  16145. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16146. },
  16147. args: ["aString"],
  16148. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16149. referencedClasses: [],
  16150. messageSends: ["includesKey:", "methodDictionary"]
  16151. }),
  16152. $globals.TBehaviorProvider);
  16153. $core.addMethod(
  16154. $core.method({
  16155. selector: "methodAt:",
  16156. protocol: "accessing",
  16157. fn: function (aString){
  16158. var self=this,$self=this;
  16159. return $core.withContext(function($ctx1) {
  16160. return $recv($self._methodDictionary())._at_(aString);
  16161. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16162. },
  16163. args: ["aString"],
  16164. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16165. referencedClasses: [],
  16166. messageSends: ["at:", "methodDictionary"]
  16167. }),
  16168. $globals.TBehaviorProvider);
  16169. $core.addMethod(
  16170. $core.method({
  16171. selector: "methodDictionary",
  16172. protocol: "accessing",
  16173. fn: function (){
  16174. var self=this,$self=this;
  16175. return $core.withContext(function($ctx1) {
  16176. var dict = $globals.HashedCollection._new();
  16177. var methods = self.methods;
  16178. Object.keys(methods).forEach(function(i) {
  16179. if(methods[i].selector) {
  16180. dict._at_put_(methods[i].selector, methods[i]);
  16181. }
  16182. });
  16183. return dict;
  16184. return self;
  16185. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16186. },
  16187. args: [],
  16188. source: "methodDictionary\x0a\x09<inlineJS: 'var dict = $globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict'>",
  16189. referencedClasses: [],
  16190. messageSends: []
  16191. }),
  16192. $globals.TBehaviorProvider);
  16193. $core.addMethod(
  16194. $core.method({
  16195. selector: "methodOrganizationEnter:andLeave:",
  16196. protocol: "accessing",
  16197. fn: function (aMethod,oldMethod){
  16198. var self=this,$self=this;
  16199. return $core.withContext(function($ctx1) {
  16200. var $1,$2,$receiver;
  16201. if(($receiver = aMethod) == null || $receiver.a$nil){
  16202. aMethod;
  16203. } else {
  16204. $1=$self._organization();
  16205. $2=$recv(aMethod)._protocol();
  16206. $ctx1.sendIdx["protocol"]=1;
  16207. $recv($1)._addElement_($2);
  16208. }
  16209. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16210. oldMethod;
  16211. } else {
  16212. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16213. }
  16214. return self;
  16215. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16216. },
  16217. args: ["aMethod", "oldMethod"],
  16218. source: "methodOrganizationEnter: aMethod andLeave: oldMethod\x0a\x09aMethod ifNotNil: [\x0a\x09\x09self organization addElement: aMethod protocol ].\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ]",
  16219. referencedClasses: [],
  16220. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16221. }),
  16222. $globals.TBehaviorProvider);
  16223. $core.addMethod(
  16224. $core.method({
  16225. selector: "methodTemplate",
  16226. protocol: "accessing",
  16227. fn: function (){
  16228. var self=this,$self=this;
  16229. return $core.withContext(function($ctx1) {
  16230. return $recv($globals.String)._streamContents_((function(stream){
  16231. return $core.withContext(function($ctx2) {
  16232. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16233. $ctx2.sendIdx["write:"]=1;
  16234. $recv(stream)._lf();
  16235. $ctx2.sendIdx["lf"]=1;
  16236. $recv(stream)._tab();
  16237. $ctx2.sendIdx["tab"]=1;
  16238. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16239. $ctx2.sendIdx["write:"]=2;
  16240. $recv(stream)._lf();
  16241. $ctx2.sendIdx["lf"]=2;
  16242. $recv(stream)._lf();
  16243. $ctx2.sendIdx["lf"]=3;
  16244. $recv(stream)._tab();
  16245. $ctx2.sendIdx["tab"]=2;
  16246. $recv(stream)._write_("| temporary variable names |");
  16247. $ctx2.sendIdx["write:"]=3;
  16248. $recv(stream)._lf();
  16249. $recv(stream)._tab();
  16250. return $recv(stream)._write_("statements");
  16251. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16252. }));
  16253. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16254. },
  16255. args: [],
  16256. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: 'messageSelectorAndArgumentNames'; lf;\x0a\x09\x09tab; write: '\x22comment stating purpose of message\x22'; lf;\x0a\x09\x09lf;\x0a\x09\x09tab; write: '| temporary variable names |'; lf;\x0a\x09\x09tab; write: 'statements' ]",
  16257. referencedClasses: ["String"],
  16258. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16259. }),
  16260. $globals.TBehaviorProvider);
  16261. $core.addMethod(
  16262. $core.method({
  16263. selector: "methods",
  16264. protocol: "accessing",
  16265. fn: function (){
  16266. var self=this,$self=this;
  16267. return $core.withContext(function($ctx1) {
  16268. return $recv($self._methodDictionary())._values();
  16269. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16270. },
  16271. args: [],
  16272. source: "methods\x0a\x09^ self methodDictionary values",
  16273. referencedClasses: [],
  16274. messageSends: ["values", "methodDictionary"]
  16275. }),
  16276. $globals.TBehaviorProvider);
  16277. $core.addMethod(
  16278. $core.method({
  16279. selector: "methodsInProtocol:",
  16280. protocol: "accessing",
  16281. fn: function (aString){
  16282. var self=this,$self=this;
  16283. return $core.withContext(function($ctx1) {
  16284. return $recv($self._methods())._select_((function(each){
  16285. return $core.withContext(function($ctx2) {
  16286. return $recv($recv(each)._protocol()).__eq(aString);
  16287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16288. }));
  16289. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16290. },
  16291. args: ["aString"],
  16292. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16293. referencedClasses: [],
  16294. messageSends: ["select:", "methods", "=", "protocol"]
  16295. }),
  16296. $globals.TBehaviorProvider);
  16297. $core.addMethod(
  16298. $core.method({
  16299. selector: "organization",
  16300. protocol: "accessing",
  16301. fn: function (){
  16302. var self=this,$self=this;
  16303. return $core.withContext(function($ctx1) {
  16304. var $1,$receiver;
  16305. $1=$self._basicOrganization();
  16306. $ctx1.sendIdx["basicOrganization"]=1;
  16307. if(($receiver = $1) == null || $receiver.a$nil){
  16308. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16309. return $self._basicOrganization();
  16310. } else {
  16311. return $1;
  16312. }
  16313. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16314. },
  16315. args: [],
  16316. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16317. referencedClasses: ["ClassOrganizer"],
  16318. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16319. }),
  16320. $globals.TBehaviorProvider);
  16321. $core.addMethod(
  16322. $core.method({
  16323. selector: "ownMethods",
  16324. protocol: "accessing",
  16325. fn: function (){
  16326. var self=this,$self=this;
  16327. return $core.withContext(function($ctx1) {
  16328. var $1;
  16329. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16330. return $core.withContext(function($ctx2) {
  16331. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16332. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16333. })))._sorted_((function(a,b){
  16334. return $core.withContext(function($ctx2) {
  16335. $1=$recv(a)._selector();
  16336. $ctx2.sendIdx["selector"]=1;
  16337. return $recv($1).__lt_eq($recv(b)._selector());
  16338. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16339. }));
  16340. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16341. },
  16342. args: [],
  16343. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x0a\x09nor obtained via trait composition\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self ownMethodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  16344. referencedClasses: ["OrderedCollection"],
  16345. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16346. }),
  16347. $globals.TBehaviorProvider);
  16348. $core.addMethod(
  16349. $core.method({
  16350. selector: "ownMethodsInProtocol:",
  16351. protocol: "accessing",
  16352. fn: function (aString){
  16353. var self=this,$self=this;
  16354. return $core.withContext(function($ctx1) {
  16355. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16356. return $core.withContext(function($ctx2) {
  16357. return $recv($recv(each)._methodClass()).__eq(self);
  16358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16359. }));
  16360. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16361. },
  16362. args: ["aString"],
  16363. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16364. referencedClasses: [],
  16365. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16366. }),
  16367. $globals.TBehaviorProvider);
  16368. $core.addMethod(
  16369. $core.method({
  16370. selector: "ownProtocols",
  16371. protocol: "accessing",
  16372. fn: function (){
  16373. var self=this,$self=this;
  16374. return $core.withContext(function($ctx1) {
  16375. return $recv($self._protocols())._reject_((function(each){
  16376. return $core.withContext(function($ctx2) {
  16377. return $recv(each)._match_("^\x5c*");
  16378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16379. }));
  16380. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16381. },
  16382. args: [],
  16383. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  16384. referencedClasses: [],
  16385. messageSends: ["reject:", "protocols", "match:"]
  16386. }),
  16387. $globals.TBehaviorProvider);
  16388. $core.addMethod(
  16389. $core.method({
  16390. selector: "packageOfProtocol:",
  16391. protocol: "accessing",
  16392. fn: function (aString){
  16393. var self=this,$self=this;
  16394. return $core.withContext(function($ctx1) {
  16395. var $1;
  16396. $1=$recv(aString)._beginsWith_("*");
  16397. if(!$core.assert($1)){
  16398. return $self._package();
  16399. }
  16400. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16401. return nil;
  16402. }));
  16403. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16404. },
  16405. args: ["aString"],
  16406. source: "packageOfProtocol: aString\x0a\x09\x22Answer the package the method of receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the receiver's package\x22\x0a\x09\x0a\x09(aString beginsWith: '*') ifFalse: [\x0a\x09\x09^ self package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: aString allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  16407. referencedClasses: ["Package"],
  16408. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16409. }),
  16410. $globals.TBehaviorProvider);
  16411. $core.addMethod(
  16412. $core.method({
  16413. selector: "protocols",
  16414. protocol: "accessing",
  16415. fn: function (){
  16416. var self=this,$self=this;
  16417. return $core.withContext(function($ctx1) {
  16418. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16419. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16420. },
  16421. args: [],
  16422. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16423. referencedClasses: [],
  16424. messageSends: ["sorted", "asArray", "elements", "organization"]
  16425. }),
  16426. $globals.TBehaviorProvider);
  16427. $core.addMethod(
  16428. $core.method({
  16429. selector: "protocolsDo:",
  16430. protocol: "enumerating",
  16431. fn: function (aBlock){
  16432. var self=this,$self=this;
  16433. var methodsByProtocol;
  16434. return $core.withContext(function($ctx1) {
  16435. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16436. $ctx1.sendIdx["new"]=1;
  16437. $recv($self._methodDictionary())._valuesDo_((function(m){
  16438. return $core.withContext(function($ctx2) {
  16439. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16440. return $core.withContext(function($ctx3) {
  16441. return $recv($globals.Array)._new();
  16442. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16443. })))._add_(m);
  16444. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16445. }));
  16446. $recv($self._protocols())._do_((function(protocol){
  16447. return $core.withContext(function($ctx2) {
  16448. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16449. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16450. }));
  16451. return self;
  16452. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16453. },
  16454. args: ["aBlock"],
  16455. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  16456. referencedClasses: ["HashedCollection", "Array"],
  16457. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16458. }),
  16459. $globals.TBehaviorProvider);
  16460. $core.addMethod(
  16461. $core.method({
  16462. selector: "recompile",
  16463. protocol: "compiling",
  16464. fn: function (){
  16465. var self=this,$self=this;
  16466. return $core.withContext(function($ctx1) {
  16467. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16468. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16469. },
  16470. args: [],
  16471. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16472. referencedClasses: ["Compiler"],
  16473. messageSends: ["recompile:", "new"]
  16474. }),
  16475. $globals.TBehaviorProvider);
  16476. $core.addMethod(
  16477. $core.method({
  16478. selector: "removeCompiledMethod:",
  16479. protocol: "compiling",
  16480. fn: function (aMethod){
  16481. var self=this,$self=this;
  16482. return $core.withContext(function($ctx1) {
  16483. var $1,$3,$2;
  16484. $self._basicRemoveCompiledMethod_(aMethod);
  16485. $1=$recv($globals.SystemAnnouncer)._current();
  16486. $3=$recv($globals.MethodRemoved)._new();
  16487. $recv($3)._method_(aMethod);
  16488. $2=$recv($3)._yourself();
  16489. $recv($1)._announce_($2);
  16490. return self;
  16491. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16492. },
  16493. args: ["aMethod"],
  16494. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  16495. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16496. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16497. }),
  16498. $globals.TBehaviorProvider);
  16499. $core.addMethod(
  16500. $core.method({
  16501. selector: "removeProtocolIfEmpty:",
  16502. protocol: "accessing",
  16503. fn: function (aString){
  16504. var self=this,$self=this;
  16505. return $core.withContext(function($ctx1) {
  16506. $recv($self._methods())._detect_ifNone_((function(each){
  16507. return $core.withContext(function($ctx2) {
  16508. return $recv($recv(each)._protocol()).__eq(aString);
  16509. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16510. }),(function(){
  16511. return $core.withContext(function($ctx2) {
  16512. return $recv($self._organization())._removeElement_(aString);
  16513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16514. }));
  16515. return self;
  16516. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16517. },
  16518. args: ["aString"],
  16519. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16520. referencedClasses: [],
  16521. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16522. }),
  16523. $globals.TBehaviorProvider);
  16524. $core.addMethod(
  16525. $core.method({
  16526. selector: "selectors",
  16527. protocol: "accessing",
  16528. fn: function (){
  16529. var self=this,$self=this;
  16530. return $core.withContext(function($ctx1) {
  16531. return $recv($self._methodDictionary())._keys();
  16532. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16533. },
  16534. args: [],
  16535. source: "selectors\x0a\x09^ self methodDictionary keys",
  16536. referencedClasses: [],
  16537. messageSends: ["keys", "methodDictionary"]
  16538. }),
  16539. $globals.TBehaviorProvider);
  16540. $core.addMethod(
  16541. $core.method({
  16542. selector: "setTraitComposition:",
  16543. protocol: "compiling",
  16544. fn: function (aTraitComposition){
  16545. var self=this,$self=this;
  16546. return $core.withContext(function($ctx1) {
  16547. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16548. return self;
  16549. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16550. },
  16551. args: ["aTraitComposition"],
  16552. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16553. referencedClasses: [],
  16554. messageSends: []
  16555. }),
  16556. $globals.TBehaviorProvider);
  16557. $core.addMethod(
  16558. $core.method({
  16559. selector: "traitComposition",
  16560. protocol: "accessing",
  16561. fn: function (){
  16562. var self=this,$self=this;
  16563. return $core.withContext(function($ctx1) {
  16564. var $1,$receiver;
  16565. $1=$self._basicAt_("traitComposition");
  16566. if(($receiver = $1) == null || $receiver.a$nil){
  16567. return [];
  16568. } else {
  16569. var aCollection;
  16570. aCollection=$receiver;
  16571. return $recv(aCollection)._collect_((function(each){
  16572. return $core.withContext(function($ctx2) {
  16573. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16575. }));
  16576. }
  16577. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16578. },
  16579. args: [],
  16580. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16581. referencedClasses: ["TraitTransformation"],
  16582. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16583. }),
  16584. $globals.TBehaviorProvider);
  16585. $core.addMethod(
  16586. $core.method({
  16587. selector: "traitCompositionDefinition",
  16588. protocol: "accessing",
  16589. fn: function (){
  16590. var self=this,$self=this;
  16591. return $core.withContext(function($ctx1) {
  16592. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16593. return $core.withContext(function($ctx2) {
  16594. return $recv($globals.String)._streamContents_((function(str){
  16595. return $core.withContext(function($ctx3) {
  16596. $recv(str)._write_("{");
  16597. $ctx3.sendIdx["write:"]=1;
  16598. $recv(traitComposition)._do_separatedBy_((function(each){
  16599. return $core.withContext(function($ctx4) {
  16600. return $recv(str)._write_($recv(each)._definition());
  16601. $ctx4.sendIdx["write:"]=2;
  16602. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16603. }),(function(){
  16604. return $core.withContext(function($ctx4) {
  16605. return $recv(str)._write_(". ");
  16606. $ctx4.sendIdx["write:"]=3;
  16607. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16608. }));
  16609. return $recv(str)._write_("}");
  16610. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16611. }));
  16612. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16613. }));
  16614. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16615. },
  16616. args: [],
  16617. source: "traitCompositionDefinition\x0a\x09^ self traitComposition ifNotEmpty: [ :traitComposition |\x0a\x09\x09String streamContents: [ :str |\x0a\x09\x09\x09str write: '{'.\x0a\x09\x09\x09traitComposition\x0a\x09\x09\x09\x09do: [ :each | str write: each definition ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ] ]",
  16618. referencedClasses: ["String"],
  16619. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16620. }),
  16621. $globals.TBehaviorProvider);
  16622. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16623. $globals.TMasterBehavior.comment="I am the behavior on the instance-side of the browser.\x0a\x0aI define things like package, category, name, comment etc.\x0aas opposed to derived behaviors (metaclass, class trait, ...)\x0athat relate to me.";
  16624. $core.addMethod(
  16625. $core.method({
  16626. selector: "asJavaScriptSource",
  16627. protocol: "converting",
  16628. fn: function (){
  16629. var self=this,$self=this;
  16630. return $core.withContext(function($ctx1) {
  16631. return "$globals.".__comma($self._name());
  16632. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16633. },
  16634. args: [],
  16635. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16636. referencedClasses: [],
  16637. messageSends: [",", "name"]
  16638. }),
  16639. $globals.TMasterBehavior);
  16640. $core.addMethod(
  16641. $core.method({
  16642. selector: "browse",
  16643. protocol: "browsing",
  16644. fn: function (){
  16645. var self=this,$self=this;
  16646. return $core.withContext(function($ctx1) {
  16647. $recv($globals.Finder)._findClass_(self);
  16648. return self;
  16649. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16650. },
  16651. args: [],
  16652. source: "browse\x0a\x09Finder findClass: self",
  16653. referencedClasses: ["Finder"],
  16654. messageSends: ["findClass:"]
  16655. }),
  16656. $globals.TMasterBehavior);
  16657. $core.addMethod(
  16658. $core.method({
  16659. selector: "category",
  16660. protocol: "accessing",
  16661. fn: function (){
  16662. var self=this,$self=this;
  16663. return $core.withContext(function($ctx1) {
  16664. var $1,$receiver;
  16665. $1=$self._package();
  16666. $ctx1.sendIdx["package"]=1;
  16667. if(($receiver = $1) == null || $receiver.a$nil){
  16668. return "Unclassified";
  16669. } else {
  16670. return $recv($self._package())._name();
  16671. }
  16672. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16673. },
  16674. args: [],
  16675. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16676. referencedClasses: [],
  16677. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16678. }),
  16679. $globals.TMasterBehavior);
  16680. $core.addMethod(
  16681. $core.method({
  16682. selector: "classTag",
  16683. protocol: "accessing",
  16684. fn: function (){
  16685. var self=this,$self=this;
  16686. return $core.withContext(function($ctx1) {
  16687. return $self._subclassResponsibility();
  16688. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16689. },
  16690. args: [],
  16691. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16692. referencedClasses: [],
  16693. messageSends: ["subclassResponsibility"]
  16694. }),
  16695. $globals.TMasterBehavior);
  16696. $core.addMethod(
  16697. $core.method({
  16698. selector: "comment",
  16699. protocol: "accessing",
  16700. fn: function (){
  16701. var self=this,$self=this;
  16702. return $core.withContext(function($ctx1) {
  16703. var $1,$receiver;
  16704. $1=$self._basicAt_("comment");
  16705. if(($receiver = $1) == null || $receiver.a$nil){
  16706. return "";
  16707. } else {
  16708. return $1;
  16709. }
  16710. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16711. },
  16712. args: [],
  16713. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16714. referencedClasses: [],
  16715. messageSends: ["ifNil:", "basicAt:"]
  16716. }),
  16717. $globals.TMasterBehavior);
  16718. $core.addMethod(
  16719. $core.method({
  16720. selector: "comment:",
  16721. protocol: "accessing",
  16722. fn: function (aString){
  16723. var self=this,$self=this;
  16724. return $core.withContext(function($ctx1) {
  16725. var $1,$3,$2;
  16726. $self._basicAt_put_("comment",aString);
  16727. $1=$recv($globals.SystemAnnouncer)._current();
  16728. $3=$recv($globals.ClassCommentChanged)._new();
  16729. $recv($3)._theClass_(self);
  16730. $2=$recv($3)._yourself();
  16731. $recv($1)._announce_($2);
  16732. return self;
  16733. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16734. },
  16735. args: ["aString"],
  16736. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  16737. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16738. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16739. }),
  16740. $globals.TMasterBehavior);
  16741. $core.addMethod(
  16742. $core.method({
  16743. selector: "definedMethods",
  16744. protocol: "accessing",
  16745. fn: function (){
  16746. var self=this,$self=this;
  16747. var methods;
  16748. return $core.withContext(function($ctx1) {
  16749. var $1,$receiver;
  16750. methods=$self._methods();
  16751. $ctx1.sendIdx["methods"]=1;
  16752. $1=$self._theMetaClass();
  16753. if(($receiver = $1) == null || $receiver.a$nil){
  16754. return methods;
  16755. } else {
  16756. var meta;
  16757. meta=$receiver;
  16758. return $recv(methods).__comma($recv(meta)._methods());
  16759. }
  16760. return self;
  16761. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16762. },
  16763. args: [],
  16764. source: "definedMethods\x0a\x09\x22Answers methods of me and derived 'meta' part if present\x22\x0a\x09| methods |\x0a\x09methods := self methods.\x0a\x09self theMetaClass\x0a\x09\x09ifNil: [ ^ methods ]\x0a\x09\x09ifNotNil: [ :meta | ^ methods, meta methods ]",
  16765. referencedClasses: [],
  16766. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16767. }),
  16768. $globals.TMasterBehavior);
  16769. $core.addMethod(
  16770. $core.method({
  16771. selector: "enterOrganization",
  16772. protocol: "accessing",
  16773. fn: function (){
  16774. var self=this,$self=this;
  16775. return $core.withContext(function($ctx1) {
  16776. var $1,$receiver;
  16777. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16778. $globals.Smalltalk;
  16779. } else {
  16780. $1=$self._basicAt_("category");
  16781. if(($receiver = $1) == null || $receiver.a$nil){
  16782. $self._basicPackage_(nil);
  16783. $ctx1.sendIdx["basicPackage:"]=1;
  16784. } else {
  16785. var category;
  16786. category=$receiver;
  16787. $self._basicPackage_($recv($globals.Package)._named_(category));
  16788. $recv($recv($self._package())._organization())._addElement_(self);
  16789. }
  16790. }
  16791. return self;
  16792. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16793. },
  16794. args: [],
  16795. source: "enterOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09(self basicAt: 'category')\x0a\x09\x09\x09ifNil: [ self basicPackage: nil ]\x0a\x09\x09\x09ifNotNil: [ :category |\x0a\x09\x09\x09\x09\x22Amber has 1-1 correspondence between cat and pkg, atm\x22\x0a\x09\x09\x09\x09self basicPackage: (Package named: category).\x0a\x09\x09\x09\x09self package organization addElement: self ] ]",
  16796. referencedClasses: ["Smalltalk", "Package"],
  16797. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16798. }),
  16799. $globals.TMasterBehavior);
  16800. $core.addMethod(
  16801. $core.method({
  16802. selector: "leaveOrganization",
  16803. protocol: "accessing",
  16804. fn: function (){
  16805. var self=this,$self=this;
  16806. return $core.withContext(function($ctx1) {
  16807. var $receiver;
  16808. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16809. $globals.Smalltalk;
  16810. } else {
  16811. $recv($recv($self._package())._organization())._removeElement_(self);
  16812. }
  16813. return self;
  16814. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16815. },
  16816. args: [],
  16817. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16818. referencedClasses: ["Smalltalk"],
  16819. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16820. }),
  16821. $globals.TMasterBehavior);
  16822. $core.addMethod(
  16823. $core.method({
  16824. selector: "name",
  16825. protocol: "accessing",
  16826. fn: function (){
  16827. var self=this,$self=this;
  16828. return $core.withContext(function($ctx1) {
  16829. return self.name;
  16830. return self;
  16831. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16832. },
  16833. args: [],
  16834. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16835. referencedClasses: [],
  16836. messageSends: []
  16837. }),
  16838. $globals.TMasterBehavior);
  16839. $core.addMethod(
  16840. $core.method({
  16841. selector: "package:",
  16842. protocol: "accessing",
  16843. fn: function (aPackage){
  16844. var self=this,$self=this;
  16845. var oldPackage;
  16846. return $core.withContext(function($ctx1) {
  16847. var $2,$1,$3,$5,$4;
  16848. $2=$self._package();
  16849. $ctx1.sendIdx["package"]=1;
  16850. $1=$recv($2).__eq(aPackage);
  16851. if($core.assert($1)){
  16852. return self;
  16853. }
  16854. oldPackage=$self._package();
  16855. $self._leaveOrganization();
  16856. $self._basicAt_put_("category",$recv(aPackage)._name());
  16857. $self._enterOrganization();
  16858. $3=$recv($globals.SystemAnnouncer)._current();
  16859. $5=$recv($globals.ClassMoved)._new();
  16860. $recv($5)._theClass_(self);
  16861. $recv($5)._oldPackage_(oldPackage);
  16862. $4=$recv($5)._yourself();
  16863. $recv($3)._announce_($4);
  16864. return self;
  16865. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16866. },
  16867. args: ["aPackage"],
  16868. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16869. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16870. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16871. }),
  16872. $globals.TMasterBehavior);
  16873. $core.addMethod(
  16874. $core.method({
  16875. selector: "theNonMetaClass",
  16876. protocol: "accessing",
  16877. fn: function (){
  16878. var self=this,$self=this;
  16879. return self;
  16880. },
  16881. args: [],
  16882. source: "theNonMetaClass\x0a\x09^ self",
  16883. referencedClasses: [],
  16884. messageSends: []
  16885. }),
  16886. $globals.TMasterBehavior);
  16887. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16888. $core.addMethod(
  16889. $core.method({
  16890. selector: "-",
  16891. protocol: "composition",
  16892. fn: function (anArray){
  16893. var self=this,$self=this;
  16894. return $core.withContext(function($ctx1) {
  16895. return $recv($self._asTraitTransformation()).__minus(anArray);
  16896. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16897. },
  16898. args: ["anArray"],
  16899. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16900. referencedClasses: [],
  16901. messageSends: ["-", "asTraitTransformation"]
  16902. }),
  16903. $globals.Trait);
  16904. $core.addMethod(
  16905. $core.method({
  16906. selector: "@",
  16907. protocol: "composition",
  16908. fn: function (anArrayOfAssociations){
  16909. var self=this,$self=this;
  16910. return $core.withContext(function($ctx1) {
  16911. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16912. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16913. },
  16914. args: ["anArrayOfAssociations"],
  16915. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16916. referencedClasses: [],
  16917. messageSends: ["@", "asTraitTransformation"]
  16918. }),
  16919. $globals.Trait);
  16920. $core.addMethod(
  16921. $core.method({
  16922. selector: "asTraitComposition",
  16923. protocol: "converting",
  16924. fn: function (){
  16925. var self=this,$self=this;
  16926. return $core.withContext(function($ctx1) {
  16927. return $recv($self._asTraitTransformation())._asTraitComposition();
  16928. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16929. },
  16930. args: [],
  16931. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16932. referencedClasses: [],
  16933. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16934. }),
  16935. $globals.Trait);
  16936. $core.addMethod(
  16937. $core.method({
  16938. selector: "asTraitTransformation",
  16939. protocol: "converting",
  16940. fn: function (){
  16941. var self=this,$self=this;
  16942. return $core.withContext(function($ctx1) {
  16943. return $recv($globals.TraitTransformation)._on_(self);
  16944. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16945. },
  16946. args: [],
  16947. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16948. referencedClasses: ["TraitTransformation"],
  16949. messageSends: ["on:"]
  16950. }),
  16951. $globals.Trait);
  16952. $core.addMethod(
  16953. $core.method({
  16954. selector: "basicOrganization",
  16955. protocol: "accessing",
  16956. fn: function (){
  16957. var self=this,$self=this;
  16958. return $self["@organization"];
  16959. },
  16960. args: [],
  16961. source: "basicOrganization\x0a\x09^ organization",
  16962. referencedClasses: [],
  16963. messageSends: []
  16964. }),
  16965. $globals.Trait);
  16966. $core.addMethod(
  16967. $core.method({
  16968. selector: "basicOrganization:",
  16969. protocol: "accessing",
  16970. fn: function (aClassOrganizer){
  16971. var self=this,$self=this;
  16972. $self["@organization"]=aClassOrganizer;
  16973. return self;
  16974. },
  16975. args: ["aClassOrganizer"],
  16976. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16977. referencedClasses: [],
  16978. messageSends: []
  16979. }),
  16980. $globals.Trait);
  16981. $core.addMethod(
  16982. $core.method({
  16983. selector: "basicPackage:",
  16984. protocol: "accessing",
  16985. fn: function (aPackage){
  16986. var self=this,$self=this;
  16987. $self["@package"]=aPackage;
  16988. return self;
  16989. },
  16990. args: ["aPackage"],
  16991. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  16992. referencedClasses: [],
  16993. messageSends: []
  16994. }),
  16995. $globals.Trait);
  16996. $core.addMethod(
  16997. $core.method({
  16998. selector: "classTag",
  16999. protocol: "accessing",
  17000. fn: function (){
  17001. var self=this,$self=this;
  17002. return "trait";
  17003. },
  17004. args: [],
  17005. source: "classTag\x0a\x09^ 'trait'",
  17006. referencedClasses: [],
  17007. messageSends: []
  17008. }),
  17009. $globals.Trait);
  17010. $core.addMethod(
  17011. $core.method({
  17012. selector: "definition",
  17013. protocol: "accessing",
  17014. fn: function (){
  17015. var self=this,$self=this;
  17016. return $core.withContext(function($ctx1) {
  17017. var $1;
  17018. return $recv($globals.String)._streamContents_((function(stream){
  17019. return $core.withContext(function($ctx2) {
  17020. $recv(stream)._write_("Trait named: ");
  17021. $ctx2.sendIdx["write:"]=1;
  17022. $recv(stream)._printSymbol_($self._name());
  17023. $recv(stream)._lf();
  17024. $ctx2.sendIdx["lf"]=1;
  17025. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  17026. return $core.withContext(function($ctx3) {
  17027. $1=$recv($globals.String)._tab();
  17028. $ctx3.sendIdx["tab"]=1;
  17029. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  17030. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17031. })));
  17032. $ctx2.sendIdx["write:"]=2;
  17033. $recv(stream)._tab();
  17034. $recv(stream)._write_("package: ");
  17035. return $recv(stream)._print_($self._category());
  17036. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17037. }));
  17038. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  17039. },
  17040. args: [],
  17041. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Trait named: '; printSymbol: self name; lf;\x0a\x09\x09write: (self traitCompositionDefinition ifNotEmpty: [ :tcd | { String tab. 'uses: '. tcd. String lf }]);\x0a\x09\x09tab; write: 'package: '; print: self category ]",
  17042. referencedClasses: ["String"],
  17043. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17044. }),
  17045. $globals.Trait);
  17046. $core.addMethod(
  17047. $core.method({
  17048. selector: "package",
  17049. protocol: "accessing",
  17050. fn: function (){
  17051. var self=this,$self=this;
  17052. return $self["@package"];
  17053. },
  17054. args: [],
  17055. source: "package\x0a\x09^ package",
  17056. referencedClasses: [],
  17057. messageSends: []
  17058. }),
  17059. $globals.Trait);
  17060. $core.addMethod(
  17061. $core.method({
  17062. selector: "theMetaClass",
  17063. protocol: "accessing",
  17064. fn: function (){
  17065. var self=this,$self=this;
  17066. return nil;
  17067. },
  17068. args: [],
  17069. source: "theMetaClass\x0a\x09^ nil",
  17070. referencedClasses: [],
  17071. messageSends: []
  17072. }),
  17073. $globals.Trait);
  17074. $core.addMethod(
  17075. $core.method({
  17076. selector: "traitUsers",
  17077. protocol: "accessing",
  17078. fn: function (){
  17079. var self=this,$self=this;
  17080. return $core.withContext(function($ctx1) {
  17081. return $recv($self._basicAt_("traitUsers"))._copy();
  17082. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  17083. },
  17084. args: [],
  17085. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  17086. referencedClasses: [],
  17087. messageSends: ["copy", "basicAt:"]
  17088. }),
  17089. $globals.Trait);
  17090. $core.addMethod(
  17091. $core.method({
  17092. selector: "named:package:",
  17093. protocol: "instance creation",
  17094. fn: function (aString,anotherString){
  17095. var self=this,$self=this;
  17096. return $core.withContext(function($ctx1) {
  17097. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17098. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  17099. },
  17100. args: ["aString", "anotherString"],
  17101. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17102. referencedClasses: ["ClassBuilder"],
  17103. messageSends: ["addTraitNamed:package:", "new"]
  17104. }),
  17105. $globals.Trait.a$cls);
  17106. $core.addMethod(
  17107. $core.method({
  17108. selector: "named:uses:package:",
  17109. protocol: "instance creation",
  17110. fn: function (aString,aTraitCompositionDescription,anotherString){
  17111. var self=this,$self=this;
  17112. var trait;
  17113. return $core.withContext(function($ctx1) {
  17114. trait=$self._named_package_(aString,anotherString);
  17115. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17116. return trait;
  17117. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  17118. },
  17119. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17120. source: "named: aString uses: aTraitCompositionDescription package: anotherString\x0a\x09| trait |\x0a\x09trait := self named: aString package: anotherString.\x0a\x09trait setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ trait",
  17121. referencedClasses: [],
  17122. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17123. }),
  17124. $globals.Trait.a$cls);
  17125. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17126. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17127. $core.addMethod(
  17128. $core.method({
  17129. selector: "-",
  17130. protocol: "composition",
  17131. fn: function (anArray){
  17132. var self=this,$self=this;
  17133. return $core.withContext(function($ctx1) {
  17134. var $1;
  17135. $1=$self._copy();
  17136. $recv($1)._addExclusions_(anArray);
  17137. return $recv($1)._yourself();
  17138. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17139. },
  17140. args: ["anArray"],
  17141. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17142. referencedClasses: [],
  17143. messageSends: ["addExclusions:", "copy", "yourself"]
  17144. }),
  17145. $globals.TraitTransformation);
  17146. $core.addMethod(
  17147. $core.method({
  17148. selector: "@",
  17149. protocol: "composition",
  17150. fn: function (anArrayOfAssociations){
  17151. var self=this,$self=this;
  17152. return $core.withContext(function($ctx1) {
  17153. var $1;
  17154. $1=$self._copy();
  17155. $recv($1)._addAliases_(anArrayOfAssociations);
  17156. return $recv($1)._yourself();
  17157. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17158. },
  17159. args: ["anArrayOfAssociations"],
  17160. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17161. referencedClasses: [],
  17162. messageSends: ["addAliases:", "copy", "yourself"]
  17163. }),
  17164. $globals.TraitTransformation);
  17165. $core.addMethod(
  17166. $core.method({
  17167. selector: "addAliases:",
  17168. protocol: "accessing",
  17169. fn: function (anArrayOfAssociations){
  17170. var self=this,$self=this;
  17171. return $core.withContext(function($ctx1) {
  17172. $recv(anArrayOfAssociations)._do_((function(each){
  17173. var key;
  17174. return $core.withContext(function($ctx2) {
  17175. key=$recv(each)._key();
  17176. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17177. return $core.withContext(function($ctx3) {
  17178. return $self._error_("Cannot use same alias name twice.");
  17179. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17180. }),(function(){
  17181. return $core.withContext(function($ctx3) {
  17182. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17183. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17184. }));
  17185. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17186. }));
  17187. return anArrayOfAssociations;
  17188. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17189. },
  17190. args: ["anArrayOfAssociations"],
  17191. source: "addAliases: anArrayOfAssociations\x0a\x09anArrayOfAssociations do: [ :each |\x0a\x09\x09| key |\x0a\x09\x09key := each key.\x0a\x09\x09aliases at: key\x0a\x09\x09\x09ifPresent: [ self error: 'Cannot use same alias name twice.' ]\x0a\x09\x09\x09ifAbsent: [ aliases at: key put: each value ] ].\x0a\x09^ anArrayOfAssociations",
  17192. referencedClasses: [],
  17193. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17194. }),
  17195. $globals.TraitTransformation);
  17196. $core.addMethod(
  17197. $core.method({
  17198. selector: "addExclusions:",
  17199. protocol: "accessing",
  17200. fn: function (anArray){
  17201. var self=this,$self=this;
  17202. return $core.withContext(function($ctx1) {
  17203. $recv($self["@exclusions"])._addAll_(anArray);
  17204. return anArray;
  17205. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17206. },
  17207. args: ["anArray"],
  17208. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17209. referencedClasses: [],
  17210. messageSends: ["addAll:"]
  17211. }),
  17212. $globals.TraitTransformation);
  17213. $core.addMethod(
  17214. $core.method({
  17215. selector: "aliases",
  17216. protocol: "accessing",
  17217. fn: function (){
  17218. var self=this,$self=this;
  17219. return $self["@aliases"];
  17220. },
  17221. args: [],
  17222. source: "aliases\x0a\x09^ aliases",
  17223. referencedClasses: [],
  17224. messageSends: []
  17225. }),
  17226. $globals.TraitTransformation);
  17227. $core.addMethod(
  17228. $core.method({
  17229. selector: "asJavaScriptObject",
  17230. protocol: "converting",
  17231. fn: function (){
  17232. var self=this,$self=this;
  17233. return $core.withContext(function($ctx1) {
  17234. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17235. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17236. },
  17237. args: [],
  17238. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17239. referencedClasses: [],
  17240. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17241. }),
  17242. $globals.TraitTransformation);
  17243. $core.addMethod(
  17244. $core.method({
  17245. selector: "asJavaScriptSource",
  17246. protocol: "converting",
  17247. fn: function (){
  17248. var self=this,$self=this;
  17249. return $core.withContext(function($ctx1) {
  17250. var $2,$3,$1;
  17251. return $recv($globals.String)._streamContents_((function(str){
  17252. return $core.withContext(function($ctx2) {
  17253. $2=$recv($self._trait())._asJavaScriptSource();
  17254. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17255. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17256. return $core.withContext(function($ctx3) {
  17257. return [", aliases: ",$recv(al)._asJSONString()];
  17258. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17259. }));
  17260. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17261. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17262. return $core.withContext(function($ctx3) {
  17263. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17264. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17265. })),"}"];
  17266. return $recv(str)._write_($1);
  17267. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17268. }));
  17269. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17270. },
  17271. args: [],
  17272. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str | str write: {\x0a\x09\x09'{trait: '. self trait asJavaScriptSource.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09{', aliases: '. al asJSONString} ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09{', exclusions: '. ex asArray sorted asJavaScriptSource} ].\x0a\x09\x09'}' } ]",
  17273. referencedClasses: ["String"],
  17274. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17275. }),
  17276. $globals.TraitTransformation);
  17277. $core.addMethod(
  17278. $core.method({
  17279. selector: "asTraitComposition",
  17280. protocol: "converting",
  17281. fn: function (){
  17282. var self=this,$self=this;
  17283. return [self];
  17284. },
  17285. args: [],
  17286. source: "asTraitComposition\x0a\x09^ { self }",
  17287. referencedClasses: [],
  17288. messageSends: []
  17289. }),
  17290. $globals.TraitTransformation);
  17291. $core.addMethod(
  17292. $core.method({
  17293. selector: "asTraitTransformation",
  17294. protocol: "converting",
  17295. fn: function (){
  17296. var self=this,$self=this;
  17297. return self;
  17298. },
  17299. args: [],
  17300. source: "asTraitTransformation\x0a\x09^ self",
  17301. referencedClasses: [],
  17302. messageSends: []
  17303. }),
  17304. $globals.TraitTransformation);
  17305. $core.addMethod(
  17306. $core.method({
  17307. selector: "definition",
  17308. protocol: "accessing",
  17309. fn: function (){
  17310. var self=this,$self=this;
  17311. return $core.withContext(function($ctx1) {
  17312. return $recv($globals.String)._streamContents_((function(str){
  17313. return $core.withContext(function($ctx2) {
  17314. $recv(str)._print_($self._trait());
  17315. $recv($self._aliases())._ifNotEmpty_((function(al){
  17316. return $core.withContext(function($ctx3) {
  17317. $recv(str)._write_(" @ {");
  17318. $ctx3.sendIdx["write:"]=1;
  17319. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17320. return $core.withContext(function($ctx4) {
  17321. $recv(str)._printSymbol_($recv(each)._key());
  17322. $ctx4.sendIdx["printSymbol:"]=1;
  17323. $recv(str)._write_(" -> ");
  17324. $ctx4.sendIdx["write:"]=2;
  17325. return $recv(str)._printSymbol_($recv(each)._value());
  17326. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17327. }),(function(){
  17328. return $core.withContext(function($ctx4) {
  17329. return $recv(str)._write_(". ");
  17330. $ctx4.sendIdx["write:"]=3;
  17331. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17332. }));
  17333. $ctx3.sendIdx["do:separatedBy:"]=1;
  17334. return $recv(str)._write_("}");
  17335. $ctx3.sendIdx["write:"]=4;
  17336. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17337. }));
  17338. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17339. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17340. return $core.withContext(function($ctx3) {
  17341. $recv(str)._write_(" - #(");
  17342. $ctx3.sendIdx["write:"]=5;
  17343. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17344. return $core.withContext(function($ctx4) {
  17345. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17346. $ctx4.sendIdx["write:"]=6;
  17347. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17348. }),(function(){
  17349. return $core.withContext(function($ctx4) {
  17350. return $recv(str)._space();
  17351. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17352. }));
  17353. return $recv(str)._write_(")");
  17354. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17355. }));
  17356. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17357. }));
  17358. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17359. },
  17360. args: [],
  17361. source: "definition\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str print: self trait.\x0a\x09\x09self aliases ifNotEmpty: [ :al |\x0a\x09\x09\x09str write: ' @ {'.\x0a\x09\x09\x09al associations\x0a\x09\x09\x09\x09do: [ :each | str printSymbol: each key; write: ' -> '; printSymbol: each value ]\x0a\x09\x09\x09\x09separatedBy: [ str write: '. ' ].\x0a\x09\x09\x09str write: '}' ].\x0a\x09\x09self exclusions ifNotEmpty: [ :ex |\x0a\x09\x09\x09str write: ' - #('.\x0a\x09\x09\x09ex asArray sorted \x0a\x09\x09\x09\x09do: [ :each | str write: each symbolPrintString allButFirst ]\x0a\x09\x09\x09\x09separatedBy: [ str space ].\x0a\x09\x09\x09str write: ')' ] ]",
  17362. referencedClasses: ["String"],
  17363. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17364. }),
  17365. $globals.TraitTransformation);
  17366. $core.addMethod(
  17367. $core.method({
  17368. selector: "exclusions",
  17369. protocol: "accessing",
  17370. fn: function (){
  17371. var self=this,$self=this;
  17372. return $self["@exclusions"];
  17373. },
  17374. args: [],
  17375. source: "exclusions\x0a\x09^ exclusions",
  17376. referencedClasses: [],
  17377. messageSends: []
  17378. }),
  17379. $globals.TraitTransformation);
  17380. $core.addMethod(
  17381. $core.method({
  17382. selector: "initialize",
  17383. protocol: "initialization",
  17384. fn: function (){
  17385. var self=this,$self=this;
  17386. return $core.withContext(function($ctx1) {
  17387. (
  17388. $ctx1.supercall = true,
  17389. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17390. $ctx1.supercall = false;
  17391. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17392. $self["@exclusions"]=$recv($globals.Set)._new();
  17393. $self["@trait"]=nil;
  17394. return self;
  17395. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17396. },
  17397. args: [],
  17398. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17399. referencedClasses: ["Set"],
  17400. messageSends: ["initialize", "new"]
  17401. }),
  17402. $globals.TraitTransformation);
  17403. $core.addMethod(
  17404. $core.method({
  17405. selector: "postCopy",
  17406. protocol: "copying",
  17407. fn: function (){
  17408. var self=this,$self=this;
  17409. return $core.withContext(function($ctx1) {
  17410. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17411. $ctx1.sendIdx["copy"]=1;
  17412. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17413. return self;
  17414. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17415. },
  17416. args: [],
  17417. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17418. referencedClasses: [],
  17419. messageSends: ["copy"]
  17420. }),
  17421. $globals.TraitTransformation);
  17422. $core.addMethod(
  17423. $core.method({
  17424. selector: "trait",
  17425. protocol: "accessing",
  17426. fn: function (){
  17427. var self=this,$self=this;
  17428. return $self["@trait"];
  17429. },
  17430. args: [],
  17431. source: "trait\x0a\x09^ trait",
  17432. referencedClasses: [],
  17433. messageSends: []
  17434. }),
  17435. $globals.TraitTransformation);
  17436. $core.addMethod(
  17437. $core.method({
  17438. selector: "trait:",
  17439. protocol: "accessing",
  17440. fn: function (anObject){
  17441. var self=this,$self=this;
  17442. $self["@trait"]=anObject;
  17443. return self;
  17444. },
  17445. args: ["anObject"],
  17446. source: "trait: anObject\x0a\x09trait := anObject",
  17447. referencedClasses: [],
  17448. messageSends: []
  17449. }),
  17450. $globals.TraitTransformation);
  17451. $core.addMethod(
  17452. $core.method({
  17453. selector: "fromJSON:",
  17454. protocol: "instance creation",
  17455. fn: function (aJSObject){
  17456. var self=this,$self=this;
  17457. return $core.withContext(function($ctx1) {
  17458. var $1,$4,$3,$2;
  17459. $1=(
  17460. $ctx1.supercall = true,
  17461. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17462. $ctx1.supercall = false;
  17463. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17464. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17465. return $globals.HashedCollection._newFromPairs_([]);
  17466. }));
  17467. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17468. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17469. $2=$recv($3)._associations();
  17470. $recv($1)._addAliases_($2);
  17471. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17472. return [];
  17473. })));
  17474. return $recv($1)._yourself();
  17475. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17476. },
  17477. args: ["aJSObject"],
  17478. source: "fromJSON: aJSObject\x0a\x09^ super new\x0a\x09\x09trait: (aJSObject at: #trait);\x0a\x09\x09addAliases: (Smalltalk readJSObject: (aJSObject at: #aliases ifAbsent: [#{}])) associations;\x0a\x09\x09addExclusions: (aJSObject at: #exclusions ifAbsent: [#()]);\x0a\x09\x09yourself",
  17479. referencedClasses: ["Smalltalk"],
  17480. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17481. }),
  17482. $globals.TraitTransformation.a$cls);
  17483. $core.addMethod(
  17484. $core.method({
  17485. selector: "on:",
  17486. protocol: "instance creation",
  17487. fn: function (aTrait){
  17488. var self=this,$self=this;
  17489. return $core.withContext(function($ctx1) {
  17490. var $1;
  17491. $1=(
  17492. $ctx1.supercall = true,
  17493. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17494. $ctx1.supercall = false;
  17495. $recv($1)._trait_(aTrait);
  17496. return $recv($1)._yourself();
  17497. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17498. },
  17499. args: ["aTrait"],
  17500. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17501. referencedClasses: [],
  17502. messageSends: ["trait:", "new", "yourself"]
  17503. }),
  17504. $globals.TraitTransformation.a$cls);
  17505. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17506. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17507. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17508. $core.addMethod(
  17509. $core.method({
  17510. selector: "asTraitComposition",
  17511. protocol: "*Kernel-Classes",
  17512. fn: function (){
  17513. var self=this,$self=this;
  17514. return $core.withContext(function($ctx1) {
  17515. return $self._collect_((function(each){
  17516. return $core.withContext(function($ctx2) {
  17517. return $recv(each)._asTraitTransformation();
  17518. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17519. }));
  17520. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17521. },
  17522. args: [],
  17523. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17524. referencedClasses: [],
  17525. messageSends: ["collect:", "asTraitTransformation"]
  17526. }),
  17527. $globals.Array);
  17528. });
  17529. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17530. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17531. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17532. $core.addPackage("Kernel-Methods");
  17533. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  17534. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17535. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17536. $globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
  17537. $core.addMethod(
  17538. $core.method({
  17539. selector: "applyTo:arguments:",
  17540. protocol: "evaluating",
  17541. fn: function (anObject,aCollection){
  17542. var self=this,$self=this;
  17543. return $core.withContext(function($ctx1) {
  17544. return self.apply(anObject, aCollection);
  17545. return self;
  17546. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17547. },
  17548. args: ["anObject", "aCollection"],
  17549. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17550. referencedClasses: [],
  17551. messageSends: []
  17552. }),
  17553. $globals.BlockClosure);
  17554. $core.addMethod(
  17555. $core.method({
  17556. selector: "asCompiledMethod:",
  17557. protocol: "converting",
  17558. fn: function (aString){
  17559. var self=this,$self=this;
  17560. return $core.withContext(function($ctx1) {
  17561. return $core.method({selector:aString, fn:self});;
  17562. return self;
  17563. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17564. },
  17565. args: ["aString"],
  17566. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17567. referencedClasses: [],
  17568. messageSends: []
  17569. }),
  17570. $globals.BlockClosure);
  17571. $core.addMethod(
  17572. $core.method({
  17573. selector: "compiledSource",
  17574. protocol: "accessing",
  17575. fn: function (){
  17576. var self=this,$self=this;
  17577. return $core.withContext(function($ctx1) {
  17578. return self.toString();
  17579. return self;
  17580. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17581. },
  17582. args: [],
  17583. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17584. referencedClasses: [],
  17585. messageSends: []
  17586. }),
  17587. $globals.BlockClosure);
  17588. $core.addMethod(
  17589. $core.method({
  17590. selector: "currySelf",
  17591. protocol: "converting",
  17592. fn: function (){
  17593. var self=this,$self=this;
  17594. return $core.withContext(function($ctx1) {
  17595. return function () {
  17596. var args = [ this ];
  17597. args.push.apply(args, arguments);
  17598. return self.apply(null, args);
  17599. }
  17600. ;
  17601. return self;
  17602. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17603. },
  17604. args: [],
  17605. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09'>",
  17606. referencedClasses: [],
  17607. messageSends: []
  17608. }),
  17609. $globals.BlockClosure);
  17610. $core.addMethod(
  17611. $core.method({
  17612. selector: "ensure:",
  17613. protocol: "evaluating",
  17614. fn: function (aBlock){
  17615. var self=this,$self=this;
  17616. return $core.withContext(function($ctx1) {
  17617. try{return $self._value()}finally{aBlock._value()};
  17618. return self;
  17619. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17620. },
  17621. args: ["aBlock"],
  17622. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17623. referencedClasses: [],
  17624. messageSends: []
  17625. }),
  17626. $globals.BlockClosure);
  17627. $core.addMethod(
  17628. $core.method({
  17629. selector: "fork",
  17630. protocol: "timeout/interval",
  17631. fn: function (){
  17632. var self=this,$self=this;
  17633. return $core.withContext(function($ctx1) {
  17634. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17635. return self;
  17636. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17637. },
  17638. args: [],
  17639. source: "fork\x0a\x09ForkPool default fork: self",
  17640. referencedClasses: ["ForkPool"],
  17641. messageSends: ["fork:", "default"]
  17642. }),
  17643. $globals.BlockClosure);
  17644. $core.addMethod(
  17645. $core.method({
  17646. selector: "new",
  17647. protocol: "evaluating",
  17648. fn: function (){
  17649. var self=this,$self=this;
  17650. return $core.withContext(function($ctx1) {
  17651. return new self();
  17652. return self;
  17653. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17654. },
  17655. args: [],
  17656. source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<inlineJS: 'return new self()'>",
  17657. referencedClasses: [],
  17658. messageSends: []
  17659. }),
  17660. $globals.BlockClosure);
  17661. $core.addMethod(
  17662. $core.method({
  17663. selector: "newValue:",
  17664. protocol: "evaluating",
  17665. fn: function (anObject){
  17666. var self=this,$self=this;
  17667. return $core.withContext(function($ctx1) {
  17668. return $self._newWithValues_([anObject]);
  17669. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17670. },
  17671. args: ["anObject"],
  17672. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17673. referencedClasses: [],
  17674. messageSends: ["newWithValues:"]
  17675. }),
  17676. $globals.BlockClosure);
  17677. $core.addMethod(
  17678. $core.method({
  17679. selector: "newValue:value:",
  17680. protocol: "evaluating",
  17681. fn: function (anObject,anObject2){
  17682. var self=this,$self=this;
  17683. return $core.withContext(function($ctx1) {
  17684. return $self._newWithValues_([anObject,anObject2]);
  17685. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17686. },
  17687. args: ["anObject", "anObject2"],
  17688. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17689. referencedClasses: [],
  17690. messageSends: ["newWithValues:"]
  17691. }),
  17692. $globals.BlockClosure);
  17693. $core.addMethod(
  17694. $core.method({
  17695. selector: "newValue:value:value:",
  17696. protocol: "evaluating",
  17697. fn: function (anObject,anObject2,anObject3){
  17698. var self=this,$self=this;
  17699. return $core.withContext(function($ctx1) {
  17700. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17701. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17702. },
  17703. args: ["anObject", "anObject2", "anObject3"],
  17704. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17705. referencedClasses: [],
  17706. messageSends: ["newWithValues:"]
  17707. }),
  17708. $globals.BlockClosure);
  17709. $core.addMethod(
  17710. $core.method({
  17711. selector: "newWithValues:",
  17712. protocol: "evaluating",
  17713. fn: function (aCollection){
  17714. var self=this,$self=this;
  17715. return $core.withContext(function($ctx1) {
  17716. var object = Object.create(self.prototype);
  17717. var result = self.apply(object, aCollection);
  17718. return typeof result === "object" ? result : object;
  17719. ;
  17720. return self;
  17721. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17722. },
  17723. args: ["aCollection"],
  17724. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<inlineJS: '\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09'>",
  17725. referencedClasses: [],
  17726. messageSends: []
  17727. }),
  17728. $globals.BlockClosure);
  17729. $core.addMethod(
  17730. $core.method({
  17731. selector: "numArgs",
  17732. protocol: "accessing",
  17733. fn: function (){
  17734. var self=this,$self=this;
  17735. return $core.withContext(function($ctx1) {
  17736. return self.length;
  17737. return self;
  17738. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17739. },
  17740. args: [],
  17741. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17742. referencedClasses: [],
  17743. messageSends: []
  17744. }),
  17745. $globals.BlockClosure);
  17746. $core.addMethod(
  17747. $core.method({
  17748. selector: "on:do:",
  17749. protocol: "error handling",
  17750. fn: function (anErrorClass,aBlock){
  17751. var self=this,$self=this;
  17752. return $core.withContext(function($ctx1) {
  17753. var $1;
  17754. return $self._tryCatch_((function(error){
  17755. var smalltalkError;
  17756. return $core.withContext(function($ctx2) {
  17757. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17758. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17759. if($core.assert($1)){
  17760. return $recv(aBlock)._value_(smalltalkError);
  17761. } else {
  17762. return $recv(smalltalkError)._resignal();
  17763. }
  17764. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17765. }));
  17766. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17767. },
  17768. args: ["anErrorClass", "aBlock"],
  17769. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  17770. referencedClasses: ["Smalltalk"],
  17771. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  17772. }),
  17773. $globals.BlockClosure);
  17774. $core.addMethod(
  17775. $core.method({
  17776. selector: "receiver",
  17777. protocol: "accessing",
  17778. fn: function (){
  17779. var self=this,$self=this;
  17780. return nil;
  17781. },
  17782. args: [],
  17783. source: "receiver\x0a\x09^ nil",
  17784. referencedClasses: [],
  17785. messageSends: []
  17786. }),
  17787. $globals.BlockClosure);
  17788. $core.addMethod(
  17789. $core.method({
  17790. selector: "timeToRun",
  17791. protocol: "evaluating",
  17792. fn: function (){
  17793. var self=this,$self=this;
  17794. return $core.withContext(function($ctx1) {
  17795. return $recv($globals.Date)._millisecondsToRun_(self);
  17796. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17797. },
  17798. args: [],
  17799. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17800. referencedClasses: ["Date"],
  17801. messageSends: ["millisecondsToRun:"]
  17802. }),
  17803. $globals.BlockClosure);
  17804. $core.addMethod(
  17805. $core.method({
  17806. selector: "tryCatch:",
  17807. protocol: "error handling",
  17808. fn: function (aBlock){
  17809. var self=this,$self=this;
  17810. return $core.withContext(function($ctx1) {
  17811. try {
  17812. return $self._value();
  17813. } catch(error) {
  17814. // pass non-local returns undetected
  17815. if (Array.isArray(error) && error.length === 1) throw error;
  17816. return aBlock._value_(error);
  17817. }
  17818. ;
  17819. return self;
  17820. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17821. },
  17822. args: ["aBlock"],
  17823. source: "tryCatch: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09try {\x0a\x09\x09\x09return $self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09'>",
  17824. referencedClasses: [],
  17825. messageSends: []
  17826. }),
  17827. $globals.BlockClosure);
  17828. $core.addMethod(
  17829. $core.method({
  17830. selector: "value",
  17831. protocol: "evaluating",
  17832. fn: function (){
  17833. var self=this,$self=this;
  17834. return $core.withContext(function($ctx1) {
  17835. return self();;
  17836. return self;
  17837. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17838. },
  17839. args: [],
  17840. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17841. referencedClasses: [],
  17842. messageSends: []
  17843. }),
  17844. $globals.BlockClosure);
  17845. $core.addMethod(
  17846. $core.method({
  17847. selector: "value:",
  17848. protocol: "evaluating",
  17849. fn: function (anArg){
  17850. var self=this,$self=this;
  17851. return $core.withContext(function($ctx1) {
  17852. return self(anArg);;
  17853. return self;
  17854. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17855. },
  17856. args: ["anArg"],
  17857. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17858. referencedClasses: [],
  17859. messageSends: []
  17860. }),
  17861. $globals.BlockClosure);
  17862. $core.addMethod(
  17863. $core.method({
  17864. selector: "value:value:",
  17865. protocol: "evaluating",
  17866. fn: function (firstArg,secondArg){
  17867. var self=this,$self=this;
  17868. return $core.withContext(function($ctx1) {
  17869. return self(firstArg, secondArg);;
  17870. return self;
  17871. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17872. },
  17873. args: ["firstArg", "secondArg"],
  17874. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17875. referencedClasses: [],
  17876. messageSends: []
  17877. }),
  17878. $globals.BlockClosure);
  17879. $core.addMethod(
  17880. $core.method({
  17881. selector: "value:value:value:",
  17882. protocol: "evaluating",
  17883. fn: function (firstArg,secondArg,thirdArg){
  17884. var self=this,$self=this;
  17885. return $core.withContext(function($ctx1) {
  17886. return self(firstArg, secondArg, thirdArg);;
  17887. return self;
  17888. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17889. },
  17890. args: ["firstArg", "secondArg", "thirdArg"],
  17891. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17892. referencedClasses: [],
  17893. messageSends: []
  17894. }),
  17895. $globals.BlockClosure);
  17896. $core.addMethod(
  17897. $core.method({
  17898. selector: "valueWithInterval:",
  17899. protocol: "timeout/interval",
  17900. fn: function (aNumber){
  17901. var self=this,$self=this;
  17902. return $core.withContext(function($ctx1) {
  17903. var interval = setInterval(self, aNumber);
  17904. return $globals.Timeout._on_(interval);
  17905. ;
  17906. return self;
  17907. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17908. },
  17909. args: ["aNumber"],
  17910. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17911. referencedClasses: [],
  17912. messageSends: []
  17913. }),
  17914. $globals.BlockClosure);
  17915. $core.addMethod(
  17916. $core.method({
  17917. selector: "valueWithPossibleArguments:",
  17918. protocol: "evaluating",
  17919. fn: function (aCollection){
  17920. var self=this,$self=this;
  17921. return $core.withContext(function($ctx1) {
  17922. return self.apply(null, aCollection);;
  17923. return self;
  17924. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17925. },
  17926. args: ["aCollection"],
  17927. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17928. referencedClasses: [],
  17929. messageSends: []
  17930. }),
  17931. $globals.BlockClosure);
  17932. $core.addMethod(
  17933. $core.method({
  17934. selector: "valueWithTimeout:",
  17935. protocol: "timeout/interval",
  17936. fn: function (aNumber){
  17937. var self=this,$self=this;
  17938. return $core.withContext(function($ctx1) {
  17939. var timeout = setTimeout(self, aNumber);
  17940. return $globals.Timeout._on_(timeout);
  17941. ;
  17942. return self;
  17943. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17944. },
  17945. args: ["aNumber"],
  17946. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17947. referencedClasses: [],
  17948. messageSends: []
  17949. }),
  17950. $globals.BlockClosure);
  17951. $core.addMethod(
  17952. $core.method({
  17953. selector: "whileFalse",
  17954. protocol: "controlling",
  17955. fn: function (){
  17956. var self=this,$self=this;
  17957. return $core.withContext(function($ctx1) {
  17958. $self._whileFalse_((function(){
  17959. }));
  17960. return self;
  17961. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17962. },
  17963. args: [],
  17964. source: "whileFalse\x0a\x09self whileFalse: []",
  17965. referencedClasses: [],
  17966. messageSends: ["whileFalse:"]
  17967. }),
  17968. $globals.BlockClosure);
  17969. $core.addMethod(
  17970. $core.method({
  17971. selector: "whileFalse:",
  17972. protocol: "controlling",
  17973. fn: function (aBlock){
  17974. var self=this,$self=this;
  17975. return $core.withContext(function($ctx1) {
  17976. while(!$core.assert($self._value())) {aBlock._value()};
  17977. return self;
  17978. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17979. },
  17980. args: ["aBlock"],
  17981. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  17982. referencedClasses: [],
  17983. messageSends: []
  17984. }),
  17985. $globals.BlockClosure);
  17986. $core.addMethod(
  17987. $core.method({
  17988. selector: "whileTrue",
  17989. protocol: "controlling",
  17990. fn: function (){
  17991. var self=this,$self=this;
  17992. return $core.withContext(function($ctx1) {
  17993. $self._whileTrue_((function(){
  17994. }));
  17995. return self;
  17996. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17997. },
  17998. args: [],
  17999. source: "whileTrue\x0a\x09self whileTrue: []",
  18000. referencedClasses: [],
  18001. messageSends: ["whileTrue:"]
  18002. }),
  18003. $globals.BlockClosure);
  18004. $core.addMethod(
  18005. $core.method({
  18006. selector: "whileTrue:",
  18007. protocol: "controlling",
  18008. fn: function (aBlock){
  18009. var self=this,$self=this;
  18010. return $core.withContext(function($ctx1) {
  18011. while($core.assert($self._value())) {aBlock._value()};
  18012. return self;
  18013. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  18014. },
  18015. args: ["aBlock"],
  18016. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  18017. referencedClasses: [],
  18018. messageSends: []
  18019. }),
  18020. $globals.BlockClosure);
  18021. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  18022. $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
  18023. $core.addMethod(
  18024. $core.method({
  18025. selector: "arguments",
  18026. protocol: "accessing",
  18027. fn: function (){
  18028. var self=this,$self=this;
  18029. return $core.withContext(function($ctx1) {
  18030. return self.args || [];
  18031. return self;
  18032. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  18033. },
  18034. args: [],
  18035. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  18036. referencedClasses: [],
  18037. messageSends: []
  18038. }),
  18039. $globals.CompiledMethod);
  18040. $core.addMethod(
  18041. $core.method({
  18042. selector: "browse",
  18043. protocol: "browsing",
  18044. fn: function (){
  18045. var self=this,$self=this;
  18046. return $core.withContext(function($ctx1) {
  18047. $recv($globals.Finder)._findMethod_(self);
  18048. return self;
  18049. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  18050. },
  18051. args: [],
  18052. source: "browse\x0a\x09Finder findMethod: self",
  18053. referencedClasses: ["Finder"],
  18054. messageSends: ["findMethod:"]
  18055. }),
  18056. $globals.CompiledMethod);
  18057. $core.addMethod(
  18058. $core.method({
  18059. selector: "category",
  18060. protocol: "accessing",
  18061. fn: function (){
  18062. var self=this,$self=this;
  18063. return $core.withContext(function($ctx1) {
  18064. return $self._protocol();
  18065. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  18066. },
  18067. args: [],
  18068. source: "category\x0a\x09^ self protocol",
  18069. referencedClasses: [],
  18070. messageSends: ["protocol"]
  18071. }),
  18072. $globals.CompiledMethod);
  18073. $core.addMethod(
  18074. $core.method({
  18075. selector: "defaultProtocol",
  18076. protocol: "defaults",
  18077. fn: function (){
  18078. var self=this,$self=this;
  18079. return "as yet unclassified";
  18080. },
  18081. args: [],
  18082. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18083. referencedClasses: [],
  18084. messageSends: []
  18085. }),
  18086. $globals.CompiledMethod);
  18087. $core.addMethod(
  18088. $core.method({
  18089. selector: "fn",
  18090. protocol: "accessing",
  18091. fn: function (){
  18092. var self=this,$self=this;
  18093. return $core.withContext(function($ctx1) {
  18094. return $self._basicAt_("fn");
  18095. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  18096. },
  18097. args: [],
  18098. source: "fn\x0a\x09^ self basicAt: 'fn'",
  18099. referencedClasses: [],
  18100. messageSends: ["basicAt:"]
  18101. }),
  18102. $globals.CompiledMethod);
  18103. $core.addMethod(
  18104. $core.method({
  18105. selector: "fn:",
  18106. protocol: "accessing",
  18107. fn: function (aBlock){
  18108. var self=this,$self=this;
  18109. return $core.withContext(function($ctx1) {
  18110. $self._basicAt_put_("fn",aBlock);
  18111. return self;
  18112. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18113. },
  18114. args: ["aBlock"],
  18115. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18116. referencedClasses: [],
  18117. messageSends: ["basicAt:put:"]
  18118. }),
  18119. $globals.CompiledMethod);
  18120. $core.addMethod(
  18121. $core.method({
  18122. selector: "isCompiledMethod",
  18123. protocol: "testing",
  18124. fn: function (){
  18125. var self=this,$self=this;
  18126. return true;
  18127. },
  18128. args: [],
  18129. source: "isCompiledMethod\x0a\x09^ true",
  18130. referencedClasses: [],
  18131. messageSends: []
  18132. }),
  18133. $globals.CompiledMethod);
  18134. $core.addMethod(
  18135. $core.method({
  18136. selector: "isOverridden",
  18137. protocol: "testing",
  18138. fn: function (){
  18139. var self=this,$self=this;
  18140. var selector;
  18141. return $core.withContext(function($ctx1) {
  18142. var $1;
  18143. var $early={};
  18144. try {
  18145. selector=$self._selector();
  18146. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18147. return $core.withContext(function($ctx2) {
  18148. $1=$recv(each)._includesSelector_(selector);
  18149. if($core.assert($1)){
  18150. throw $early=[true];
  18151. }
  18152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18153. }));
  18154. return false;
  18155. }
  18156. catch(e) {if(e===$early)return e[0]; throw e}
  18157. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18158. },
  18159. args: [],
  18160. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  18161. referencedClasses: [],
  18162. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18163. }),
  18164. $globals.CompiledMethod);
  18165. $core.addMethod(
  18166. $core.method({
  18167. selector: "isOverride",
  18168. protocol: "testing",
  18169. fn: function (){
  18170. var self=this,$self=this;
  18171. var superclass;
  18172. return $core.withContext(function($ctx1) {
  18173. var $1,$2,$receiver;
  18174. $1=$self._methodClass();
  18175. $ctx1.sendIdx["methodClass"]=1;
  18176. superclass=$recv($1)._superclass();
  18177. $ctx1.sendIdx["superclass"]=1;
  18178. $2=superclass;
  18179. if(($receiver = $2) == null || $receiver.a$nil){
  18180. return false;
  18181. } else {
  18182. $2;
  18183. }
  18184. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18185. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18186. },
  18187. args: [],
  18188. source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
  18189. referencedClasses: [],
  18190. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18191. }),
  18192. $globals.CompiledMethod);
  18193. $core.addMethod(
  18194. $core.method({
  18195. selector: "messageSends",
  18196. protocol: "accessing",
  18197. fn: function (){
  18198. var self=this,$self=this;
  18199. return $core.withContext(function($ctx1) {
  18200. return $self._basicAt_("messageSends");
  18201. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18202. },
  18203. args: [],
  18204. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18205. referencedClasses: [],
  18206. messageSends: ["basicAt:"]
  18207. }),
  18208. $globals.CompiledMethod);
  18209. $core.addMethod(
  18210. $core.method({
  18211. selector: "methodClass",
  18212. protocol: "accessing",
  18213. fn: function (){
  18214. var self=this,$self=this;
  18215. return $core.withContext(function($ctx1) {
  18216. return $self._basicAt_("owner");
  18217. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18218. },
  18219. args: [],
  18220. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18221. referencedClasses: [],
  18222. messageSends: ["basicAt:"]
  18223. }),
  18224. $globals.CompiledMethod);
  18225. $core.addMethod(
  18226. $core.method({
  18227. selector: "package",
  18228. protocol: "accessing",
  18229. fn: function (){
  18230. var self=this,$self=this;
  18231. return $core.withContext(function($ctx1) {
  18232. var $1,$receiver;
  18233. $1=$self._methodClass();
  18234. if(($receiver = $1) == null || $receiver.a$nil){
  18235. return $1;
  18236. } else {
  18237. var class_;
  18238. class_=$receiver;
  18239. return $recv(class_)._packageOfProtocol_($self._protocol());
  18240. }
  18241. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18242. },
  18243. args: [],
  18244. source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09^ self methodClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  18245. referencedClasses: [],
  18246. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18247. }),
  18248. $globals.CompiledMethod);
  18249. $core.addMethod(
  18250. $core.method({
  18251. selector: "protocol",
  18252. protocol: "accessing",
  18253. fn: function (){
  18254. var self=this,$self=this;
  18255. return $core.withContext(function($ctx1) {
  18256. var $1,$receiver;
  18257. $1=$self._basicAt_("protocol");
  18258. if(($receiver = $1) == null || $receiver.a$nil){
  18259. return $self._defaultProtocol();
  18260. } else {
  18261. return $1;
  18262. }
  18263. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18264. },
  18265. args: [],
  18266. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18267. referencedClasses: [],
  18268. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18269. }),
  18270. $globals.CompiledMethod);
  18271. $core.addMethod(
  18272. $core.method({
  18273. selector: "protocol:",
  18274. protocol: "accessing",
  18275. fn: function (aString){
  18276. var self=this,$self=this;
  18277. var oldProtocol;
  18278. return $core.withContext(function($ctx1) {
  18279. var $1,$3,$2,$4,$receiver;
  18280. oldProtocol=$self._protocol();
  18281. $self._basicAt_put_("protocol",aString);
  18282. $1=$recv($globals.SystemAnnouncer)._current();
  18283. $3=$recv($globals.MethodMoved)._new();
  18284. $recv($3)._method_(self);
  18285. $recv($3)._oldProtocol_(oldProtocol);
  18286. $2=$recv($3)._yourself();
  18287. $recv($1)._announce_($2);
  18288. $4=$self._methodClass();
  18289. if(($receiver = $4) == null || $receiver.a$nil){
  18290. $4;
  18291. } else {
  18292. var methodClass;
  18293. methodClass=$receiver;
  18294. $recv($recv(methodClass)._organization())._addElement_(aString);
  18295. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18296. }
  18297. return self;
  18298. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18299. },
  18300. args: ["aString"],
  18301. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  18302. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18303. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18304. }),
  18305. $globals.CompiledMethod);
  18306. $core.addMethod(
  18307. $core.method({
  18308. selector: "referencedClasses",
  18309. protocol: "accessing",
  18310. fn: function (){
  18311. var self=this,$self=this;
  18312. return $core.withContext(function($ctx1) {
  18313. return $self._basicAt_("referencedClasses");
  18314. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18315. },
  18316. args: [],
  18317. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18318. referencedClasses: [],
  18319. messageSends: ["basicAt:"]
  18320. }),
  18321. $globals.CompiledMethod);
  18322. $core.addMethod(
  18323. $core.method({
  18324. selector: "selector",
  18325. protocol: "accessing",
  18326. fn: function (){
  18327. var self=this,$self=this;
  18328. return $core.withContext(function($ctx1) {
  18329. return $self._basicAt_("selector");
  18330. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18331. },
  18332. args: [],
  18333. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18334. referencedClasses: [],
  18335. messageSends: ["basicAt:"]
  18336. }),
  18337. $globals.CompiledMethod);
  18338. $core.addMethod(
  18339. $core.method({
  18340. selector: "selector:",
  18341. protocol: "accessing",
  18342. fn: function (aString){
  18343. var self=this,$self=this;
  18344. return $core.withContext(function($ctx1) {
  18345. $self._basicAt_put_("selector",aString);
  18346. return self;
  18347. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18348. },
  18349. args: ["aString"],
  18350. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18351. referencedClasses: [],
  18352. messageSends: ["basicAt:put:"]
  18353. }),
  18354. $globals.CompiledMethod);
  18355. $core.addMethod(
  18356. $core.method({
  18357. selector: "sendTo:arguments:",
  18358. protocol: "evaluating",
  18359. fn: function (anObject,aCollection){
  18360. var self=this,$self=this;
  18361. return $core.withContext(function($ctx1) {
  18362. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18363. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18364. },
  18365. args: ["anObject", "aCollection"],
  18366. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18367. referencedClasses: [],
  18368. messageSends: ["applyTo:arguments:", "fn"]
  18369. }),
  18370. $globals.CompiledMethod);
  18371. $core.addMethod(
  18372. $core.method({
  18373. selector: "source",
  18374. protocol: "accessing",
  18375. fn: function (){
  18376. var self=this,$self=this;
  18377. return $core.withContext(function($ctx1) {
  18378. var $1,$receiver;
  18379. $1=$self._basicAt_("source");
  18380. if(($receiver = $1) == null || $receiver.a$nil){
  18381. return "";
  18382. } else {
  18383. return $1;
  18384. }
  18385. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18386. },
  18387. args: [],
  18388. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18389. referencedClasses: [],
  18390. messageSends: ["ifNil:", "basicAt:"]
  18391. }),
  18392. $globals.CompiledMethod);
  18393. $core.addMethod(
  18394. $core.method({
  18395. selector: "source:",
  18396. protocol: "accessing",
  18397. fn: function (aString){
  18398. var self=this,$self=this;
  18399. return $core.withContext(function($ctx1) {
  18400. $self._basicAt_put_("source",aString);
  18401. return self;
  18402. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18403. },
  18404. args: ["aString"],
  18405. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18406. referencedClasses: [],
  18407. messageSends: ["basicAt:put:"]
  18408. }),
  18409. $globals.CompiledMethod);
  18410. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18411. $globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
  18412. $core.addMethod(
  18413. $core.method({
  18414. selector: "addWorker",
  18415. protocol: "private",
  18416. fn: function (){
  18417. var self=this,$self=this;
  18418. return $core.withContext(function($ctx1) {
  18419. $recv($self["@worker"])._valueWithTimeout_((0));
  18420. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18421. return self;
  18422. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18423. },
  18424. args: [],
  18425. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18426. referencedClasses: [],
  18427. messageSends: ["valueWithTimeout:", "+"]
  18428. }),
  18429. $globals.ForkPool);
  18430. $core.addMethod(
  18431. $core.method({
  18432. selector: "defaultMaxPoolSize",
  18433. protocol: "defaults",
  18434. fn: function (){
  18435. var self=this,$self=this;
  18436. return $core.withContext(function($ctx1) {
  18437. return $recv($self._class())._defaultMaxPoolSize();
  18438. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18439. },
  18440. args: [],
  18441. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18442. referencedClasses: [],
  18443. messageSends: ["defaultMaxPoolSize", "class"]
  18444. }),
  18445. $globals.ForkPool);
  18446. $core.addMethod(
  18447. $core.method({
  18448. selector: "fork:",
  18449. protocol: "actions",
  18450. fn: function (aBlock){
  18451. var self=this,$self=this;
  18452. return $core.withContext(function($ctx1) {
  18453. var $1;
  18454. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18455. if($core.assert($1)){
  18456. $self._addWorker();
  18457. }
  18458. $recv($self["@queue"])._nextPut_(aBlock);
  18459. return self;
  18460. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18461. },
  18462. args: ["aBlock"],
  18463. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18464. referencedClasses: [],
  18465. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18466. }),
  18467. $globals.ForkPool);
  18468. $core.addMethod(
  18469. $core.method({
  18470. selector: "initialize",
  18471. protocol: "initialization",
  18472. fn: function (){
  18473. var self=this,$self=this;
  18474. return $core.withContext(function($ctx1) {
  18475. (
  18476. $ctx1.supercall = true,
  18477. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18478. $ctx1.supercall = false;
  18479. $self["@poolSize"]=(0);
  18480. $self["@queue"]=$recv($globals.Queue)._new();
  18481. $self["@worker"]=$self._makeWorker();
  18482. return self;
  18483. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18484. },
  18485. args: [],
  18486. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18487. referencedClasses: ["Queue"],
  18488. messageSends: ["initialize", "new", "makeWorker"]
  18489. }),
  18490. $globals.ForkPool);
  18491. $core.addMethod(
  18492. $core.method({
  18493. selector: "makeWorker",
  18494. protocol: "initialization",
  18495. fn: function (){
  18496. var self=this,$self=this;
  18497. var sentinel;
  18498. return $core.withContext(function($ctx1) {
  18499. var $1;
  18500. sentinel=$recv($globals.Object)._new();
  18501. return (function(){
  18502. var block;
  18503. return $core.withContext(function($ctx2) {
  18504. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18505. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18506. return sentinel;
  18507. }));
  18508. $1=$recv(block).__eq_eq(sentinel);
  18509. if(!$core.assert($1)){
  18510. return $recv((function(){
  18511. return $core.withContext(function($ctx3) {
  18512. return $recv(block)._value();
  18513. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18514. }))._ensure_((function(){
  18515. return $core.withContext(function($ctx3) {
  18516. return $self._addWorker();
  18517. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18518. }));
  18519. }
  18520. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18521. });
  18522. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18523. },
  18524. args: [],
  18525. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]",
  18526. referencedClasses: ["Object"],
  18527. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18528. }),
  18529. $globals.ForkPool);
  18530. $core.addMethod(
  18531. $core.method({
  18532. selector: "maxPoolSize",
  18533. protocol: "accessing",
  18534. fn: function (){
  18535. var self=this,$self=this;
  18536. return $core.withContext(function($ctx1) {
  18537. var $1,$receiver;
  18538. $1=$self["@maxPoolSize"];
  18539. if(($receiver = $1) == null || $receiver.a$nil){
  18540. return $self._defaultMaxPoolSize();
  18541. } else {
  18542. return $1;
  18543. }
  18544. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18545. },
  18546. args: [],
  18547. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18548. referencedClasses: [],
  18549. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18550. }),
  18551. $globals.ForkPool);
  18552. $core.addMethod(
  18553. $core.method({
  18554. selector: "maxPoolSize:",
  18555. protocol: "accessing",
  18556. fn: function (anInteger){
  18557. var self=this,$self=this;
  18558. $self["@maxPoolSize"]=anInteger;
  18559. return self;
  18560. },
  18561. args: ["anInteger"],
  18562. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18563. referencedClasses: [],
  18564. messageSends: []
  18565. }),
  18566. $globals.ForkPool);
  18567. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18568. $core.addMethod(
  18569. $core.method({
  18570. selector: "default",
  18571. protocol: "accessing",
  18572. fn: function (){
  18573. var self=this,$self=this;
  18574. return $core.withContext(function($ctx1) {
  18575. var $1,$receiver;
  18576. $1=$self["@default"];
  18577. if(($receiver = $1) == null || $receiver.a$nil){
  18578. $self["@default"]=$self._new();
  18579. return $self["@default"];
  18580. } else {
  18581. return $1;
  18582. }
  18583. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18584. },
  18585. args: [],
  18586. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18587. referencedClasses: [],
  18588. messageSends: ["ifNil:", "new"]
  18589. }),
  18590. $globals.ForkPool.a$cls);
  18591. $core.addMethod(
  18592. $core.method({
  18593. selector: "defaultMaxPoolSize",
  18594. protocol: "accessing",
  18595. fn: function (){
  18596. var self=this,$self=this;
  18597. return (100);
  18598. },
  18599. args: [],
  18600. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18601. referencedClasses: [],
  18602. messageSends: []
  18603. }),
  18604. $globals.ForkPool.a$cls);
  18605. $core.addMethod(
  18606. $core.method({
  18607. selector: "resetDefault",
  18608. protocol: "accessing",
  18609. fn: function (){
  18610. var self=this,$self=this;
  18611. $self["@default"]=nil;
  18612. return self;
  18613. },
  18614. args: [],
  18615. source: "resetDefault\x0a\x09default := nil",
  18616. referencedClasses: [],
  18617. messageSends: []
  18618. }),
  18619. $globals.ForkPool.a$cls);
  18620. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18621. $globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
  18622. $core.addMethod(
  18623. $core.method({
  18624. selector: "arguments",
  18625. protocol: "accessing",
  18626. fn: function (){
  18627. var self=this,$self=this;
  18628. return $self["@arguments"];
  18629. },
  18630. args: [],
  18631. source: "arguments\x0a\x09^ arguments",
  18632. referencedClasses: [],
  18633. messageSends: []
  18634. }),
  18635. $globals.Message);
  18636. $core.addMethod(
  18637. $core.method({
  18638. selector: "arguments:",
  18639. protocol: "accessing",
  18640. fn: function (anArray){
  18641. var self=this,$self=this;
  18642. $self["@arguments"]=anArray;
  18643. return self;
  18644. },
  18645. args: ["anArray"],
  18646. source: "arguments: anArray\x0a\x09arguments := anArray",
  18647. referencedClasses: [],
  18648. messageSends: []
  18649. }),
  18650. $globals.Message);
  18651. $core.addMethod(
  18652. $core.method({
  18653. selector: "printOn:",
  18654. protocol: "printing",
  18655. fn: function (aStream){
  18656. var self=this,$self=this;
  18657. return $core.withContext(function($ctx1) {
  18658. (
  18659. $ctx1.supercall = true,
  18660. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18661. $ctx1.supercall = false;
  18662. $recv(aStream)._nextPutAll_("(");
  18663. $ctx1.sendIdx["nextPutAll:"]=1;
  18664. $recv(aStream)._nextPutAll_($self._selector());
  18665. $ctx1.sendIdx["nextPutAll:"]=2;
  18666. $recv(aStream)._nextPutAll_(")");
  18667. return self;
  18668. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18669. },
  18670. args: ["aStream"],
  18671. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18672. referencedClasses: [],
  18673. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18674. }),
  18675. $globals.Message);
  18676. $core.addMethod(
  18677. $core.method({
  18678. selector: "selector",
  18679. protocol: "accessing",
  18680. fn: function (){
  18681. var self=this,$self=this;
  18682. return $self["@selector"];
  18683. },
  18684. args: [],
  18685. source: "selector\x0a\x09^ selector",
  18686. referencedClasses: [],
  18687. messageSends: []
  18688. }),
  18689. $globals.Message);
  18690. $core.addMethod(
  18691. $core.method({
  18692. selector: "selector:",
  18693. protocol: "accessing",
  18694. fn: function (aString){
  18695. var self=this,$self=this;
  18696. $self["@selector"]=aString;
  18697. return self;
  18698. },
  18699. args: ["aString"],
  18700. source: "selector: aString\x0a\x09selector := aString",
  18701. referencedClasses: [],
  18702. messageSends: []
  18703. }),
  18704. $globals.Message);
  18705. $core.addMethod(
  18706. $core.method({
  18707. selector: "sendTo:",
  18708. protocol: "actions",
  18709. fn: function (anObject){
  18710. var self=this,$self=this;
  18711. return $core.withContext(function($ctx1) {
  18712. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18713. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18714. },
  18715. args: ["anObject"],
  18716. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18717. referencedClasses: [],
  18718. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18719. }),
  18720. $globals.Message);
  18721. $core.addMethod(
  18722. $core.method({
  18723. selector: "selector:arguments:",
  18724. protocol: "instance creation",
  18725. fn: function (aString,anArray){
  18726. var self=this,$self=this;
  18727. return $core.withContext(function($ctx1) {
  18728. var $1;
  18729. $1=$self._new();
  18730. $recv($1)._selector_(aString);
  18731. $recv($1)._arguments_(anArray);
  18732. return $recv($1)._yourself();
  18733. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18734. },
  18735. args: ["aString", "anArray"],
  18736. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18737. referencedClasses: [],
  18738. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18739. }),
  18740. $globals.Message.a$cls);
  18741. $core.addMethod(
  18742. $core.method({
  18743. selector: "selector:arguments:notUnderstoodBy:",
  18744. protocol: "dnu handling",
  18745. fn: function (aString,anArray,anObject){
  18746. var self=this,$self=this;
  18747. return $core.withContext(function($ctx1) {
  18748. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18749. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18750. },
  18751. args: ["aString", "anArray", "anObject"],
  18752. source: "selector: aString arguments: anArray notUnderstoodBy: anObject\x0a\x09\x22Creates the message and passes it to #doesNotUnderstand:.\x0a\x09Used by kernel to handle MNU.\x22\x0a\x09^ anObject doesNotUnderstand:\x0a\x09\x09(self selector: aString arguments: anArray)",
  18753. referencedClasses: [],
  18754. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18755. }),
  18756. $globals.Message.a$cls);
  18757. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18758. $globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
  18759. $core.addMethod(
  18760. $core.method({
  18761. selector: "arguments",
  18762. protocol: "accessing",
  18763. fn: function (){
  18764. var self=this,$self=this;
  18765. return $core.withContext(function($ctx1) {
  18766. return $recv($self["@message"])._arguments();
  18767. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18768. },
  18769. args: [],
  18770. source: "arguments\x0a\x09^ message arguments",
  18771. referencedClasses: [],
  18772. messageSends: ["arguments"]
  18773. }),
  18774. $globals.MessageSend);
  18775. $core.addMethod(
  18776. $core.method({
  18777. selector: "arguments:",
  18778. protocol: "accessing",
  18779. fn: function (aCollection){
  18780. var self=this,$self=this;
  18781. return $core.withContext(function($ctx1) {
  18782. $recv($self["@message"])._arguments_(aCollection);
  18783. return self;
  18784. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18785. },
  18786. args: ["aCollection"],
  18787. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18788. referencedClasses: [],
  18789. messageSends: ["arguments:"]
  18790. }),
  18791. $globals.MessageSend);
  18792. $core.addMethod(
  18793. $core.method({
  18794. selector: "initialize",
  18795. protocol: "initialization",
  18796. fn: function (){
  18797. var self=this,$self=this;
  18798. return $core.withContext(function($ctx1) {
  18799. (
  18800. $ctx1.supercall = true,
  18801. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18802. $ctx1.supercall = false;
  18803. $self["@message"]=$recv($globals.Message)._new();
  18804. return self;
  18805. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18806. },
  18807. args: [],
  18808. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18809. referencedClasses: ["Message"],
  18810. messageSends: ["initialize", "new"]
  18811. }),
  18812. $globals.MessageSend);
  18813. $core.addMethod(
  18814. $core.method({
  18815. selector: "printOn:",
  18816. protocol: "printing",
  18817. fn: function (aStream){
  18818. var self=this,$self=this;
  18819. return $core.withContext(function($ctx1) {
  18820. (
  18821. $ctx1.supercall = true,
  18822. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18823. $ctx1.supercall = false;
  18824. $recv(aStream)._nextPutAll_("(");
  18825. $ctx1.sendIdx["nextPutAll:"]=1;
  18826. $recv(aStream)._nextPutAll_($self._receiver());
  18827. $ctx1.sendIdx["nextPutAll:"]=2;
  18828. $recv(aStream)._nextPutAll_(" >> ");
  18829. $ctx1.sendIdx["nextPutAll:"]=3;
  18830. $recv(aStream)._nextPutAll_($self._selector());
  18831. $ctx1.sendIdx["nextPutAll:"]=4;
  18832. $recv(aStream)._nextPutAll_(")");
  18833. return self;
  18834. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18835. },
  18836. args: ["aStream"],
  18837. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18838. referencedClasses: [],
  18839. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18840. }),
  18841. $globals.MessageSend);
  18842. $core.addMethod(
  18843. $core.method({
  18844. selector: "receiver",
  18845. protocol: "accessing",
  18846. fn: function (){
  18847. var self=this,$self=this;
  18848. return $self["@receiver"];
  18849. },
  18850. args: [],
  18851. source: "receiver\x0a\x09^ receiver",
  18852. referencedClasses: [],
  18853. messageSends: []
  18854. }),
  18855. $globals.MessageSend);
  18856. $core.addMethod(
  18857. $core.method({
  18858. selector: "receiver:",
  18859. protocol: "accessing",
  18860. fn: function (anObject){
  18861. var self=this,$self=this;
  18862. $self["@receiver"]=anObject;
  18863. return self;
  18864. },
  18865. args: ["anObject"],
  18866. source: "receiver: anObject\x0a\x09receiver := anObject",
  18867. referencedClasses: [],
  18868. messageSends: []
  18869. }),
  18870. $globals.MessageSend);
  18871. $core.addMethod(
  18872. $core.method({
  18873. selector: "selector",
  18874. protocol: "accessing",
  18875. fn: function (){
  18876. var self=this,$self=this;
  18877. return $core.withContext(function($ctx1) {
  18878. return $recv($self["@message"])._selector();
  18879. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18880. },
  18881. args: [],
  18882. source: "selector\x0a\x09^ message selector",
  18883. referencedClasses: [],
  18884. messageSends: ["selector"]
  18885. }),
  18886. $globals.MessageSend);
  18887. $core.addMethod(
  18888. $core.method({
  18889. selector: "selector:",
  18890. protocol: "accessing",
  18891. fn: function (aString){
  18892. var self=this,$self=this;
  18893. return $core.withContext(function($ctx1) {
  18894. $recv($self["@message"])._selector_(aString);
  18895. return self;
  18896. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18897. },
  18898. args: ["aString"],
  18899. source: "selector: aString\x0a\x09message selector: aString",
  18900. referencedClasses: [],
  18901. messageSends: ["selector:"]
  18902. }),
  18903. $globals.MessageSend);
  18904. $core.addMethod(
  18905. $core.method({
  18906. selector: "value",
  18907. protocol: "evaluating",
  18908. fn: function (){
  18909. var self=this,$self=this;
  18910. return $core.withContext(function($ctx1) {
  18911. return $recv($self["@message"])._sendTo_($self._receiver());
  18912. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18913. },
  18914. args: [],
  18915. source: "value\x0a\x09^ message sendTo: self receiver",
  18916. referencedClasses: [],
  18917. messageSends: ["sendTo:", "receiver"]
  18918. }),
  18919. $globals.MessageSend);
  18920. $core.addMethod(
  18921. $core.method({
  18922. selector: "value:",
  18923. protocol: "evaluating",
  18924. fn: function (anObject){
  18925. var self=this,$self=this;
  18926. return $core.withContext(function($ctx1) {
  18927. var $1;
  18928. $1=$self["@message"];
  18929. $recv($1)._arguments_([anObject]);
  18930. return $recv($1)._sendTo_($self._receiver());
  18931. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18932. },
  18933. args: ["anObject"],
  18934. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18935. referencedClasses: [],
  18936. messageSends: ["arguments:", "sendTo:", "receiver"]
  18937. }),
  18938. $globals.MessageSend);
  18939. $core.addMethod(
  18940. $core.method({
  18941. selector: "value:value:",
  18942. protocol: "evaluating",
  18943. fn: function (firstArgument,secondArgument){
  18944. var self=this,$self=this;
  18945. return $core.withContext(function($ctx1) {
  18946. var $1;
  18947. $1=$self["@message"];
  18948. $recv($1)._arguments_([firstArgument,secondArgument]);
  18949. return $recv($1)._sendTo_($self._receiver());
  18950. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18951. },
  18952. args: ["firstArgument", "secondArgument"],
  18953. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18954. referencedClasses: [],
  18955. messageSends: ["arguments:", "sendTo:", "receiver"]
  18956. }),
  18957. $globals.MessageSend);
  18958. $core.addMethod(
  18959. $core.method({
  18960. selector: "value:value:value:",
  18961. protocol: "evaluating",
  18962. fn: function (firstArgument,secondArgument,thirdArgument){
  18963. var self=this,$self=this;
  18964. return $core.withContext(function($ctx1) {
  18965. var $1;
  18966. $1=$self["@message"];
  18967. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18968. return $recv($1)._sendTo_($self._receiver());
  18969. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18970. },
  18971. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18972. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18973. referencedClasses: [],
  18974. messageSends: ["arguments:", "sendTo:", "receiver"]
  18975. }),
  18976. $globals.MessageSend);
  18977. $core.addMethod(
  18978. $core.method({
  18979. selector: "valueWithPossibleArguments:",
  18980. protocol: "evaluating",
  18981. fn: function (aCollection){
  18982. var self=this,$self=this;
  18983. return $core.withContext(function($ctx1) {
  18984. $self._arguments_(aCollection);
  18985. return $self._value();
  18986. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18987. },
  18988. args: ["aCollection"],
  18989. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18990. referencedClasses: [],
  18991. messageSends: ["arguments:", "value"]
  18992. }),
  18993. $globals.MessageSend);
  18994. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18995. $globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
  18996. $core.addMethod(
  18997. $core.method({
  18998. selector: "asString",
  18999. protocol: "converting",
  19000. fn: function (){
  19001. var self=this,$self=this;
  19002. return $core.withContext(function($ctx1) {
  19003. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  19004. $2=$self._isBlockContext();
  19005. if($core.assert($2)){
  19006. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  19007. $ctx1.sendIdx[","]=2;
  19008. $1=$recv($3).__comma(")");
  19009. $ctx1.sendIdx[","]=1;
  19010. } else {
  19011. var methodClass;
  19012. methodClass=$recv($self._method())._methodClass();
  19013. $5=methodClass;
  19014. $7=$self._receiver();
  19015. $ctx1.sendIdx["receiver"]=1;
  19016. $6=$recv($7)._class();
  19017. $ctx1.sendIdx["class"]=1;
  19018. $4=$recv($5).__eq($6);
  19019. if($core.assert($4)){
  19020. $11=$self._receiver();
  19021. $ctx1.sendIdx["receiver"]=2;
  19022. $10=$recv($11)._class();
  19023. $ctx1.sendIdx["class"]=2;
  19024. $9=$recv($10)._name();
  19025. $ctx1.sendIdx["name"]=1;
  19026. $8=$recv($9).__comma(" >> ");
  19027. $ctx1.sendIdx[","]=4;
  19028. $12=$self._selector();
  19029. $ctx1.sendIdx["selector"]=1;
  19030. $1=$recv($8).__comma($12);
  19031. $ctx1.sendIdx[","]=3;
  19032. } else {
  19033. $16=$recv($recv($self._receiver())._class())._name();
  19034. $ctx1.sendIdx["name"]=2;
  19035. $15=$recv($16).__comma("(");
  19036. $14=$recv($15).__comma($recv(methodClass)._name());
  19037. $ctx1.sendIdx[","]=7;
  19038. $13=$recv($14).__comma(") >> ");
  19039. $ctx1.sendIdx[","]=6;
  19040. $1=$recv($13).__comma($self._selector());
  19041. $ctx1.sendIdx[","]=5;
  19042. }
  19043. }
  19044. return $1;
  19045. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  19046. },
  19047. args: [],
  19048. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
  19049. referencedClasses: [],
  19050. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  19051. }),
  19052. $globals.MethodContext);
  19053. $core.addMethod(
  19054. $core.method({
  19055. selector: "basicReceiver",
  19056. protocol: "accessing",
  19057. fn: function (){
  19058. var self=this,$self=this;
  19059. return $core.withContext(function($ctx1) {
  19060. return self.receiver;
  19061. return self;
  19062. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  19063. },
  19064. args: [],
  19065. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  19066. referencedClasses: [],
  19067. messageSends: []
  19068. }),
  19069. $globals.MethodContext);
  19070. $core.addMethod(
  19071. $core.method({
  19072. selector: "evaluatedSelector",
  19073. protocol: "accessing",
  19074. fn: function (){
  19075. var self=this,$self=this;
  19076. return $core.withContext(function($ctx1) {
  19077. return self.evaluatedSelector;
  19078. return self;
  19079. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  19080. },
  19081. args: [],
  19082. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  19083. referencedClasses: [],
  19084. messageSends: []
  19085. }),
  19086. $globals.MethodContext);
  19087. $core.addMethod(
  19088. $core.method({
  19089. selector: "findContextSuchThat:",
  19090. protocol: "accessing",
  19091. fn: function (testBlock){
  19092. var self=this,$self=this;
  19093. var context;
  19094. return $core.withContext(function($ctx1) {
  19095. var $1;
  19096. var $early={};
  19097. try {
  19098. context=self;
  19099. $recv((function(){
  19100. return $core.withContext(function($ctx2) {
  19101. return $recv(context)._isNil();
  19102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19103. }))._whileFalse_((function(){
  19104. return $core.withContext(function($ctx2) {
  19105. $1=$recv(testBlock)._value_(context);
  19106. if($core.assert($1)){
  19107. throw $early=[context];
  19108. }
  19109. context=$recv(context)._outerContext();
  19110. return context;
  19111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19112. }));
  19113. return nil;
  19114. }
  19115. catch(e) {if(e===$early)return e[0]; throw e}
  19116. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19117. },
  19118. args: ["testBlock"],
  19119. source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
  19120. referencedClasses: [],
  19121. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19122. }),
  19123. $globals.MethodContext);
  19124. $core.addMethod(
  19125. $core.method({
  19126. selector: "home",
  19127. protocol: "accessing",
  19128. fn: function (){
  19129. var self=this,$self=this;
  19130. return $core.withContext(function($ctx1) {
  19131. return self.homeContext;
  19132. return self;
  19133. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19134. },
  19135. args: [],
  19136. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19137. referencedClasses: [],
  19138. messageSends: []
  19139. }),
  19140. $globals.MethodContext);
  19141. $core.addMethod(
  19142. $core.method({
  19143. selector: "index",
  19144. protocol: "accessing",
  19145. fn: function (){
  19146. var self=this,$self=this;
  19147. return $core.withContext(function($ctx1) {
  19148. return self.index || 0;
  19149. return self;
  19150. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19151. },
  19152. args: [],
  19153. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19154. referencedClasses: [],
  19155. messageSends: []
  19156. }),
  19157. $globals.MethodContext);
  19158. $core.addMethod(
  19159. $core.method({
  19160. selector: "isBlockContext",
  19161. protocol: "testing",
  19162. fn: function (){
  19163. var self=this,$self=this;
  19164. return $core.withContext(function($ctx1) {
  19165. return $recv($self._selector())._isNil();
  19166. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19167. },
  19168. args: [],
  19169. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19170. referencedClasses: [],
  19171. messageSends: ["isNil", "selector"]
  19172. }),
  19173. $globals.MethodContext);
  19174. $core.addMethod(
  19175. $core.method({
  19176. selector: "locals",
  19177. protocol: "accessing",
  19178. fn: function (){
  19179. var self=this,$self=this;
  19180. return $core.withContext(function($ctx1) {
  19181. return self.locals || {};
  19182. return self;
  19183. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19184. },
  19185. args: [],
  19186. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19187. referencedClasses: [],
  19188. messageSends: []
  19189. }),
  19190. $globals.MethodContext);
  19191. $core.addMethod(
  19192. $core.method({
  19193. selector: "method",
  19194. protocol: "accessing",
  19195. fn: function (){
  19196. var self=this,$self=this;
  19197. var method,lookupClass,receiverClass,supercall;
  19198. return $core.withContext(function($ctx1) {
  19199. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19200. $1=$self._methodContext();
  19201. $ctx1.sendIdx["methodContext"]=1;
  19202. if(($receiver = $1) == null || $receiver.a$nil){
  19203. return nil;
  19204. } else {
  19205. $1;
  19206. }
  19207. $3=$self._methodContext();
  19208. $ctx1.sendIdx["methodContext"]=2;
  19209. $2=$recv($3)._receiver();
  19210. receiverClass=$recv($2)._class();
  19211. $4=receiverClass;
  19212. $6=$self._methodContext();
  19213. $ctx1.sendIdx["methodContext"]=3;
  19214. $5=$recv($6)._selector();
  19215. $ctx1.sendIdx["selector"]=1;
  19216. method=$recv($4)._lookupSelector_($5);
  19217. $ctx1.sendIdx["lookupSelector:"]=1;
  19218. $7=$self._outerContext();
  19219. if(($receiver = $7) == null || $receiver.a$nil){
  19220. supercall=false;
  19221. } else {
  19222. var outer;
  19223. outer=$receiver;
  19224. supercall=$recv(outer)._supercall();
  19225. }
  19226. $8=supercall;
  19227. if($core.assert($8)){
  19228. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19229. } else {
  19230. return method;
  19231. }
  19232. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19233. },
  19234. args: [],
  19235. source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
  19236. referencedClasses: [],
  19237. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19238. }),
  19239. $globals.MethodContext);
  19240. $core.addMethod(
  19241. $core.method({
  19242. selector: "methodContext",
  19243. protocol: "accessing",
  19244. fn: function (){
  19245. var self=this,$self=this;
  19246. return $core.withContext(function($ctx1) {
  19247. var $1,$2,$receiver;
  19248. $1=$self._isBlockContext();
  19249. if(!$core.assert($1)){
  19250. return self;
  19251. }
  19252. $2=$self._outerContext();
  19253. if(($receiver = $2) == null || $receiver.a$nil){
  19254. return $2;
  19255. } else {
  19256. var outer;
  19257. outer=$receiver;
  19258. return $recv(outer)._methodContext();
  19259. }
  19260. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19261. },
  19262. args: [],
  19263. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19264. referencedClasses: [],
  19265. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19266. }),
  19267. $globals.MethodContext);
  19268. $core.addMethod(
  19269. $core.method({
  19270. selector: "outerContext",
  19271. protocol: "accessing",
  19272. fn: function (){
  19273. var self=this,$self=this;
  19274. return $core.withContext(function($ctx1) {
  19275. return self.outerContext || self.homeContext;
  19276. return self;
  19277. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19278. },
  19279. args: [],
  19280. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19281. referencedClasses: [],
  19282. messageSends: []
  19283. }),
  19284. $globals.MethodContext);
  19285. $core.addMethod(
  19286. $core.method({
  19287. selector: "printOn:",
  19288. protocol: "printing",
  19289. fn: function (aStream){
  19290. var self=this,$self=this;
  19291. return $core.withContext(function($ctx1) {
  19292. (
  19293. $ctx1.supercall = true,
  19294. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19295. $ctx1.supercall = false;
  19296. $recv(aStream)._nextPutAll_("(");
  19297. $ctx1.sendIdx["nextPutAll:"]=1;
  19298. $recv(aStream)._nextPutAll_($self._asString());
  19299. $ctx1.sendIdx["nextPutAll:"]=2;
  19300. $recv(aStream)._nextPutAll_(")");
  19301. return self;
  19302. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19303. },
  19304. args: ["aStream"],
  19305. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19306. referencedClasses: [],
  19307. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19308. }),
  19309. $globals.MethodContext);
  19310. $core.addMethod(
  19311. $core.method({
  19312. selector: "receiver",
  19313. protocol: "accessing",
  19314. fn: function (){
  19315. var self=this,$self=this;
  19316. return $core.withContext(function($ctx1) {
  19317. var $2,$1;
  19318. $1=$recv($self._isBlockContext())._and_((function(){
  19319. return $core.withContext(function($ctx2) {
  19320. $2=$self._outerContext();
  19321. $ctx2.sendIdx["outerContext"]=1;
  19322. return $recv($2)._notNil();
  19323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19324. }));
  19325. if($core.assert($1)){
  19326. return $recv($self._outerContext())._receiver();
  19327. } else {
  19328. return $self._basicReceiver();
  19329. }
  19330. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19331. },
  19332. args: [],
  19333. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19334. referencedClasses: [],
  19335. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19336. }),
  19337. $globals.MethodContext);
  19338. $core.addMethod(
  19339. $core.method({
  19340. selector: "selector",
  19341. protocol: "accessing",
  19342. fn: function (){
  19343. var self=this,$self=this;
  19344. return $core.withContext(function($ctx1) {
  19345. if(self.selector) {
  19346. return $core.js2st(self.selector);
  19347. } else {
  19348. return nil;
  19349. }
  19350. ;
  19351. return self;
  19352. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19353. },
  19354. args: [],
  19355. source: "selector\x0a\x09<inlineJS: '\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return $core.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09'>",
  19356. referencedClasses: [],
  19357. messageSends: []
  19358. }),
  19359. $globals.MethodContext);
  19360. $core.addMethod(
  19361. $core.method({
  19362. selector: "sendIndexAt:",
  19363. protocol: "accessing",
  19364. fn: function (aSelector){
  19365. var self=this,$self=this;
  19366. return $core.withContext(function($ctx1) {
  19367. return self.sendIdx[aSelector] || 0;
  19368. return self;
  19369. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19370. },
  19371. args: ["aSelector"],
  19372. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19373. referencedClasses: [],
  19374. messageSends: []
  19375. }),
  19376. $globals.MethodContext);
  19377. $core.addMethod(
  19378. $core.method({
  19379. selector: "sendIndexes",
  19380. protocol: "accessing",
  19381. fn: function (){
  19382. var self=this,$self=this;
  19383. return $core.withContext(function($ctx1) {
  19384. return self.sendIdx;
  19385. return self;
  19386. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19387. },
  19388. args: [],
  19389. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19390. referencedClasses: [],
  19391. messageSends: []
  19392. }),
  19393. $globals.MethodContext);
  19394. $core.addMethod(
  19395. $core.method({
  19396. selector: "stubHere",
  19397. protocol: "accessing",
  19398. fn: function (){
  19399. var self=this,$self=this;
  19400. return $core.withContext(function($ctx1) {
  19401. self.homeContext = undefined;
  19402. return self;
  19403. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19404. },
  19405. args: [],
  19406. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19407. referencedClasses: [],
  19408. messageSends: []
  19409. }),
  19410. $globals.MethodContext);
  19411. $core.addMethod(
  19412. $core.method({
  19413. selector: "stubToAtMost:",
  19414. protocol: "error handling",
  19415. fn: function (anInteger){
  19416. var self=this,$self=this;
  19417. var context;
  19418. return $core.withContext(function($ctx1) {
  19419. var $1,$2,$receiver;
  19420. context=self;
  19421. $recv(anInteger)._timesRepeat_((function(){
  19422. return $core.withContext(function($ctx2) {
  19423. $1=context;
  19424. if(($receiver = $1) == null || $receiver.a$nil){
  19425. context=$1;
  19426. } else {
  19427. context=$recv(context)._home();
  19428. }
  19429. return context;
  19430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19431. }));
  19432. $2=context;
  19433. if(($receiver = $2) == null || $receiver.a$nil){
  19434. $2;
  19435. } else {
  19436. $recv(context)._stubHere();
  19437. }
  19438. return self;
  19439. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19440. },
  19441. args: ["anInteger"],
  19442. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19443. referencedClasses: [],
  19444. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19445. }),
  19446. $globals.MethodContext);
  19447. $core.addMethod(
  19448. $core.method({
  19449. selector: "supercall",
  19450. protocol: "accessing",
  19451. fn: function (){
  19452. var self=this,$self=this;
  19453. return $core.withContext(function($ctx1) {
  19454. return self.supercall == true;
  19455. return self;
  19456. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19457. },
  19458. args: [],
  19459. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19460. referencedClasses: [],
  19461. messageSends: []
  19462. }),
  19463. $globals.MethodContext);
  19464. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19465. $globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
  19466. $core.addMethod(
  19467. $core.method({
  19468. selector: "constructorNamed:",
  19469. protocol: "instance creation",
  19470. fn: function (aString){
  19471. var self=this,$self=this;
  19472. return $core.withContext(function($ctx1) {
  19473. var nativeFunc=$globals.Platform._globals()[aString];
  19474. return new nativeFunc();
  19475. ;
  19476. return self;
  19477. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19478. },
  19479. args: ["aString"],
  19480. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19481. referencedClasses: [],
  19482. messageSends: []
  19483. }),
  19484. $globals.NativeFunction.a$cls);
  19485. $core.addMethod(
  19486. $core.method({
  19487. selector: "constructorNamed:value:",
  19488. protocol: "instance creation",
  19489. fn: function (aString,anObject){
  19490. var self=this,$self=this;
  19491. return $core.withContext(function($ctx1) {
  19492. var nativeFunc=$globals.Platform._globals()[aString];
  19493. return new nativeFunc(anObject);
  19494. ;
  19495. return self;
  19496. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19497. },
  19498. args: ["aString", "anObject"],
  19499. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19500. referencedClasses: [],
  19501. messageSends: []
  19502. }),
  19503. $globals.NativeFunction.a$cls);
  19504. $core.addMethod(
  19505. $core.method({
  19506. selector: "constructorNamed:value:value:",
  19507. protocol: "instance creation",
  19508. fn: function (aString,anObject,anObject2){
  19509. var self=this,$self=this;
  19510. return $core.withContext(function($ctx1) {
  19511. var nativeFunc=$globals.Platform._globals[aString];
  19512. return new nativeFunc(anObject,anObject2);
  19513. ;
  19514. return self;
  19515. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19516. },
  19517. args: ["aString", "anObject", "anObject2"],
  19518. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19519. referencedClasses: [],
  19520. messageSends: []
  19521. }),
  19522. $globals.NativeFunction.a$cls);
  19523. $core.addMethod(
  19524. $core.method({
  19525. selector: "constructorNamed:value:value:value:",
  19526. protocol: "instance creation",
  19527. fn: function (aString,anObject,anObject2,anObject3){
  19528. var self=this,$self=this;
  19529. return $core.withContext(function($ctx1) {
  19530. var nativeFunc=$globals.Platform._globals[aString];
  19531. return new nativeFunc(anObject,anObject2, anObject3);
  19532. ;
  19533. return self;
  19534. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19535. },
  19536. args: ["aString", "anObject", "anObject2", "anObject3"],
  19537. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19538. referencedClasses: [],
  19539. messageSends: []
  19540. }),
  19541. $globals.NativeFunction.a$cls);
  19542. $core.addMethod(
  19543. $core.method({
  19544. selector: "constructorOf:",
  19545. protocol: "instance creation",
  19546. fn: function (nativeFunc){
  19547. var self=this,$self=this;
  19548. return $core.withContext(function($ctx1) {
  19549. return new nativeFunc();
  19550. ;
  19551. return self;
  19552. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19553. },
  19554. args: ["nativeFunc"],
  19555. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19556. referencedClasses: [],
  19557. messageSends: []
  19558. }),
  19559. $globals.NativeFunction.a$cls);
  19560. $core.addMethod(
  19561. $core.method({
  19562. selector: "constructorOf:value:",
  19563. protocol: "instance creation",
  19564. fn: function (nativeFunc,anObject){
  19565. var self=this,$self=this;
  19566. return $core.withContext(function($ctx1) {
  19567. return new nativeFunc(anObject);
  19568. ;
  19569. return self;
  19570. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19571. },
  19572. args: ["nativeFunc", "anObject"],
  19573. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19574. referencedClasses: [],
  19575. messageSends: []
  19576. }),
  19577. $globals.NativeFunction.a$cls);
  19578. $core.addMethod(
  19579. $core.method({
  19580. selector: "constructorOf:value:value:",
  19581. protocol: "instance creation",
  19582. fn: function (nativeFunc,anObject,anObject2){
  19583. var self=this,$self=this;
  19584. return $core.withContext(function($ctx1) {
  19585. return new nativeFunc(anObject,anObject2);
  19586. ;
  19587. return self;
  19588. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19589. },
  19590. args: ["nativeFunc", "anObject", "anObject2"],
  19591. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19592. referencedClasses: [],
  19593. messageSends: []
  19594. }),
  19595. $globals.NativeFunction.a$cls);
  19596. $core.addMethod(
  19597. $core.method({
  19598. selector: "constructorOf:value:value:value:",
  19599. protocol: "instance creation",
  19600. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19601. var self=this,$self=this;
  19602. return $core.withContext(function($ctx1) {
  19603. return new nativeFunc(anObject,anObject2, anObject3);
  19604. ;
  19605. return self;
  19606. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19607. },
  19608. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19609. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19610. referencedClasses: [],
  19611. messageSends: []
  19612. }),
  19613. $globals.NativeFunction.a$cls);
  19614. $core.addMethod(
  19615. $core.method({
  19616. selector: "exists:",
  19617. protocol: "testing",
  19618. fn: function (aString){
  19619. var self=this,$self=this;
  19620. return $core.withContext(function($ctx1) {
  19621. return $recv($globals.Platform)._includesGlobal_(aString);
  19622. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19623. },
  19624. args: ["aString"],
  19625. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19626. referencedClasses: ["Platform"],
  19627. messageSends: ["includesGlobal:"]
  19628. }),
  19629. $globals.NativeFunction.a$cls);
  19630. $core.addMethod(
  19631. $core.method({
  19632. selector: "functionNamed:",
  19633. protocol: "function calling",
  19634. fn: function (aString){
  19635. var self=this,$self=this;
  19636. return $core.withContext(function($ctx1) {
  19637. var nativeFunc=$globals.Platform._globals[aString];
  19638. return nativeFunc();
  19639. ;
  19640. return self;
  19641. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19642. },
  19643. args: ["aString"],
  19644. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19645. referencedClasses: [],
  19646. messageSends: []
  19647. }),
  19648. $globals.NativeFunction.a$cls);
  19649. $core.addMethod(
  19650. $core.method({
  19651. selector: "functionNamed:value:",
  19652. protocol: "function calling",
  19653. fn: function (aString,anObject){
  19654. var self=this,$self=this;
  19655. return $core.withContext(function($ctx1) {
  19656. var nativeFunc=$globals.Platform._globals()[aString];
  19657. return nativeFunc(anObject);
  19658. ;
  19659. return self;
  19660. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19661. },
  19662. args: ["aString", "anObject"],
  19663. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19664. referencedClasses: [],
  19665. messageSends: []
  19666. }),
  19667. $globals.NativeFunction.a$cls);
  19668. $core.addMethod(
  19669. $core.method({
  19670. selector: "functionNamed:value:value:",
  19671. protocol: "function calling",
  19672. fn: function (aString,anObject,anObject2){
  19673. var self=this,$self=this;
  19674. return $core.withContext(function($ctx1) {
  19675. var nativeFunc=$globals.Platform._globals()[aString];
  19676. return nativeFunc(anObject,anObject2);
  19677. ;
  19678. return self;
  19679. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19680. },
  19681. args: ["aString", "anObject", "anObject2"],
  19682. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19683. referencedClasses: [],
  19684. messageSends: []
  19685. }),
  19686. $globals.NativeFunction.a$cls);
  19687. $core.addMethod(
  19688. $core.method({
  19689. selector: "functionNamed:value:value:value:",
  19690. protocol: "function calling",
  19691. fn: function (aString,anObject,anObject2,anObject3){
  19692. var self=this,$self=this;
  19693. return $core.withContext(function($ctx1) {
  19694. var nativeFunc=$globals.Platform._globals()[aString];
  19695. return nativeFunc(anObject,anObject2, anObject3);
  19696. ;
  19697. return self;
  19698. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19699. },
  19700. args: ["aString", "anObject", "anObject2", "anObject3"],
  19701. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19702. referencedClasses: [],
  19703. messageSends: []
  19704. }),
  19705. $globals.NativeFunction.a$cls);
  19706. $core.addMethod(
  19707. $core.method({
  19708. selector: "functionNamed:valueWithArgs:",
  19709. protocol: "function calling",
  19710. fn: function (aString,args){
  19711. var self=this,$self=this;
  19712. return $core.withContext(function($ctx1) {
  19713. var nativeFunc=$globals.Platform._globals()[aString];
  19714. return Function.prototype.apply.call(nativeFunc, null, args);
  19715. ;
  19716. return self;
  19717. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19718. },
  19719. args: ["aString", "args"],
  19720. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19721. referencedClasses: [],
  19722. messageSends: []
  19723. }),
  19724. $globals.NativeFunction.a$cls);
  19725. $core.addMethod(
  19726. $core.method({
  19727. selector: "functionOf:",
  19728. protocol: "function calling",
  19729. fn: function (nativeFunc){
  19730. var self=this,$self=this;
  19731. return $core.withContext(function($ctx1) {
  19732. return nativeFunc();
  19733. ;
  19734. return self;
  19735. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19736. },
  19737. args: ["nativeFunc"],
  19738. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19739. referencedClasses: [],
  19740. messageSends: []
  19741. }),
  19742. $globals.NativeFunction.a$cls);
  19743. $core.addMethod(
  19744. $core.method({
  19745. selector: "functionOf:value:",
  19746. protocol: "function calling",
  19747. fn: function (nativeFunc,anObject){
  19748. var self=this,$self=this;
  19749. return $core.withContext(function($ctx1) {
  19750. return nativeFunc(anObject);
  19751. ;
  19752. return self;
  19753. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19754. },
  19755. args: ["nativeFunc", "anObject"],
  19756. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19757. referencedClasses: [],
  19758. messageSends: []
  19759. }),
  19760. $globals.NativeFunction.a$cls);
  19761. $core.addMethod(
  19762. $core.method({
  19763. selector: "functionOf:value:value:",
  19764. protocol: "function calling",
  19765. fn: function (nativeFunc,anObject,anObject2){
  19766. var self=this,$self=this;
  19767. return $core.withContext(function($ctx1) {
  19768. return nativeFunc(anObject,anObject2);
  19769. ;
  19770. return self;
  19771. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19772. },
  19773. args: ["nativeFunc", "anObject", "anObject2"],
  19774. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19775. referencedClasses: [],
  19776. messageSends: []
  19777. }),
  19778. $globals.NativeFunction.a$cls);
  19779. $core.addMethod(
  19780. $core.method({
  19781. selector: "functionOf:value:value:value:",
  19782. protocol: "function calling",
  19783. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19784. var self=this,$self=this;
  19785. return $core.withContext(function($ctx1) {
  19786. return nativeFunc(anObject,anObject2, anObject3);
  19787. ;
  19788. return self;
  19789. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19790. },
  19791. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19792. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19793. referencedClasses: [],
  19794. messageSends: []
  19795. }),
  19796. $globals.NativeFunction.a$cls);
  19797. $core.addMethod(
  19798. $core.method({
  19799. selector: "functionOf:valueWithArgs:",
  19800. protocol: "function calling",
  19801. fn: function (nativeFunc,args){
  19802. var self=this,$self=this;
  19803. return $core.withContext(function($ctx1) {
  19804. return Function.prototype.apply.call(nativeFunc, null, args);
  19805. ;
  19806. return self;
  19807. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19808. },
  19809. args: ["nativeFunc", "args"],
  19810. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19811. referencedClasses: [],
  19812. messageSends: []
  19813. }),
  19814. $globals.NativeFunction.a$cls);
  19815. $core.addMethod(
  19816. $core.method({
  19817. selector: "isNativeFunction:",
  19818. protocol: "testing",
  19819. fn: function (anObject){
  19820. var self=this,$self=this;
  19821. return $core.withContext(function($ctx1) {
  19822. return typeof anObject === "function";
  19823. return self;
  19824. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19825. },
  19826. args: ["anObject"],
  19827. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19828. referencedClasses: [],
  19829. messageSends: []
  19830. }),
  19831. $globals.NativeFunction.a$cls);
  19832. $core.addMethod(
  19833. $core.method({
  19834. selector: "methodOf:this:",
  19835. protocol: "method calling",
  19836. fn: function (nativeFunc,thisObject){
  19837. var self=this,$self=this;
  19838. return $core.withContext(function($ctx1) {
  19839. return Function.prototype.call.call(nativeFunc, thisObject);
  19840. ;
  19841. return self;
  19842. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19843. },
  19844. args: ["nativeFunc", "thisObject"],
  19845. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19846. referencedClasses: [],
  19847. messageSends: []
  19848. }),
  19849. $globals.NativeFunction.a$cls);
  19850. $core.addMethod(
  19851. $core.method({
  19852. selector: "methodOf:this:value:",
  19853. protocol: "method calling",
  19854. fn: function (nativeFunc,thisObject,anObject){
  19855. var self=this,$self=this;
  19856. return $core.withContext(function($ctx1) {
  19857. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19858. ;
  19859. return self;
  19860. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19861. },
  19862. args: ["nativeFunc", "thisObject", "anObject"],
  19863. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19864. referencedClasses: [],
  19865. messageSends: []
  19866. }),
  19867. $globals.NativeFunction.a$cls);
  19868. $core.addMethod(
  19869. $core.method({
  19870. selector: "methodOf:this:value:value:",
  19871. protocol: "method calling",
  19872. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19873. var self=this,$self=this;
  19874. return $core.withContext(function($ctx1) {
  19875. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19876. ;
  19877. return self;
  19878. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19879. },
  19880. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19881. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09'>",
  19882. referencedClasses: [],
  19883. messageSends: []
  19884. }),
  19885. $globals.NativeFunction.a$cls);
  19886. $core.addMethod(
  19887. $core.method({
  19888. selector: "methodOf:this:value:value:value:",
  19889. protocol: "method calling",
  19890. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19891. var self=this,$self=this;
  19892. return $core.withContext(function($ctx1) {
  19893. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19894. ;
  19895. return self;
  19896. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19897. },
  19898. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19899. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09'>",
  19900. referencedClasses: [],
  19901. messageSends: []
  19902. }),
  19903. $globals.NativeFunction.a$cls);
  19904. $core.addMethod(
  19905. $core.method({
  19906. selector: "methodOf:this:valueWithArgs:",
  19907. protocol: "method calling",
  19908. fn: function (nativeFunc,thisObject,args){
  19909. var self=this,$self=this;
  19910. return $core.withContext(function($ctx1) {
  19911. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19912. ;
  19913. return self;
  19914. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19915. },
  19916. args: ["nativeFunc", "thisObject", "args"],
  19917. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19918. referencedClasses: [],
  19919. messageSends: []
  19920. }),
  19921. $globals.NativeFunction.a$cls);
  19922. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19923. $globals.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
  19924. $core.addMethod(
  19925. $core.method({
  19926. selector: "clearInterval",
  19927. protocol: "timeout/interval",
  19928. fn: function (){
  19929. var self=this,$self=this;
  19930. return $core.withContext(function($ctx1) {
  19931. var interval = $self["@rawTimeout"];
  19932. clearInterval(interval);
  19933. ;
  19934. return self;
  19935. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19936. },
  19937. args: [],
  19938. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  19939. referencedClasses: [],
  19940. messageSends: []
  19941. }),
  19942. $globals.Timeout);
  19943. $core.addMethod(
  19944. $core.method({
  19945. selector: "clearTimeout",
  19946. protocol: "timeout/interval",
  19947. fn: function (){
  19948. var self=this,$self=this;
  19949. return $core.withContext(function($ctx1) {
  19950. var timeout = $self["@rawTimeout"];
  19951. clearTimeout(timeout);
  19952. ;
  19953. return self;
  19954. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19955. },
  19956. args: [],
  19957. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19958. referencedClasses: [],
  19959. messageSends: []
  19960. }),
  19961. $globals.Timeout);
  19962. $core.addMethod(
  19963. $core.method({
  19964. selector: "rawTimeout:",
  19965. protocol: "accessing",
  19966. fn: function (anObject){
  19967. var self=this,$self=this;
  19968. $self["@rawTimeout"]=anObject;
  19969. return self;
  19970. },
  19971. args: ["anObject"],
  19972. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19973. referencedClasses: [],
  19974. messageSends: []
  19975. }),
  19976. $globals.Timeout);
  19977. $core.addMethod(
  19978. $core.method({
  19979. selector: "on:",
  19980. protocol: "instance creation",
  19981. fn: function (anObject){
  19982. var self=this,$self=this;
  19983. return $core.withContext(function($ctx1) {
  19984. var $1;
  19985. $1=$self._new();
  19986. $recv($1)._rawTimeout_(anObject);
  19987. return $recv($1)._yourself();
  19988. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  19989. },
  19990. args: ["anObject"],
  19991. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19992. referencedClasses: [],
  19993. messageSends: ["rawTimeout:", "new", "yourself"]
  19994. }),
  19995. $globals.Timeout.a$cls);
  19996. });
  19997. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19998. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19999. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20000. $core.addPackage("Kernel-Dag");
  20001. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  20002. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20003. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  20004. $globals.AbstractDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aConcrete classes should implement `visitDagNode:`,\x0athey can reuse possible variants of implementation\x0aoffered directly: `visitDagNodeVariantSimple:`\x0aand `visitDagNodeVariantRedux:`.";
  20005. $core.addMethod(
  20006. $core.method({
  20007. selector: "value:",
  20008. protocol: "evaluating",
  20009. fn: function (anObject){
  20010. var self=this,$self=this;
  20011. return $core.withContext(function($ctx1) {
  20012. return $self._visit_(anObject);
  20013. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  20014. },
  20015. args: ["anObject"],
  20016. source: "value: anObject\x0a\x09^ self visit: anObject",
  20017. referencedClasses: [],
  20018. messageSends: ["visit:"]
  20019. }),
  20020. $globals.AbstractDagVisitor);
  20021. $core.addMethod(
  20022. $core.method({
  20023. selector: "visit:",
  20024. protocol: "visiting",
  20025. fn: function (aNode){
  20026. var self=this,$self=this;
  20027. return $core.withContext(function($ctx1) {
  20028. return $recv(aNode)._acceptDagVisitor_(self);
  20029. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20030. },
  20031. args: ["aNode"],
  20032. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  20033. referencedClasses: [],
  20034. messageSends: ["acceptDagVisitor:"]
  20035. }),
  20036. $globals.AbstractDagVisitor);
  20037. $core.addMethod(
  20038. $core.method({
  20039. selector: "visitAll:",
  20040. protocol: "visiting",
  20041. fn: function (aCollection){
  20042. var self=this,$self=this;
  20043. return $core.withContext(function($ctx1) {
  20044. return $recv(aCollection)._collect_((function(each){
  20045. return $core.withContext(function($ctx2) {
  20046. return $self._visit_(each);
  20047. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20048. }));
  20049. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  20050. },
  20051. args: ["aCollection"],
  20052. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20053. referencedClasses: [],
  20054. messageSends: ["collect:", "visit:"]
  20055. }),
  20056. $globals.AbstractDagVisitor);
  20057. $core.addMethod(
  20058. $core.method({
  20059. selector: "visitAllChildren:",
  20060. protocol: "visiting",
  20061. fn: function (aDagNode){
  20062. var self=this,$self=this;
  20063. return $core.withContext(function($ctx1) {
  20064. return $self._visitAll_($recv(aDagNode)._dagChildren());
  20065. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  20066. },
  20067. args: ["aDagNode"],
  20068. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  20069. referencedClasses: [],
  20070. messageSends: ["visitAll:", "dagChildren"]
  20071. }),
  20072. $globals.AbstractDagVisitor);
  20073. $core.addMethod(
  20074. $core.method({
  20075. selector: "visitDagNode:",
  20076. protocol: "visiting",
  20077. fn: function (aNode){
  20078. var self=this,$self=this;
  20079. return $core.withContext(function($ctx1) {
  20080. $self._subclassResponsibility();
  20081. return self;
  20082. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20083. },
  20084. args: ["aNode"],
  20085. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20086. referencedClasses: [],
  20087. messageSends: ["subclassResponsibility"]
  20088. }),
  20089. $globals.AbstractDagVisitor);
  20090. $core.addMethod(
  20091. $core.method({
  20092. selector: "visitDagNodeVariantRedux:",
  20093. protocol: "visiting",
  20094. fn: function (aNode){
  20095. var self=this,$self=this;
  20096. var newChildren,oldChildren;
  20097. return $core.withContext(function($ctx1) {
  20098. var $2,$3,$1,$4,$5;
  20099. var $early={};
  20100. try {
  20101. oldChildren=$recv(aNode)._dagChildren();
  20102. newChildren=$self._visitAllChildren_(aNode);
  20103. $2=$recv(oldChildren)._size();
  20104. $ctx1.sendIdx["size"]=1;
  20105. $3=$recv(newChildren)._size();
  20106. $ctx1.sendIdx["size"]=2;
  20107. $1=$recv($2).__eq($3);
  20108. if($core.assert($1)){
  20109. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  20110. return $core.withContext(function($ctx2) {
  20111. $4=$recv(oldChildren)._at_(i);
  20112. $ctx2.sendIdx["at:"]=1;
  20113. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20114. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20115. }),(function(){
  20116. throw $early=[aNode];
  20117. }));
  20118. }
  20119. $5=$recv(aNode)._copy();
  20120. $recv($5)._dagChildren_(newChildren);
  20121. return $recv($5)._yourself();
  20122. }
  20123. catch(e) {if(e===$early)return e[0]; throw e}
  20124. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20125. },
  20126. args: ["aNode"],
  20127. source: "visitDagNodeVariantRedux: aNode\x0a\x09\x22Immutable-guarded implementation of visitDagNode:.\x0a\x09Visits all children and checks if there were changes.\x0a\x09If not, returns aNode.\x0a\x09If yes, returns copy of aNode with new children.\x22\x0a\x0a\x09| newChildren oldChildren |\x0a\x09oldChildren := aNode dagChildren.\x0a\x09newChildren := self visitAllChildren: aNode.\x0a\x09oldChildren size = newChildren size ifTrue: [\x0a\x09\x09(1 to: oldChildren size) detect: [ :i |\x0a\x09\x09\x09(oldChildren at: i) ~= (newChildren at: i)\x0a\x09\x09] ifNone: [ \x22no change\x22 ^ aNode ] ].\x0a\x09^ aNode copy dagChildren: newChildren; yourself",
  20128. referencedClasses: [],
  20129. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20130. }),
  20131. $globals.AbstractDagVisitor);
  20132. $core.addMethod(
  20133. $core.method({
  20134. selector: "visitDagNodeVariantSimple:",
  20135. protocol: "visiting",
  20136. fn: function (aNode){
  20137. var self=this,$self=this;
  20138. return $core.withContext(function($ctx1) {
  20139. $self._visitAllChildren_(aNode);
  20140. return aNode;
  20141. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20142. },
  20143. args: ["aNode"],
  20144. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20145. referencedClasses: [],
  20146. messageSends: ["visitAllChildren:"]
  20147. }),
  20148. $globals.AbstractDagVisitor);
  20149. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20150. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20151. $core.addMethod(
  20152. $core.method({
  20153. selector: "initialize",
  20154. protocol: "initialization",
  20155. fn: function (){
  20156. var self=this,$self=this;
  20157. return $core.withContext(function($ctx1) {
  20158. (
  20159. $ctx1.supercall = true,
  20160. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20161. $ctx1.supercall = false;
  20162. $self["@path"]=[];
  20163. return self;
  20164. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20165. },
  20166. args: [],
  20167. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20168. referencedClasses: [],
  20169. messageSends: ["initialize"]
  20170. }),
  20171. $globals.PathDagVisitor);
  20172. $core.addMethod(
  20173. $core.method({
  20174. selector: "path",
  20175. protocol: "accessing",
  20176. fn: function (){
  20177. var self=this,$self=this;
  20178. return $self["@path"];
  20179. },
  20180. args: [],
  20181. source: "path\x0a\x09^ path",
  20182. referencedClasses: [],
  20183. messageSends: []
  20184. }),
  20185. $globals.PathDagVisitor);
  20186. $core.addMethod(
  20187. $core.method({
  20188. selector: "visit:",
  20189. protocol: "visiting",
  20190. fn: function (aNode){
  20191. var self=this,$self=this;
  20192. var oldPath,result;
  20193. return $core.withContext(function($ctx1) {
  20194. result=aNode;
  20195. oldPath=$self["@path"];
  20196. $recv((function(){
  20197. return $core.withContext(function($ctx2) {
  20198. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20199. result=(
  20200. $ctx2.supercall = true,
  20201. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20202. $ctx2.supercall = false;
  20203. return result;
  20204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20205. }))._ensure_((function(){
  20206. $self["@path"]=oldPath;
  20207. return $self["@path"];
  20208. }));
  20209. return result;
  20210. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20211. },
  20212. args: ["aNode"],
  20213. source: "visit: aNode\x0a\x09| oldPath result |\x0a\x09result := aNode.\x0a\x09oldPath := path.\x0a\x09[\x0a\x09\x09path := path, {aNode}.\x0a\x09\x09result := super visit: aNode\x0a\x09] ensure: [ path := oldPath ].\x0a\x09^ result",
  20214. referencedClasses: [],
  20215. messageSends: ["ensure:", ",", "visit:"]
  20216. }),
  20217. $globals.PathDagVisitor);
  20218. $core.addMethod(
  20219. $core.method({
  20220. selector: "visitDagNodeVariantRedux:",
  20221. protocol: "visiting",
  20222. fn: function (aNode){
  20223. var self=this,$self=this;
  20224. var newNode;
  20225. return $core.withContext(function($ctx1) {
  20226. var $1;
  20227. newNode=(
  20228. $ctx1.supercall = true,
  20229. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20230. $ctx1.supercall = false;
  20231. $1=$recv(aNode).__eq_eq(newNode);
  20232. if(!$core.assert($1)){
  20233. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20234. }
  20235. return newNode;
  20236. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20237. },
  20238. args: ["aNode"],
  20239. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20240. referencedClasses: [],
  20241. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20242. }),
  20243. $globals.PathDagVisitor);
  20244. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20245. $globals.DagNode.comment="I am the abstract root class of any directed acyclic graph.\x0a\x0aConcrete classes should implement `dagChildren` and `dagChildren:`\x0ato get / set direct successor nodes (aka child nodes / subnodes).";
  20246. $core.addMethod(
  20247. $core.method({
  20248. selector: "acceptDagVisitor:",
  20249. protocol: "visiting",
  20250. fn: function (aVisitor){
  20251. var self=this,$self=this;
  20252. return $core.withContext(function($ctx1) {
  20253. return $recv(aVisitor)._visitDagNode_(self);
  20254. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20255. },
  20256. args: ["aVisitor"],
  20257. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20258. referencedClasses: [],
  20259. messageSends: ["visitDagNode:"]
  20260. }),
  20261. $globals.DagNode);
  20262. $core.addMethod(
  20263. $core.method({
  20264. selector: "allDagChildren",
  20265. protocol: "accessing",
  20266. fn: function (){
  20267. var self=this,$self=this;
  20268. var allNodes;
  20269. return $core.withContext(function($ctx1) {
  20270. var $1;
  20271. $1=$self._dagChildren();
  20272. $ctx1.sendIdx["dagChildren"]=1;
  20273. allNodes=$recv($1)._asSet();
  20274. $recv($self._dagChildren())._do_((function(each){
  20275. return $core.withContext(function($ctx2) {
  20276. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20278. }));
  20279. return allNodes;
  20280. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20281. },
  20282. args: [],
  20283. source: "allDagChildren\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self dagChildren asSet.\x0a\x09self dagChildren do: [ :each | \x0a\x09\x09allNodes addAll: each allDagChildren ].\x0a\x09\x0a\x09^ allNodes",
  20284. referencedClasses: [],
  20285. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20286. }),
  20287. $globals.DagNode);
  20288. $core.addMethod(
  20289. $core.method({
  20290. selector: "dagChildren",
  20291. protocol: "accessing",
  20292. fn: function (){
  20293. var self=this,$self=this;
  20294. return $core.withContext(function($ctx1) {
  20295. $self._subclassResponsibility();
  20296. return self;
  20297. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20298. },
  20299. args: [],
  20300. source: "dagChildren\x0a\x09self subclassResponsibility",
  20301. referencedClasses: [],
  20302. messageSends: ["subclassResponsibility"]
  20303. }),
  20304. $globals.DagNode);
  20305. $core.addMethod(
  20306. $core.method({
  20307. selector: "dagChildren:",
  20308. protocol: "accessing",
  20309. fn: function (aCollection){
  20310. var self=this,$self=this;
  20311. return $core.withContext(function($ctx1) {
  20312. $self._subclassResponsibility();
  20313. return self;
  20314. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20315. },
  20316. args: ["aCollection"],
  20317. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20318. referencedClasses: [],
  20319. messageSends: ["subclassResponsibility"]
  20320. }),
  20321. $globals.DagNode);
  20322. $core.addMethod(
  20323. $core.method({
  20324. selector: "isDagNode",
  20325. protocol: "testing",
  20326. fn: function (){
  20327. var self=this,$self=this;
  20328. return true;
  20329. },
  20330. args: [],
  20331. source: "isDagNode\x0a\x09^ true",
  20332. referencedClasses: [],
  20333. messageSends: []
  20334. }),
  20335. $globals.DagNode);
  20336. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20337. $globals.DagParentNode.comment="I am `DagNode` that stores a collection of its children,\x0alazy initialized to empty array.\x0a\x0aI can `addDagChild:` to add a child.";
  20338. $core.addMethod(
  20339. $core.method({
  20340. selector: "addDagChild:",
  20341. protocol: "accessing",
  20342. fn: function (aDagNode){
  20343. var self=this,$self=this;
  20344. return $core.withContext(function($ctx1) {
  20345. $recv($self._dagChildren())._add_(aDagNode);
  20346. return self;
  20347. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20348. },
  20349. args: ["aDagNode"],
  20350. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20351. referencedClasses: [],
  20352. messageSends: ["add:", "dagChildren"]
  20353. }),
  20354. $globals.DagParentNode);
  20355. $core.addMethod(
  20356. $core.method({
  20357. selector: "dagChildren",
  20358. protocol: "accessing",
  20359. fn: function (){
  20360. var self=this,$self=this;
  20361. return $core.withContext(function($ctx1) {
  20362. var $1,$receiver;
  20363. $1=$self["@nodes"];
  20364. if(($receiver = $1) == null || $receiver.a$nil){
  20365. $self["@nodes"]=$recv($globals.Array)._new();
  20366. return $self["@nodes"];
  20367. } else {
  20368. return $1;
  20369. }
  20370. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20371. },
  20372. args: [],
  20373. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20374. referencedClasses: ["Array"],
  20375. messageSends: ["ifNil:", "new"]
  20376. }),
  20377. $globals.DagParentNode);
  20378. $core.addMethod(
  20379. $core.method({
  20380. selector: "dagChildren:",
  20381. protocol: "accessing",
  20382. fn: function (aCollection){
  20383. var self=this,$self=this;
  20384. $self["@nodes"]=aCollection;
  20385. return self;
  20386. },
  20387. args: ["aCollection"],
  20388. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20389. referencedClasses: [],
  20390. messageSends: []
  20391. }),
  20392. $globals.DagParentNode);
  20393. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20394. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20395. $core.addMethod(
  20396. $core.method({
  20397. selector: "dagChildren",
  20398. protocol: "accessing",
  20399. fn: function (){
  20400. var self=this,$self=this;
  20401. return [];
  20402. },
  20403. args: [],
  20404. source: "dagChildren\x0a\x09^ #()",
  20405. referencedClasses: [],
  20406. messageSends: []
  20407. }),
  20408. $globals.DagSink);
  20409. $core.addMethod(
  20410. $core.method({
  20411. selector: "dagChildren:",
  20412. protocol: "accessing",
  20413. fn: function (aCollection){
  20414. var self=this,$self=this;
  20415. return $core.withContext(function($ctx1) {
  20416. $recv(aCollection)._ifNotEmpty_((function(){
  20417. return $core.withContext(function($ctx2) {
  20418. return $self._error_("A DagSink cannot have children.");
  20419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20420. }));
  20421. return self;
  20422. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20423. },
  20424. args: ["aCollection"],
  20425. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20426. referencedClasses: [],
  20427. messageSends: ["ifNotEmpty:", "error:"]
  20428. }),
  20429. $globals.DagSink);
  20430. $core.addMethod(
  20431. $core.method({
  20432. selector: "isDagNode",
  20433. protocol: "*Kernel-Dag",
  20434. fn: function (){
  20435. var self=this,$self=this;
  20436. return false;
  20437. },
  20438. args: [],
  20439. source: "isDagNode\x0a\x09^ false",
  20440. referencedClasses: [],
  20441. messageSends: []
  20442. }),
  20443. $globals.Object);
  20444. });
  20445. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20446. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20447. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20448. $core.addPackage("Kernel-Exceptions");
  20449. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20450. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20451. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20452. $globals.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
  20453. $core.addMethod(
  20454. $core.method({
  20455. selector: "beHandled",
  20456. protocol: "accessing",
  20457. fn: function (){
  20458. var self=this,$self=this;
  20459. return $core.withContext(function($ctx1) {
  20460. self.amberHandled = true;
  20461. return self;
  20462. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20463. },
  20464. args: [],
  20465. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20466. referencedClasses: [],
  20467. messageSends: []
  20468. }),
  20469. $globals.Error);
  20470. $core.addMethod(
  20471. $core.method({
  20472. selector: "beUnhandled",
  20473. protocol: "accessing",
  20474. fn: function (){
  20475. var self=this,$self=this;
  20476. return $core.withContext(function($ctx1) {
  20477. self.amberHandled = false;
  20478. return self;
  20479. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20480. },
  20481. args: [],
  20482. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20483. referencedClasses: [],
  20484. messageSends: []
  20485. }),
  20486. $globals.Error);
  20487. $core.addMethod(
  20488. $core.method({
  20489. selector: "context",
  20490. protocol: "accessing",
  20491. fn: function (){
  20492. var self=this,$self=this;
  20493. return $core.withContext(function($ctx1) {
  20494. return self.context;
  20495. return self;
  20496. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20497. },
  20498. args: [],
  20499. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20500. referencedClasses: [],
  20501. messageSends: []
  20502. }),
  20503. $globals.Error);
  20504. $core.addMethod(
  20505. $core.method({
  20506. selector: "initialize",
  20507. protocol: "initialization",
  20508. fn: function (){
  20509. var self=this,$self=this;
  20510. return $core.withContext(function($ctx1) {
  20511. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20512. return self;
  20513. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20514. },
  20515. args: [],
  20516. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20517. referencedClasses: [],
  20518. messageSends: ["messageText:", ",", "name", "class"]
  20519. }),
  20520. $globals.Error);
  20521. $core.addMethod(
  20522. $core.method({
  20523. selector: "isSmalltalkError",
  20524. protocol: "testing",
  20525. fn: function (){
  20526. var self=this,$self=this;
  20527. return $core.withContext(function($ctx1) {
  20528. return self.smalltalkError === true;
  20529. return self;
  20530. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20531. },
  20532. args: [],
  20533. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20534. referencedClasses: [],
  20535. messageSends: []
  20536. }),
  20537. $globals.Error);
  20538. $core.addMethod(
  20539. $core.method({
  20540. selector: "jsStack",
  20541. protocol: "accessing",
  20542. fn: function (){
  20543. var self=this,$self=this;
  20544. return $core.withContext(function($ctx1) {
  20545. return self.stack;
  20546. return self;
  20547. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20548. },
  20549. args: [],
  20550. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20551. referencedClasses: [],
  20552. messageSends: []
  20553. }),
  20554. $globals.Error);
  20555. $core.addMethod(
  20556. $core.method({
  20557. selector: "messageText",
  20558. protocol: "accessing",
  20559. fn: function (){
  20560. var self=this,$self=this;
  20561. return $self["@messageText"];
  20562. },
  20563. args: [],
  20564. source: "messageText\x0a\x09^ messageText",
  20565. referencedClasses: [],
  20566. messageSends: []
  20567. }),
  20568. $globals.Error);
  20569. $core.addMethod(
  20570. $core.method({
  20571. selector: "messageText:",
  20572. protocol: "accessing",
  20573. fn: function (aString){
  20574. var self=this,$self=this;
  20575. $self["@messageText"]=aString;
  20576. return self;
  20577. },
  20578. args: ["aString"],
  20579. source: "messageText: aString\x0a\x09messageText := aString",
  20580. referencedClasses: [],
  20581. messageSends: []
  20582. }),
  20583. $globals.Error);
  20584. $core.addMethod(
  20585. $core.method({
  20586. selector: "resignal",
  20587. protocol: "signaling",
  20588. fn: function (){
  20589. var self=this,$self=this;
  20590. return $core.withContext(function($ctx1) {
  20591. self.amberHandled = false;
  20592. throw(self);
  20593. ;
  20594. return self;
  20595. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20596. },
  20597. args: [],
  20598. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09'>",
  20599. referencedClasses: [],
  20600. messageSends: []
  20601. }),
  20602. $globals.Error);
  20603. $core.addMethod(
  20604. $core.method({
  20605. selector: "signal",
  20606. protocol: "signaling",
  20607. fn: function (){
  20608. var self=this,$self=this;
  20609. return $core.withContext(function($ctx1) {
  20610. self.amberHandled = false;
  20611. self.context = $core.getThisContext();
  20612. self.smalltalkError = true;
  20613. throw self;
  20614. ;
  20615. return self;
  20616. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20617. },
  20618. args: [],
  20619. source: "signal\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09'>",
  20620. referencedClasses: [],
  20621. messageSends: []
  20622. }),
  20623. $globals.Error);
  20624. $core.addMethod(
  20625. $core.method({
  20626. selector: "signal:",
  20627. protocol: "signaling",
  20628. fn: function (aString){
  20629. var self=this,$self=this;
  20630. return $core.withContext(function($ctx1) {
  20631. $self._messageText_(aString);
  20632. $self._signal();
  20633. return self;
  20634. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20635. },
  20636. args: ["aString"],
  20637. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20638. referencedClasses: [],
  20639. messageSends: ["messageText:", "signal"]
  20640. }),
  20641. $globals.Error);
  20642. $core.addMethod(
  20643. $core.method({
  20644. selector: "signalerContext",
  20645. protocol: "accessing",
  20646. fn: function (){
  20647. var self=this,$self=this;
  20648. return $core.withContext(function($ctx1) {
  20649. return $self._signalerContextFrom_($self._context());
  20650. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20651. },
  20652. args: [],
  20653. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20654. referencedClasses: [],
  20655. messageSends: ["signalerContextFrom:", "context"]
  20656. }),
  20657. $globals.Error);
  20658. $core.addMethod(
  20659. $core.method({
  20660. selector: "signalerContextFrom:",
  20661. protocol: "accessing",
  20662. fn: function (aContext){
  20663. var self=this,$self=this;
  20664. return $core.withContext(function($ctx1) {
  20665. var $3,$2,$1;
  20666. return $recv(aContext)._findContextSuchThat_((function(context){
  20667. return $core.withContext(function($ctx2) {
  20668. $3=$recv(context)._receiver();
  20669. $ctx2.sendIdx["receiver"]=1;
  20670. $2=$recv($3).__eq_eq(self);
  20671. $ctx2.sendIdx["=="]=1;
  20672. $1=$recv($2)._or_((function(){
  20673. return $core.withContext(function($ctx3) {
  20674. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20675. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20676. }));
  20677. return $recv($1)._not();
  20678. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20679. }));
  20680. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20681. },
  20682. args: ["aContext"],
  20683. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  20684. referencedClasses: [],
  20685. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20686. }),
  20687. $globals.Error);
  20688. $core.addMethod(
  20689. $core.method({
  20690. selector: "wasHandled",
  20691. protocol: "testing",
  20692. fn: function (){
  20693. var self=this,$self=this;
  20694. return $core.withContext(function($ctx1) {
  20695. return self.amberHandled || false;
  20696. return self;
  20697. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20698. },
  20699. args: [],
  20700. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20701. referencedClasses: [],
  20702. messageSends: []
  20703. }),
  20704. $globals.Error);
  20705. $core.addMethod(
  20706. $core.method({
  20707. selector: "classTag",
  20708. protocol: "accessing",
  20709. fn: function (){
  20710. var self=this,$self=this;
  20711. return "exception";
  20712. },
  20713. args: [],
  20714. 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^ 'exception'",
  20715. referencedClasses: [],
  20716. messageSends: []
  20717. }),
  20718. $globals.Error.a$cls);
  20719. $core.addMethod(
  20720. $core.method({
  20721. selector: "signal",
  20722. protocol: "instance creation",
  20723. fn: function (){
  20724. var self=this,$self=this;
  20725. return $core.withContext(function($ctx1) {
  20726. return $recv($self._new())._signal();
  20727. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20728. },
  20729. args: [],
  20730. source: "signal\x0a\x09^ self new signal",
  20731. referencedClasses: [],
  20732. messageSends: ["signal", "new"]
  20733. }),
  20734. $globals.Error.a$cls);
  20735. $core.addMethod(
  20736. $core.method({
  20737. selector: "signal:",
  20738. protocol: "instance creation",
  20739. fn: function (aString){
  20740. var self=this,$self=this;
  20741. return $core.withContext(function($ctx1) {
  20742. return $recv($self._new())._signal_(aString);
  20743. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20744. },
  20745. args: ["aString"],
  20746. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20747. referencedClasses: [],
  20748. messageSends: ["signal:", "new"]
  20749. }),
  20750. $globals.Error.a$cls);
  20751. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20752. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20753. $core.addMethod(
  20754. $core.method({
  20755. selector: "messageText",
  20756. protocol: "accessing",
  20757. fn: function (){
  20758. var self=this,$self=this;
  20759. return "Halt encountered";
  20760. },
  20761. args: [],
  20762. source: "messageText\x0a\x09^ 'Halt encountered'",
  20763. referencedClasses: [],
  20764. messageSends: []
  20765. }),
  20766. $globals.Halt);
  20767. $core.addMethod(
  20768. $core.method({
  20769. selector: "signalerContextFrom:",
  20770. protocol: "accessing",
  20771. fn: function (aContext){
  20772. var self=this,$self=this;
  20773. return $core.withContext(function($ctx1) {
  20774. var $3,$2,$1;
  20775. return $recv(aContext)._findContextSuchThat_((function(context){
  20776. return $core.withContext(function($ctx2) {
  20777. $3=$recv(context)._receiver();
  20778. $ctx2.sendIdx["receiver"]=1;
  20779. $2=$recv($3).__eq_eq(self);
  20780. $ctx2.sendIdx["=="]=1;
  20781. $1=$recv($2)._or_((function(){
  20782. return $core.withContext(function($ctx3) {
  20783. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20784. return $core.withContext(function($ctx4) {
  20785. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20786. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20787. }));
  20788. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20789. }));
  20790. $ctx2.sendIdx["or:"]=1;
  20791. return $recv($1)._not();
  20792. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20793. }));
  20794. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20795. },
  20796. args: ["aContext"],
  20797. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  20798. referencedClasses: [],
  20799. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20800. }),
  20801. $globals.Halt);
  20802. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20803. $globals.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`";
  20804. $core.addMethod(
  20805. $core.method({
  20806. selector: "context:",
  20807. protocol: "accessing",
  20808. fn: function (aMethodContext){
  20809. var self=this,$self=this;
  20810. return $core.withContext(function($ctx1) {
  20811. self.context = aMethodContext;
  20812. return self;
  20813. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20814. },
  20815. args: ["aMethodContext"],
  20816. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<inlineJS: 'self.context = aMethodContext'>",
  20817. referencedClasses: [],
  20818. messageSends: []
  20819. }),
  20820. $globals.JavaScriptException);
  20821. $core.addMethod(
  20822. $core.method({
  20823. selector: "exception",
  20824. protocol: "accessing",
  20825. fn: function (){
  20826. var self=this,$self=this;
  20827. return $self["@exception"];
  20828. },
  20829. args: [],
  20830. source: "exception\x0a\x09^ exception",
  20831. referencedClasses: [],
  20832. messageSends: []
  20833. }),
  20834. $globals.JavaScriptException);
  20835. $core.addMethod(
  20836. $core.method({
  20837. selector: "exception:",
  20838. protocol: "accessing",
  20839. fn: function (anException){
  20840. var self=this,$self=this;
  20841. $self["@exception"]=anException;
  20842. return self;
  20843. },
  20844. args: ["anException"],
  20845. source: "exception: anException\x0a\x09exception := anException",
  20846. referencedClasses: [],
  20847. messageSends: []
  20848. }),
  20849. $globals.JavaScriptException);
  20850. $core.addMethod(
  20851. $core.method({
  20852. selector: "messageText",
  20853. protocol: "accessing",
  20854. fn: function (){
  20855. var self=this,$self=this;
  20856. return $core.withContext(function($ctx1) {
  20857. return "JavaScript exception: " + $self["@exception"].toString();
  20858. return self;
  20859. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20860. },
  20861. args: [],
  20862. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20863. referencedClasses: [],
  20864. messageSends: []
  20865. }),
  20866. $globals.JavaScriptException);
  20867. $core.addMethod(
  20868. $core.method({
  20869. selector: "shouldBeStubbed",
  20870. protocol: "testing",
  20871. fn: function (){
  20872. var self=this,$self=this;
  20873. return $core.withContext(function($ctx1) {
  20874. return $self["@exception"] instanceof RangeError;
  20875. return self;
  20876. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20877. },
  20878. args: [],
  20879. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20880. referencedClasses: [],
  20881. messageSends: []
  20882. }),
  20883. $globals.JavaScriptException);
  20884. $core.addMethod(
  20885. $core.method({
  20886. selector: "wrap",
  20887. protocol: "error handling",
  20888. fn: function (){
  20889. var self=this,$self=this;
  20890. return $core.withContext(function($ctx1) {
  20891. var $1;
  20892. $recv((function(){
  20893. return $core.withContext(function($ctx2) {
  20894. return $self._signal();
  20895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20896. }))._tryCatch_((function(){
  20897. return $core.withContext(function($ctx2) {
  20898. $1=$self._shouldBeStubbed();
  20899. if($core.assert($1)){
  20900. return $recv($self._context())._stubToAtMost_((100));
  20901. }
  20902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20903. }));
  20904. return self;
  20905. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20906. },
  20907. args: [],
  20908. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20909. referencedClasses: [],
  20910. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20911. }),
  20912. $globals.JavaScriptException);
  20913. $core.addMethod(
  20914. $core.method({
  20915. selector: "on:",
  20916. protocol: "instance creation",
  20917. fn: function (anException){
  20918. var self=this,$self=this;
  20919. return $core.withContext(function($ctx1) {
  20920. var $1;
  20921. $1=$self._new();
  20922. $recv($1)._exception_(anException);
  20923. return $recv($1)._yourself();
  20924. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20925. },
  20926. args: ["anException"],
  20927. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20928. referencedClasses: [],
  20929. messageSends: ["exception:", "new", "yourself"]
  20930. }),
  20931. $globals.JavaScriptException.a$cls);
  20932. $core.addMethod(
  20933. $core.method({
  20934. selector: "on:context:",
  20935. protocol: "instance creation",
  20936. fn: function (anException,aMethodContext){
  20937. var self=this,$self=this;
  20938. return $core.withContext(function($ctx1) {
  20939. var $1;
  20940. $1=$self._new();
  20941. $recv($1)._exception_(anException);
  20942. $recv($1)._context_(aMethodContext);
  20943. return $recv($1)._yourself();
  20944. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  20945. },
  20946. args: ["anException", "aMethodContext"],
  20947. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20948. referencedClasses: [],
  20949. messageSends: ["exception:", "new", "context:", "yourself"]
  20950. }),
  20951. $globals.JavaScriptException.a$cls);
  20952. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  20953. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20954. $core.addMethod(
  20955. $core.method({
  20956. selector: "message",
  20957. protocol: "accessing",
  20958. fn: function (){
  20959. var self=this,$self=this;
  20960. return $self["@message"];
  20961. },
  20962. args: [],
  20963. source: "message\x0a\x09^ message",
  20964. referencedClasses: [],
  20965. messageSends: []
  20966. }),
  20967. $globals.MessageNotUnderstood);
  20968. $core.addMethod(
  20969. $core.method({
  20970. selector: "message:",
  20971. protocol: "accessing",
  20972. fn: function (aMessage){
  20973. var self=this,$self=this;
  20974. $self["@message"]=aMessage;
  20975. return self;
  20976. },
  20977. args: ["aMessage"],
  20978. source: "message: aMessage\x0a\x09message := aMessage",
  20979. referencedClasses: [],
  20980. messageSends: []
  20981. }),
  20982. $globals.MessageNotUnderstood);
  20983. $core.addMethod(
  20984. $core.method({
  20985. selector: "messageText",
  20986. protocol: "accessing",
  20987. fn: function (){
  20988. var self=this,$self=this;
  20989. return $core.withContext(function($ctx1) {
  20990. var $1;
  20991. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  20992. $ctx1.sendIdx[","]=1;
  20993. return $1;
  20994. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  20995. },
  20996. args: [],
  20997. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  20998. referencedClasses: [],
  20999. messageSends: [",", "asString", "receiver", "selector", "message"]
  21000. }),
  21001. $globals.MessageNotUnderstood);
  21002. $core.addMethod(
  21003. $core.method({
  21004. selector: "receiver",
  21005. protocol: "accessing",
  21006. fn: function (){
  21007. var self=this,$self=this;
  21008. return $self["@receiver"];
  21009. },
  21010. args: [],
  21011. source: "receiver\x0a\x09^ receiver",
  21012. referencedClasses: [],
  21013. messageSends: []
  21014. }),
  21015. $globals.MessageNotUnderstood);
  21016. $core.addMethod(
  21017. $core.method({
  21018. selector: "receiver:",
  21019. protocol: "accessing",
  21020. fn: function (anObject){
  21021. var self=this,$self=this;
  21022. $self["@receiver"]=anObject;
  21023. return self;
  21024. },
  21025. args: ["anObject"],
  21026. source: "receiver: anObject\x0a\x09receiver := anObject",
  21027. referencedClasses: [],
  21028. messageSends: []
  21029. }),
  21030. $globals.MessageNotUnderstood);
  21031. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  21032. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  21033. $core.addMethod(
  21034. $core.method({
  21035. selector: "object",
  21036. protocol: "accessing",
  21037. fn: function (){
  21038. var self=this,$self=this;
  21039. return $self["@object"];
  21040. },
  21041. args: [],
  21042. source: "object\x0a\x09^ object",
  21043. referencedClasses: [],
  21044. messageSends: []
  21045. }),
  21046. $globals.NonBooleanReceiver);
  21047. $core.addMethod(
  21048. $core.method({
  21049. selector: "object:",
  21050. protocol: "accessing",
  21051. fn: function (anObject){
  21052. var self=this,$self=this;
  21053. $self["@object"]=anObject;
  21054. return self;
  21055. },
  21056. args: ["anObject"],
  21057. source: "object: anObject\x0a\x09object := anObject",
  21058. referencedClasses: [],
  21059. messageSends: []
  21060. }),
  21061. $globals.NonBooleanReceiver);
  21062. $core.addMethod(
  21063. $core.method({
  21064. selector: "signalOn:",
  21065. protocol: "instance creation",
  21066. fn: function (anObject){
  21067. var self=this,$self=this;
  21068. return $core.withContext(function($ctx1) {
  21069. var $1;
  21070. $1=$self._new();
  21071. $recv($1)._object_(anObject);
  21072. return $recv($1)._signal();
  21073. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  21074. },
  21075. args: ["anObject"],
  21076. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  21077. referencedClasses: [],
  21078. messageSends: ["object:", "new", "signal"]
  21079. }),
  21080. $globals.NonBooleanReceiver.a$cls);
  21081. });
  21082. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21083. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21084. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21085. $core.addPackage("Kernel-Promises");
  21086. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  21087. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21088. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21089. $core.addMethod(
  21090. $core.method({
  21091. selector: "all:",
  21092. protocol: "composites",
  21093. fn: function (aCollection){
  21094. var self=this,$self=this;
  21095. return $core.withContext(function($ctx1) {
  21096. return Promise.all($recv(aCollection)._asArray());
  21097. return self;
  21098. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21099. },
  21100. args: ["aCollection"],
  21101. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21102. referencedClasses: [],
  21103. messageSends: []
  21104. }),
  21105. $globals.Promise.a$cls);
  21106. $core.addMethod(
  21107. $core.method({
  21108. selector: "any:",
  21109. protocol: "composites",
  21110. fn: function (aCollection){
  21111. var self=this,$self=this;
  21112. return $core.withContext(function($ctx1) {
  21113. return Promise.race($recv(aCollection)._asArray());
  21114. return self;
  21115. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21116. },
  21117. args: ["aCollection"],
  21118. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21119. referencedClasses: [],
  21120. messageSends: []
  21121. }),
  21122. $globals.Promise.a$cls);
  21123. $core.addMethod(
  21124. $core.method({
  21125. selector: "forBlock:",
  21126. protocol: "instance creation",
  21127. fn: function (aBlock){
  21128. var self=this,$self=this;
  21129. return $core.withContext(function($ctx1) {
  21130. return $recv($self._new())._then_(aBlock);
  21131. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21132. },
  21133. args: ["aBlock"],
  21134. source: "forBlock: aBlock\x0a\x22Returns a Promise that is resolved with the value of aBlock,\x0aand rejected if error happens while evaluating aBlock.\x22\x0a\x09^ self new then: aBlock",
  21135. referencedClasses: [],
  21136. messageSends: ["then:", "new"]
  21137. }),
  21138. $globals.Promise.a$cls);
  21139. $core.addMethod(
  21140. $core.method({
  21141. selector: "new",
  21142. protocol: "instance creation",
  21143. fn: function (){
  21144. var self=this,$self=this;
  21145. return $core.withContext(function($ctx1) {
  21146. return Promise.resolve();
  21147. return self;
  21148. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21149. },
  21150. args: [],
  21151. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21152. referencedClasses: [],
  21153. messageSends: []
  21154. }),
  21155. $globals.Promise.a$cls);
  21156. $core.addMethod(
  21157. $core.method({
  21158. selector: "new:",
  21159. protocol: "instance creation",
  21160. fn: function (aBlock){
  21161. var self=this,$self=this;
  21162. return $core.withContext(function($ctx1) {
  21163. return new Promise(function (resolve, reject) {
  21164. var model = {value: resolve, signal: reject};
  21165. aBlock._value_(model);
  21166. });
  21167. return self;
  21168. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21169. },
  21170. args: ["aBlock"],
  21171. source: "new: aBlock\x0a\x22Returns a Promise that is eventually resolved or rejected.\x0aPass a block that is called with one argument, model.\x0aYou should call model value: ... to resolve the promise\x0aand model signal: ... to reject the promise.\x0aIf error happens during run of the block,\x0apromise is rejected with that error as well.\x22\x0a<inlineJS: 'return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject};\x0a aBlock._value_(model);\x0a})'>",
  21172. referencedClasses: [],
  21173. messageSends: []
  21174. }),
  21175. $globals.Promise.a$cls);
  21176. $core.addMethod(
  21177. $core.method({
  21178. selector: "signal:",
  21179. protocol: "instance creation",
  21180. fn: function (anObject){
  21181. var self=this,$self=this;
  21182. return $core.withContext(function($ctx1) {
  21183. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21184. return self;
  21185. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21186. },
  21187. args: ["anObject"],
  21188. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21189. referencedClasses: [],
  21190. messageSends: []
  21191. }),
  21192. $globals.Promise.a$cls);
  21193. $core.addMethod(
  21194. $core.method({
  21195. selector: "value:",
  21196. protocol: "instance creation",
  21197. fn: function (anObject){
  21198. var self=this,$self=this;
  21199. return $core.withContext(function($ctx1) {
  21200. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21201. return self;
  21202. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21203. },
  21204. args: ["anObject"],
  21205. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21206. referencedClasses: [],
  21207. messageSends: []
  21208. }),
  21209. $globals.Promise.a$cls);
  21210. $core.addTrait("TThenable", "Kernel-Promises");
  21211. $core.addMethod(
  21212. $core.method({
  21213. selector: "catch:",
  21214. protocol: "promises",
  21215. fn: function (aBlock){
  21216. var self=this,$self=this;
  21217. return $core.withContext(function($ctx1) {
  21218. return self.then(null, function (err) {return $core.seamless(function () {
  21219. return aBlock._value_(err);
  21220. })});
  21221. return self;
  21222. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21223. },
  21224. args: ["aBlock"],
  21225. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21226. referencedClasses: [],
  21227. messageSends: []
  21228. }),
  21229. $globals.TThenable);
  21230. $core.addMethod(
  21231. $core.method({
  21232. selector: "on:do:",
  21233. protocol: "promises",
  21234. fn: function (aClass,aBlock){
  21235. var self=this,$self=this;
  21236. return $core.withContext(function($ctx1) {
  21237. return self.then(null, function (err) {return $core.seamless(function () {
  21238. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21239. else throw err;
  21240. })});
  21241. return self;
  21242. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21243. },
  21244. args: ["aClass", "aBlock"],
  21245. source: "on: aClass do: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})'>",
  21246. referencedClasses: [],
  21247. messageSends: []
  21248. }),
  21249. $globals.TThenable);
  21250. $core.addMethod(
  21251. $core.method({
  21252. selector: "on:do:catch:",
  21253. protocol: "promises",
  21254. fn: function (aClass,aBlock,anotherBlock){
  21255. var self=this,$self=this;
  21256. return $core.withContext(function($ctx1) {
  21257. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21258. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21259. },
  21260. args: ["aClass", "aBlock", "anotherBlock"],
  21261. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21262. referencedClasses: [],
  21263. messageSends: ["catch:", "on:do:"]
  21264. }),
  21265. $globals.TThenable);
  21266. $core.addMethod(
  21267. $core.method({
  21268. selector: "then:",
  21269. protocol: "promises",
  21270. fn: function (aBlockOrArray){
  21271. var self=this,$self=this;
  21272. return $core.withContext(function($ctx1) {
  21273. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21274. return array.reduce(function (soFar, aBlock) {
  21275. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21276. function (result) {return $core.seamless(function () {
  21277. if (Array.isArray(result)) {
  21278. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21279. } else {
  21280. return aBlock._value_(result);
  21281. }
  21282. })} :
  21283. function (result) {return $core.seamless(function () {
  21284. return aBlock._value_(result);
  21285. })}
  21286. );
  21287. }, self);
  21288. return self;
  21289. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21290. },
  21291. args: ["aBlockOrArray"],
  21292. source: "then: aBlockOrArray\x0a\x22Accepts a block or array of blocks.\x0aEach of blocks in the array or the singleton one is\x0aused in .then call to a promise, to accept a result\x0aand transform it to the result for the next one.\x0aIn case a block has more than one argument\x0aand result is an array, first n-1 elements of the array\x0aare put into additional arguments beyond the first.\x0aThe first argument always contains the result as-is.\x22\x0a<inlineJS: '\x0avar array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];\x0areturn array.reduce(function (soFar, aBlock) {\x0a return soFar.then(typeof aBlock === \x22function\x22 && aBlock.length > 1 ?\x0a function (result) {return $core.seamless(function () {\x0a if (Array.isArray(result)) {\x0a return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));\x0a } else {\x0a return aBlock._value_(result);\x0a }\x0a })} :\x0a function (result) {return $core.seamless(function () {\x0a return aBlock._value_(result);\x0a })}\x0a );\x0a}, self)'>",
  21293. referencedClasses: [],
  21294. messageSends: []
  21295. }),
  21296. $globals.TThenable);
  21297. $core.addMethod(
  21298. $core.method({
  21299. selector: "then:catch:",
  21300. protocol: "promises",
  21301. fn: function (aBlockOrArray,anotherBlock){
  21302. var self=this,$self=this;
  21303. return $core.withContext(function($ctx1) {
  21304. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21305. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21306. },
  21307. args: ["aBlockOrArray", "anotherBlock"],
  21308. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21309. referencedClasses: [],
  21310. messageSends: ["catch:", "then:"]
  21311. }),
  21312. $globals.TThenable);
  21313. $core.addMethod(
  21314. $core.method({
  21315. selector: "then:on:do:",
  21316. protocol: "promises",
  21317. fn: function (aBlockOrArray,aClass,aBlock){
  21318. var self=this,$self=this;
  21319. return $core.withContext(function($ctx1) {
  21320. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21321. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21322. },
  21323. args: ["aBlockOrArray", "aClass", "aBlock"],
  21324. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21325. referencedClasses: [],
  21326. messageSends: ["on:do:", "then:"]
  21327. }),
  21328. $globals.TThenable);
  21329. $core.addMethod(
  21330. $core.method({
  21331. selector: "then:on:do:catch:",
  21332. protocol: "promises",
  21333. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21334. var self=this,$self=this;
  21335. return $core.withContext(function($ctx1) {
  21336. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21337. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21338. },
  21339. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21340. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21341. referencedClasses: [],
  21342. messageSends: ["catch:", "on:do:", "then:"]
  21343. }),
  21344. $globals.TThenable);
  21345. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21346. });
  21347. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects", "amber_core/Kernel-Promises"], function($boot){"use strict";
  21348. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21349. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21350. $core.addPackage("Kernel-Infrastructure");
  21351. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  21352. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21353. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21354. $core.addMethod(
  21355. $core.method({
  21356. selector: "organizeClasses",
  21357. protocol: "organization",
  21358. fn: function (){
  21359. var self=this,$self=this;
  21360. return $core.withContext(function($ctx1) {
  21361. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21362. return $core.withContext(function($ctx2) {
  21363. return $recv(each)._enterOrganization();
  21364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21365. }));
  21366. return self;
  21367. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21368. },
  21369. args: [],
  21370. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21371. referencedClasses: ["Smalltalk"],
  21372. messageSends: ["do:", "classes", "enterOrganization"]
  21373. }),
  21374. $globals.AmberBootstrapInitialization.a$cls);
  21375. $core.addMethod(
  21376. $core.method({
  21377. selector: "organizeMethods",
  21378. protocol: "organization",
  21379. fn: function (){
  21380. var self=this,$self=this;
  21381. return $core.withContext(function($ctx1) {
  21382. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21383. return $core.withContext(function($ctx2) {
  21384. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21385. return $core.withContext(function($ctx3) {
  21386. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21387. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21388. }));
  21389. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21390. }));
  21391. $ctx1.sendIdx["do:"]=1;
  21392. return self;
  21393. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21394. },
  21395. args: [],
  21396. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21397. referencedClasses: ["Smalltalk"],
  21398. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21399. }),
  21400. $globals.AmberBootstrapInitialization.a$cls);
  21401. $core.addMethod(
  21402. $core.method({
  21403. selector: "run",
  21404. protocol: "public api",
  21405. fn: function (){
  21406. var self=this,$self=this;
  21407. return $core.withContext(function($ctx1) {
  21408. $recv($globals.SmalltalkImage)._initialize();
  21409. $self._organizeClasses();
  21410. $self._organizeMethods();
  21411. $recv($globals.Smalltalk)._postLoad();
  21412. return self;
  21413. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21414. },
  21415. args: [],
  21416. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09Smalltalk postLoad",
  21417. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21418. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21419. }),
  21420. $globals.AmberBootstrapInitialization.a$cls);
  21421. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21422. $globals.JSObjectProxy.comment="I handle sending messages to JavaScript objects, making JavaScript object accessing from Amber fully transparent.\x0aMy instances make intensive use of `#doesNotUnderstand:`.\x0a\x0aMy instances are automatically created by Amber whenever a message is sent to a JavaScript object.\x0a\x0a## Usage examples\x0a\x0aJSObjectProxy objects are instanciated by Amber when a Smalltalk message is sent to a JavaScript object.\x0a\x0a\x09window alert: 'hello world'.\x0a\x09window inspect.\x0a\x09(window jQuery: 'body') append: 'hello world'\x0a\x0aAmber messages sends are converted to JavaScript function calls or object property access _(in this order)_. If n one of them match, a `MessageNotUnderstood` error will be thrown.\x0a\x0a## Message conversion rules\x0a\x0a- `someUser name` becomes `someUser.name`\x0a- `someUser name: 'John'` becomes `someUser name = \x22John\x22`\x0a- `console log: 'hello world'` becomes `console.log('hello world')`\x0a- `(window jQuery: 'foo') css: 'background' color: 'red'` becomes `window.jQuery('foo').css('background', 'red')`\x0a\x0a__Note:__ For keyword-based messages, only the first keyword is kept: `window foo: 1 bar: 2` is equivalent to `window foo: 1 baz: 2`.";
  21423. $core.addMethod(
  21424. $core.method({
  21425. selector: "=",
  21426. protocol: "comparing",
  21427. fn: function (anObject){
  21428. var self=this,$self=this;
  21429. return $core.withContext(function($ctx1) {
  21430. var $2,$1;
  21431. $2=$recv(anObject)._class();
  21432. $ctx1.sendIdx["class"]=1;
  21433. $1=$recv($2).__eq_eq($self._class());
  21434. if(!$core.assert($1)){
  21435. return false;
  21436. }
  21437. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21438. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21439. },
  21440. args: ["anObject"],
  21441. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21442. referencedClasses: ["JSObjectProxy"],
  21443. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21444. }),
  21445. $globals.JSObjectProxy);
  21446. $core.addMethod(
  21447. $core.method({
  21448. selector: "asJavaScriptObject",
  21449. protocol: "converting",
  21450. fn: function (){
  21451. var self=this,$self=this;
  21452. return $self["@jsObject"];
  21453. },
  21454. args: [],
  21455. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21456. referencedClasses: [],
  21457. messageSends: []
  21458. }),
  21459. $globals.JSObjectProxy);
  21460. $core.addMethod(
  21461. $core.method({
  21462. selector: "at:",
  21463. protocol: "accessing",
  21464. fn: function (aString){
  21465. var self=this,$self=this;
  21466. return $core.withContext(function($ctx1) {
  21467. return $self['@jsObject'][aString];
  21468. return self;
  21469. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21470. },
  21471. args: ["aString"],
  21472. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21473. referencedClasses: [],
  21474. messageSends: []
  21475. }),
  21476. $globals.JSObjectProxy);
  21477. $core.addMethod(
  21478. $core.method({
  21479. selector: "at:ifAbsent:",
  21480. protocol: "accessing",
  21481. fn: function (aString,aBlock){
  21482. var self=this,$self=this;
  21483. return $core.withContext(function($ctx1) {
  21484. var obj = $self['@jsObject'];
  21485. return aString in obj ? obj[aString] : aBlock._value();
  21486. ;
  21487. return self;
  21488. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21489. },
  21490. args: ["aString", "aBlock"],
  21491. source: "at: aString ifAbsent: aBlock\x0a\x09\x22return the aString property or evaluate aBlock if the property is not defined on the object\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09'>",
  21492. referencedClasses: [],
  21493. messageSends: []
  21494. }),
  21495. $globals.JSObjectProxy);
  21496. $core.addMethod(
  21497. $core.method({
  21498. selector: "at:ifPresent:",
  21499. protocol: "accessing",
  21500. fn: function (aString,aBlock){
  21501. var self=this,$self=this;
  21502. return $core.withContext(function($ctx1) {
  21503. var obj = $self['@jsObject'];
  21504. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21505. ;
  21506. return self;
  21507. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21508. },
  21509. args: ["aString", "aBlock"],
  21510. source: "at: aString ifPresent: aBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined or return nil\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09'>",
  21511. referencedClasses: [],
  21512. messageSends: []
  21513. }),
  21514. $globals.JSObjectProxy);
  21515. $core.addMethod(
  21516. $core.method({
  21517. selector: "at:ifPresent:ifAbsent:",
  21518. protocol: "accessing",
  21519. fn: function (aString,aBlock,anotherBlock){
  21520. var self=this,$self=this;
  21521. return $core.withContext(function($ctx1) {
  21522. var obj = $self['@jsObject'];
  21523. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21524. ;
  21525. return self;
  21526. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21527. },
  21528. args: ["aString", "aBlock", "anotherBlock"],
  21529. source: "at: aString ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22return the evaluation of aBlock with the value if the property is defined\x0a\x09or return value of anotherBlock\x22\x0a\x09<inlineJS: '\x0a\x09\x09var obj = $self[''@jsObject''];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09'>",
  21530. referencedClasses: [],
  21531. messageSends: []
  21532. }),
  21533. $globals.JSObjectProxy);
  21534. $core.addMethod(
  21535. $core.method({
  21536. selector: "at:put:",
  21537. protocol: "accessing",
  21538. fn: function (aString,anObject){
  21539. var self=this,$self=this;
  21540. return $core.withContext(function($ctx1) {
  21541. return $self['@jsObject'][aString] = anObject;
  21542. return self;
  21543. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21544. },
  21545. args: ["aString", "anObject"],
  21546. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21547. referencedClasses: [],
  21548. messageSends: []
  21549. }),
  21550. $globals.JSObjectProxy);
  21551. $core.addMethod(
  21552. $core.method({
  21553. selector: "catch:",
  21554. protocol: "promises",
  21555. fn: function (aBlock){
  21556. var self=this,$self=this;
  21557. return $core.withContext(function($ctx1) {
  21558. var $1,$2;
  21559. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21560. if($core.assert($1)){
  21561. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21562. } else {
  21563. $2=(
  21564. $ctx1.supercall = true,
  21565. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21566. $ctx1.supercall = false;
  21567. return $2;
  21568. }
  21569. return self;
  21570. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21571. },
  21572. args: ["aBlock"],
  21573. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21574. referencedClasses: ["NativeFunction", "TThenable"],
  21575. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21576. }),
  21577. $globals.JSObjectProxy);
  21578. $core.addMethod(
  21579. $core.method({
  21580. selector: "doesNotUnderstand:",
  21581. protocol: "proxy",
  21582. fn: function (aMessage){
  21583. var self=this,$self=this;
  21584. return $core.withContext(function($ctx1) {
  21585. var $1,$receiver;
  21586. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21587. if(($receiver = $1) == null || $receiver.a$nil){
  21588. return (
  21589. $ctx1.supercall = true,
  21590. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21591. $ctx1.supercall = false;
  21592. } else {
  21593. var jsSelector;
  21594. jsSelector=$receiver;
  21595. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21596. }
  21597. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21598. },
  21599. args: ["aMessage"],
  21600. source: "doesNotUnderstand: aMessage\x0a\x09^ (JSObjectProxy lookupProperty: aMessage selector asJavaScriptPropertyName ofProxy: self)\x0a\x09\x09ifNil: [ super doesNotUnderstand: aMessage ]\x0a\x09\x09ifNotNil: [ :jsSelector | \x0a\x09\x09\x09JSObjectProxy \x0a\x09\x09\x09\x09forwardMessage: jsSelector \x0a\x09\x09\x09\x09withArguments: aMessage arguments\x0a\x09\x09\x09\x09ofProxy: self ]",
  21601. referencedClasses: ["JSObjectProxy"],
  21602. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21603. }),
  21604. $globals.JSObjectProxy);
  21605. $core.addMethod(
  21606. $core.method({
  21607. selector: "in:",
  21608. protocol: "accessing",
  21609. fn: function (aValuable){
  21610. var self=this,$self=this;
  21611. return $core.withContext(function($ctx1) {
  21612. return $recv(aValuable)._value_($self["@jsObject"]);
  21613. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21614. },
  21615. args: ["aValuable"],
  21616. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21617. referencedClasses: [],
  21618. messageSends: ["value:"]
  21619. }),
  21620. $globals.JSObjectProxy);
  21621. $core.addMethod(
  21622. $core.method({
  21623. selector: "jsObject",
  21624. protocol: "accessing",
  21625. fn: function (){
  21626. var self=this,$self=this;
  21627. return $self["@jsObject"];
  21628. },
  21629. args: [],
  21630. source: "jsObject\x0a\x09^ jsObject",
  21631. referencedClasses: [],
  21632. messageSends: []
  21633. }),
  21634. $globals.JSObjectProxy);
  21635. $core.addMethod(
  21636. $core.method({
  21637. selector: "keysAndValuesDo:",
  21638. protocol: "enumerating",
  21639. fn: function (aBlock){
  21640. var self=this,$self=this;
  21641. return $core.withContext(function($ctx1) {
  21642. var o = $self['@jsObject'];
  21643. for(var i in o) {
  21644. aBlock._value_value_(i, o[i]);
  21645. }
  21646. ;
  21647. return self;
  21648. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21649. },
  21650. args: ["aBlock"],
  21651. source: "keysAndValuesDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var o = $self[''@jsObject''];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09'>",
  21652. referencedClasses: [],
  21653. messageSends: []
  21654. }),
  21655. $globals.JSObjectProxy);
  21656. $core.addMethod(
  21657. $core.method({
  21658. selector: "on:do:",
  21659. protocol: "promises",
  21660. fn: function (aClass,aBlock){
  21661. var self=this,$self=this;
  21662. return $core.withContext(function($ctx1) {
  21663. var $1,$2;
  21664. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21665. if($core.assert($1)){
  21666. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21667. } else {
  21668. $2=(
  21669. $ctx1.supercall = true,
  21670. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21671. $ctx1.supercall = false;
  21672. return $2;
  21673. }
  21674. return self;
  21675. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21676. },
  21677. args: ["aClass", "aBlock"],
  21678. source: "on: aClass do: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #on:do:) sendTo: jsObject arguments: {aClass. aBlock} ]\x0a\x09ifFalse: [ ^ super on: aClass do: aBlock ]",
  21679. referencedClasses: ["NativeFunction", "TThenable"],
  21680. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21681. }),
  21682. $globals.JSObjectProxy);
  21683. $core.addMethod(
  21684. $core.method({
  21685. selector: "printOn:",
  21686. protocol: "printing",
  21687. fn: function (aStream){
  21688. var self=this,$self=this;
  21689. return $core.withContext(function($ctx1) {
  21690. $recv(aStream)._nextPutAll_($self._printString());
  21691. return self;
  21692. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21693. },
  21694. args: ["aStream"],
  21695. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21696. referencedClasses: [],
  21697. messageSends: ["nextPutAll:", "printString"]
  21698. }),
  21699. $globals.JSObjectProxy);
  21700. $core.addMethod(
  21701. $core.method({
  21702. selector: "printString",
  21703. protocol: "printing",
  21704. fn: function (){
  21705. var self=this,$self=this;
  21706. return $core.withContext(function($ctx1) {
  21707. var js = $self['@jsObject'];
  21708. return js.toString
  21709. ? js.toString()
  21710. : Object.prototype.toString.call(js)
  21711. ;
  21712. return self;
  21713. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21714. },
  21715. args: [],
  21716. source: "printString\x0a\x09<inlineJS: '\x0a\x09\x09var js = $self[''@jsObject''];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09'>",
  21717. referencedClasses: [],
  21718. messageSends: []
  21719. }),
  21720. $globals.JSObjectProxy);
  21721. $core.addMethod(
  21722. $core.method({
  21723. selector: "putOn:",
  21724. protocol: "streaming",
  21725. fn: function (aStream){
  21726. var self=this,$self=this;
  21727. return $core.withContext(function($ctx1) {
  21728. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21729. return self;
  21730. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21731. },
  21732. args: ["aStream"],
  21733. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21734. referencedClasses: [],
  21735. messageSends: ["nextPutJSObject:"]
  21736. }),
  21737. $globals.JSObjectProxy);
  21738. $core.addMethod(
  21739. $core.method({
  21740. selector: "removeKey:",
  21741. protocol: "accessing",
  21742. fn: function (aString){
  21743. var self=this,$self=this;
  21744. return $core.withContext(function($ctx1) {
  21745. delete $self['@jsObject'][aString]; return aString;
  21746. return self;
  21747. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  21748. },
  21749. args: ["aString"],
  21750. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>",
  21751. referencedClasses: [],
  21752. messageSends: []
  21753. }),
  21754. $globals.JSObjectProxy);
  21755. $core.addMethod(
  21756. $core.method({
  21757. selector: "then:",
  21758. protocol: "promises",
  21759. fn: function (aBlockOrArray){
  21760. var self=this,$self=this;
  21761. return $core.withContext(function($ctx1) {
  21762. var $1,$2;
  21763. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21764. if($core.assert($1)){
  21765. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21766. } else {
  21767. $2=(
  21768. $ctx1.supercall = true,
  21769. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21770. $ctx1.supercall = false;
  21771. return $2;
  21772. }
  21773. return self;
  21774. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21775. },
  21776. args: ["aBlockOrArray"],
  21777. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21778. referencedClasses: ["NativeFunction", "TThenable"],
  21779. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21780. }),
  21781. $globals.JSObjectProxy);
  21782. $core.addMethod(
  21783. $core.method({
  21784. selector: "addObjectVariablesTo:ofProxy:",
  21785. protocol: "proxy",
  21786. fn: function (aDictionary,aProxy){
  21787. var self=this,$self=this;
  21788. return $core.withContext(function($ctx1) {
  21789. var jsObject = aProxy['@jsObject'];
  21790. for(var i in jsObject) {
  21791. aDictionary._at_put_(i, jsObject[i]);
  21792. }
  21793. ;
  21794. return self;
  21795. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21796. },
  21797. args: ["aDictionary", "aProxy"],
  21798. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09var jsObject = aProxy[''@jsObject''];\x0a\x09\x09for(var i in jsObject) {\x0a\x09\x09\x09aDictionary._at_put_(i, jsObject[i]);\x0a\x09\x09}\x0a\x09'>",
  21799. referencedClasses: [],
  21800. messageSends: []
  21801. }),
  21802. $globals.JSObjectProxy.a$cls);
  21803. $core.addMethod(
  21804. $core.method({
  21805. selector: "compareJSObjectOfProxy:withProxy:",
  21806. protocol: "proxy",
  21807. fn: function (aProxy,anotherProxy){
  21808. var self=this,$self=this;
  21809. return $core.withContext(function($ctx1) {
  21810. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21811. return aProxy["@jsObject"] === anotherJSObject;
  21812. return self;
  21813. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21814. },
  21815. args: ["aProxy", "anotherProxy"],
  21816. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<inlineJS: '\x0a\x09var anotherJSObject = anotherProxy.a$cls ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a'>",
  21817. referencedClasses: [],
  21818. messageSends: []
  21819. }),
  21820. $globals.JSObjectProxy.a$cls);
  21821. $core.addMethod(
  21822. $core.method({
  21823. selector: "forwardMessage:withArguments:ofProxy:",
  21824. protocol: "proxy",
  21825. fn: function (aString,anArray,aProxy){
  21826. var self=this,$self=this;
  21827. return $core.withContext(function($ctx1) {
  21828. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21829. ;
  21830. return self;
  21831. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21832. },
  21833. args: ["aString", "anArray", "aProxy"],
  21834. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21835. referencedClasses: [],
  21836. messageSends: []
  21837. }),
  21838. $globals.JSObjectProxy.a$cls);
  21839. $core.addMethod(
  21840. $core.method({
  21841. selector: "jsObject:ofProxy:",
  21842. protocol: "proxy",
  21843. fn: function (aJSObject,aProxy){
  21844. var self=this,$self=this;
  21845. return $core.withContext(function($ctx1) {
  21846. aProxy['@jsObject'] = aJSObject;
  21847. return self;
  21848. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21849. },
  21850. args: ["aJSObject", "aProxy"],
  21851. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21852. referencedClasses: [],
  21853. messageSends: []
  21854. }),
  21855. $globals.JSObjectProxy.a$cls);
  21856. $core.addMethod(
  21857. $core.method({
  21858. selector: "lookupProperty:ofProxy:",
  21859. protocol: "proxy",
  21860. fn: function (aString,aProxy){
  21861. var self=this,$self=this;
  21862. return $core.withContext(function($ctx1) {
  21863. return aString in aProxy._jsObject() ? aString : nil;
  21864. return self;
  21865. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21866. },
  21867. args: ["aString", "aProxy"],
  21868. source: "lookupProperty: aString ofProxy: aProxy\x0a\x09\x22Looks up a property in JS object.\x0a\x09Answer the property if it is present, or nil if it is not present.\x22\x0a\x09\x0a\x09<inlineJS: 'return aString in aProxy._jsObject() ? aString : nil'>",
  21869. referencedClasses: [],
  21870. messageSends: []
  21871. }),
  21872. $globals.JSObjectProxy.a$cls);
  21873. $core.addMethod(
  21874. $core.method({
  21875. selector: "null",
  21876. protocol: "accessing",
  21877. fn: function (){
  21878. var self=this,$self=this;
  21879. return $core.withContext(function($ctx1) {
  21880. return null;
  21881. return self;
  21882. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21883. },
  21884. args: [],
  21885. source: "null\x0a\x09<inlineJS: 'return null'>",
  21886. referencedClasses: [],
  21887. messageSends: []
  21888. }),
  21889. $globals.JSObjectProxy.a$cls);
  21890. $core.addMethod(
  21891. $core.method({
  21892. selector: "on:",
  21893. protocol: "instance creation",
  21894. fn: function (aJSObject){
  21895. var self=this,$self=this;
  21896. var instance;
  21897. return $core.withContext(function($ctx1) {
  21898. instance=$self._new();
  21899. $self._jsObject_ofProxy_(aJSObject,instance);
  21900. return instance;
  21901. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21902. },
  21903. args: ["aJSObject"],
  21904. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21905. referencedClasses: [],
  21906. messageSends: ["new", "jsObject:ofProxy:"]
  21907. }),
  21908. $globals.JSObjectProxy.a$cls);
  21909. $core.addMethod(
  21910. $core.method({
  21911. selector: "undefined",
  21912. protocol: "accessing",
  21913. fn: function (){
  21914. var self=this,$self=this;
  21915. return $core.withContext(function($ctx1) {
  21916. return undefined;
  21917. return self;
  21918. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  21919. },
  21920. args: [],
  21921. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  21922. referencedClasses: [],
  21923. messageSends: []
  21924. }),
  21925. $globals.JSObjectProxy.a$cls);
  21926. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21927. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21928. $core.addMethod(
  21929. $core.method({
  21930. selector: "addElement:",
  21931. protocol: "accessing",
  21932. fn: function (anObject){
  21933. var self=this,$self=this;
  21934. return $core.withContext(function($ctx1) {
  21935. $recv($self._elements())._add_(anObject);
  21936. return self;
  21937. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21938. },
  21939. args: ["anObject"],
  21940. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21941. referencedClasses: [],
  21942. messageSends: ["add:", "elements"]
  21943. }),
  21944. $globals.Organizer);
  21945. $core.addMethod(
  21946. $core.method({
  21947. selector: "elements",
  21948. protocol: "accessing",
  21949. fn: function (){
  21950. var self=this,$self=this;
  21951. return $self["@elements"];
  21952. },
  21953. args: [],
  21954. source: "elements\x0a\x09^ elements",
  21955. referencedClasses: [],
  21956. messageSends: []
  21957. }),
  21958. $globals.Organizer);
  21959. $core.addMethod(
  21960. $core.method({
  21961. selector: "initialize",
  21962. protocol: "initialization",
  21963. fn: function (){
  21964. var self=this,$self=this;
  21965. return $core.withContext(function($ctx1) {
  21966. (
  21967. $ctx1.supercall = true,
  21968. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21969. $ctx1.supercall = false;
  21970. $self["@elements"]=$recv($globals.Set)._new();
  21971. return self;
  21972. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  21973. },
  21974. args: [],
  21975. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  21976. referencedClasses: ["Set"],
  21977. messageSends: ["initialize", "new"]
  21978. }),
  21979. $globals.Organizer);
  21980. $core.addMethod(
  21981. $core.method({
  21982. selector: "removeElement:",
  21983. protocol: "accessing",
  21984. fn: function (anObject){
  21985. var self=this,$self=this;
  21986. return $core.withContext(function($ctx1) {
  21987. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  21988. }));
  21989. return self;
  21990. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  21991. },
  21992. args: ["anObject"],
  21993. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  21994. referencedClasses: [],
  21995. messageSends: ["remove:ifAbsent:", "elements"]
  21996. }),
  21997. $globals.Organizer);
  21998. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  21999. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  22000. $core.addMethod(
  22001. $core.method({
  22002. selector: "addElement:",
  22003. protocol: "accessing",
  22004. fn: function (aString){
  22005. var self=this,$self=this;
  22006. return $core.withContext(function($ctx1) {
  22007. var $1,$3,$2;
  22008. (
  22009. $ctx1.supercall = true,
  22010. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  22011. $ctx1.supercall = false;
  22012. $1=$recv($globals.SystemAnnouncer)._current();
  22013. $3=$recv($globals.ProtocolAdded)._new();
  22014. $recv($3)._protocol_(aString);
  22015. $recv($3)._theClass_($self._theClass());
  22016. $2=$recv($3)._yourself();
  22017. $recv($1)._announce_($2);
  22018. return self;
  22019. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  22020. },
  22021. args: ["aString"],
  22022. source: "addElement: aString\x0a\x09super addElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolAdded new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  22023. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  22024. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22025. }),
  22026. $globals.ClassOrganizer);
  22027. $core.addMethod(
  22028. $core.method({
  22029. selector: "removeElement:",
  22030. protocol: "accessing",
  22031. fn: function (aString){
  22032. var self=this,$self=this;
  22033. return $core.withContext(function($ctx1) {
  22034. var $1,$3,$2;
  22035. (
  22036. $ctx1.supercall = true,
  22037. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  22038. $ctx1.supercall = false;
  22039. $1=$recv($globals.SystemAnnouncer)._current();
  22040. $3=$recv($globals.ProtocolRemoved)._new();
  22041. $recv($3)._protocol_(aString);
  22042. $recv($3)._theClass_($self._theClass());
  22043. $2=$recv($3)._yourself();
  22044. $recv($1)._announce_($2);
  22045. return self;
  22046. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  22047. },
  22048. args: ["aString"],
  22049. source: "removeElement: aString\x0a\x09super removeElement: aString.\x0a\x0a\x09SystemAnnouncer current announce: (ProtocolRemoved new\x0a\x09\x09protocol: aString;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09yourself)",
  22050. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  22051. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22052. }),
  22053. $globals.ClassOrganizer);
  22054. $core.addMethod(
  22055. $core.method({
  22056. selector: "theClass",
  22057. protocol: "accessing",
  22058. fn: function (){
  22059. var self=this,$self=this;
  22060. return $self["@traitOrBehavior"];
  22061. },
  22062. args: [],
  22063. source: "theClass\x0a\x09^ traitOrBehavior",
  22064. referencedClasses: [],
  22065. messageSends: []
  22066. }),
  22067. $globals.ClassOrganizer);
  22068. $core.addMethod(
  22069. $core.method({
  22070. selector: "theClass:",
  22071. protocol: "accessing",
  22072. fn: function (aClass){
  22073. var self=this,$self=this;
  22074. $self["@traitOrBehavior"]=aClass;
  22075. return self;
  22076. },
  22077. args: ["aClass"],
  22078. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22079. referencedClasses: [],
  22080. messageSends: []
  22081. }),
  22082. $globals.ClassOrganizer);
  22083. $core.addMethod(
  22084. $core.method({
  22085. selector: "on:",
  22086. protocol: "instance creation",
  22087. fn: function (aClass){
  22088. var self=this,$self=this;
  22089. return $core.withContext(function($ctx1) {
  22090. var $1;
  22091. $1=$self._new();
  22092. $recv($1)._theClass_(aClass);
  22093. return $recv($1)._yourself();
  22094. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22095. },
  22096. args: ["aClass"],
  22097. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22098. referencedClasses: [],
  22099. messageSends: ["theClass:", "new", "yourself"]
  22100. }),
  22101. $globals.ClassOrganizer.a$cls);
  22102. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22103. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22104. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  22105. $globals.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a Smalltalk current packageAt: 'Kernel'\x0a Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
  22106. $core.addMethod(
  22107. $core.method({
  22108. selector: "basicTransport",
  22109. protocol: "private",
  22110. fn: function (){
  22111. var self=this,$self=this;
  22112. return $self["@basicTransport"];
  22113. },
  22114. args: [],
  22115. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22116. referencedClasses: [],
  22117. messageSends: []
  22118. }),
  22119. $globals.Package);
  22120. $core.addMethod(
  22121. $core.method({
  22122. selector: "beClean",
  22123. protocol: "accessing",
  22124. fn: function (){
  22125. var self=this,$self=this;
  22126. return $core.withContext(function($ctx1) {
  22127. var $1,$3,$2;
  22128. $self["@dirty"]=false;
  22129. $1=$recv($globals.SystemAnnouncer)._current();
  22130. $3=$recv($globals.PackageClean)._new();
  22131. $recv($3)._package_(self);
  22132. $2=$recv($3)._yourself();
  22133. $recv($1)._announce_($2);
  22134. return self;
  22135. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22136. },
  22137. args: [],
  22138. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22139. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22140. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22141. }),
  22142. $globals.Package);
  22143. $core.addMethod(
  22144. $core.method({
  22145. selector: "beDirty",
  22146. protocol: "accessing",
  22147. fn: function (){
  22148. var self=this,$self=this;
  22149. return $core.withContext(function($ctx1) {
  22150. var $1,$3,$2;
  22151. $self["@dirty"]=true;
  22152. $1=$recv($globals.SystemAnnouncer)._current();
  22153. $3=$recv($globals.PackageDirty)._new();
  22154. $recv($3)._package_(self);
  22155. $2=$recv($3)._yourself();
  22156. $recv($1)._announce_($2);
  22157. return self;
  22158. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22159. },
  22160. args: [],
  22161. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22162. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22163. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22164. }),
  22165. $globals.Package);
  22166. $core.addMethod(
  22167. $core.method({
  22168. selector: "classTemplate",
  22169. protocol: "accessing",
  22170. fn: function (){
  22171. var self=this,$self=this;
  22172. return $core.withContext(function($ctx1) {
  22173. return $recv($globals.String)._streamContents_((function(stream){
  22174. return $core.withContext(function($ctx2) {
  22175. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22176. $ctx2.sendIdx["write:"]=1;
  22177. $recv(stream)._lf();
  22178. $ctx2.sendIdx["lf"]=1;
  22179. $recv(stream)._tab();
  22180. $ctx2.sendIdx["tab"]=1;
  22181. $recv(stream)._write_("instanceVariableNames: ''");
  22182. $ctx2.sendIdx["write:"]=2;
  22183. $recv(stream)._lf();
  22184. $recv(stream)._tab();
  22185. $recv(stream)._write_("package: ");
  22186. return $recv(stream)._print_($self._name());
  22187. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22188. }));
  22189. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22190. },
  22191. args: [],
  22192. source: "classTemplate\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: 'Object subclass: #NameOfSubclass'; lf;\x0a\x09\x09tab; write: 'instanceVariableNames: '''''; lf;\x0a\x09\x09tab; write: 'package: '; print: self name ]",
  22193. referencedClasses: ["String"],
  22194. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22195. }),
  22196. $globals.Package);
  22197. $core.addMethod(
  22198. $core.method({
  22199. selector: "classes",
  22200. protocol: "classes",
  22201. fn: function (){
  22202. var self=this,$self=this;
  22203. return $core.withContext(function($ctx1) {
  22204. return $recv($recv($self._organization())._elements())._copy();
  22205. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22206. },
  22207. args: [],
  22208. source: "classes\x0a\x09^ self organization elements copy",
  22209. referencedClasses: [],
  22210. messageSends: ["copy", "elements", "organization"]
  22211. }),
  22212. $globals.Package);
  22213. $core.addMethod(
  22214. $core.method({
  22215. selector: "definition",
  22216. protocol: "accessing",
  22217. fn: function (){
  22218. var self=this,$self=this;
  22219. return $core.withContext(function($ctx1) {
  22220. var $1;
  22221. return $recv($globals.String)._streamContents_((function(stream){
  22222. return $core.withContext(function($ctx2) {
  22223. $1=$recv($self._class())._name();
  22224. $ctx2.sendIdx["name"]=1;
  22225. $recv(stream)._write_($1);
  22226. $ctx2.sendIdx["write:"]=1;
  22227. $recv(stream)._lf();
  22228. $ctx2.sendIdx["lf"]=1;
  22229. $recv(stream)._tab();
  22230. $ctx2.sendIdx["tab"]=1;
  22231. $recv(stream)._write_("named: ");
  22232. $ctx2.sendIdx["write:"]=2;
  22233. $recv(stream)._print_($self._name());
  22234. $recv(stream)._lf();
  22235. $ctx2.sendIdx["lf"]=2;
  22236. $recv(stream)._tab();
  22237. $ctx2.sendIdx["tab"]=2;
  22238. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22239. $ctx2.sendIdx["write:"]=3;
  22240. $recv(stream)._lf();
  22241. $recv(stream)._tab();
  22242. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22243. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22244. }));
  22245. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22246. },
  22247. args: [],
  22248. source: "definition\x0a\x09^ String streamContents: [ :stream | stream\x0a\x09\x09write: self class name; lf;\x0a\x09\x09tab; write: 'named: '; print: self name; lf;\x0a\x09\x09tab; write: { 'imports: '. self importsDefinition }; lf;\x0a\x09\x09tab; write: { 'transport: ('. self transport definition. ')' } ]",
  22249. referencedClasses: ["String"],
  22250. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22251. }),
  22252. $globals.Package);
  22253. $core.addMethod(
  22254. $core.method({
  22255. selector: "eval:",
  22256. protocol: "evaluating",
  22257. fn: function (aString){
  22258. var self=this,$self=this;
  22259. return $core.withContext(function($ctx1) {
  22260. var $1,$receiver;
  22261. $1=$self["@evalBlock"];
  22262. if(($receiver = $1) == null || $receiver.a$nil){
  22263. return $recv($globals.Compiler)._eval_(aString);
  22264. } else {
  22265. return $recv($self["@evalBlock"])._value_(aString);
  22266. }
  22267. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22268. },
  22269. args: ["aString"],
  22270. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22271. referencedClasses: ["Compiler"],
  22272. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22273. }),
  22274. $globals.Package);
  22275. $core.addMethod(
  22276. $core.method({
  22277. selector: "evalBlock",
  22278. protocol: "accessing",
  22279. fn: function (){
  22280. var self=this,$self=this;
  22281. return $self["@evalBlock"];
  22282. },
  22283. args: [],
  22284. source: "evalBlock\x0a\x09^ evalBlock",
  22285. referencedClasses: [],
  22286. messageSends: []
  22287. }),
  22288. $globals.Package);
  22289. $core.addMethod(
  22290. $core.method({
  22291. selector: "evalBlock:",
  22292. protocol: "accessing",
  22293. fn: function (aBlock){
  22294. var self=this,$self=this;
  22295. $self["@evalBlock"]=aBlock;
  22296. return self;
  22297. },
  22298. args: ["aBlock"],
  22299. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22300. referencedClasses: [],
  22301. messageSends: []
  22302. }),
  22303. $globals.Package);
  22304. $core.addMethod(
  22305. $core.method({
  22306. selector: "imports",
  22307. protocol: "accessing",
  22308. fn: function (){
  22309. var self=this,$self=this;
  22310. return $core.withContext(function($ctx1) {
  22311. var $1,$receiver;
  22312. $1=$self["@imports"];
  22313. if(($receiver = $1) == null || $receiver.a$nil){
  22314. $self._imports_([]);
  22315. return $self["@imports"];
  22316. } else {
  22317. return $1;
  22318. }
  22319. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22320. },
  22321. args: [],
  22322. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22323. referencedClasses: [],
  22324. messageSends: ["ifNil:", "imports:"]
  22325. }),
  22326. $globals.Package);
  22327. $core.addMethod(
  22328. $core.method({
  22329. selector: "imports:",
  22330. protocol: "accessing",
  22331. fn: function (anArray){
  22332. var self=this,$self=this;
  22333. return $core.withContext(function($ctx1) {
  22334. $self._validateImports_(anArray);
  22335. $self["@imports"]=$recv(anArray)._asSet();
  22336. return self;
  22337. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22338. },
  22339. args: ["anArray"],
  22340. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22341. referencedClasses: [],
  22342. messageSends: ["validateImports:", "asSet"]
  22343. }),
  22344. $globals.Package);
  22345. $core.addMethod(
  22346. $core.method({
  22347. selector: "importsAsJson",
  22348. protocol: "converting",
  22349. fn: function (){
  22350. var self=this,$self=this;
  22351. return $core.withContext(function($ctx1) {
  22352. var $1;
  22353. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22354. return $core.withContext(function($ctx2) {
  22355. $1=$recv(each)._isString();
  22356. if($core.assert($1)){
  22357. return each;
  22358. } else {
  22359. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22360. $ctx2.sendIdx[","]=1;
  22361. }
  22362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22363. }));
  22364. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22365. },
  22366. args: [],
  22367. source: "importsAsJson\x0a\x0a\x09^ self sortedImportsAsArray collect: [ :each |\x0a\x09\x09each isString\x0a\x09\x09\x09ifTrue: [ each ]\x0a\x09\x09\x09ifFalse: [ each key, '=', each value ]]",
  22368. referencedClasses: [],
  22369. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22370. }),
  22371. $globals.Package);
  22372. $core.addMethod(
  22373. $core.method({
  22374. selector: "importsDefinition",
  22375. protocol: "accessing",
  22376. fn: function (){
  22377. var self=this,$self=this;
  22378. return $core.withContext(function($ctx1) {
  22379. return $recv($globals.String)._streamContents_((function(stream){
  22380. return $core.withContext(function($ctx2) {
  22381. $recv(stream)._write_("{");
  22382. $ctx2.sendIdx["write:"]=1;
  22383. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22384. return $core.withContext(function($ctx3) {
  22385. return $recv(stream)._print_(each);
  22386. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22387. }),(function(){
  22388. return $core.withContext(function($ctx3) {
  22389. return $recv(stream)._write_(". ");
  22390. $ctx3.sendIdx["write:"]=2;
  22391. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22392. }));
  22393. return $recv(stream)._write_("}");
  22394. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22395. }));
  22396. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22397. },
  22398. args: [],
  22399. source: "importsDefinition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream write: '{'.\x0a\x09\x09self sortedImportsAsArray\x0a\x09\x09\x09do: [ :each | stream print: each ]\x0a\x09\x09\x09separatedBy: [ stream write: '. ' ].\x0a\x09\x09stream write: '}' ]",
  22400. referencedClasses: ["String"],
  22401. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22402. }),
  22403. $globals.Package);
  22404. $core.addMethod(
  22405. $core.method({
  22406. selector: "importsFromJson:",
  22407. protocol: "converting",
  22408. fn: function (anArray){
  22409. var self=this,$self=this;
  22410. return $core.withContext(function($ctx1) {
  22411. var $1;
  22412. return $recv(anArray)._collect_((function(each){
  22413. var split;
  22414. return $core.withContext(function($ctx2) {
  22415. split=$recv(each)._tokenize_("=");
  22416. $1=$recv($recv(split)._size()).__eq((1));
  22417. if($core.assert($1)){
  22418. return $recv(split)._first();
  22419. $ctx2.sendIdx["first"]=1;
  22420. } else {
  22421. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22422. }
  22423. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22424. }));
  22425. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22426. },
  22427. args: ["anArray"],
  22428. source: "importsFromJson: anArray\x0a\x09\x22Parses array of string, eg. #('asdf' 'qwer=tyuo')\x0a\x09into array of Strings and Associations,\x0a\x09eg. {'asdf'. 'qwer'->'tyuo'}\x22\x0a\x0a\x09^ anArray collect: [ :each |\x0a\x09\x09| split |\x0a\x09\x09split := each tokenize: '='.\x0a\x09\x09split size = 1\x0a\x09\x09\x09ifTrue: [ split first ]\x0a\x09\x09\x09ifFalse: [ split first -> split second ]]",
  22429. referencedClasses: [],
  22430. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22431. }),
  22432. $globals.Package);
  22433. $core.addMethod(
  22434. $core.method({
  22435. selector: "initialize",
  22436. protocol: "initialization",
  22437. fn: function (){
  22438. var self=this,$self=this;
  22439. return $core.withContext(function($ctx1) {
  22440. (
  22441. $ctx1.supercall = true,
  22442. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22443. $ctx1.supercall = false;
  22444. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22445. $self["@evalBlock"]=nil;
  22446. $self["@dirty"]=nil;
  22447. $self["@imports"]=nil;
  22448. $self["@transport"]=nil;
  22449. return self;
  22450. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22451. },
  22452. args: [],
  22453. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  22454. referencedClasses: ["PackageOrganizer"],
  22455. messageSends: ["initialize", "new"]
  22456. }),
  22457. $globals.Package);
  22458. $core.addMethod(
  22459. $core.method({
  22460. selector: "isDirty",
  22461. protocol: "testing",
  22462. fn: function (){
  22463. var self=this,$self=this;
  22464. return $core.withContext(function($ctx1) {
  22465. var $1,$receiver;
  22466. $1=$self["@dirty"];
  22467. if(($receiver = $1) == null || $receiver.a$nil){
  22468. return false;
  22469. } else {
  22470. return $1;
  22471. }
  22472. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22473. },
  22474. args: [],
  22475. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22476. referencedClasses: [],
  22477. messageSends: ["ifNil:"]
  22478. }),
  22479. $globals.Package);
  22480. $core.addMethod(
  22481. $core.method({
  22482. selector: "isPackage",
  22483. protocol: "testing",
  22484. fn: function (){
  22485. var self=this,$self=this;
  22486. return true;
  22487. },
  22488. args: [],
  22489. source: "isPackage\x0a\x09^ true",
  22490. referencedClasses: [],
  22491. messageSends: []
  22492. }),
  22493. $globals.Package);
  22494. $core.addMethod(
  22495. $core.method({
  22496. selector: "javaScriptDescriptor:",
  22497. protocol: "accessing",
  22498. fn: function (anObject){
  22499. var self=this,$self=this;
  22500. var basicEval,basicImports;
  22501. return $core.withContext(function($ctx1) {
  22502. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22503. return $core.withContext(function($ctx2) {
  22504. return nil._asJavaScriptObject();
  22505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22506. }));
  22507. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22508. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22509. return [];
  22510. }));
  22511. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22512. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22513. }));
  22514. $self._evalBlock_(basicEval);
  22515. $self._imports_($self._importsFromJson_(basicImports));
  22516. return self;
  22517. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22518. },
  22519. args: ["anObject"],
  22520. source: "javaScriptDescriptor: anObject\x0a\x09| basicEval basicImports |\x0a\x0a\x09basicEval := (anObject at: 'innerEval' ifAbsent: [ nil asJavaScriptObject ]).\x0a\x09basicImports := (anObject at: 'imports' ifAbsent: [ #() ]).\x0a\x09basicTransport := (anObject at: 'transport' ifAbsent: []).\x0a\x09\x09\x09\x0a\x09self\x0a\x09\x09evalBlock: basicEval;\x0a\x09\x09imports: (self importsFromJson: basicImports)",
  22521. referencedClasses: [],
  22522. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  22523. }),
  22524. $globals.Package);
  22525. $core.addMethod(
  22526. $core.method({
  22527. selector: "loadDependencies",
  22528. protocol: "dependencies",
  22529. fn: function (){
  22530. var self=this,$self=this;
  22531. var classes,packages;
  22532. return $core.withContext(function($ctx1) {
  22533. var $1;
  22534. classes=$self._loadDependencyClasses();
  22535. $1=$recv($recv(classes)._collect_((function(each){
  22536. return $core.withContext(function($ctx2) {
  22537. return $recv(each)._package();
  22538. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22539. })))._asSet();
  22540. $recv($1)._remove_ifAbsent_(self,(function(){
  22541. }));
  22542. return $recv($1)._yourself();
  22543. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22544. },
  22545. args: [],
  22546. source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^ (classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself",
  22547. referencedClasses: [],
  22548. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22549. }),
  22550. $globals.Package);
  22551. $core.addMethod(
  22552. $core.method({
  22553. selector: "loadDependencyClasses",
  22554. protocol: "dependencies",
  22555. fn: function (){
  22556. var self=this,$self=this;
  22557. var starCategoryName;
  22558. return $core.withContext(function($ctx1) {
  22559. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22560. starCategoryName="*".__comma($self._name());
  22561. $ctx1.sendIdx[","]=1;
  22562. $3=$self._classes();
  22563. $ctx1.sendIdx["classes"]=1;
  22564. $2=$recv($3)._collect_((function(each){
  22565. return $core.withContext(function($ctx2) {
  22566. return $recv(each)._superclass();
  22567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22568. }));
  22569. $ctx1.sendIdx["collect:"]=1;
  22570. $1=$recv($2)._asSet();
  22571. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22572. return $core.withContext(function($ctx2) {
  22573. $5=$recv(each)._protocols();
  22574. $ctx2.sendIdx["protocols"]=1;
  22575. $7=$recv(each)._theMetaClass();
  22576. if(($receiver = $7) == null || $receiver.a$nil){
  22577. $6=[];
  22578. } else {
  22579. var meta;
  22580. meta=$receiver;
  22581. $6=$recv(meta)._protocols();
  22582. }
  22583. $4=$recv($5).__comma($6);
  22584. return $recv($4)._includes_(starCategoryName);
  22585. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22586. })));
  22587. $ctx1.sendIdx["addAll:"]=1;
  22588. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22589. return $core.withContext(function($ctx2) {
  22590. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22591. return $core.withContext(function($ctx3) {
  22592. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22593. return $core.withContext(function($ctx4) {
  22594. return $recv(eachTT)._trait();
  22595. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22596. })));
  22597. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22598. }));
  22599. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22600. })));
  22601. $recv($1)._remove_ifAbsent_(nil,(function(){
  22602. }));
  22603. return $recv($1)._yourself();
  22604. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22605. },
  22606. args: [],
  22607. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x0a\x09as well as all traits used\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09addAll: (Smalltalk classes select: [ :each |\x0a\x09\x09\x09each protocols, (each theMetaClass ifNil: [ #() ] ifNotNil: [ :meta | meta protocols])\x0a\x09\x09\x09\x09includes: starCategoryName ]);\x0a\x09\x09addAll: (Array streamContents: [ :as | self traitCompositions valuesDo: [ :each | as write: (each collect: [ :eachTT | eachTT trait ])]]);\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09yourself",
  22608. referencedClasses: ["Smalltalk", "Array"],
  22609. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22610. }),
  22611. $globals.Package);
  22612. $core.addMethod(
  22613. $core.method({
  22614. selector: "name",
  22615. protocol: "accessing",
  22616. fn: function (){
  22617. var self=this,$self=this;
  22618. return $self["@name"];
  22619. },
  22620. args: [],
  22621. source: "name\x0a\x09^ name",
  22622. referencedClasses: [],
  22623. messageSends: []
  22624. }),
  22625. $globals.Package);
  22626. $core.addMethod(
  22627. $core.method({
  22628. selector: "name:",
  22629. protocol: "accessing",
  22630. fn: function (aString){
  22631. var self=this,$self=this;
  22632. $self["@name"]=aString;
  22633. return self;
  22634. },
  22635. args: ["aString"],
  22636. source: "name: aString\x0a\x09name := aString",
  22637. referencedClasses: [],
  22638. messageSends: []
  22639. }),
  22640. $globals.Package);
  22641. $core.addMethod(
  22642. $core.method({
  22643. selector: "organization",
  22644. protocol: "accessing",
  22645. fn: function (){
  22646. var self=this,$self=this;
  22647. return $self["@organization"];
  22648. },
  22649. args: [],
  22650. source: "organization\x0a\x09^ organization",
  22651. referencedClasses: [],
  22652. messageSends: []
  22653. }),
  22654. $globals.Package);
  22655. $core.addMethod(
  22656. $core.method({
  22657. selector: "printOn:",
  22658. protocol: "printing",
  22659. fn: function (aStream){
  22660. var self=this,$self=this;
  22661. return $core.withContext(function($ctx1) {
  22662. (
  22663. $ctx1.supercall = true,
  22664. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22665. $ctx1.supercall = false;
  22666. $recv(aStream)._nextPutAll_(" (");
  22667. $ctx1.sendIdx["nextPutAll:"]=1;
  22668. $recv(aStream)._nextPutAll_($self._name());
  22669. $ctx1.sendIdx["nextPutAll:"]=2;
  22670. $recv(aStream)._nextPutAll_(")");
  22671. return self;
  22672. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22673. },
  22674. args: ["aStream"],
  22675. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22676. referencedClasses: [],
  22677. messageSends: ["printOn:", "nextPutAll:", "name"]
  22678. }),
  22679. $globals.Package);
  22680. $core.addMethod(
  22681. $core.method({
  22682. selector: "setupClasses",
  22683. protocol: "classes",
  22684. fn: function (){
  22685. var self=this,$self=this;
  22686. return $core.withContext(function($ctx1) {
  22687. $recv($self._classes())._do_((function(each){
  22688. return $core.withContext(function($ctx2) {
  22689. return $recv(each)._initialize();
  22690. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22691. }));
  22692. return self;
  22693. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22694. },
  22695. args: [],
  22696. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22697. referencedClasses: [],
  22698. messageSends: ["do:", "classes", "initialize"]
  22699. }),
  22700. $globals.Package);
  22701. $core.addMethod(
  22702. $core.method({
  22703. selector: "sortedClasses",
  22704. protocol: "classes",
  22705. fn: function (){
  22706. var self=this,$self=this;
  22707. return $core.withContext(function($ctx1) {
  22708. return $recv($self._class())._sortedClasses_($self._classes());
  22709. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22710. },
  22711. args: [],
  22712. source: "sortedClasses\x0a\x09\x22Answer all classes in the receiver, sorted by superclass/subclasses and by class name for common subclasses (Issue #143).\x22\x0a\x0a\x09^ self class sortedClasses: self classes",
  22713. referencedClasses: [],
  22714. messageSends: ["sortedClasses:", "class", "classes"]
  22715. }),
  22716. $globals.Package);
  22717. $core.addMethod(
  22718. $core.method({
  22719. selector: "sortedImportsAsArray",
  22720. protocol: "private",
  22721. fn: function (){
  22722. var self=this,$self=this;
  22723. return $core.withContext(function($ctx1) {
  22724. var $3,$2,$4,$1,$6,$5,$7;
  22725. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22726. return $core.withContext(function($ctx2) {
  22727. $3=$recv(a)._isString();
  22728. $ctx2.sendIdx["isString"]=1;
  22729. $2=$recv($3)._not();
  22730. $4=$recv(b)._isString();
  22731. $ctx2.sendIdx["isString"]=2;
  22732. $1=$recv($2).__and($4);
  22733. return $recv($1)._or_((function(){
  22734. return $core.withContext(function($ctx3) {
  22735. $6=$recv(a)._isString();
  22736. $ctx3.sendIdx["isString"]=3;
  22737. $5=$recv($6).__eq($recv(b)._isString());
  22738. return $recv($5)._and_((function(){
  22739. return $core.withContext(function($ctx4) {
  22740. $7=$recv(a)._value();
  22741. $ctx4.sendIdx["value"]=1;
  22742. return $recv($7).__lt_eq($recv(b)._value());
  22743. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22744. }));
  22745. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22746. }));
  22747. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22748. }));
  22749. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22750. },
  22751. args: [],
  22752. source: "sortedImportsAsArray\x0a\x09\x22Answer imports sorted first by type (associations first),\x0a\x09then by value\x22\x0a\x0a\x09^ self imports asArray\x0a\x09\x09sorted: [ :a :b |\x0a\x09\x09\x09a isString not & b isString or: [\x0a\x09\x09\x09\x09a isString = b isString and: [\x0a\x09\x09\x09\x09\x09a value <= b value ]]]",
  22753. referencedClasses: [],
  22754. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22755. }),
  22756. $globals.Package);
  22757. $core.addMethod(
  22758. $core.method({
  22759. selector: "traitCompositions",
  22760. protocol: "dependencies",
  22761. fn: function (){
  22762. var self=this,$self=this;
  22763. var traitCompositions;
  22764. return $core.withContext(function($ctx1) {
  22765. var $1,$2,$3,$receiver;
  22766. traitCompositions=$recv($globals.Dictionary)._new();
  22767. $recv($self._classes())._do_((function(each){
  22768. return $core.withContext(function($ctx2) {
  22769. $1=traitCompositions;
  22770. $2=$recv(each)._traitComposition();
  22771. $ctx2.sendIdx["traitComposition"]=1;
  22772. $recv($1)._at_put_(each,$2);
  22773. $ctx2.sendIdx["at:put:"]=1;
  22774. $3=$recv(each)._theMetaClass();
  22775. if(($receiver = $3) == null || $receiver.a$nil){
  22776. return $3;
  22777. } else {
  22778. var meta;
  22779. meta=$receiver;
  22780. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22781. }
  22782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22783. }));
  22784. return $recv(traitCompositions)._reject_((function(each){
  22785. return $core.withContext(function($ctx2) {
  22786. return $recv(each)._isEmpty();
  22787. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22788. }));
  22789. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22790. },
  22791. args: [],
  22792. source: "traitCompositions\x0a\x09| traitCompositions |\x0a\x09traitCompositions := Dictionary new.\x0a\x09self classes do: [ :each |\x0a\x09\x09traitCompositions at: each put: each traitComposition.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | traitCompositions at: meta put: meta traitComposition ] ].\x0a\x09^ traitCompositions reject: [ :each | each isEmpty ]",
  22793. referencedClasses: ["Dictionary"],
  22794. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22795. }),
  22796. $globals.Package);
  22797. $core.addMethod(
  22798. $core.method({
  22799. selector: "transport",
  22800. protocol: "accessing",
  22801. fn: function (){
  22802. var self=this,$self=this;
  22803. return $core.withContext(function($ctx1) {
  22804. var $1,$receiver;
  22805. $1=$self["@transport"];
  22806. if(($receiver = $1) == null || $receiver.a$nil){
  22807. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22808. return $self["@transport"];
  22809. } else {
  22810. return $1;
  22811. }
  22812. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22813. },
  22814. args: [],
  22815. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22816. referencedClasses: ["PackageTransport"],
  22817. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22818. }),
  22819. $globals.Package);
  22820. $core.addMethod(
  22821. $core.method({
  22822. selector: "transport:",
  22823. protocol: "accessing",
  22824. fn: function (aPackageTransport){
  22825. var self=this,$self=this;
  22826. return $core.withContext(function($ctx1) {
  22827. $self["@transport"]=aPackageTransport;
  22828. $recv(aPackageTransport)._package_(self);
  22829. return self;
  22830. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22831. },
  22832. args: ["aPackageTransport"],
  22833. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22834. referencedClasses: [],
  22835. messageSends: ["package:"]
  22836. }),
  22837. $globals.Package);
  22838. $core.addMethod(
  22839. $core.method({
  22840. selector: "validateImports:",
  22841. protocol: "validation",
  22842. fn: function (aCollection){
  22843. var self=this,$self=this;
  22844. return $core.withContext(function($ctx1) {
  22845. var $1,$2,$5,$4,$3,$6;
  22846. $recv(aCollection)._do_((function(import_){
  22847. return $core.withContext(function($ctx2) {
  22848. $1=$recv(import_)._isString();
  22849. $ctx2.sendIdx["isString"]=1;
  22850. if(!$core.assert($1)){
  22851. $2=$recv(import_)._respondsTo_("key");
  22852. if(!$core.assert($2)){
  22853. $self._error_("Imports must be Strings or Associations");
  22854. $ctx2.sendIdx["error:"]=1;
  22855. }
  22856. $5=$recv(import_)._key();
  22857. $ctx2.sendIdx["key"]=1;
  22858. $4=$recv($5)._isString();
  22859. $ctx2.sendIdx["isString"]=2;
  22860. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22861. if(!$core.assert($3)){
  22862. $self._error_("Key and value must be Strings");
  22863. $ctx2.sendIdx["error:"]=2;
  22864. }
  22865. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22866. if(!$core.assert($6)){
  22867. return $self._error_("Keys must be identifiers");
  22868. }
  22869. }
  22870. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22871. }));
  22872. return self;
  22873. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22874. },
  22875. args: ["aCollection"],
  22876. source: "validateImports: aCollection\x0a\x0a\x09aCollection do: [ :import |\x0a\x09\x09import isString ifFalse: [\x0a\x09\x09\x09(import respondsTo: #key) ifFalse: [\x0a\x09\x09\x09\x09self error: 'Imports must be Strings or Associations' ].\x0a\x09\x09\x09import key isString & import value isString ifFalse: [\x0a\x09\x09\x09\x09self error: 'Key and value must be Strings' ].\x0a\x09\x09\x09(import key match: '^[a-zA-Z][a-zA-Z0-9]*$') ifFalse: [\x0a\x09\x09\x09\x09self error: 'Keys must be identifiers' ]]]",
  22877. referencedClasses: [],
  22878. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22879. }),
  22880. $globals.Package);
  22881. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22882. $core.addMethod(
  22883. $core.method({
  22884. selector: "named:",
  22885. protocol: "accessing",
  22886. fn: function (aPackageName){
  22887. var self=this,$self=this;
  22888. return $core.withContext(function($ctx1) {
  22889. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22890. return $core.withContext(function($ctx2) {
  22891. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22893. }));
  22894. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22895. },
  22896. args: ["aPackageName"],
  22897. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22898. referencedClasses: ["Smalltalk"],
  22899. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22900. }),
  22901. $globals.Package.a$cls);
  22902. $core.addMethod(
  22903. $core.method({
  22904. selector: "named:ifAbsent:",
  22905. protocol: "accessing",
  22906. fn: function (aPackageName,aBlock){
  22907. var self=this,$self=this;
  22908. return $core.withContext(function($ctx1) {
  22909. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22910. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22911. },
  22912. args: ["aPackageName", "aBlock"],
  22913. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22914. referencedClasses: ["Smalltalk"],
  22915. messageSends: ["packageAt:ifAbsent:"]
  22916. }),
  22917. $globals.Package.a$cls);
  22918. $core.addMethod(
  22919. $core.method({
  22920. selector: "named:imports:transport:",
  22921. protocol: "accessing",
  22922. fn: function (aPackageName,anArray,aTransport){
  22923. var self=this,$self=this;
  22924. var pkg;
  22925. return $core.withContext(function($ctx1) {
  22926. pkg=$self._named_(aPackageName);
  22927. $recv(pkg)._imports_(anArray);
  22928. $recv(pkg)._transport_(aTransport);
  22929. return pkg;
  22930. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22931. },
  22932. args: ["aPackageName", "anArray", "aTransport"],
  22933. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg imports: anArray.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22934. referencedClasses: [],
  22935. messageSends: ["named:", "imports:", "transport:"]
  22936. }),
  22937. $globals.Package.a$cls);
  22938. $core.addMethod(
  22939. $core.method({
  22940. selector: "named:javaScriptDescriptor:",
  22941. protocol: "instance creation",
  22942. fn: function (aString,anObject){
  22943. var self=this,$self=this;
  22944. var pkg;
  22945. return $core.withContext(function($ctx1) {
  22946. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  22947. $recv(pkg)._javaScriptDescriptor_(anObject);
  22948. return pkg;
  22949. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  22950. },
  22951. args: ["aString", "anObject"],
  22952. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  22953. referencedClasses: ["Smalltalk"],
  22954. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22955. }),
  22956. $globals.Package.a$cls);
  22957. $core.addMethod(
  22958. $core.method({
  22959. selector: "named:transport:",
  22960. protocol: "accessing",
  22961. fn: function (aPackageName,aTransport){
  22962. var self=this,$self=this;
  22963. var pkg;
  22964. return $core.withContext(function($ctx1) {
  22965. pkg=$self._named_(aPackageName);
  22966. $recv(pkg)._transport_(aTransport);
  22967. return pkg;
  22968. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22969. },
  22970. args: ["aPackageName", "aTransport"],
  22971. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22972. referencedClasses: [],
  22973. messageSends: ["named:", "transport:"]
  22974. }),
  22975. $globals.Package.a$cls);
  22976. $core.addMethod(
  22977. $core.method({
  22978. selector: "new:",
  22979. protocol: "instance creation",
  22980. fn: function (aString){
  22981. var self=this,$self=this;
  22982. return $core.withContext(function($ctx1) {
  22983. var $1;
  22984. $1=$recv($globals.Package)._new();
  22985. $recv($1)._name_(aString);
  22986. return $recv($1)._yourself();
  22987. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  22988. },
  22989. args: ["aString"],
  22990. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  22991. referencedClasses: ["Package"],
  22992. messageSends: ["name:", "new", "yourself"]
  22993. }),
  22994. $globals.Package.a$cls);
  22995. $core.addMethod(
  22996. $core.method({
  22997. selector: "sortedClasses:",
  22998. protocol: "sorting",
  22999. fn: function (classes){
  23000. var self=this,$self=this;
  23001. var children,others,nodes,expandedClasses;
  23002. return $core.withContext(function($ctx1) {
  23003. var $1,$3,$2;
  23004. children=[];
  23005. others=[];
  23006. $recv(classes)._do_((function(each){
  23007. return $core.withContext(function($ctx2) {
  23008. $1=$recv(classes)._includes_($recv(each)._superclass());
  23009. if($core.assert($1)){
  23010. return $recv(others)._add_(each);
  23011. } else {
  23012. return $recv(children)._add_(each);
  23013. $ctx2.sendIdx["add:"]=1;
  23014. }
  23015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23016. }));
  23017. $ctx1.sendIdx["do:"]=1;
  23018. nodes=$recv(children)._collect_((function(each){
  23019. return $core.withContext(function($ctx2) {
  23020. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  23021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  23022. }));
  23023. nodes=$recv(nodes)._sorted_((function(a,b){
  23024. return $core.withContext(function($ctx2) {
  23025. $3=$recv(a)._theClass();
  23026. $ctx2.sendIdx["theClass"]=1;
  23027. $2=$recv($3)._name();
  23028. $ctx2.sendIdx["name"]=1;
  23029. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  23030. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  23031. }));
  23032. expandedClasses=$recv($globals.Array)._new();
  23033. $recv(nodes)._do_((function(aNode){
  23034. return $core.withContext(function($ctx2) {
  23035. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  23036. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  23037. }));
  23038. return expandedClasses;
  23039. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  23040. },
  23041. args: ["classes"],
  23042. source: "sortedClasses: classes\x0a\x09\x22Answer classes, sorted by superclass/subclasses and by class name for common subclasses (Issue #143)\x22\x0a\x0a\x09| children others nodes expandedClasses |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09classes do: [ :each |\x0a\x09\x09(classes includes: each superclass)\x0a\x09\x09\x09ifFalse: [ children add: each ]\x0a\x09\x09\x09ifTrue: [ others add: each ]].\x0a\x09nodes := children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: 0 ].\x0a\x09nodes := nodes sorted: [ :a :b | a theClass name <= b theClass name ].\x0a\x09expandedClasses := Array new.\x0a\x09nodes do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: expandedClasses ].\x0a\x09^ expandedClasses",
  23043. referencedClasses: ["ClassSorterNode", "Array"],
  23044. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  23045. }),
  23046. $globals.Package.a$cls);
  23047. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  23048. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23049. $core.addMethod(
  23050. $core.method({
  23051. selector: "announcer",
  23052. protocol: "accessing",
  23053. fn: function (){
  23054. var self=this,$self=this;
  23055. return $core.withContext(function($ctx1) {
  23056. return $recv($globals.SystemAnnouncer)._current();
  23057. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23058. },
  23059. args: [],
  23060. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23061. referencedClasses: ["SystemAnnouncer"],
  23062. messageSends: ["current"]
  23063. }),
  23064. $globals.PackageStateObserver);
  23065. $core.addMethod(
  23066. $core.method({
  23067. selector: "observeSystem",
  23068. protocol: "actions",
  23069. fn: function (){
  23070. var self=this,$self=this;
  23071. return $core.withContext(function($ctx1) {
  23072. var $1;
  23073. $1=$self._announcer();
  23074. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23075. $ctx1.sendIdx["on:send:to:"]=1;
  23076. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23077. $ctx1.sendIdx["on:send:to:"]=2;
  23078. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23079. $ctx1.sendIdx["on:send:to:"]=3;
  23080. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23081. return self;
  23082. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23083. },
  23084. args: [],
  23085. source: "observeSystem\x0a\x09self announcer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassAnnouncement\x0a\x09\x09send: #onClassModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodAnnouncement\x0a\x09\x09send: #onMethodModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolAnnouncement\x0a\x09\x09send: #onProtocolModification:\x0a\x09\x09to: self",
  23086. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23087. messageSends: ["on:send:to:", "announcer"]
  23088. }),
  23089. $globals.PackageStateObserver);
  23090. $core.addMethod(
  23091. $core.method({
  23092. selector: "onClassModification:",
  23093. protocol: "reactions",
  23094. fn: function (anAnnouncement){
  23095. var self=this,$self=this;
  23096. return $core.withContext(function($ctx1) {
  23097. var $1,$receiver;
  23098. $1=$recv(anAnnouncement)._theClass();
  23099. if(($receiver = $1) == null || $receiver.a$nil){
  23100. $1;
  23101. } else {
  23102. var theClass;
  23103. theClass=$receiver;
  23104. $recv($recv(theClass)._package())._beDirty();
  23105. }
  23106. return self;
  23107. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23108. },
  23109. args: ["anAnnouncement"],
  23110. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23111. referencedClasses: [],
  23112. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23113. }),
  23114. $globals.PackageStateObserver);
  23115. $core.addMethod(
  23116. $core.method({
  23117. selector: "onMethodModification:",
  23118. protocol: "reactions",
  23119. fn: function (anAnnouncement){
  23120. var self=this,$self=this;
  23121. return $core.withContext(function($ctx1) {
  23122. var $1,$receiver;
  23123. $1=$recv($recv(anAnnouncement)._method())._package();
  23124. if(($receiver = $1) == null || $receiver.a$nil){
  23125. $1;
  23126. } else {
  23127. var package_;
  23128. package_=$receiver;
  23129. $recv(package_)._beDirty();
  23130. }
  23131. return self;
  23132. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23133. },
  23134. args: ["anAnnouncement"],
  23135. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23136. referencedClasses: [],
  23137. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23138. }),
  23139. $globals.PackageStateObserver);
  23140. $core.addMethod(
  23141. $core.method({
  23142. selector: "onPackageAdded:",
  23143. protocol: "reactions",
  23144. fn: function (anAnnouncement){
  23145. var self=this,$self=this;
  23146. return $core.withContext(function($ctx1) {
  23147. $recv($recv(anAnnouncement)._package())._beDirty();
  23148. return self;
  23149. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23150. },
  23151. args: ["anAnnouncement"],
  23152. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23153. referencedClasses: [],
  23154. messageSends: ["beDirty", "package"]
  23155. }),
  23156. $globals.PackageStateObserver);
  23157. $core.addMethod(
  23158. $core.method({
  23159. selector: "onProtocolModification:",
  23160. protocol: "reactions",
  23161. fn: function (anAnnouncement){
  23162. var self=this,$self=this;
  23163. return $core.withContext(function($ctx1) {
  23164. var $1,$receiver;
  23165. $1=$recv(anAnnouncement)._package();
  23166. if(($receiver = $1) == null || $receiver.a$nil){
  23167. $1;
  23168. } else {
  23169. var package_;
  23170. package_=$receiver;
  23171. $recv(package_)._beDirty();
  23172. }
  23173. return self;
  23174. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23175. },
  23176. args: ["anAnnouncement"],
  23177. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23178. referencedClasses: [],
  23179. messageSends: ["ifNotNil:", "package", "beDirty"]
  23180. }),
  23181. $globals.PackageStateObserver);
  23182. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23183. $core.addMethod(
  23184. $core.method({
  23185. selector: "current",
  23186. protocol: "accessing",
  23187. fn: function (){
  23188. var self=this,$self=this;
  23189. return $core.withContext(function($ctx1) {
  23190. var $1,$receiver;
  23191. $1=$self["@current"];
  23192. if(($receiver = $1) == null || $receiver.a$nil){
  23193. $self["@current"]=$self._new();
  23194. return $self["@current"];
  23195. } else {
  23196. return $1;
  23197. }
  23198. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23199. },
  23200. args: [],
  23201. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23202. referencedClasses: [],
  23203. messageSends: ["ifNil:", "new"]
  23204. }),
  23205. $globals.PackageStateObserver.a$cls);
  23206. $core.addMethod(
  23207. $core.method({
  23208. selector: "initialize",
  23209. protocol: "initialization",
  23210. fn: function (){
  23211. var self=this,$self=this;
  23212. return $core.withContext(function($ctx1) {
  23213. $recv($self._current())._observeSystem();
  23214. return self;
  23215. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23216. },
  23217. args: [],
  23218. source: "initialize\x0a\x09self current observeSystem",
  23219. referencedClasses: [],
  23220. messageSends: ["observeSystem", "current"]
  23221. }),
  23222. $globals.PackageStateObserver.a$cls);
  23223. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23224. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23225. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23226. $globals.Setting.comment="I represent a setting **stored** at `Smalltalk settings`. \x0aIn the current implementation, `Smalltalk settings` is an object persisted in the localStorage.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: aDefaultValue`.\x0a\x0aTo read the value of a setting you can also use the convenience:\x0a\x0a`theValueSet := 'any.characteristic' settingValue` \x0a\x0aor with a default using:\x0a\x0a `theEnsuredValueSet := 'any.characteristic' settingValueIfAbsent: true`";
  23227. $core.addMethod(
  23228. $core.method({
  23229. selector: "defaultValue",
  23230. protocol: "accessing",
  23231. fn: function (){
  23232. var self=this,$self=this;
  23233. return $self["@defaultValue"];
  23234. },
  23235. args: [],
  23236. source: "defaultValue\x0a\x09^ defaultValue",
  23237. referencedClasses: [],
  23238. messageSends: []
  23239. }),
  23240. $globals.Setting);
  23241. $core.addMethod(
  23242. $core.method({
  23243. selector: "defaultValue:",
  23244. protocol: "accessing",
  23245. fn: function (aStringifiableObject){
  23246. var self=this,$self=this;
  23247. $self["@defaultValue"]=aStringifiableObject;
  23248. return self;
  23249. },
  23250. args: ["aStringifiableObject"],
  23251. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23252. referencedClasses: [],
  23253. messageSends: []
  23254. }),
  23255. $globals.Setting);
  23256. $core.addMethod(
  23257. $core.method({
  23258. selector: "key",
  23259. protocol: "accessing",
  23260. fn: function (){
  23261. var self=this,$self=this;
  23262. return $self["@key"];
  23263. },
  23264. args: [],
  23265. source: "key\x0a\x09^ key",
  23266. referencedClasses: [],
  23267. messageSends: []
  23268. }),
  23269. $globals.Setting);
  23270. $core.addMethod(
  23271. $core.method({
  23272. selector: "key:",
  23273. protocol: "accessing",
  23274. fn: function (aString){
  23275. var self=this,$self=this;
  23276. $self["@key"]=aString;
  23277. return self;
  23278. },
  23279. args: ["aString"],
  23280. source: "key: aString\x0a\x09key := aString",
  23281. referencedClasses: [],
  23282. messageSends: []
  23283. }),
  23284. $globals.Setting);
  23285. $core.addMethod(
  23286. $core.method({
  23287. selector: "value",
  23288. protocol: "accessing",
  23289. fn: function (){
  23290. var self=this,$self=this;
  23291. return $core.withContext(function($ctx1) {
  23292. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23293. return $core.withContext(function($ctx2) {
  23294. return $self._defaultValue();
  23295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23296. }));
  23297. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23298. },
  23299. args: [],
  23300. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23301. referencedClasses: ["Smalltalk"],
  23302. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23303. }),
  23304. $globals.Setting);
  23305. $core.addMethod(
  23306. $core.method({
  23307. selector: "value:",
  23308. protocol: "accessing",
  23309. fn: function (aStringifiableObject){
  23310. var self=this,$self=this;
  23311. return $core.withContext(function($ctx1) {
  23312. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23313. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23314. },
  23315. args: ["aStringifiableObject"],
  23316. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23317. referencedClasses: ["Smalltalk"],
  23318. messageSends: ["at:put:", "settings", "key"]
  23319. }),
  23320. $globals.Setting);
  23321. $core.addMethod(
  23322. $core.method({
  23323. selector: "at:ifAbsent:",
  23324. protocol: "instance creation",
  23325. fn: function (aString,aDefaultValue){
  23326. var self=this,$self=this;
  23327. return $core.withContext(function($ctx1) {
  23328. var $1;
  23329. $1=(
  23330. $ctx1.supercall = true,
  23331. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23332. $ctx1.supercall = false;
  23333. $recv($1)._key_(aString);
  23334. $recv($1)._defaultValue_(aDefaultValue);
  23335. return $recv($1)._yourself();
  23336. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23337. },
  23338. args: ["aString", "aDefaultValue"],
  23339. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23340. referencedClasses: [],
  23341. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23342. }),
  23343. $globals.Setting.a$cls);
  23344. $core.addMethod(
  23345. $core.method({
  23346. selector: "new",
  23347. protocol: "instance creation",
  23348. fn: function (){
  23349. var self=this,$self=this;
  23350. return $core.withContext(function($ctx1) {
  23351. $self._shouldNotImplement();
  23352. return self;
  23353. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23354. },
  23355. args: [],
  23356. source: "new\x0a\x09self shouldNotImplement",
  23357. referencedClasses: [],
  23358. messageSends: ["shouldNotImplement"]
  23359. }),
  23360. $globals.Setting.a$cls);
  23361. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23362. $globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `$core` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#globals #at:` answers a specific global (usually, a class) or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  23363. $core.addMethod(
  23364. $core.method({
  23365. selector: "addGlobalJsVariable:",
  23366. protocol: "globals",
  23367. fn: function (aString){
  23368. var self=this,$self=this;
  23369. return $core.withContext(function($ctx1) {
  23370. $recv($self._globalJsVariables())._add_(aString);
  23371. return self;
  23372. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23373. },
  23374. args: ["aString"],
  23375. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23376. referencedClasses: [],
  23377. messageSends: ["add:", "globalJsVariables"]
  23378. }),
  23379. $globals.SmalltalkImage);
  23380. $core.addMethod(
  23381. $core.method({
  23382. selector: "adoptPackageDescriptors",
  23383. protocol: "private",
  23384. fn: function (){
  23385. var self=this,$self=this;
  23386. var pkgs;
  23387. return $core.withContext(function($ctx1) {
  23388. pkgs=$recv($globals.Set)._new();
  23389. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23390. return $core.withContext(function($ctx2) {
  23391. return $recv(pkgs)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  23392. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23393. }));
  23394. return pkgs;
  23395. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{pkgs:pkgs},$globals.SmalltalkImage)});
  23396. },
  23397. args: [],
  23398. source: "adoptPackageDescriptors\x0a\x09| pkgs |\x0a\x09pkgs := Set new.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09pkgs add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ pkgs",
  23399. referencedClasses: ["Set", "Package"],
  23400. messageSends: ["new", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:"]
  23401. }),
  23402. $globals.SmalltalkImage);
  23403. $core.addMethod(
  23404. $core.method({
  23405. selector: "amdRequire",
  23406. protocol: "accessing amd",
  23407. fn: function (){
  23408. var self=this,$self=this;
  23409. return $core.withContext(function($ctx1) {
  23410. return $recv($self._core())._at_("amdRequire");
  23411. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23412. },
  23413. args: [],
  23414. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23415. referencedClasses: [],
  23416. messageSends: ["at:", "core"]
  23417. }),
  23418. $globals.SmalltalkImage);
  23419. $core.addMethod(
  23420. $core.method({
  23421. selector: "asSmalltalkException:",
  23422. protocol: "error handling",
  23423. fn: function (anObject){
  23424. var self=this,$self=this;
  23425. return $core.withContext(function($ctx1) {
  23426. var $1;
  23427. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23428. return $core.withContext(function($ctx2) {
  23429. return $recv(anObject)._isKindOf_($globals.Error);
  23430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23431. }));
  23432. if($core.assert($1)){
  23433. return anObject;
  23434. } else {
  23435. return $recv($globals.JavaScriptException)._on_(anObject);
  23436. }
  23437. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23438. },
  23439. args: ["anObject"],
  23440. source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
  23441. referencedClasses: ["Error", "JavaScriptException"],
  23442. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23443. }),
  23444. $globals.SmalltalkImage);
  23445. $core.addMethod(
  23446. $core.method({
  23447. selector: "basicCreatePackage:",
  23448. protocol: "private",
  23449. fn: function (packageName){
  23450. var self=this,$self=this;
  23451. return $core.withContext(function($ctx1) {
  23452. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23453. return $core.withContext(function($ctx2) {
  23454. return $recv($globals.Package)._new_(packageName);
  23455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23456. }));
  23457. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23458. },
  23459. args: ["packageName"],
  23460. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09^ self packageDictionary at: packageName ifAbsentPut: [ Package new: packageName ]",
  23461. referencedClasses: ["Package"],
  23462. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23463. }),
  23464. $globals.SmalltalkImage);
  23465. $core.addMethod(
  23466. $core.method({
  23467. selector: "basicParse:",
  23468. protocol: "private",
  23469. fn: function (aString){
  23470. var self=this,$self=this;
  23471. return $core.withContext(function($ctx1) {
  23472. return $recv($globals.SmalltalkParser)._parse_(aString);
  23473. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23474. },
  23475. args: ["aString"],
  23476. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23477. referencedClasses: ["SmalltalkParser"],
  23478. messageSends: ["parse:"]
  23479. }),
  23480. $globals.SmalltalkImage);
  23481. $core.addMethod(
  23482. $core.method({
  23483. selector: "cancelOptOut:",
  23484. protocol: "accessing",
  23485. fn: function (anObject){
  23486. var self=this,$self=this;
  23487. return $core.withContext(function($ctx1) {
  23488. delete anObject.klass; delete anObject.a$cls;;
  23489. return self;
  23490. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23491. },
  23492. args: ["anObject"],
  23493. source: "cancelOptOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09If this property is shadowed for anObject by optOut:,\x0a\x09the object is treated as plain JS object.\x0a\x09This removes the shadow and anObject is Smalltalk object\x0a\x09again if it was before.\x22\x0a\x09\x0a\x09<inlineJS: 'delete anObject.klass; delete anObject.a$cls;'>",
  23494. referencedClasses: [],
  23495. messageSends: []
  23496. }),
  23497. $globals.SmalltalkImage);
  23498. $core.addMethod(
  23499. $core.method({
  23500. selector: "classes",
  23501. protocol: "classes",
  23502. fn: function (){
  23503. var self=this,$self=this;
  23504. return $core.withContext(function($ctx1) {
  23505. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23506. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23507. },
  23508. args: [],
  23509. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23510. referencedClasses: [],
  23511. messageSends: ["copy", "traitsOrClasses", "core"]
  23512. }),
  23513. $globals.SmalltalkImage);
  23514. $core.addMethod(
  23515. $core.method({
  23516. selector: "core",
  23517. protocol: "accessing",
  23518. fn: function (){
  23519. var self=this,$self=this;
  23520. return $core.withContext(function($ctx1) {
  23521. return $core;
  23522. return self;
  23523. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23524. },
  23525. args: [],
  23526. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23527. referencedClasses: [],
  23528. messageSends: []
  23529. }),
  23530. $globals.SmalltalkImage);
  23531. $core.addMethod(
  23532. $core.method({
  23533. selector: "createPackage:",
  23534. protocol: "packages",
  23535. fn: function (packageName){
  23536. var self=this,$self=this;
  23537. var package_,announcement;
  23538. return $core.withContext(function($ctx1) {
  23539. var $1;
  23540. package_=$self._basicCreatePackage_(packageName);
  23541. $1=$recv($globals.PackageAdded)._new();
  23542. $recv($1)._package_(package_);
  23543. announcement=$recv($1)._yourself();
  23544. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23545. return package_;
  23546. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23547. },
  23548. args: ["packageName"],
  23549. source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
  23550. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23551. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23552. }),
  23553. $globals.SmalltalkImage);
  23554. $core.addMethod(
  23555. $core.method({
  23556. selector: "defaultAmdNamespace",
  23557. protocol: "accessing amd",
  23558. fn: function (){
  23559. var self=this,$self=this;
  23560. return $core.withContext(function($ctx1) {
  23561. return "transport.defaultAmdNamespace"._settingValue();
  23562. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23563. },
  23564. args: [],
  23565. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23566. referencedClasses: [],
  23567. messageSends: ["settingValue"]
  23568. }),
  23569. $globals.SmalltalkImage);
  23570. $core.addMethod(
  23571. $core.method({
  23572. selector: "defaultAmdNamespace:",
  23573. protocol: "accessing amd",
  23574. fn: function (aString){
  23575. var self=this,$self=this;
  23576. return $core.withContext(function($ctx1) {
  23577. "transport.defaultAmdNamespace"._settingValue_(aString);
  23578. return self;
  23579. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23580. },
  23581. args: ["aString"],
  23582. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23583. referencedClasses: [],
  23584. messageSends: ["settingValue:"]
  23585. }),
  23586. $globals.SmalltalkImage);
  23587. $core.addMethod(
  23588. $core.method({
  23589. selector: "deleteClass:",
  23590. protocol: "private",
  23591. fn: function (aClass){
  23592. var self=this,$self=this;
  23593. return $core.withContext(function($ctx1) {
  23594. $core.removeClass(aClass);
  23595. return self;
  23596. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23597. },
  23598. args: ["aClass"],
  23599. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  23600. referencedClasses: [],
  23601. messageSends: []
  23602. }),
  23603. $globals.SmalltalkImage);
  23604. $core.addMethod(
  23605. $core.method({
  23606. selector: "deleteGlobalJsVariable:",
  23607. protocol: "globals",
  23608. fn: function (aString){
  23609. var self=this,$self=this;
  23610. return $core.withContext(function($ctx1) {
  23611. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23612. }));
  23613. return self;
  23614. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23615. },
  23616. args: ["aString"],
  23617. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23618. referencedClasses: [],
  23619. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23620. }),
  23621. $globals.SmalltalkImage);
  23622. $core.addMethod(
  23623. $core.method({
  23624. selector: "existsJsGlobal:",
  23625. protocol: "testing",
  23626. fn: function (aString){
  23627. var self=this,$self=this;
  23628. return $core.withContext(function($ctx1) {
  23629. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23630. return $recv($globals.Platform)._includesGlobal_(aString);
  23631. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23632. },
  23633. args: ["aString"],
  23634. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23635. referencedClasses: ["Platform"],
  23636. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23637. }),
  23638. $globals.SmalltalkImage);
  23639. $core.addMethod(
  23640. $core.method({
  23641. selector: "globalJsVariables",
  23642. protocol: "globals",
  23643. fn: function (){
  23644. var self=this,$self=this;
  23645. return $core.withContext(function($ctx1) {
  23646. var $1,$receiver;
  23647. $1=$self["@globalJsVariables"];
  23648. if(($receiver = $1) == null || $receiver.a$nil){
  23649. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23650. return $self["@globalJsVariables"];
  23651. } else {
  23652. return $1;
  23653. }
  23654. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23655. },
  23656. args: [],
  23657. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23658. referencedClasses: [],
  23659. messageSends: ["ifNil:"]
  23660. }),
  23661. $globals.SmalltalkImage);
  23662. $core.addMethod(
  23663. $core.method({
  23664. selector: "globals",
  23665. protocol: "accessing",
  23666. fn: function (){
  23667. var self=this,$self=this;
  23668. return $core.withContext(function($ctx1) {
  23669. return $globals;
  23670. return self;
  23671. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23672. },
  23673. args: [],
  23674. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23675. referencedClasses: [],
  23676. messageSends: []
  23677. }),
  23678. $globals.SmalltalkImage);
  23679. $core.addMethod(
  23680. $core.method({
  23681. selector: "includesKey:",
  23682. protocol: "accessing",
  23683. fn: function (aKey){
  23684. var self=this,$self=this;
  23685. return $core.withContext(function($ctx1) {
  23686. return $core.hasOwnProperty(aKey);
  23687. return self;
  23688. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23689. },
  23690. args: ["aKey"],
  23691. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23692. referencedClasses: [],
  23693. messageSends: []
  23694. }),
  23695. $globals.SmalltalkImage);
  23696. $core.addMethod(
  23697. $core.method({
  23698. selector: "isSmalltalkObject:",
  23699. protocol: "testing",
  23700. fn: function (anObject){
  23701. var self=this,$self=this;
  23702. return $core.withContext(function($ctx1) {
  23703. return anObject.a$cls != null;
  23704. return self;
  23705. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23706. },
  23707. args: ["anObject"],
  23708. source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'a$cls' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<inlineJS: 'return anObject.a$cls != null'>",
  23709. referencedClasses: [],
  23710. messageSends: []
  23711. }),
  23712. $globals.SmalltalkImage);
  23713. $core.addMethod(
  23714. $core.method({
  23715. selector: "optOut:",
  23716. protocol: "accessing",
  23717. fn: function (anObject){
  23718. var self=this,$self=this;
  23719. return $core.withContext(function($ctx1) {
  23720. anObject.klass = null; anObject.a$cls = null;
  23721. return self;
  23722. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23723. },
  23724. args: ["anObject"],
  23725. source: "optOut: anObject\x0a\x09\x22A Smalltalk object has a 'a$cls' property.\x0a\x09This shadows the property for anObject.\x0a\x09The object is treated as plain JS object following this.\x22\x0a\x09\x0a\x09<inlineJS: 'anObject.klass = null; anObject.a$cls = null'>",
  23726. referencedClasses: [],
  23727. messageSends: []
  23728. }),
  23729. $globals.SmalltalkImage);
  23730. $core.addMethod(
  23731. $core.method({
  23732. selector: "packageAt:ifAbsent:",
  23733. protocol: "packages",
  23734. fn: function (packageName,aBlock){
  23735. var self=this,$self=this;
  23736. return $core.withContext(function($ctx1) {
  23737. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23738. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23739. },
  23740. args: ["packageName", "aBlock"],
  23741. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23742. referencedClasses: [],
  23743. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23744. }),
  23745. $globals.SmalltalkImage);
  23746. $core.addMethod(
  23747. $core.method({
  23748. selector: "packageAt:ifPresent:",
  23749. protocol: "packages",
  23750. fn: function (packageName,aBlock){
  23751. var self=this,$self=this;
  23752. return $core.withContext(function($ctx1) {
  23753. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23754. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23755. },
  23756. args: ["packageName", "aBlock"],
  23757. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23758. referencedClasses: [],
  23759. messageSends: ["at:ifPresent:", "packageDictionary"]
  23760. }),
  23761. $globals.SmalltalkImage);
  23762. $core.addMethod(
  23763. $core.method({
  23764. selector: "packageDictionary",
  23765. protocol: "packages",
  23766. fn: function (){
  23767. var self=this,$self=this;
  23768. return $core.withContext(function($ctx1) {
  23769. var $1,$receiver;
  23770. $1=$self["@packageDictionary"];
  23771. if(($receiver = $1) == null || $receiver.a$nil){
  23772. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23773. return $self["@packageDictionary"];
  23774. } else {
  23775. return $1;
  23776. }
  23777. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23778. },
  23779. args: [],
  23780. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23781. referencedClasses: ["Dictionary"],
  23782. messageSends: ["ifNil:", "new"]
  23783. }),
  23784. $globals.SmalltalkImage);
  23785. $core.addMethod(
  23786. $core.method({
  23787. selector: "packages",
  23788. protocol: "packages",
  23789. fn: function (){
  23790. var self=this,$self=this;
  23791. return $core.withContext(function($ctx1) {
  23792. return $recv($recv($self._packageDictionary())._values())._copy();
  23793. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23794. },
  23795. args: [],
  23796. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23797. referencedClasses: [],
  23798. messageSends: ["copy", "values", "packageDictionary"]
  23799. }),
  23800. $globals.SmalltalkImage);
  23801. $core.addMethod(
  23802. $core.method({
  23803. selector: "parse:",
  23804. protocol: "accessing",
  23805. fn: function (aString){
  23806. var self=this,$self=this;
  23807. var result;
  23808. return $core.withContext(function($ctx1) {
  23809. var $1;
  23810. $recv((function(){
  23811. return $core.withContext(function($ctx2) {
  23812. result=$self._basicParse_(aString);
  23813. return result;
  23814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23815. }))._tryCatch_((function(ex){
  23816. return $core.withContext(function($ctx2) {
  23817. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23818. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23819. }));
  23820. $1=result;
  23821. $recv($1)._source_(aString);
  23822. return $recv($1)._yourself();
  23823. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23824. },
  23825. args: ["aString"],
  23826. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  23827. referencedClasses: [],
  23828. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23829. }),
  23830. $globals.SmalltalkImage);
  23831. $core.addMethod(
  23832. $core.method({
  23833. selector: "parseError:parsing:",
  23834. protocol: "error handling",
  23835. fn: function (anException,aString){
  23836. var self=this,$self=this;
  23837. var pos;
  23838. return $core.withContext(function($ctx1) {
  23839. var $1,$2,$3,$7,$6,$5,$4;
  23840. $1=$recv(anException)._isSmalltalkError();
  23841. if($core.assert($1)){
  23842. return $recv(anException)._resignal();
  23843. }
  23844. $2=$recv(anException)._basicAt_("location");
  23845. $ctx1.sendIdx["basicAt:"]=1;
  23846. pos=$recv($2)._start();
  23847. $3=$recv($globals.ParseError)._new();
  23848. $7=$recv("Parse error on line ".__comma($recv(pos)._line())).__comma(" column ");
  23849. $ctx1.sendIdx[","]=4;
  23850. $6=$recv($7).__comma($recv(pos)._column());
  23851. $ctx1.sendIdx[","]=3;
  23852. $5=$recv($6).__comma(" : Unexpected character ");
  23853. $ctx1.sendIdx[","]=2;
  23854. $4=$recv($5).__comma($recv(anException)._basicAt_("found"));
  23855. $ctx1.sendIdx[","]=1;
  23856. return $recv($3)._messageText_($4);
  23857. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString,pos:pos},$globals.SmalltalkImage)});
  23858. },
  23859. args: ["anException", "aString"],
  23860. source: "parseError: anException parsing: aString\x0a\x09| pos |\x0a\x09anException isSmalltalkError ifTrue: [ ^ anException resignal ].\x0a\x09pos := (anException basicAt: 'location') start.\x0a\x09^ ParseError new messageText: 'Parse error on line ', pos line ,' column ' , pos column ,' : Unexpected character ', (anException basicAt: 'found')",
  23861. referencedClasses: ["ParseError"],
  23862. messageSends: ["ifTrue:", "isSmalltalkError", "resignal", "start", "basicAt:", "messageText:", "new", ",", "line", "column"]
  23863. }),
  23864. $globals.SmalltalkImage);
  23865. $core.addMethod(
  23866. $core.method({
  23867. selector: "postLoad",
  23868. protocol: "image",
  23869. fn: function (){
  23870. var self=this,$self=this;
  23871. var pkgs,classes;
  23872. return $core.withContext(function($ctx1) {
  23873. var $1;
  23874. pkgs=$self._adoptPackageDescriptors();
  23875. $recv(pkgs)._do_("beClean");
  23876. $ctx1.sendIdx["do:"]=1;
  23877. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  23878. return $core.withContext(function($ctx2) {
  23879. return $recv(pkgs)._includes_($recv(each)._package());
  23880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23881. }));
  23882. $recv(classes)._do_((function(each){
  23883. return $core.withContext(function($ctx2) {
  23884. $1=$recv(each).__eq($self._class());
  23885. if(!$core.assert($1)){
  23886. return $recv(each)._initialize();
  23887. }
  23888. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23889. }));
  23890. $self._sweepPackageDescriptors_(pkgs);
  23891. return self;
  23892. }, function($ctx1) {$ctx1.fill(self,"postLoad",{pkgs:pkgs,classes:classes},$globals.SmalltalkImage)});
  23893. },
  23894. args: [],
  23895. source: "postLoad\x0a\x09| pkgs classes |\x0a\x09pkgs := self adoptPackageDescriptors.\x0a\x09pkgs do: #beClean.\x0a\x09classes := Smalltalk classes select:\x0a\x09\x09[ :each | pkgs includes: each package ].\x0a\x09classes do: [ :each |\x0a\x09\x09each = self class ifFalse: [ each initialize ] ].\x0a\x09self sweepPackageDescriptors: pkgs",
  23896. referencedClasses: ["Smalltalk"],
  23897. messageSends: ["adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  23898. }),
  23899. $globals.SmalltalkImage);
  23900. $core.addMethod(
  23901. $core.method({
  23902. selector: "pseudoVariableNames",
  23903. protocol: "accessing",
  23904. fn: function (){
  23905. var self=this,$self=this;
  23906. return ["self", "super", "nil", "true", "false", "thisContext"];
  23907. },
  23908. args: [],
  23909. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23910. referencedClasses: [],
  23911. messageSends: []
  23912. }),
  23913. $globals.SmalltalkImage);
  23914. $core.addMethod(
  23915. $core.method({
  23916. selector: "readJSObject:",
  23917. protocol: "accessing",
  23918. fn: function (anObject){
  23919. var self=this,$self=this;
  23920. return $core.withContext(function($ctx1) {
  23921. return $core.readJSObject(anObject);
  23922. return self;
  23923. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23924. },
  23925. args: ["anObject"],
  23926. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23927. referencedClasses: [],
  23928. messageSends: []
  23929. }),
  23930. $globals.SmalltalkImage);
  23931. $core.addMethod(
  23932. $core.method({
  23933. selector: "removeClass:",
  23934. protocol: "classes",
  23935. fn: function (aClass){
  23936. var self=this,$self=this;
  23937. return $core.withContext(function($ctx1) {
  23938. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23939. $1=$recv(aClass)._isMetaclass();
  23940. if($core.assert($1)){
  23941. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23942. $ctx1.sendIdx[","]=1;
  23943. $self._error_($2);
  23944. $ctx1.sendIdx["error:"]=1;
  23945. }
  23946. $recv(aClass)._allSubclassesDo_((function(subclass){
  23947. return $core.withContext(function($ctx2) {
  23948. $5=$recv(aClass)._name();
  23949. $ctx2.sendIdx["name"]=1;
  23950. $4=$recv($5).__comma(" has a subclass: ");
  23951. $ctx2.sendIdx[","]=3;
  23952. $6=$recv(subclass)._name();
  23953. $ctx2.sendIdx["name"]=2;
  23954. $3=$recv($4).__comma($6);
  23955. $ctx2.sendIdx[","]=2;
  23956. return $self._error_($3);
  23957. $ctx2.sendIdx["error:"]=2;
  23958. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23959. }));
  23960. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23961. return $core.withContext(function($ctx2) {
  23962. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23964. }));
  23965. $self._deleteClass_(aClass);
  23966. $recv(aClass)._setTraitComposition_([]);
  23967. $ctx1.sendIdx["setTraitComposition:"]=1;
  23968. $7=$recv(aClass)._theMetaClass();
  23969. if(($receiver = $7) == null || $receiver.a$nil){
  23970. $7;
  23971. } else {
  23972. var meta;
  23973. meta=$receiver;
  23974. $recv(meta)._setTraitComposition_([]);
  23975. }
  23976. $8=$recv($globals.SystemAnnouncer)._current();
  23977. $10=$recv($globals.ClassRemoved)._new();
  23978. $recv($10)._theClass_(aClass);
  23979. $9=$recv($10)._yourself();
  23980. $recv($8)._announce_($9);
  23981. return self;
  23982. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23983. },
  23984. args: ["aClass"],
  23985. source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09aClass allSubclassesDo: [ :subclass | self error: aClass name, ' has a subclass: ', subclass name ].\x0a\x09aClass traitUsers ifNotEmpty: [ self error: aClass name, ' has trait users.' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09aClass setTraitComposition: #().\x0a\x09aClass theMetaClass ifNotNil: [ :meta | meta setTraitComposition: #() ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  23986. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  23987. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  23988. }),
  23989. $globals.SmalltalkImage);
  23990. $core.addMethod(
  23991. $core.method({
  23992. selector: "removePackage:",
  23993. protocol: "packages",
  23994. fn: function (packageName){
  23995. var self=this,$self=this;
  23996. var pkg;
  23997. return $core.withContext(function($ctx1) {
  23998. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  23999. return $core.withContext(function($ctx2) {
  24000. return $self._error_("Missing package: ".__comma(packageName));
  24001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24002. }));
  24003. $recv($recv(pkg)._classes())._do_((function(each){
  24004. return $core.withContext(function($ctx2) {
  24005. return $self._removeClass_(each);
  24006. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24007. }));
  24008. $recv($self._packageDictionary())._removeKey_(packageName);
  24009. return self;
  24010. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  24011. },
  24012. args: ["packageName"],
  24013. source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self packageDictionary removeKey: packageName",
  24014. referencedClasses: [],
  24015. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  24016. }),
  24017. $globals.SmalltalkImage);
  24018. $core.addMethod(
  24019. $core.method({
  24020. selector: "renamePackage:to:",
  24021. protocol: "packages",
  24022. fn: function (packageName,newName){
  24023. var self=this,$self=this;
  24024. var pkg;
  24025. return $core.withContext(function($ctx1) {
  24026. var $1,$2,$3;
  24027. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24028. return $core.withContext(function($ctx2) {
  24029. $1="Missing package: ".__comma(packageName);
  24030. $ctx2.sendIdx[","]=1;
  24031. return $self._error_($1);
  24032. $ctx2.sendIdx["error:"]=1;
  24033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24034. }));
  24035. $self._packageAt_ifPresent_(newName,(function(){
  24036. return $core.withContext(function($ctx2) {
  24037. return $self._error_("Already exists a package called: ".__comma(newName));
  24038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  24039. }));
  24040. $2=pkg;
  24041. $recv($2)._name_(newName);
  24042. $recv($2)._beDirty();
  24043. $3=$self._packageDictionary();
  24044. $recv($3)._at_put_(newName,pkg);
  24045. $recv($3)._removeKey_(packageName);
  24046. return self;
  24047. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24048. },
  24049. args: ["packageName", "newName"],
  24050. source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09self packageAt: newName ifPresent: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName; beDirty.\x0a\x09self packageDictionary\x0a\x09\x09at: newName put: pkg;\x0a\x09\x09removeKey: packageName",
  24051. referencedClasses: [],
  24052. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24053. }),
  24054. $globals.SmalltalkImage);
  24055. $core.addMethod(
  24056. $core.method({
  24057. selector: "reservedWords",
  24058. protocol: "accessing",
  24059. fn: function (){
  24060. var self=this,$self=this;
  24061. return ["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "export", "extends", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "return", "super", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with", "yield", "let", "static", "arguments", "await", "enum", "implements", "interface", "package", "private", "protected", "public"];
  24062. },
  24063. args: [],
  24064. source: "reservedWords\x0a\x09^ #(\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-keywords\x22\x0a\x09\x09break case catch class const continue debugger\x0a\x09\x09default delete do else export extends finally\x0a\x09\x09for function if import in instanceof new\x0a\x09\x09return super switch this throw try typeof\x0a\x09\x09var void while with yield\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09let static\x0a\x09\x09\x22Amber protected words: these should not be compiled as-is when in code\x22\x0a\x09\x09arguments\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words\x22\x0a\x09\x09await enum\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09implements interface package private protected public\x0a\x09)",
  24065. referencedClasses: [],
  24066. messageSends: []
  24067. }),
  24068. $globals.SmalltalkImage);
  24069. $core.addMethod(
  24070. $core.method({
  24071. selector: "settings",
  24072. protocol: "accessing",
  24073. fn: function (){
  24074. var self=this,$self=this;
  24075. return $globals.SmalltalkSettings;
  24076. },
  24077. args: [],
  24078. source: "settings\x0a\x09^ SmalltalkSettings",
  24079. referencedClasses: ["SmalltalkSettings"],
  24080. messageSends: []
  24081. }),
  24082. $globals.SmalltalkImage);
  24083. $core.addMethod(
  24084. $core.method({
  24085. selector: "sweepPackageDescriptors:",
  24086. protocol: "private",
  24087. fn: function (pkgs){
  24088. var self=this,$self=this;
  24089. var pd;
  24090. return $core.withContext(function($ctx1) {
  24091. pd=$recv($self._core())._packageDescriptors();
  24092. $recv(pkgs)._do_((function(each){
  24093. return $core.withContext(function($ctx2) {
  24094. return $recv(pd)._removeKey_($recv(each)._name());
  24095. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24096. }));
  24097. return self;
  24098. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  24099. },
  24100. args: ["pkgs"],
  24101. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  24102. referencedClasses: [],
  24103. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  24104. }),
  24105. $globals.SmalltalkImage);
  24106. $core.addMethod(
  24107. $core.method({
  24108. selector: "version",
  24109. protocol: "accessing",
  24110. fn: function (){
  24111. var self=this,$self=this;
  24112. return "0.22.0-pre";
  24113. },
  24114. args: [],
  24115. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.22.0-pre'",
  24116. referencedClasses: [],
  24117. messageSends: []
  24118. }),
  24119. $globals.SmalltalkImage);
  24120. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24121. $core.addMethod(
  24122. $core.method({
  24123. selector: "current",
  24124. protocol: "instance creation",
  24125. fn: function (){
  24126. var self=this,$self=this;
  24127. return $core.withContext(function($ctx1) {
  24128. var $1,$receiver;
  24129. $1=$self["@current"];
  24130. if(($receiver = $1) == null || $receiver.a$nil){
  24131. $self["@current"]=(
  24132. $ctx1.supercall = true,
  24133. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24134. $ctx1.supercall = false;
  24135. return $self["@current"];
  24136. } else {
  24137. $self._deprecatedAPI();
  24138. return $self["@current"];
  24139. }
  24140. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24141. },
  24142. args: [],
  24143. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24144. referencedClasses: [],
  24145. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24146. }),
  24147. $globals.SmalltalkImage.a$cls);
  24148. $core.addMethod(
  24149. $core.method({
  24150. selector: "initialize",
  24151. protocol: "initialization",
  24152. fn: function (){
  24153. var self=this,$self=this;
  24154. var st;
  24155. return $core.withContext(function($ctx1) {
  24156. st=$self._current();
  24157. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24158. return self;
  24159. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24160. },
  24161. args: [],
  24162. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24163. referencedClasses: [],
  24164. messageSends: ["current", "at:put:", "globals"]
  24165. }),
  24166. $globals.SmalltalkImage.a$cls);
  24167. $core.addMethod(
  24168. $core.method({
  24169. selector: "new",
  24170. protocol: "instance creation",
  24171. fn: function (){
  24172. var self=this,$self=this;
  24173. return $core.withContext(function($ctx1) {
  24174. $self._shouldNotImplement();
  24175. return self;
  24176. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24177. },
  24178. args: [],
  24179. source: "new\x0a\x09self shouldNotImplement",
  24180. referencedClasses: [],
  24181. messageSends: ["shouldNotImplement"]
  24182. }),
  24183. $globals.SmalltalkImage.a$cls);
  24184. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24185. $core.addMethod(
  24186. $core.method({
  24187. selector: "nextPutJSObject:",
  24188. protocol: "*Kernel-Infrastructure",
  24189. fn: function (aJSObject){
  24190. var self=this,$self=this;
  24191. return $core.withContext(function($ctx1) {
  24192. $self._nextPut_(aJSObject);
  24193. return self;
  24194. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24195. },
  24196. args: ["aJSObject"],
  24197. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24198. referencedClasses: [],
  24199. messageSends: ["nextPut:"]
  24200. }),
  24201. $globals.ProtoStream);
  24202. $core.addMethod(
  24203. $core.method({
  24204. selector: "asJavaScriptPropertyName",
  24205. protocol: "*Kernel-Infrastructure",
  24206. fn: function (){
  24207. var self=this,$self=this;
  24208. return $core.withContext(function($ctx1) {
  24209. return $core.st2prop(self);
  24210. return self;
  24211. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24212. },
  24213. args: [],
  24214. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24215. referencedClasses: [],
  24216. messageSends: []
  24217. }),
  24218. $globals.String);
  24219. $core.addMethod(
  24220. $core.method({
  24221. selector: "asSetting",
  24222. protocol: "*Kernel-Infrastructure",
  24223. fn: function (){
  24224. var self=this,$self=this;
  24225. return $core.withContext(function($ctx1) {
  24226. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24227. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24228. },
  24229. args: [],
  24230. source: "asSetting\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Nil will be the default value.\x22\x0a\x09^ Setting at: self ifAbsent: nil",
  24231. referencedClasses: ["Setting"],
  24232. messageSends: ["at:ifAbsent:"]
  24233. }),
  24234. $globals.String);
  24235. $core.addMethod(
  24236. $core.method({
  24237. selector: "asSettingIfAbsent:",
  24238. protocol: "*Kernel-Infrastructure",
  24239. fn: function (aDefaultValue){
  24240. var self=this,$self=this;
  24241. return $core.withContext(function($ctx1) {
  24242. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24243. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24244. },
  24245. args: ["aDefaultValue"],
  24246. source: "asSettingIfAbsent: aDefaultValue\x0a\x09\x22Answer aSetting dedicated to locally store a value using this string as key.\x0a\x09Make this setting to have aDefaultValue.\x22\x0a\x09^ Setting at: self ifAbsent: aDefaultValue",
  24247. referencedClasses: ["Setting"],
  24248. messageSends: ["at:ifAbsent:"]
  24249. }),
  24250. $globals.String);
  24251. $core.addMethod(
  24252. $core.method({
  24253. selector: "settingValue",
  24254. protocol: "*Kernel-Infrastructure",
  24255. fn: function (){
  24256. var self=this,$self=this;
  24257. return $core.withContext(function($ctx1) {
  24258. return $recv($self._asSetting())._value();
  24259. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24260. },
  24261. args: [],
  24262. source: "settingValue\x0a\x09^ self asSetting value",
  24263. referencedClasses: [],
  24264. messageSends: ["value", "asSetting"]
  24265. }),
  24266. $globals.String);
  24267. $core.addMethod(
  24268. $core.method({
  24269. selector: "settingValue:",
  24270. protocol: "*Kernel-Infrastructure",
  24271. fn: function (aValue){
  24272. var self=this,$self=this;
  24273. return $core.withContext(function($ctx1) {
  24274. return $recv($self._asSetting())._value_(aValue);
  24275. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24276. },
  24277. args: ["aValue"],
  24278. source: "settingValue: aValue\x0a\x09\x22Sets the value of the setting that will be locally stored using this string as key.\x0a\x09Note that aValue can be any object that can be stringifyed\x22\x0a\x09^ self asSetting value: aValue",
  24279. referencedClasses: [],
  24280. messageSends: ["value:", "asSetting"]
  24281. }),
  24282. $globals.String);
  24283. $core.addMethod(
  24284. $core.method({
  24285. selector: "settingValueIfAbsent:",
  24286. protocol: "*Kernel-Infrastructure",
  24287. fn: function (aDefaultValue){
  24288. var self=this,$self=this;
  24289. return $core.withContext(function($ctx1) {
  24290. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24291. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24292. },
  24293. args: ["aDefaultValue"],
  24294. source: "settingValueIfAbsent: aDefaultValue\x0a\x09\x22Answer the value of the locally stored setting using this string as key.\x0a\x09Use aDefaultValue in case no setting is found\x22\x0a\x09^ (self asSettingIfAbsent: aDefaultValue) value",
  24295. referencedClasses: [],
  24296. messageSends: ["value", "asSettingIfAbsent:"]
  24297. }),
  24298. $globals.String);
  24299. });
  24300. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24301. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24302. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24303. $core.addPackage("Kernel-Announcements");
  24304. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  24305. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24306. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24307. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24308. $core.addMethod(
  24309. $core.method({
  24310. selector: "announcementClass",
  24311. protocol: "accessing",
  24312. fn: function (){
  24313. var self=this,$self=this;
  24314. return $self["@announcementClass"];
  24315. },
  24316. args: [],
  24317. source: "announcementClass\x0a\x09^ announcementClass",
  24318. referencedClasses: [],
  24319. messageSends: []
  24320. }),
  24321. $globals.AnnouncementSubscription);
  24322. $core.addMethod(
  24323. $core.method({
  24324. selector: "announcementClass:",
  24325. protocol: "accessing",
  24326. fn: function (aClass){
  24327. var self=this,$self=this;
  24328. $self["@announcementClass"]=aClass;
  24329. return self;
  24330. },
  24331. args: ["aClass"],
  24332. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  24333. referencedClasses: [],
  24334. messageSends: []
  24335. }),
  24336. $globals.AnnouncementSubscription);
  24337. $core.addMethod(
  24338. $core.method({
  24339. selector: "deliver:",
  24340. protocol: "announcing",
  24341. fn: function (anAnnouncement){
  24342. var self=this,$self=this;
  24343. return $core.withContext(function($ctx1) {
  24344. var $1;
  24345. $1=$self._handlesAnnouncement_(anAnnouncement);
  24346. if($core.assert($1)){
  24347. $recv($self._valuable())._value_(anAnnouncement);
  24348. }
  24349. return self;
  24350. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24351. },
  24352. args: ["anAnnouncement"],
  24353. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24354. referencedClasses: [],
  24355. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24356. }),
  24357. $globals.AnnouncementSubscription);
  24358. $core.addMethod(
  24359. $core.method({
  24360. selector: "handlesAnnouncement:",
  24361. protocol: "announcing",
  24362. fn: function (anAnnouncement){
  24363. var self=this,$self=this;
  24364. return $core.withContext(function($ctx1) {
  24365. var $2,$3,$1,$receiver;
  24366. $2=$recv($globals.Smalltalk)._globals();
  24367. $ctx1.sendIdx["globals"]=1;
  24368. $3=$recv($self._announcementClass())._name();
  24369. $ctx1.sendIdx["name"]=1;
  24370. $1=$recv($2)._at_($3);
  24371. $ctx1.sendIdx["at:"]=1;
  24372. if(($receiver = $1) == null || $receiver.a$nil){
  24373. return false;
  24374. } else {
  24375. var class_;
  24376. class_=$receiver;
  24377. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  24378. }
  24379. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24380. },
  24381. args: ["anAnnouncement"],
  24382. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  24383. referencedClasses: ["Smalltalk"],
  24384. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  24385. }),
  24386. $globals.AnnouncementSubscription);
  24387. $core.addMethod(
  24388. $core.method({
  24389. selector: "receiver",
  24390. protocol: "accessing",
  24391. fn: function (){
  24392. var self=this,$self=this;
  24393. return $core.withContext(function($ctx1) {
  24394. return $recv($self._valuable())._receiver();
  24395. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24396. },
  24397. args: [],
  24398. source: "receiver\x0a\x09^ self valuable receiver",
  24399. referencedClasses: [],
  24400. messageSends: ["receiver", "valuable"]
  24401. }),
  24402. $globals.AnnouncementSubscription);
  24403. $core.addMethod(
  24404. $core.method({
  24405. selector: "valuable",
  24406. protocol: "accessing",
  24407. fn: function (){
  24408. var self=this,$self=this;
  24409. return $self["@valuable"];
  24410. },
  24411. args: [],
  24412. source: "valuable\x0a\x09^ valuable",
  24413. referencedClasses: [],
  24414. messageSends: []
  24415. }),
  24416. $globals.AnnouncementSubscription);
  24417. $core.addMethod(
  24418. $core.method({
  24419. selector: "valuable:",
  24420. protocol: "accessing",
  24421. fn: function (aValuable){
  24422. var self=this,$self=this;
  24423. $self["@valuable"]=aValuable;
  24424. return self;
  24425. },
  24426. args: ["aValuable"],
  24427. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24428. referencedClasses: [],
  24429. messageSends: []
  24430. }),
  24431. $globals.AnnouncementSubscription);
  24432. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24433. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24434. $core.addMethod(
  24435. $core.method({
  24436. selector: "receiver",
  24437. protocol: "accessing",
  24438. fn: function (){
  24439. var self=this,$self=this;
  24440. return $self["@receiver"];
  24441. },
  24442. args: [],
  24443. source: "receiver\x0a\x09^ receiver",
  24444. referencedClasses: [],
  24445. messageSends: []
  24446. }),
  24447. $globals.AnnouncementValuable);
  24448. $core.addMethod(
  24449. $core.method({
  24450. selector: "receiver:",
  24451. protocol: "accessing",
  24452. fn: function (anObject){
  24453. var self=this,$self=this;
  24454. $self["@receiver"]=anObject;
  24455. return self;
  24456. },
  24457. args: ["anObject"],
  24458. source: "receiver: anObject\x0a\x09receiver := anObject",
  24459. referencedClasses: [],
  24460. messageSends: []
  24461. }),
  24462. $globals.AnnouncementValuable);
  24463. $core.addMethod(
  24464. $core.method({
  24465. selector: "valuable",
  24466. protocol: "accessing",
  24467. fn: function (){
  24468. var self=this,$self=this;
  24469. return $self["@valuable"];
  24470. },
  24471. args: [],
  24472. source: "valuable\x0a\x09^ valuable",
  24473. referencedClasses: [],
  24474. messageSends: []
  24475. }),
  24476. $globals.AnnouncementValuable);
  24477. $core.addMethod(
  24478. $core.method({
  24479. selector: "valuable:",
  24480. protocol: "accessing",
  24481. fn: function (anObject){
  24482. var self=this,$self=this;
  24483. $self["@valuable"]=anObject;
  24484. return self;
  24485. },
  24486. args: ["anObject"],
  24487. source: "valuable: anObject\x0a\x09valuable := anObject",
  24488. referencedClasses: [],
  24489. messageSends: []
  24490. }),
  24491. $globals.AnnouncementValuable);
  24492. $core.addMethod(
  24493. $core.method({
  24494. selector: "value",
  24495. protocol: "evaluating",
  24496. fn: function (){
  24497. var self=this,$self=this;
  24498. return $core.withContext(function($ctx1) {
  24499. return $recv($self._valuable())._value();
  24500. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24501. },
  24502. args: [],
  24503. source: "value\x0a\x09^ self valuable value",
  24504. referencedClasses: [],
  24505. messageSends: ["value", "valuable"]
  24506. }),
  24507. $globals.AnnouncementValuable);
  24508. $core.addMethod(
  24509. $core.method({
  24510. selector: "value:",
  24511. protocol: "evaluating",
  24512. fn: function (anObject){
  24513. var self=this,$self=this;
  24514. return $core.withContext(function($ctx1) {
  24515. return $recv($self._valuable())._value_(anObject);
  24516. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24517. },
  24518. args: ["anObject"],
  24519. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24520. referencedClasses: [],
  24521. messageSends: ["value:", "valuable"]
  24522. }),
  24523. $globals.AnnouncementValuable);
  24524. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24525. $globals.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a SystemAnnouncer current\x0a on: ClassAdded\x0a do: [ :ann | window alert: ann theClass name, ' added' ].";
  24526. $core.addMethod(
  24527. $core.method({
  24528. selector: "announce:",
  24529. protocol: "announcing",
  24530. fn: function (anAnnouncement){
  24531. var self=this,$self=this;
  24532. return $core.withContext(function($ctx1) {
  24533. $recv($self["@subscriptions"])._do_((function(each){
  24534. return $core.withContext(function($ctx2) {
  24535. return $recv(each)._deliver_(anAnnouncement);
  24536. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24537. }));
  24538. return self;
  24539. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24540. },
  24541. args: ["anAnnouncement"],
  24542. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24543. referencedClasses: [],
  24544. messageSends: ["do:", "deliver:"]
  24545. }),
  24546. $globals.Announcer);
  24547. $core.addMethod(
  24548. $core.method({
  24549. selector: "initialize",
  24550. protocol: "initialization",
  24551. fn: function (){
  24552. var self=this,$self=this;
  24553. return $core.withContext(function($ctx1) {
  24554. (
  24555. $ctx1.supercall = true,
  24556. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24557. $ctx1.supercall = false;
  24558. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24559. return self;
  24560. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24561. },
  24562. args: [],
  24563. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24564. referencedClasses: ["OrderedCollection"],
  24565. messageSends: ["initialize", "new"]
  24566. }),
  24567. $globals.Announcer);
  24568. $core.addMethod(
  24569. $core.method({
  24570. selector: "on:do:",
  24571. protocol: "subscribing",
  24572. fn: function (aClass,aBlock){
  24573. var self=this,$self=this;
  24574. return $core.withContext(function($ctx1) {
  24575. $self._on_do_for_(aClass,aBlock,nil);
  24576. return self;
  24577. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24578. },
  24579. args: ["aClass", "aBlock"],
  24580. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24581. referencedClasses: [],
  24582. messageSends: ["on:do:for:"]
  24583. }),
  24584. $globals.Announcer);
  24585. $core.addMethod(
  24586. $core.method({
  24587. selector: "on:do:for:",
  24588. protocol: "subscribing",
  24589. fn: function (aClass,aBlock,aReceiver){
  24590. var self=this,$self=this;
  24591. return $core.withContext(function($ctx1) {
  24592. var $1,$3,$5,$6,$4,$2;
  24593. $1=$self["@subscriptions"];
  24594. $3=$recv($globals.AnnouncementSubscription)._new();
  24595. $ctx1.sendIdx["new"]=1;
  24596. $5=$recv($globals.AnnouncementValuable)._new();
  24597. $recv($5)._valuable_(aBlock);
  24598. $recv($5)._receiver_(aReceiver);
  24599. $6=$recv($5)._yourself();
  24600. $ctx1.sendIdx["yourself"]=1;
  24601. $4=$6;
  24602. $recv($3)._valuable_($4);
  24603. $ctx1.sendIdx["valuable:"]=1;
  24604. $recv($3)._announcementClass_(aClass);
  24605. $2=$recv($3)._yourself();
  24606. $recv($1)._add_($2);
  24607. return self;
  24608. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24609. },
  24610. args: ["aClass", "aBlock", "aReceiver"],
  24611. source: "on: aClass do: aBlock for: aReceiver\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (AnnouncementValuable new\x0a\x09\x09\x09valuable: aBlock;\x0a\x09\x09\x09receiver: aReceiver;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  24612. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24613. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24614. }),
  24615. $globals.Announcer);
  24616. $core.addMethod(
  24617. $core.method({
  24618. selector: "on:doOnce:",
  24619. protocol: "subscribing",
  24620. fn: function (aClass,aBlock){
  24621. var self=this,$self=this;
  24622. var subscription;
  24623. return $core.withContext(function($ctx1) {
  24624. var $1;
  24625. $1=$recv($globals.AnnouncementSubscription)._new();
  24626. $recv($1)._announcementClass_(aClass);
  24627. subscription=$recv($1)._yourself();
  24628. $recv(subscription)._valuable_((function(ann){
  24629. return $core.withContext(function($ctx2) {
  24630. $recv($self["@subscriptions"])._remove_(subscription);
  24631. return $recv(aBlock)._value_(ann);
  24632. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24633. }));
  24634. $recv($self["@subscriptions"])._add_(subscription);
  24635. return self;
  24636. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24637. },
  24638. args: ["aClass", "aBlock"],
  24639. source: "on: aClass doOnce: aBlock\x0a\x09| subscription |\x0a\x09\x0a\x09subscription := AnnouncementSubscription new\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself.\x0a\x09subscription valuable: [ :ann |\x0a\x09\x09subscriptions remove: subscription.\x0a\x09\x09aBlock value: ann ].\x0a\x0a\x09subscriptions add: subscription",
  24640. referencedClasses: ["AnnouncementSubscription"],
  24641. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24642. }),
  24643. $globals.Announcer);
  24644. $core.addMethod(
  24645. $core.method({
  24646. selector: "on:send:to:",
  24647. protocol: "subscribing",
  24648. fn: function (aClass,aSelector,anObject){
  24649. var self=this,$self=this;
  24650. return $core.withContext(function($ctx1) {
  24651. var $1,$3,$5,$6,$4,$2;
  24652. $1=$self["@subscriptions"];
  24653. $3=$recv($globals.AnnouncementSubscription)._new();
  24654. $ctx1.sendIdx["new"]=1;
  24655. $5=$recv($globals.MessageSend)._new();
  24656. $recv($5)._receiver_(anObject);
  24657. $recv($5)._selector_(aSelector);
  24658. $6=$recv($5)._yourself();
  24659. $ctx1.sendIdx["yourself"]=1;
  24660. $4=$6;
  24661. $recv($3)._valuable_($4);
  24662. $recv($3)._announcementClass_(aClass);
  24663. $2=$recv($3)._yourself();
  24664. $recv($1)._add_($2);
  24665. return self;
  24666. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24667. },
  24668. args: ["aClass", "aSelector", "anObject"],
  24669. source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  24670. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24671. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24672. }),
  24673. $globals.Announcer);
  24674. $core.addMethod(
  24675. $core.method({
  24676. selector: "unsubscribe:",
  24677. protocol: "subscribing",
  24678. fn: function (anObject){
  24679. var self=this,$self=this;
  24680. return $core.withContext(function($ctx1) {
  24681. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24682. return $core.withContext(function($ctx2) {
  24683. return $recv($recv(each)._receiver()).__eq(anObject);
  24684. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24685. }));
  24686. return self;
  24687. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24688. },
  24689. args: ["anObject"],
  24690. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24691. referencedClasses: [],
  24692. messageSends: ["reject:", "=", "receiver"]
  24693. }),
  24694. $globals.Announcer);
  24695. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24696. $globals.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`";
  24697. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24698. $core.addMethod(
  24699. $core.method({
  24700. selector: "current",
  24701. protocol: "accessing",
  24702. fn: function (){
  24703. var self=this,$self=this;
  24704. return $core.withContext(function($ctx1) {
  24705. var $1,$receiver;
  24706. $1=$self["@current"];
  24707. if(($receiver = $1) == null || $receiver.a$nil){
  24708. $self["@current"]=(
  24709. $ctx1.supercall = true,
  24710. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24711. $ctx1.supercall = false;
  24712. return $self["@current"];
  24713. } else {
  24714. return $1;
  24715. }
  24716. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24717. },
  24718. args: [],
  24719. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24720. referencedClasses: [],
  24721. messageSends: ["ifNil:", "new"]
  24722. }),
  24723. $globals.SystemAnnouncer.a$cls);
  24724. $core.addMethod(
  24725. $core.method({
  24726. selector: "new",
  24727. protocol: "instance creation",
  24728. fn: function (){
  24729. var self=this,$self=this;
  24730. return $core.withContext(function($ctx1) {
  24731. $self._shouldNotImplement();
  24732. return self;
  24733. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24734. },
  24735. args: [],
  24736. source: "new\x0a\x09self shouldNotImplement",
  24737. referencedClasses: [],
  24738. messageSends: ["shouldNotImplement"]
  24739. }),
  24740. $globals.SystemAnnouncer.a$cls);
  24741. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24742. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24743. $core.addMethod(
  24744. $core.method({
  24745. selector: "classTag",
  24746. protocol: "accessing",
  24747. fn: function (){
  24748. var self=this,$self=this;
  24749. return "announcement";
  24750. },
  24751. args: [],
  24752. 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^ 'announcement'",
  24753. referencedClasses: [],
  24754. messageSends: []
  24755. }),
  24756. $globals.SystemAnnouncement.a$cls);
  24757. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24758. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24759. $core.addMethod(
  24760. $core.method({
  24761. selector: "theClass",
  24762. protocol: "accessing",
  24763. fn: function (){
  24764. var self=this,$self=this;
  24765. return $self["@theClass"];
  24766. },
  24767. args: [],
  24768. source: "theClass\x0a\x09^ theClass",
  24769. referencedClasses: [],
  24770. messageSends: []
  24771. }),
  24772. $globals.ClassAnnouncement);
  24773. $core.addMethod(
  24774. $core.method({
  24775. selector: "theClass:",
  24776. protocol: "accessing",
  24777. fn: function (aClass){
  24778. var self=this,$self=this;
  24779. $self["@theClass"]=aClass;
  24780. return self;
  24781. },
  24782. args: ["aClass"],
  24783. source: "theClass: aClass\x0a\x09theClass := aClass",
  24784. referencedClasses: [],
  24785. messageSends: []
  24786. }),
  24787. $globals.ClassAnnouncement);
  24788. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24789. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24790. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24791. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24792. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24793. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24794. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24795. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24796. $core.addMethod(
  24797. $core.method({
  24798. selector: "oldClass",
  24799. protocol: "accessing",
  24800. fn: function (){
  24801. var self=this,$self=this;
  24802. return $self["@oldClass"];
  24803. },
  24804. args: [],
  24805. source: "oldClass\x0a\x09^ oldClass",
  24806. referencedClasses: [],
  24807. messageSends: []
  24808. }),
  24809. $globals.ClassMigrated);
  24810. $core.addMethod(
  24811. $core.method({
  24812. selector: "oldClass:",
  24813. protocol: "accessing",
  24814. fn: function (aClass){
  24815. var self=this,$self=this;
  24816. $self["@oldClass"]=aClass;
  24817. return self;
  24818. },
  24819. args: ["aClass"],
  24820. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24821. referencedClasses: [],
  24822. messageSends: []
  24823. }),
  24824. $globals.ClassMigrated);
  24825. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24826. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24827. $core.addMethod(
  24828. $core.method({
  24829. selector: "oldPackage",
  24830. protocol: "accessing",
  24831. fn: function (){
  24832. var self=this,$self=this;
  24833. return $self["@oldPackage"];
  24834. },
  24835. args: [],
  24836. source: "oldPackage\x0a\x09^ oldPackage",
  24837. referencedClasses: [],
  24838. messageSends: []
  24839. }),
  24840. $globals.ClassMoved);
  24841. $core.addMethod(
  24842. $core.method({
  24843. selector: "oldPackage:",
  24844. protocol: "accessing",
  24845. fn: function (aPackage){
  24846. var self=this,$self=this;
  24847. $self["@oldPackage"]=aPackage;
  24848. return self;
  24849. },
  24850. args: ["aPackage"],
  24851. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24852. referencedClasses: [],
  24853. messageSends: []
  24854. }),
  24855. $globals.ClassMoved);
  24856. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24857. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24858. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24859. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24860. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24861. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24862. $core.addMethod(
  24863. $core.method({
  24864. selector: "method",
  24865. protocol: "accessing",
  24866. fn: function (){
  24867. var self=this,$self=this;
  24868. return $self["@method"];
  24869. },
  24870. args: [],
  24871. source: "method\x0a\x09^ method",
  24872. referencedClasses: [],
  24873. messageSends: []
  24874. }),
  24875. $globals.MethodAnnouncement);
  24876. $core.addMethod(
  24877. $core.method({
  24878. selector: "method:",
  24879. protocol: "accessing",
  24880. fn: function (aCompiledMethod){
  24881. var self=this,$self=this;
  24882. $self["@method"]=aCompiledMethod;
  24883. return self;
  24884. },
  24885. args: ["aCompiledMethod"],
  24886. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24887. referencedClasses: [],
  24888. messageSends: []
  24889. }),
  24890. $globals.MethodAnnouncement);
  24891. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24892. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24893. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24894. $globals.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced.";
  24895. $core.addMethod(
  24896. $core.method({
  24897. selector: "oldMethod",
  24898. protocol: "accessing",
  24899. fn: function (){
  24900. var self=this,$self=this;
  24901. return $self["@oldMethod"];
  24902. },
  24903. args: [],
  24904. source: "oldMethod\x0a\x09^ oldMethod",
  24905. referencedClasses: [],
  24906. messageSends: []
  24907. }),
  24908. $globals.MethodModified);
  24909. $core.addMethod(
  24910. $core.method({
  24911. selector: "oldMethod:",
  24912. protocol: "accessing",
  24913. fn: function (aMethod){
  24914. var self=this,$self=this;
  24915. $self["@oldMethod"]=aMethod;
  24916. return self;
  24917. },
  24918. args: ["aMethod"],
  24919. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24920. referencedClasses: [],
  24921. messageSends: []
  24922. }),
  24923. $globals.MethodModified);
  24924. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24925. $globals.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  24926. $core.addMethod(
  24927. $core.method({
  24928. selector: "oldProtocol",
  24929. protocol: "accessing",
  24930. fn: function (){
  24931. var self=this,$self=this;
  24932. return $self["@oldProtocol"];
  24933. },
  24934. args: [],
  24935. source: "oldProtocol\x0a\x09^ oldProtocol",
  24936. referencedClasses: [],
  24937. messageSends: []
  24938. }),
  24939. $globals.MethodMoved);
  24940. $core.addMethod(
  24941. $core.method({
  24942. selector: "oldProtocol:",
  24943. protocol: "accessing",
  24944. fn: function (aString){
  24945. var self=this,$self=this;
  24946. $self["@oldProtocol"]=aString;
  24947. return self;
  24948. },
  24949. args: ["aString"],
  24950. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24951. referencedClasses: [],
  24952. messageSends: []
  24953. }),
  24954. $globals.MethodMoved);
  24955. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24956. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24957. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24958. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24959. $core.addMethod(
  24960. $core.method({
  24961. selector: "package",
  24962. protocol: "accessing",
  24963. fn: function (){
  24964. var self=this,$self=this;
  24965. return $self["@package"];
  24966. },
  24967. args: [],
  24968. source: "package\x0a\x09^ package",
  24969. referencedClasses: [],
  24970. messageSends: []
  24971. }),
  24972. $globals.PackageAnnouncement);
  24973. $core.addMethod(
  24974. $core.method({
  24975. selector: "package:",
  24976. protocol: "accessing",
  24977. fn: function (aPackage){
  24978. var self=this,$self=this;
  24979. $self["@package"]=aPackage;
  24980. return self;
  24981. },
  24982. args: ["aPackage"],
  24983. source: "package: aPackage\x0a\x09package := aPackage",
  24984. referencedClasses: [],
  24985. messageSends: []
  24986. }),
  24987. $globals.PackageAnnouncement);
  24988. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24989. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  24990. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24991. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  24992. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24993. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  24994. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24995. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  24996. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  24997. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  24998. $core.addMethod(
  24999. $core.method({
  25000. selector: "package",
  25001. protocol: "accessing",
  25002. fn: function (){
  25003. var self=this,$self=this;
  25004. return $core.withContext(function($ctx1) {
  25005. var $1,$receiver;
  25006. $1=$self._theClass();
  25007. if(($receiver = $1) == null || $receiver.a$nil){
  25008. return $1;
  25009. } else {
  25010. var class_;
  25011. class_=$receiver;
  25012. return $recv(class_)._packageOfProtocol_($self._protocol());
  25013. }
  25014. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  25015. },
  25016. args: [],
  25017. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  25018. referencedClasses: [],
  25019. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25020. }),
  25021. $globals.ProtocolAnnouncement);
  25022. $core.addMethod(
  25023. $core.method({
  25024. selector: "protocol",
  25025. protocol: "accessing",
  25026. fn: function (){
  25027. var self=this,$self=this;
  25028. return $self["@protocol"];
  25029. },
  25030. args: [],
  25031. source: "protocol\x0a\x09^ protocol",
  25032. referencedClasses: [],
  25033. messageSends: []
  25034. }),
  25035. $globals.ProtocolAnnouncement);
  25036. $core.addMethod(
  25037. $core.method({
  25038. selector: "protocol:",
  25039. protocol: "accessing",
  25040. fn: function (aString){
  25041. var self=this,$self=this;
  25042. $self["@protocol"]=aString;
  25043. return self;
  25044. },
  25045. args: ["aString"],
  25046. source: "protocol: aString\x0a\x09protocol := aString",
  25047. referencedClasses: [],
  25048. messageSends: []
  25049. }),
  25050. $globals.ProtocolAnnouncement);
  25051. $core.addMethod(
  25052. $core.method({
  25053. selector: "theClass",
  25054. protocol: "accessing",
  25055. fn: function (){
  25056. var self=this,$self=this;
  25057. return $self["@theClass"];
  25058. },
  25059. args: [],
  25060. source: "theClass\x0a\x09^ theClass",
  25061. referencedClasses: [],
  25062. messageSends: []
  25063. }),
  25064. $globals.ProtocolAnnouncement);
  25065. $core.addMethod(
  25066. $core.method({
  25067. selector: "theClass:",
  25068. protocol: "accessing",
  25069. fn: function (aClass){
  25070. var self=this,$self=this;
  25071. $self["@theClass"]=aClass;
  25072. return self;
  25073. },
  25074. args: ["aClass"],
  25075. source: "theClass: aClass\x0a\x09theClass := aClass",
  25076. referencedClasses: [],
  25077. messageSends: []
  25078. }),
  25079. $globals.ProtocolAnnouncement);
  25080. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25081. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25082. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25083. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25084. });
  25085. define('amber_core/Platform-Services',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  25086. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25087. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25088. $core.addPackage("Platform-Services");
  25089. ($core.packageDescriptors||$core.packages)["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  25090. ($core.packageDescriptors||$core.packages)["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25091. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25092. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25093. $core.addMethod(
  25094. $core.method({
  25095. selector: "handleError:",
  25096. protocol: "error handling",
  25097. fn: function (anError){
  25098. var self=this,$self=this;
  25099. return $core.withContext(function($ctx1) {
  25100. var $1,$receiver;
  25101. $1=$recv(anError)._context();
  25102. $ctx1.sendIdx["context"]=1;
  25103. if(($receiver = $1) == null || $receiver.a$nil){
  25104. $1;
  25105. } else {
  25106. $self._logErrorContext_($recv(anError)._context());
  25107. }
  25108. $self._logError_(anError);
  25109. return self;
  25110. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25111. },
  25112. args: ["anError"],
  25113. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25114. referencedClasses: [],
  25115. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25116. }),
  25117. $globals.ConsoleErrorHandler);
  25118. $core.addMethod(
  25119. $core.method({
  25120. selector: "log:",
  25121. protocol: "private",
  25122. fn: function (aString){
  25123. var self=this,$self=this;
  25124. return $core.withContext(function($ctx1) {
  25125. $recv(console)._log_(aString);
  25126. return self;
  25127. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25128. },
  25129. args: ["aString"],
  25130. source: "log: aString\x0a\x09console log: aString",
  25131. referencedClasses: [],
  25132. messageSends: ["log:"]
  25133. }),
  25134. $globals.ConsoleErrorHandler);
  25135. $core.addMethod(
  25136. $core.method({
  25137. selector: "logContext:",
  25138. protocol: "private",
  25139. fn: function (aContext){
  25140. var self=this,$self=this;
  25141. return $core.withContext(function($ctx1) {
  25142. var $1,$receiver;
  25143. $1=$recv(aContext)._home();
  25144. $ctx1.sendIdx["home"]=1;
  25145. if(($receiver = $1) == null || $receiver.a$nil){
  25146. $1;
  25147. } else {
  25148. $self._logContext_($recv(aContext)._home());
  25149. }
  25150. $self._log_($recv(aContext)._asString());
  25151. return self;
  25152. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25153. },
  25154. args: ["aContext"],
  25155. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25156. referencedClasses: [],
  25157. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25158. }),
  25159. $globals.ConsoleErrorHandler);
  25160. $core.addMethod(
  25161. $core.method({
  25162. selector: "logError:",
  25163. protocol: "private",
  25164. fn: function (anError){
  25165. var self=this,$self=this;
  25166. return $core.withContext(function($ctx1) {
  25167. $self._log_($recv(anError)._messageText());
  25168. return self;
  25169. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25170. },
  25171. args: ["anError"],
  25172. source: "logError: anError\x0a\x09self log: anError messageText",
  25173. referencedClasses: [],
  25174. messageSends: ["log:", "messageText"]
  25175. }),
  25176. $globals.ConsoleErrorHandler);
  25177. $core.addMethod(
  25178. $core.method({
  25179. selector: "logErrorContext:",
  25180. protocol: "private",
  25181. fn: function (aContext){
  25182. var self=this,$self=this;
  25183. return $core.withContext(function($ctx1) {
  25184. var $1,$receiver;
  25185. if(($receiver = aContext) == null || $receiver.a$nil){
  25186. aContext;
  25187. } else {
  25188. $1=$recv(aContext)._home();
  25189. $ctx1.sendIdx["home"]=1;
  25190. if(($receiver = $1) == null || $receiver.a$nil){
  25191. $1;
  25192. } else {
  25193. $self._logContext_($recv(aContext)._home());
  25194. }
  25195. }
  25196. return self;
  25197. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25198. },
  25199. args: ["aContext"],
  25200. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25201. referencedClasses: [],
  25202. messageSends: ["ifNotNil:", "home", "logContext:"]
  25203. }),
  25204. $globals.ConsoleErrorHandler);
  25205. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25206. $core.addMethod(
  25207. $core.method({
  25208. selector: "initialize",
  25209. protocol: "initialization",
  25210. fn: function (){
  25211. var self=this,$self=this;
  25212. return $core.withContext(function($ctx1) {
  25213. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25214. return self;
  25215. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25216. },
  25217. args: [],
  25218. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25219. referencedClasses: ["ErrorHandler"],
  25220. messageSends: ["registerIfNone:", "new"]
  25221. }),
  25222. $globals.ConsoleErrorHandler.a$cls);
  25223. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25224. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25225. $core.addMethod(
  25226. $core.method({
  25227. selector: "clear",
  25228. protocol: "printing",
  25229. fn: function (){
  25230. var self=this,$self=this;
  25231. return self;
  25232. },
  25233. args: [],
  25234. source: "clear\x0a\x09\x22no op\x22",
  25235. referencedClasses: [],
  25236. messageSends: []
  25237. }),
  25238. $globals.ConsoleTranscript);
  25239. $core.addMethod(
  25240. $core.method({
  25241. selector: "cr",
  25242. protocol: "printing",
  25243. fn: function (){
  25244. var self=this,$self=this;
  25245. return self;
  25246. },
  25247. args: [],
  25248. source: "cr\x0a\x09\x22no op\x22",
  25249. referencedClasses: [],
  25250. messageSends: []
  25251. }),
  25252. $globals.ConsoleTranscript);
  25253. $core.addMethod(
  25254. $core.method({
  25255. selector: "open",
  25256. protocol: "actions",
  25257. fn: function (){
  25258. var self=this,$self=this;
  25259. return self;
  25260. },
  25261. args: [],
  25262. source: "open",
  25263. referencedClasses: [],
  25264. messageSends: []
  25265. }),
  25266. $globals.ConsoleTranscript);
  25267. $core.addMethod(
  25268. $core.method({
  25269. selector: "show:",
  25270. protocol: "printing",
  25271. fn: function (anObject){
  25272. var self=this,$self=this;
  25273. return $core.withContext(function($ctx1) {
  25274. console.log(String($recv(anObject)._asString()));
  25275. return self;
  25276. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25277. },
  25278. args: ["anObject"],
  25279. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<inlineJS: 'console.log(String($recv(anObject)._asString()))'>",
  25280. referencedClasses: [],
  25281. messageSends: []
  25282. }),
  25283. $globals.ConsoleTranscript);
  25284. $core.addMethod(
  25285. $core.method({
  25286. selector: "initialize",
  25287. protocol: "initialization",
  25288. fn: function (){
  25289. var self=this,$self=this;
  25290. return $core.withContext(function($ctx1) {
  25291. $recv($globals.Transcript)._registerIfNone_($self._new());
  25292. return self;
  25293. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25294. },
  25295. args: [],
  25296. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25297. referencedClasses: ["Transcript"],
  25298. messageSends: ["registerIfNone:", "new"]
  25299. }),
  25300. $globals.ConsoleTranscript.a$cls);
  25301. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25302. $globals.Environment.comment="I provide an unified entry point to manipulate Amber packages, classes and methods.\x0a\x0aTypical use cases include IDEs, remote access and restricting browsing.";
  25303. $core.addMethod(
  25304. $core.method({
  25305. selector: "addInstVarNamed:to:",
  25306. protocol: "compiling",
  25307. fn: function (aString,aClass){
  25308. var self=this,$self=this;
  25309. var newInstVars;
  25310. return $core.withContext(function($ctx1) {
  25311. var $1,$2,$3,$4,$5;
  25312. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25313. $1=$recv(aClass)._isMetaclass();
  25314. if($core.assert($1)){
  25315. $2=$self._classBuilder();
  25316. $ctx1.sendIdx["classBuilder"]=1;
  25317. $recv($2)._class_instanceVariables_(aClass,newInstVars);
  25318. } else {
  25319. $3=$self._classBuilder();
  25320. $4=$recv(aClass)._superclass();
  25321. $5=$recv(aClass)._name();
  25322. $ctx1.sendIdx["name"]=1;
  25323. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25324. }
  25325. return self;
  25326. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25327. },
  25328. args: ["aString", "aClass"],
  25329. source: "addInstVarNamed: aString to: aClass\x0a\x09| newInstVars |\x0a\x09newInstVars := aClass instanceVariableNames copyWith: aString.\x0a\x0a\x09aClass isMetaclass\x0a\x09\x09ifTrue: [ self classBuilder\x0a\x09\x09\x09class: aClass instanceVariables: newInstVars ]\x0a\x09\x09ifFalse: [ self classBuilder\x0a\x09\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09\x09named: aClass name \x0a\x09\x09\x09instanceVariableNames: newInstVars\x0a\x09\x09\x09package: aClass package name ]",
  25330. referencedClasses: [],
  25331. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:instanceVariables:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25332. }),
  25333. $globals.Environment);
  25334. $core.addMethod(
  25335. $core.method({
  25336. selector: "allSelectors",
  25337. protocol: "accessing",
  25338. fn: function (){
  25339. var self=this,$self=this;
  25340. return $core.withContext(function($ctx1) {
  25341. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25342. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25343. },
  25344. args: [],
  25345. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25346. referencedClasses: ["Smalltalk"],
  25347. messageSends: ["allSelectors", "core"]
  25348. }),
  25349. $globals.Environment);
  25350. $core.addMethod(
  25351. $core.method({
  25352. selector: "availableClassNames",
  25353. protocol: "accessing",
  25354. fn: function (){
  25355. var self=this,$self=this;
  25356. return $core.withContext(function($ctx1) {
  25357. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25358. return $core.withContext(function($ctx2) {
  25359. return $recv(each)._name();
  25360. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25361. }));
  25362. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25363. },
  25364. args: [],
  25365. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25366. referencedClasses: ["Smalltalk"],
  25367. messageSends: ["collect:", "classes", "name"]
  25368. }),
  25369. $globals.Environment);
  25370. $core.addMethod(
  25371. $core.method({
  25372. selector: "availablePackageNames",
  25373. protocol: "accessing",
  25374. fn: function (){
  25375. var self=this,$self=this;
  25376. return $core.withContext(function($ctx1) {
  25377. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25378. return $core.withContext(function($ctx2) {
  25379. return $recv(each)._name();
  25380. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25381. }));
  25382. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25383. },
  25384. args: [],
  25385. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25386. referencedClasses: ["Smalltalk"],
  25387. messageSends: ["collect:", "packages", "name"]
  25388. }),
  25389. $globals.Environment);
  25390. $core.addMethod(
  25391. $core.method({
  25392. selector: "availableProtocolsFor:",
  25393. protocol: "accessing",
  25394. fn: function (aClass){
  25395. var self=this,$self=this;
  25396. var protocols;
  25397. return $core.withContext(function($ctx1) {
  25398. var $1,$receiver;
  25399. protocols=$recv(aClass)._protocols();
  25400. $1=$recv(aClass)._superclass();
  25401. $ctx1.sendIdx["superclass"]=1;
  25402. if(($receiver = $1) == null || $receiver.a$nil){
  25403. $1;
  25404. } else {
  25405. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25406. }
  25407. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25408. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25409. },
  25410. args: ["aClass"],
  25411. source: "availableProtocolsFor: aClass\x0a\x09| protocols |\x0a\x09\x0a\x09protocols := aClass protocols.\x0a\x09aClass superclass ifNotNil: [ protocols addAll: (self availableProtocolsFor: aClass superclass) ].\x0a\x09^ protocols asSet asArray sort",
  25412. referencedClasses: [],
  25413. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25414. }),
  25415. $globals.Environment);
  25416. $core.addMethod(
  25417. $core.method({
  25418. selector: "classBuilder",
  25419. protocol: "accessing",
  25420. fn: function (){
  25421. var self=this,$self=this;
  25422. return $core.withContext(function($ctx1) {
  25423. return $recv($globals.ClassBuilder)._new();
  25424. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25425. },
  25426. args: [],
  25427. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25428. referencedClasses: ["ClassBuilder"],
  25429. messageSends: ["new"]
  25430. }),
  25431. $globals.Environment);
  25432. $core.addMethod(
  25433. $core.method({
  25434. selector: "classNamed:",
  25435. protocol: "accessing",
  25436. fn: function (aString){
  25437. var self=this,$self=this;
  25438. return $core.withContext(function($ctx1) {
  25439. var $1,$receiver;
  25440. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25441. if(($receiver = $1) == null || $receiver.a$nil){
  25442. return $self._error_("Invalid class name");
  25443. } else {
  25444. return $1;
  25445. }
  25446. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25447. },
  25448. args: ["aString"],
  25449. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25450. referencedClasses: ["Smalltalk"],
  25451. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25452. }),
  25453. $globals.Environment);
  25454. $core.addMethod(
  25455. $core.method({
  25456. selector: "classes",
  25457. protocol: "accessing",
  25458. fn: function (){
  25459. var self=this,$self=this;
  25460. return $core.withContext(function($ctx1) {
  25461. return $recv($globals.Smalltalk)._classes();
  25462. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25463. },
  25464. args: [],
  25465. source: "classes\x0a\x09^ Smalltalk classes",
  25466. referencedClasses: ["Smalltalk"],
  25467. messageSends: ["classes"]
  25468. }),
  25469. $globals.Environment);
  25470. $core.addMethod(
  25471. $core.method({
  25472. selector: "commitPackage:onSuccess:onError:",
  25473. protocol: "actions",
  25474. fn: function (aPackage,aBlock,anotherBlock){
  25475. var self=this,$self=this;
  25476. return $core.withContext(function($ctx1) {
  25477. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25478. return self;
  25479. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25480. },
  25481. args: ["aPackage", "aBlock", "anotherBlock"],
  25482. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25483. referencedClasses: [],
  25484. messageSends: ["commitOnSuccess:onError:", "transport"]
  25485. }),
  25486. $globals.Environment);
  25487. $core.addMethod(
  25488. $core.method({
  25489. selector: "compileClassComment:for:",
  25490. protocol: "compiling",
  25491. fn: function (aString,aClass){
  25492. var self=this,$self=this;
  25493. return $core.withContext(function($ctx1) {
  25494. $recv(aClass)._comment_(aString);
  25495. return self;
  25496. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25497. },
  25498. args: ["aString", "aClass"],
  25499. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25500. referencedClasses: [],
  25501. messageSends: ["comment:"]
  25502. }),
  25503. $globals.Environment);
  25504. $core.addMethod(
  25505. $core.method({
  25506. selector: "compileClassDefinition:",
  25507. protocol: "compiling",
  25508. fn: function (aString){
  25509. var self=this,$self=this;
  25510. return $core.withContext(function($ctx1) {
  25511. $recv((function(){
  25512. return $core.withContext(function($ctx2) {
  25513. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25515. }))._on_do_($globals.Error,(function(error){
  25516. return $core.withContext(function($ctx2) {
  25517. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25518. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25519. }));
  25520. return self;
  25521. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25522. },
  25523. args: ["aString"],
  25524. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25525. referencedClasses: ["DoIt", "Error", "Terminal"],
  25526. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25527. }),
  25528. $globals.Environment);
  25529. $core.addMethod(
  25530. $core.method({
  25531. selector: "compileMethod:for:protocol:",
  25532. protocol: "compiling",
  25533. fn: function (sourceCode,class_,protocol){
  25534. var self=this,$self=this;
  25535. return $core.withContext(function($ctx1) {
  25536. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25537. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25538. },
  25539. args: ["sourceCode", "class", "protocol"],
  25540. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25541. referencedClasses: [],
  25542. messageSends: ["compile:protocol:"]
  25543. }),
  25544. $globals.Environment);
  25545. $core.addMethod(
  25546. $core.method({
  25547. selector: "copyClass:to:",
  25548. protocol: "actions",
  25549. fn: function (aClass,aClassName){
  25550. var self=this,$self=this;
  25551. return $core.withContext(function($ctx1) {
  25552. var $1,$2,$receiver;
  25553. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25554. if(($receiver = $1) == null || $receiver.a$nil){
  25555. $1;
  25556. } else {
  25557. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25558. $ctx1.sendIdx[","]=1;
  25559. $self._error_($2);
  25560. }
  25561. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25562. return self;
  25563. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25564. },
  25565. args: ["aClass", "aClassName"],
  25566. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
  25567. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25568. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25569. }),
  25570. $globals.Environment);
  25571. $core.addMethod(
  25572. $core.method({
  25573. selector: "doItReceiver",
  25574. protocol: "accessing",
  25575. fn: function (){
  25576. var self=this,$self=this;
  25577. return $core.withContext(function($ctx1) {
  25578. return $recv($globals.DoIt)._new();
  25579. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25580. },
  25581. args: [],
  25582. source: "doItReceiver\x0a\x09^ DoIt new",
  25583. referencedClasses: ["DoIt"],
  25584. messageSends: ["new"]
  25585. }),
  25586. $globals.Environment);
  25587. $core.addMethod(
  25588. $core.method({
  25589. selector: "evaluate:for:",
  25590. protocol: "evaluating",
  25591. fn: function (aString,anObject){
  25592. var self=this,$self=this;
  25593. return $core.withContext(function($ctx1) {
  25594. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25595. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25596. },
  25597. args: ["aString", "anObject"],
  25598. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25599. referencedClasses: ["Evaluator"],
  25600. messageSends: ["evaluate:for:"]
  25601. }),
  25602. $globals.Environment);
  25603. $core.addMethod(
  25604. $core.method({
  25605. selector: "evaluate:on:do:",
  25606. protocol: "error handling",
  25607. fn: function (aBlock,anErrorClass,exceptionBlock){
  25608. var self=this,$self=this;
  25609. return $core.withContext(function($ctx1) {
  25610. var $1;
  25611. $recv(aBlock)._tryCatch_((function(exception){
  25612. return $core.withContext(function($ctx2) {
  25613. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25614. if($core.assert($1)){
  25615. return $recv(exceptionBlock)._value_(exception);
  25616. } else {
  25617. return $recv(exception)._resignal();
  25618. }
  25619. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25620. }));
  25621. return self;
  25622. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25623. },
  25624. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25625. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception resignal ] ]",
  25626. referencedClasses: [],
  25627. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  25628. }),
  25629. $globals.Environment);
  25630. $core.addMethod(
  25631. $core.method({
  25632. selector: "inspect:",
  25633. protocol: "actions",
  25634. fn: function (anObject){
  25635. var self=this,$self=this;
  25636. return $core.withContext(function($ctx1) {
  25637. $recv($globals.Inspector)._inspect_(anObject);
  25638. return self;
  25639. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25640. },
  25641. args: ["anObject"],
  25642. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25643. referencedClasses: ["Inspector"],
  25644. messageSends: ["inspect:"]
  25645. }),
  25646. $globals.Environment);
  25647. $core.addMethod(
  25648. $core.method({
  25649. selector: "moveClass:toPackage:",
  25650. protocol: "actions",
  25651. fn: function (aClass,aPackageName){
  25652. var self=this,$self=this;
  25653. var package_;
  25654. return $core.withContext(function($ctx1) {
  25655. var $1,$2,$receiver;
  25656. package_=$recv($globals.Package)._named_(aPackageName);
  25657. $1=package_;
  25658. if(($receiver = $1) == null || $receiver.a$nil){
  25659. $self._error_("Invalid package name");
  25660. } else {
  25661. $1;
  25662. }
  25663. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25664. if($core.assert($2)){
  25665. return self;
  25666. }
  25667. $recv(aClass)._package_(package_);
  25668. $recv(aClass)._recompile();
  25669. return self;
  25670. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25671. },
  25672. args: ["aClass", "aPackageName"],
  25673. source: "moveClass: aClass toPackage: aPackageName\x0a\x09| package |\x0a\x09\x0a\x09package := Package named: aPackageName.\x0a\x09package ifNil: [ self error: 'Invalid package name' ].\x0a\x09package == aClass package ifTrue: [ ^ self ].\x0a\x09\x0a\x09aClass package: package.\x0a\x09aClass recompile",
  25674. referencedClasses: ["Package"],
  25675. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25676. }),
  25677. $globals.Environment);
  25678. $core.addMethod(
  25679. $core.method({
  25680. selector: "moveMethod:toClass:",
  25681. protocol: "actions",
  25682. fn: function (aMethod,aClassName){
  25683. var self=this,$self=this;
  25684. var destinationClass;
  25685. return $core.withContext(function($ctx1) {
  25686. var $2,$3,$1,$5,$4;
  25687. destinationClass=$self._classNamed_(aClassName);
  25688. $2=destinationClass;
  25689. $3=$recv(aMethod)._methodClass();
  25690. $ctx1.sendIdx["methodClass"]=1;
  25691. $1=$recv($2).__eq_eq($3);
  25692. if($core.assert($1)){
  25693. return self;
  25694. }
  25695. $5=$recv(aMethod)._methodClass();
  25696. $ctx1.sendIdx["methodClass"]=2;
  25697. $4=$recv($5)._isMetaclass();
  25698. if($core.assert($4)){
  25699. destinationClass=$recv(destinationClass)._theMetaClass();
  25700. destinationClass;
  25701. }
  25702. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25703. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25704. return self;
  25705. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25706. },
  25707. args: ["aMethod", "aClassName"],
  25708. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass theMetaClass ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  25709. referencedClasses: [],
  25710. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25711. }),
  25712. $globals.Environment);
  25713. $core.addMethod(
  25714. $core.method({
  25715. selector: "moveMethod:toProtocol:",
  25716. protocol: "actions",
  25717. fn: function (aMethod,aProtocol){
  25718. var self=this,$self=this;
  25719. return $core.withContext(function($ctx1) {
  25720. $recv(aMethod)._protocol_(aProtocol);
  25721. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25722. return self;
  25723. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25724. },
  25725. args: ["aMethod", "aProtocol"],
  25726. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25727. referencedClasses: [],
  25728. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25729. }),
  25730. $globals.Environment);
  25731. $core.addMethod(
  25732. $core.method({
  25733. selector: "packages",
  25734. protocol: "accessing",
  25735. fn: function (){
  25736. var self=this,$self=this;
  25737. return $core.withContext(function($ctx1) {
  25738. return $recv($globals.Smalltalk)._packages();
  25739. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25740. },
  25741. args: [],
  25742. source: "packages\x0a\x09^ Smalltalk packages",
  25743. referencedClasses: ["Smalltalk"],
  25744. messageSends: ["packages"]
  25745. }),
  25746. $globals.Environment);
  25747. $core.addMethod(
  25748. $core.method({
  25749. selector: "registerErrorHandler:",
  25750. protocol: "services",
  25751. fn: function (anErrorHandler){
  25752. var self=this,$self=this;
  25753. return $core.withContext(function($ctx1) {
  25754. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25755. return self;
  25756. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25757. },
  25758. args: ["anErrorHandler"],
  25759. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25760. referencedClasses: ["ErrorHandler"],
  25761. messageSends: ["register:"]
  25762. }),
  25763. $globals.Environment);
  25764. $core.addMethod(
  25765. $core.method({
  25766. selector: "registerFinder:",
  25767. protocol: "services",
  25768. fn: function (aFinder){
  25769. var self=this,$self=this;
  25770. return $core.withContext(function($ctx1) {
  25771. $recv($globals.Finder)._register_(aFinder);
  25772. return self;
  25773. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25774. },
  25775. args: ["aFinder"],
  25776. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25777. referencedClasses: ["Finder"],
  25778. messageSends: ["register:"]
  25779. }),
  25780. $globals.Environment);
  25781. $core.addMethod(
  25782. $core.method({
  25783. selector: "registerInspector:",
  25784. protocol: "services",
  25785. fn: function (anInspector){
  25786. var self=this,$self=this;
  25787. return $core.withContext(function($ctx1) {
  25788. $recv($globals.Inspector)._register_(anInspector);
  25789. return self;
  25790. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25791. },
  25792. args: ["anInspector"],
  25793. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25794. referencedClasses: ["Inspector"],
  25795. messageSends: ["register:"]
  25796. }),
  25797. $globals.Environment);
  25798. $core.addMethod(
  25799. $core.method({
  25800. selector: "registerProgressHandler:",
  25801. protocol: "services",
  25802. fn: function (aProgressHandler){
  25803. var self=this,$self=this;
  25804. return $core.withContext(function($ctx1) {
  25805. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25806. return self;
  25807. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25808. },
  25809. args: ["aProgressHandler"],
  25810. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25811. referencedClasses: ["ProgressHandler"],
  25812. messageSends: ["register:"]
  25813. }),
  25814. $globals.Environment);
  25815. $core.addMethod(
  25816. $core.method({
  25817. selector: "registerTranscript:",
  25818. protocol: "services",
  25819. fn: function (aTranscript){
  25820. var self=this,$self=this;
  25821. return $core.withContext(function($ctx1) {
  25822. $recv($globals.Transcript)._register_(aTranscript);
  25823. return self;
  25824. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25825. },
  25826. args: ["aTranscript"],
  25827. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25828. referencedClasses: ["Transcript"],
  25829. messageSends: ["register:"]
  25830. }),
  25831. $globals.Environment);
  25832. $core.addMethod(
  25833. $core.method({
  25834. selector: "removeClass:",
  25835. protocol: "actions",
  25836. fn: function (aClass){
  25837. var self=this,$self=this;
  25838. return $core.withContext(function($ctx1) {
  25839. $recv($globals.Smalltalk)._removeClass_(aClass);
  25840. return self;
  25841. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25842. },
  25843. args: ["aClass"],
  25844. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25845. referencedClasses: ["Smalltalk"],
  25846. messageSends: ["removeClass:"]
  25847. }),
  25848. $globals.Environment);
  25849. $core.addMethod(
  25850. $core.method({
  25851. selector: "removeMethod:",
  25852. protocol: "actions",
  25853. fn: function (aMethod){
  25854. var self=this,$self=this;
  25855. return $core.withContext(function($ctx1) {
  25856. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25857. return self;
  25858. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25859. },
  25860. args: ["aMethod"],
  25861. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25862. referencedClasses: [],
  25863. messageSends: ["removeCompiledMethod:", "methodClass"]
  25864. }),
  25865. $globals.Environment);
  25866. $core.addMethod(
  25867. $core.method({
  25868. selector: "removeProtocol:from:",
  25869. protocol: "actions",
  25870. fn: function (aString,aClass){
  25871. var self=this,$self=this;
  25872. return $core.withContext(function($ctx1) {
  25873. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25874. return $core.withContext(function($ctx2) {
  25875. return $recv(aClass)._removeCompiledMethod_(each);
  25876. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25877. }));
  25878. return self;
  25879. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25880. },
  25881. args: ["aString", "aClass"],
  25882. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25883. referencedClasses: [],
  25884. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25885. }),
  25886. $globals.Environment);
  25887. $core.addMethod(
  25888. $core.method({
  25889. selector: "renameClass:to:",
  25890. protocol: "actions",
  25891. fn: function (aClass,aClassName){
  25892. var self=this,$self=this;
  25893. return $core.withContext(function($ctx1) {
  25894. var $1,$2,$receiver;
  25895. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25896. if(($receiver = $1) == null || $receiver.a$nil){
  25897. $1;
  25898. } else {
  25899. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25900. $ctx1.sendIdx[","]=1;
  25901. $self._error_($2);
  25902. }
  25903. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25904. return self;
  25905. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25906. },
  25907. args: ["aClass", "aClassName"],
  25908. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
  25909. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25910. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25911. }),
  25912. $globals.Environment);
  25913. $core.addMethod(
  25914. $core.method({
  25915. selector: "renamePackage:to:",
  25916. protocol: "actions",
  25917. fn: function (aPackageName,aNewPackageName){
  25918. var self=this,$self=this;
  25919. return $core.withContext(function($ctx1) {
  25920. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25921. return self;
  25922. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25923. },
  25924. args: ["aPackageName", "aNewPackageName"],
  25925. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25926. referencedClasses: ["Smalltalk"],
  25927. messageSends: ["renamePackage:to:"]
  25928. }),
  25929. $globals.Environment);
  25930. $core.addMethod(
  25931. $core.method({
  25932. selector: "renameProtocol:to:in:",
  25933. protocol: "actions",
  25934. fn: function (aString,anotherString,aClass){
  25935. var self=this,$self=this;
  25936. return $core.withContext(function($ctx1) {
  25937. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25938. return $core.withContext(function($ctx2) {
  25939. return $recv(each)._protocol_(anotherString);
  25940. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25941. }));
  25942. return self;
  25943. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25944. },
  25945. args: ["aString", "anotherString", "aClass"],
  25946. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25947. referencedClasses: [],
  25948. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25949. }),
  25950. $globals.Environment);
  25951. $core.addMethod(
  25952. $core.method({
  25953. selector: "setClassCommentOf:to:",
  25954. protocol: "actions",
  25955. fn: function (aClass,aString){
  25956. var self=this,$self=this;
  25957. return $core.withContext(function($ctx1) {
  25958. $recv(aClass)._comment_(aString);
  25959. return self;
  25960. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25961. },
  25962. args: ["aClass", "aString"],
  25963. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25964. referencedClasses: [],
  25965. messageSends: ["comment:"]
  25966. }),
  25967. $globals.Environment);
  25968. $core.addMethod(
  25969. $core.method({
  25970. selector: "systemAnnouncer",
  25971. protocol: "accessing",
  25972. fn: function (){
  25973. var self=this,$self=this;
  25974. return $core.withContext(function($ctx1) {
  25975. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  25976. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  25977. },
  25978. args: [],
  25979. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  25980. referencedClasses: ["Smalltalk"],
  25981. messageSends: ["current", "at:", "globals"]
  25982. }),
  25983. $globals.Environment);
  25984. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  25985. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  25986. $core.addMethod(
  25987. $core.method({
  25988. selector: "do:on:displaying:",
  25989. protocol: "progress handling",
  25990. fn: function (aBlock,aCollection,aString){
  25991. var self=this,$self=this;
  25992. return $core.withContext(function($ctx1) {
  25993. $recv(aCollection)._do_(aBlock);
  25994. return self;
  25995. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  25996. },
  25997. args: ["aBlock", "aCollection", "aString"],
  25998. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  25999. referencedClasses: [],
  26000. messageSends: ["do:"]
  26001. }),
  26002. $globals.NullProgressHandler);
  26003. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  26004. $core.addMethod(
  26005. $core.method({
  26006. selector: "initialize",
  26007. protocol: "initialization",
  26008. fn: function (){
  26009. var self=this,$self=this;
  26010. return $core.withContext(function($ctx1) {
  26011. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  26012. return self;
  26013. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  26014. },
  26015. args: [],
  26016. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  26017. referencedClasses: ["ProgressHandler"],
  26018. messageSends: ["registerIfNone:", "new"]
  26019. }),
  26020. $globals.NullProgressHandler.a$cls);
  26021. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26022. $globals.Service.comment="I implement the basic behavior for class registration to a service.\x0a\x0aSee the `Transcript` class for a concrete service.\x0a\x0a## API\x0a\x0aUse class-side methods `#register:` and `#registerIfNone:` to register classes to a specific service.";
  26023. $globals.Service.a$cls.iVarNames = ["current"];
  26024. $core.addMethod(
  26025. $core.method({
  26026. selector: "current",
  26027. protocol: "accessing",
  26028. fn: function (){
  26029. var self=this,$self=this;
  26030. return $self["@current"];
  26031. },
  26032. args: [],
  26033. source: "current\x0a\x09^ current",
  26034. referencedClasses: [],
  26035. messageSends: []
  26036. }),
  26037. $globals.Service.a$cls);
  26038. $core.addMethod(
  26039. $core.method({
  26040. selector: "new",
  26041. protocol: "instance creation",
  26042. fn: function (){
  26043. var self=this,$self=this;
  26044. return $core.withContext(function($ctx1) {
  26045. $self._shouldNotImplement();
  26046. return self;
  26047. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  26048. },
  26049. args: [],
  26050. source: "new\x0a\x09self shouldNotImplement",
  26051. referencedClasses: [],
  26052. messageSends: ["shouldNotImplement"]
  26053. }),
  26054. $globals.Service.a$cls);
  26055. $core.addMethod(
  26056. $core.method({
  26057. selector: "register:",
  26058. protocol: "registration",
  26059. fn: function (anObject){
  26060. var self=this,$self=this;
  26061. $self["@current"]=anObject;
  26062. return self;
  26063. },
  26064. args: ["anObject"],
  26065. source: "register: anObject\x0a\x09current := anObject",
  26066. referencedClasses: [],
  26067. messageSends: []
  26068. }),
  26069. $globals.Service.a$cls);
  26070. $core.addMethod(
  26071. $core.method({
  26072. selector: "registerIfNone:",
  26073. protocol: "registration",
  26074. fn: function (anObject){
  26075. var self=this,$self=this;
  26076. return $core.withContext(function($ctx1) {
  26077. var $1,$receiver;
  26078. $1=$self._current();
  26079. if(($receiver = $1) == null || $receiver.a$nil){
  26080. $self._register_(anObject);
  26081. } else {
  26082. $1;
  26083. }
  26084. return self;
  26085. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26086. },
  26087. args: ["anObject"],
  26088. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26089. referencedClasses: [],
  26090. messageSends: ["ifNil:", "current", "register:"]
  26091. }),
  26092. $globals.Service.a$cls);
  26093. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26094. $globals.ErrorHandler.comment="I am the service used to handle Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aRegistered service instances must implement `#handleError:` to perform an action on the thrown exception.";
  26095. $core.addMethod(
  26096. $core.method({
  26097. selector: "handleError:",
  26098. protocol: "error handling",
  26099. fn: function (anError){
  26100. var self=this,$self=this;
  26101. return $core.withContext(function($ctx1) {
  26102. var $1;
  26103. $1=$recv((function(){
  26104. return $core.withContext(function($ctx2) {
  26105. return $recv(anError)._isSmalltalkError();
  26106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26107. }))._tryCatch_((function(){
  26108. return false;
  26109. }));
  26110. if($core.assert($1)){
  26111. $self._handleUnhandledError_(anError);
  26112. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26113. } else {
  26114. var smalltalkError;
  26115. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26116. $recv(smalltalkError)._wrap();
  26117. $self._handleUnhandledError_(smalltalkError);
  26118. }
  26119. return self;
  26120. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26121. },
  26122. args: ["anError"],
  26123. source: "handleError: anError\x0a\x09([ anError isSmalltalkError ] tryCatch: [ false ])\x0a\x09\x09ifTrue: [ self handleUnhandledError: anError ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09| smalltalkError |\x0a\x09\x09\x09smalltalkError := JavaScriptException on: anError.\x0a\x09\x09\x09smalltalkError wrap.\x0a\x09\x09\x09self handleUnhandledError: smalltalkError ]",
  26124. referencedClasses: ["JavaScriptException"],
  26125. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26126. }),
  26127. $globals.ErrorHandler.a$cls);
  26128. $core.addMethod(
  26129. $core.method({
  26130. selector: "handleUnhandledError:",
  26131. protocol: "error handling",
  26132. fn: function (anError){
  26133. var self=this,$self=this;
  26134. return $core.withContext(function($ctx1) {
  26135. var $1;
  26136. $1=$recv(anError)._wasHandled();
  26137. if(!$core.assert($1)){
  26138. $recv($self._current())._handleError_(anError);
  26139. $recv(anError)._beHandled();
  26140. }
  26141. return self;
  26142. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26143. },
  26144. args: ["anError"],
  26145. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26146. referencedClasses: [],
  26147. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26148. }),
  26149. $globals.ErrorHandler.a$cls);
  26150. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26151. $globals.Finder.comment="I am the service responsible for finding classes/methods.\x0a__There is no default finder.__\x0a\x0a## API\x0a\x0aUse `#browse` on an object to find it.";
  26152. $core.addMethod(
  26153. $core.method({
  26154. selector: "findClass:",
  26155. protocol: "finding",
  26156. fn: function (aClass){
  26157. var self=this,$self=this;
  26158. return $core.withContext(function($ctx1) {
  26159. return $recv($self._current())._findClass_(aClass);
  26160. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26161. },
  26162. args: ["aClass"],
  26163. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26164. referencedClasses: [],
  26165. messageSends: ["findClass:", "current"]
  26166. }),
  26167. $globals.Finder.a$cls);
  26168. $core.addMethod(
  26169. $core.method({
  26170. selector: "findMethod:",
  26171. protocol: "finding",
  26172. fn: function (aCompiledMethod){
  26173. var self=this,$self=this;
  26174. return $core.withContext(function($ctx1) {
  26175. return $recv($self._current())._findMethod_(aCompiledMethod);
  26176. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26177. },
  26178. args: ["aCompiledMethod"],
  26179. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26180. referencedClasses: [],
  26181. messageSends: ["findMethod:", "current"]
  26182. }),
  26183. $globals.Finder.a$cls);
  26184. $core.addMethod(
  26185. $core.method({
  26186. selector: "findString:",
  26187. protocol: "finding",
  26188. fn: function (aString){
  26189. var self=this,$self=this;
  26190. return $core.withContext(function($ctx1) {
  26191. return $recv($self._current())._findString_(aString);
  26192. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26193. },
  26194. args: ["aString"],
  26195. source: "findString: aString\x0a\x09^ self current findString: aString",
  26196. referencedClasses: [],
  26197. messageSends: ["findString:", "current"]
  26198. }),
  26199. $globals.Finder.a$cls);
  26200. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26201. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26202. $core.addMethod(
  26203. $core.method({
  26204. selector: "inspect:",
  26205. protocol: "inspecting",
  26206. fn: function (anObject){
  26207. var self=this,$self=this;
  26208. return $core.withContext(function($ctx1) {
  26209. return $recv($self._current())._inspect_(anObject);
  26210. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26211. },
  26212. args: ["anObject"],
  26213. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26214. referencedClasses: [],
  26215. messageSends: ["inspect:", "current"]
  26216. }),
  26217. $globals.Inspector.a$cls);
  26218. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26219. $globals.Platform.comment="I am bridge to JS environment.\x0a\x0a## API\x0a\x0a Platform globals. \x22JS global object\x22\x0a Platform newXHR \x22new XMLHttpRequest() or its shim\x22";
  26220. $core.addMethod(
  26221. $core.method({
  26222. selector: "globals",
  26223. protocol: "accessing",
  26224. fn: function (){
  26225. var self=this,$self=this;
  26226. return $core.withContext(function($ctx1) {
  26227. return $recv($self._current())._globals();
  26228. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26229. },
  26230. args: [],
  26231. source: "globals\x0a\x09^ self current globals",
  26232. referencedClasses: [],
  26233. messageSends: ["globals", "current"]
  26234. }),
  26235. $globals.Platform.a$cls);
  26236. $core.addMethod(
  26237. $core.method({
  26238. selector: "includesGlobal:",
  26239. protocol: "testing",
  26240. fn: function (aString){
  26241. var self=this,$self=this;
  26242. return $core.withContext(function($ctx1) {
  26243. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26244. return true;
  26245. }),(function(){
  26246. return false;
  26247. }));
  26248. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26249. },
  26250. args: ["aString"],
  26251. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26252. referencedClasses: [],
  26253. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26254. }),
  26255. $globals.Platform.a$cls);
  26256. $core.addMethod(
  26257. $core.method({
  26258. selector: "newXhr",
  26259. protocol: "accessing",
  26260. fn: function (){
  26261. var self=this,$self=this;
  26262. return $core.withContext(function($ctx1) {
  26263. return $recv($self._current())._newXhr();
  26264. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26265. },
  26266. args: [],
  26267. source: "newXhr\x0a\x09^ self current newXhr",
  26268. referencedClasses: [],
  26269. messageSends: ["newXhr", "current"]
  26270. }),
  26271. $globals.Platform.a$cls);
  26272. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26273. $globals.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aRegistered instances must implement `#do:on:displaying:`.\x0a\x0aThe default behavior is to simply iterate over the collection, using `NullProgressHandler`.";
  26274. $core.addMethod(
  26275. $core.method({
  26276. selector: "do:on:displaying:",
  26277. protocol: "progress handling",
  26278. fn: function (aBlock,aCollection,aString){
  26279. var self=this,$self=this;
  26280. return $core.withContext(function($ctx1) {
  26281. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26282. return self;
  26283. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26284. },
  26285. args: ["aBlock", "aCollection", "aString"],
  26286. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26287. referencedClasses: [],
  26288. messageSends: ["do:on:displaying:", "current"]
  26289. }),
  26290. $globals.ProgressHandler.a$cls);
  26291. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26292. $globals.Terminal.comment="I am UI interface service.\x0a\x0a## API\x0a\x0a Terminal alert: 'Hey, there is a problem'.\x0a Terminal confirm: 'Affirmative?'.\x0a Terminal prompt: 'Your name:'.";
  26293. $core.addMethod(
  26294. $core.method({
  26295. selector: "alert:",
  26296. protocol: "dialogs",
  26297. fn: function (aString){
  26298. var self=this,$self=this;
  26299. return $core.withContext(function($ctx1) {
  26300. return $recv($self._current())._alert_(aString);
  26301. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26302. },
  26303. args: ["aString"],
  26304. source: "alert: aString\x0a\x09^ self current alert: aString",
  26305. referencedClasses: [],
  26306. messageSends: ["alert:", "current"]
  26307. }),
  26308. $globals.Terminal.a$cls);
  26309. $core.addMethod(
  26310. $core.method({
  26311. selector: "confirm:",
  26312. protocol: "dialogs",
  26313. fn: function (aString){
  26314. var self=this,$self=this;
  26315. return $core.withContext(function($ctx1) {
  26316. return $recv($self._current())._confirm_(aString);
  26317. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26318. },
  26319. args: ["aString"],
  26320. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26321. referencedClasses: [],
  26322. messageSends: ["confirm:", "current"]
  26323. }),
  26324. $globals.Terminal.a$cls);
  26325. $core.addMethod(
  26326. $core.method({
  26327. selector: "prompt:",
  26328. protocol: "dialogs",
  26329. fn: function (aString){
  26330. var self=this,$self=this;
  26331. return $core.withContext(function($ctx1) {
  26332. return $recv($self._current())._prompt_(aString);
  26333. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26334. },
  26335. args: ["aString"],
  26336. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26337. referencedClasses: [],
  26338. messageSends: ["prompt:", "current"]
  26339. }),
  26340. $globals.Terminal.a$cls);
  26341. $core.addMethod(
  26342. $core.method({
  26343. selector: "prompt:default:",
  26344. protocol: "dialogs",
  26345. fn: function (aString,defaultString){
  26346. var self=this,$self=this;
  26347. return $core.withContext(function($ctx1) {
  26348. return $recv($self._current())._prompt_default_(aString,defaultString);
  26349. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26350. },
  26351. args: ["aString", "defaultString"],
  26352. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26353. referencedClasses: [],
  26354. messageSends: ["prompt:default:", "current"]
  26355. }),
  26356. $globals.Terminal.a$cls);
  26357. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26358. $globals.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a Transcript \x0a show: 'hello world';\x0a cr;\x0a show: anObject.";
  26359. $core.addMethod(
  26360. $core.method({
  26361. selector: "clear",
  26362. protocol: "printing",
  26363. fn: function (){
  26364. var self=this,$self=this;
  26365. return $core.withContext(function($ctx1) {
  26366. $recv($self._current())._clear();
  26367. return self;
  26368. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26369. },
  26370. args: [],
  26371. source: "clear\x0a\x09self current clear",
  26372. referencedClasses: [],
  26373. messageSends: ["clear", "current"]
  26374. }),
  26375. $globals.Transcript.a$cls);
  26376. $core.addMethod(
  26377. $core.method({
  26378. selector: "cr",
  26379. protocol: "printing",
  26380. fn: function (){
  26381. var self=this,$self=this;
  26382. return $core.withContext(function($ctx1) {
  26383. $recv($self._current())._show_($recv($globals.String)._cr());
  26384. return self;
  26385. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26386. },
  26387. args: [],
  26388. source: "cr\x0a\x09self current show: String cr",
  26389. referencedClasses: ["String"],
  26390. messageSends: ["show:", "current", "cr"]
  26391. }),
  26392. $globals.Transcript.a$cls);
  26393. $core.addMethod(
  26394. $core.method({
  26395. selector: "inspect:",
  26396. protocol: "printing",
  26397. fn: function (anObject){
  26398. var self=this,$self=this;
  26399. return $core.withContext(function($ctx1) {
  26400. $self._show_(anObject);
  26401. return self;
  26402. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26403. },
  26404. args: ["anObject"],
  26405. source: "inspect: anObject\x0a\x09self show: anObject",
  26406. referencedClasses: [],
  26407. messageSends: ["show:"]
  26408. }),
  26409. $globals.Transcript.a$cls);
  26410. $core.addMethod(
  26411. $core.method({
  26412. selector: "open",
  26413. protocol: "instance creation",
  26414. fn: function (){
  26415. var self=this,$self=this;
  26416. return $core.withContext(function($ctx1) {
  26417. $recv($self._current())._open();
  26418. return self;
  26419. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26420. },
  26421. args: [],
  26422. source: "open\x0a\x09self current open",
  26423. referencedClasses: [],
  26424. messageSends: ["open", "current"]
  26425. }),
  26426. $globals.Transcript.a$cls);
  26427. $core.addMethod(
  26428. $core.method({
  26429. selector: "show:",
  26430. protocol: "printing",
  26431. fn: function (anObject){
  26432. var self=this,$self=this;
  26433. return $core.withContext(function($ctx1) {
  26434. $recv($self._current())._show_(anObject);
  26435. return self;
  26436. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26437. },
  26438. args: ["anObject"],
  26439. source: "show: anObject\x0a\x09self current show: anObject",
  26440. referencedClasses: [],
  26441. messageSends: ["show:", "current"]
  26442. }),
  26443. $globals.Transcript.a$cls);
  26444. $core.addMethod(
  26445. $core.method({
  26446. selector: "inspectOn:",
  26447. protocol: "*Platform-Services",
  26448. fn: function (anInspector){
  26449. var self=this,$self=this;
  26450. var variables;
  26451. return $core.withContext(function($ctx1) {
  26452. variables=$recv($globals.Dictionary)._new();
  26453. $recv(variables)._at_put_("#self",self);
  26454. $ctx1.sendIdx["at:put:"]=1;
  26455. $recv(variables)._at_put_("#keys",$self._keys());
  26456. $ctx1.sendIdx["at:put:"]=2;
  26457. $self._keysAndValuesDo_((function(key,value){
  26458. return $core.withContext(function($ctx2) {
  26459. return $recv(variables)._at_put_(key,value);
  26460. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26461. }));
  26462. $recv(anInspector)._setLabel_($self._printString());
  26463. $recv(anInspector)._setVariables_(variables);
  26464. return self;
  26465. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26466. },
  26467. args: ["anInspector"],
  26468. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#keys' put: self keys.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09variables at: key put: value ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  26469. referencedClasses: ["Dictionary"],
  26470. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26471. }),
  26472. $globals.AssociativeCollection);
  26473. $core.addMethod(
  26474. $core.method({
  26475. selector: "inspectOn:",
  26476. protocol: "*Platform-Services",
  26477. fn: function (anInspector){
  26478. var self=this,$self=this;
  26479. var variables;
  26480. return $core.withContext(function($ctx1) {
  26481. variables=$recv($globals.Dictionary)._new();
  26482. $recv(variables)._at_put_("#self",self);
  26483. $ctx1.sendIdx["at:put:"]=1;
  26484. $self._withIndexDo_((function(each,i){
  26485. return $core.withContext(function($ctx2) {
  26486. return $recv(variables)._at_put_(i,each);
  26487. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26488. }));
  26489. $recv(anInspector)._setLabel_($self._printString());
  26490. $recv(anInspector)._setVariables_(variables);
  26491. return self;
  26492. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26493. },
  26494. args: ["anInspector"],
  26495. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09variables at: i put: each ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  26496. referencedClasses: ["Dictionary"],
  26497. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26498. }),
  26499. $globals.Collection);
  26500. $core.addMethod(
  26501. $core.method({
  26502. selector: "inspectOn:",
  26503. protocol: "*Platform-Services",
  26504. fn: function (anInspector){
  26505. var self=this,$self=this;
  26506. var variables;
  26507. return $core.withContext(function($ctx1) {
  26508. variables=$recv($globals.Dictionary)._new();
  26509. $recv(variables)._at_put_("#self",self);
  26510. $ctx1.sendIdx["at:put:"]=1;
  26511. $recv(variables)._at_put_("#year",$self._year());
  26512. $ctx1.sendIdx["at:put:"]=2;
  26513. $recv(variables)._at_put_("#month",$self._month());
  26514. $ctx1.sendIdx["at:put:"]=3;
  26515. $recv(variables)._at_put_("#day",$self._day());
  26516. $ctx1.sendIdx["at:put:"]=4;
  26517. $recv(variables)._at_put_("#hours",$self._hours());
  26518. $ctx1.sendIdx["at:put:"]=5;
  26519. $recv(variables)._at_put_("#minutes",$self._minutes());
  26520. $ctx1.sendIdx["at:put:"]=6;
  26521. $recv(variables)._at_put_("#seconds",$self._seconds());
  26522. $ctx1.sendIdx["at:put:"]=7;
  26523. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26524. $recv(anInspector)._setLabel_($self._printString());
  26525. $recv(anInspector)._setVariables_(variables);
  26526. return self;
  26527. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26528. },
  26529. args: ["anInspector"],
  26530. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#year' put: self year.\x0a\x09variables at: '#month' put: self month.\x0a\x09variables at: '#day' put: self day.\x0a\x09variables at: '#hours' put: self hours.\x0a\x09variables at: '#minutes' put: self minutes.\x0a\x09variables at: '#seconds' put: self seconds.\x0a\x09variables at: '#milliseconds' put: self milliseconds.\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  26531. referencedClasses: ["Dictionary"],
  26532. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26533. }),
  26534. $globals.Date);
  26535. $core.addMethod(
  26536. $core.method({
  26537. selector: "inspectOn:",
  26538. protocol: "*Platform-Services",
  26539. fn: function (anInspector){
  26540. var self=this,$self=this;
  26541. var variables;
  26542. return $core.withContext(function($ctx1) {
  26543. variables=$recv($globals.Dictionary)._new();
  26544. $recv(variables)._at_put_("#self",$self._jsObject());
  26545. $recv(anInspector)._setLabel_($self._printString());
  26546. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26547. $recv(anInspector)._setVariables_(variables);
  26548. return self;
  26549. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26550. },
  26551. args: ["anInspector"],
  26552. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self jsObject.\x0a\x09anInspector setLabel: self printString.\x0a\x09JSObjectProxy addObjectVariablesTo: variables ofProxy: self.\x0a\x09anInspector setVariables: variables",
  26553. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26554. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26555. }),
  26556. $globals.JSObjectProxy);
  26557. $core.addMethod(
  26558. $core.method({
  26559. selector: "inspectOn:",
  26560. protocol: "*Platform-Services",
  26561. fn: function (anInspector){
  26562. var self=this,$self=this;
  26563. var variables;
  26564. return $core.withContext(function($ctx1) {
  26565. variables=$recv($globals.Dictionary)._new();
  26566. $recv(variables)._at_put_("#self",self);
  26567. $ctx1.sendIdx["at:put:"]=1;
  26568. $recv(variables)._at_put_("#home",$self._home());
  26569. $ctx1.sendIdx["at:put:"]=2;
  26570. $recv(variables)._at_put_("#receiver",$self._receiver());
  26571. $ctx1.sendIdx["at:put:"]=3;
  26572. $recv(variables)._at_put_("#selector",$self._selector());
  26573. $ctx1.sendIdx["at:put:"]=4;
  26574. $recv(variables)._at_put_("#locals",$self._locals());
  26575. $ctx1.sendIdx["at:put:"]=5;
  26576. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26577. return $core.withContext(function($ctx2) {
  26578. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26580. }));
  26581. $recv(anInspector)._setLabel_($self._printString());
  26582. $recv(anInspector)._setVariables_(variables);
  26583. return self;
  26584. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26585. },
  26586. args: ["anInspector"],
  26587. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09variables at: '#home' put: self home.\x0a\x09variables at: '#receiver' put: self receiver.\x0a\x09variables at: '#selector' put: self selector.\x0a\x09variables at: '#locals' put: self locals.\x0a\x09self class instanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  26588. referencedClasses: ["Dictionary"],
  26589. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26590. }),
  26591. $globals.MethodContext);
  26592. $core.addMethod(
  26593. $core.method({
  26594. selector: "inspectOn:",
  26595. protocol: "*Platform-Services",
  26596. fn: function (anInspector){
  26597. var self=this,$self=this;
  26598. var variables;
  26599. return $core.withContext(function($ctx1) {
  26600. variables=$recv($globals.Dictionary)._new();
  26601. $recv(variables)._at_put_("#self",self);
  26602. $ctx1.sendIdx["at:put:"]=1;
  26603. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26604. return $core.withContext(function($ctx2) {
  26605. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26606. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26607. }));
  26608. $recv(anInspector)._setLabel_($self._printString());
  26609. $recv(anInspector)._setVariables_(variables);
  26610. return self;
  26611. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26612. },
  26613. args: ["anInspector"],
  26614. source: "inspectOn: anInspector\x0a\x09| variables |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09self class allInstanceVariableNames do: [ :each |\x0a\x09\x09variables at: each put: (self instVarAt: each) ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  26615. referencedClasses: ["Dictionary"],
  26616. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26617. }),
  26618. $globals.Object);
  26619. $core.addMethod(
  26620. $core.method({
  26621. selector: "do:displayingProgress:",
  26622. protocol: "*Platform-Services",
  26623. fn: function (aBlock,aString){
  26624. var self=this,$self=this;
  26625. return $core.withContext(function($ctx1) {
  26626. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26627. return self;
  26628. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26629. },
  26630. args: ["aBlock", "aString"],
  26631. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26632. referencedClasses: ["ProgressHandler"],
  26633. messageSends: ["do:on:displaying:"]
  26634. }),
  26635. $globals.SequenceableCollection);
  26636. $core.addMethod(
  26637. $core.method({
  26638. selector: "inspectOn:",
  26639. protocol: "*Platform-Services",
  26640. fn: function (anInspector){
  26641. var self=this,$self=this;
  26642. var variables,i;
  26643. return $core.withContext(function($ctx1) {
  26644. variables=$recv($globals.Dictionary)._new();
  26645. $recv(variables)._at_put_("#self",self);
  26646. $ctx1.sendIdx["at:put:"]=1;
  26647. i=(1);
  26648. $self._do_((function(each){
  26649. return $core.withContext(function($ctx2) {
  26650. $recv(variables)._at_put_(i,each);
  26651. i=$recv(i).__plus((1));
  26652. return i;
  26653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26654. }));
  26655. $recv(anInspector)._setLabel_($self._printString());
  26656. $recv(anInspector)._setVariables_(variables);
  26657. return self;
  26658. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26659. },
  26660. args: ["anInspector"],
  26661. source: "inspectOn: anInspector\x0a\x09| variables i |\x0a\x09variables := Dictionary new.\x0a\x09variables at: '#self' put: self.\x0a\x09i := 1.\x0a\x09self do: [ :each |\x0a\x09\x09variables at: i put: each.\x0a\x09\x09i := i + 1 ].\x0a\x09anInspector\x0a\x09\x09setLabel: self printString;\x0a\x09\x09setVariables: variables",
  26662. referencedClasses: ["Dictionary"],
  26663. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26664. }),
  26665. $globals.Set);
  26666. $core.addMethod(
  26667. $core.method({
  26668. selector: "inspectOn:",
  26669. protocol: "*Platform-Services",
  26670. fn: function (anInspector){
  26671. var self=this,$self=this;
  26672. var label;
  26673. return $core.withContext(function($ctx1) {
  26674. var $3,$2,$1,$5,$4;
  26675. (
  26676. $ctx1.supercall = true,
  26677. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26678. $ctx1.supercall = false;
  26679. $3=$self._printString();
  26680. $ctx1.sendIdx["printString"]=1;
  26681. $2=$recv($3)._size();
  26682. $1=$recv($2).__gt((30));
  26683. if($core.assert($1)){
  26684. $5=$self._printString();
  26685. $ctx1.sendIdx["printString"]=2;
  26686. $4=$recv($5)._copyFrom_to_((1),(30));
  26687. label=$recv($4).__comma("...'");
  26688. label;
  26689. } else {
  26690. label=$self._printString();
  26691. label;
  26692. }
  26693. $recv(anInspector)._setLabel_(label);
  26694. return self;
  26695. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26696. },
  26697. args: ["anInspector"],
  26698. source: "inspectOn: anInspector\x0a\x09| label |\x0a\x09super inspectOn: anInspector.\x0a\x09self printString size > 30\x0a\x09\x09ifTrue: [ label := (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ label := self printString ].\x0a\x09anInspector setLabel: label",
  26699. referencedClasses: [],
  26700. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26701. }),
  26702. $globals.String);
  26703. });
  26704. define('amber/deploy',[
  26705. './helpers',
  26706. './boot', // pre-fetch, dep of ./helpers
  26707. // --- packages of the core Amber begin here ---
  26708. 'amber_core/Kernel-Helpers',
  26709. 'amber_core/Kernel-Objects',
  26710. 'amber_core/Kernel-Classes',
  26711. 'amber_core/Kernel-Methods',
  26712. 'amber_core/Kernel-Collections',
  26713. 'amber_core/Kernel-Dag',
  26714. 'amber_core/Kernel-Infrastructure',
  26715. 'amber_core/Kernel-Promises',
  26716. 'amber_core/Kernel-Exceptions',
  26717. 'amber_core/Kernel-Announcements',
  26718. 'amber_core/Platform-Services',
  26719. // --- packages of the core Amber end here ---
  26720. ], function (amber) {
  26721. return amber;
  26722. });
  26723. // jshint ignore:start
  26724. define('amber/parser',['./boot'], function($boot) {
  26725. var $globals = $boot.globals;
  26726. $globals.SmalltalkParser = (function() {
  26727. "use strict";
  26728. /*
  26729. * Generated by PEG.js 0.9.0.
  26730. *
  26731. * http://pegjs.org/
  26732. */
  26733. function peg$subclass(child, parent) {
  26734. function ctor() { this.constructor = child; }
  26735. ctor.prototype = parent.prototype;
  26736. child.prototype = new ctor();
  26737. }
  26738. function peg$SyntaxError(message, expected, found, location) {
  26739. this.message = message;
  26740. this.expected = expected;
  26741. this.found = found;
  26742. this.location = location;
  26743. this.name = "SyntaxError";
  26744. if (typeof Error.captureStackTrace === "function") {
  26745. Error.captureStackTrace(this, peg$SyntaxError);
  26746. }
  26747. }
  26748. peg$subclass(peg$SyntaxError, Error);
  26749. function peg$parse(input) {
  26750. var options = arguments.length > 1 ? arguments[1] : {},
  26751. parser = this,
  26752. peg$FAILED = {},
  26753. peg$startRuleFunctions = { start: peg$parsestart },
  26754. peg$startRuleFunction = peg$parsestart,
  26755. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26756. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF\\n\\r\\u2028\\u2029]" },
  26757. peg$c2 = "\"",
  26758. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26759. peg$c4 = /^[^"]/,
  26760. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26761. peg$c6 = ".",
  26762. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26763. peg$c8 = /^[a-zA-Z]/,
  26764. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26765. peg$c10 = /^[a-zA-Z0-9]/,
  26766. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26767. peg$c12 = ":",
  26768. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26769. peg$c14 = /^[A-Z]/,
  26770. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26771. peg$c16 = function(val) {
  26772. return $globals.ValueNode._new()
  26773. ._location_(location())
  26774. ._source_(text())
  26775. ._value_(val);
  26776. },
  26777. peg$c17 = "'",
  26778. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26779. peg$c19 = "''",
  26780. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26781. peg$c21 = function() {return '\'';},
  26782. peg$c22 = /^[^']/,
  26783. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26784. peg$c24 = function(val) {return val.join('');},
  26785. peg$c25 = "$",
  26786. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26787. peg$c27 = { type: "any", description: "any character" },
  26788. peg$c28 = function(char) {
  26789. return $globals.ValueNode._new()
  26790. ._location_(location())
  26791. ._source_(text())
  26792. ._value_(char);
  26793. },
  26794. peg$c29 = "#",
  26795. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26796. peg$c31 = function(rest) {return rest;},
  26797. peg$c32 = "e",
  26798. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26799. peg$c34 = function(n) {return parseFloat(n);},
  26800. peg$c35 = "-",
  26801. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26802. peg$c37 = "16r",
  26803. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26804. peg$c39 = /^[0-9a-fA-F]/,
  26805. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26806. peg$c41 = function(neg, num) {
  26807. return parseInt(((neg || '') + num), 16);
  26808. },
  26809. peg$c42 = /^[0-9]/,
  26810. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26811. peg$c44 = function(n) {return parseFloat(n, 10);},
  26812. peg$c45 = function(n) {return parseInt(n, 10);},
  26813. peg$c46 = "#(",
  26814. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26815. peg$c48 = ")",
  26816. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26817. peg$c50 = function(rest) {
  26818. return rest
  26819. ._location_(location())
  26820. ._source_(text());
  26821. },
  26822. peg$c51 = "(",
  26823. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26824. peg$c53 = function(lit) {return lit._value();},
  26825. peg$c54 = function(lits) {
  26826. return $globals.ValueNode._new()
  26827. ._value_(lits);
  26828. },
  26829. peg$c55 = "{",
  26830. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26831. peg$c57 = "}",
  26832. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26833. peg$c59 = function(expressions) {
  26834. return $globals.DynamicArrayNode._new()
  26835. ._location_(location())
  26836. ._source_(text())
  26837. ._dagChildren_(expressions || []);
  26838. },
  26839. peg$c60 = "#{",
  26840. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26841. peg$c62 = function(expressions) {
  26842. return $globals.DynamicDictionaryNode._new()
  26843. ._location_(location())
  26844. ._source_(text())
  26845. ._dagChildren_(expressions || []);
  26846. },
  26847. peg$c63 = "true",
  26848. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26849. peg$c65 = function() {return true;},
  26850. peg$c66 = "false",
  26851. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26852. peg$c68 = function() {return false;},
  26853. peg$c69 = "nil",
  26854. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26855. peg$c71 = function() {return null;},
  26856. peg$c72 = function(identifier) {
  26857. return $globals.VariableNode._new()
  26858. ._location_(location())
  26859. ._source_(text())
  26860. ._value_(identifier);
  26861. },
  26862. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26863. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26864. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26865. peg$c76 = function(pairs) {
  26866. var selector = '';
  26867. var params = [];
  26868. for(var i = 0; i < pairs.length; i++) {
  26869. selector += pairs[i].key;
  26870. params.push(pairs[i].arg);
  26871. }
  26872. return [selector, params];
  26873. },
  26874. peg$c77 = function(selector, arg) {
  26875. return [selector, [arg]];
  26876. },
  26877. peg$c78 = function(selector) {return [selector, []];},
  26878. peg$c79 = function(expression) {
  26879. return expression;
  26880. },
  26881. peg$c80 = function(first, others) {
  26882. return [first].concat(others);
  26883. },
  26884. peg$c81 = function(selector) {
  26885. return $globals.Message._selector_arguments_(selector, []);
  26886. },
  26887. peg$c82 = function(pairs) {
  26888. var selector = '';
  26889. var args = [];
  26890. for(var i = 0; i < pairs.length; i++) {
  26891. selector += pairs[i].key;
  26892. args.push(pairs[i].arg._value());
  26893. }
  26894. return $globals.Message._selector_arguments_(selector, args)
  26895. },
  26896. peg$c83 = "<",
  26897. peg$c84 = { type: "literal", value: "<", description: "\"<\"" },
  26898. peg$c85 = ">",
  26899. peg$c86 = { type: "literal", value: ">", description: "\">\"" },
  26900. peg$c87 = function(message) {return message;},
  26901. peg$c88 = ":=",
  26902. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  26903. peg$c90 = function(variable, expression) {
  26904. return $globals.AssignmentNode._new()
  26905. ._location_(location())
  26906. ._source_(text())
  26907. ._left_(variable)
  26908. ._right_(expression);
  26909. },
  26910. peg$c91 = "^",
  26911. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  26912. peg$c93 = function(expression) {
  26913. return $globals.ReturnNode._new()
  26914. ._location_(location())
  26915. ._source_(text())
  26916. ._dagChildren_([expression]);
  26917. },
  26918. peg$c94 = "|",
  26919. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  26920. peg$c96 = function(variable) {return variable;},
  26921. peg$c97 = function(vars) {
  26922. return vars;
  26923. },
  26924. peg$c98 = function(param) {return param;},
  26925. peg$c99 = function(params) {
  26926. return params;
  26927. },
  26928. peg$c100 = function(ret) {return [ret];},
  26929. peg$c101 = function(exps, ret) {
  26930. var expressions = exps;
  26931. expressions.push(ret);
  26932. return expressions;
  26933. },
  26934. peg$c102 = function(expressions) {return expressions || [];},
  26935. peg$c103 = function(aPragmas, temps, zPragmas, statements) {
  26936. return $globals.SequenceNode._new()
  26937. ._location_(location())
  26938. ._source_(text())
  26939. ._temps_(temps || [])
  26940. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  26941. ._dagChildren_(statements || []);
  26942. },
  26943. peg$c104 = "[",
  26944. peg$c105 = { type: "literal", value: "[", description: "\"[\"" },
  26945. peg$c106 = "]",
  26946. peg$c107 = { type: "literal", value: "]", description: "\"]\"" },
  26947. peg$c108 = function(params, sequence) {
  26948. return $globals.BlockNode._new()
  26949. ._location_(location())
  26950. ._source_(text())
  26951. ._parameters_(params || [])
  26952. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26953. },
  26954. peg$c109 = function(selector) {
  26955. return $globals.SendNode._new()
  26956. ._location_(location())
  26957. ._source_(text())
  26958. ._selector_(selector);
  26959. },
  26960. peg$c110 = function(receiver, tail) {
  26961. return receiver._withTail_(tail);
  26962. },
  26963. peg$c111 = function(selector, arg) {
  26964. return $globals.SendNode._new()
  26965. ._location_(location())
  26966. ._source_(text())
  26967. ._selector_(selector)
  26968. ._arguments_([arg]);
  26969. },
  26970. peg$c112 = function(pairs) {
  26971. var selector = '';
  26972. var args = [];
  26973. for(var i = 0; i < pairs.length; i++) {
  26974. selector += pairs[i].key;
  26975. args.push(pairs[i].arg);
  26976. }
  26977. return $globals.SendNode._new()
  26978. ._location_(location())
  26979. ._source_(text())
  26980. ._selector_(selector)
  26981. ._arguments_(args);
  26982. },
  26983. peg$c113 = function(receiver, tail) {
  26984. return tail ? receiver._withTail_([tail]) : receiver;
  26985. },
  26986. peg$c114 = function(send) {return send._isSendNode();},
  26987. peg$c115 = ";",
  26988. peg$c116 = { type: "literal", value: ";", description: "\";\"" },
  26989. peg$c117 = function(send, mess) {return mess;},
  26990. peg$c118 = function(send, messages) {
  26991. messages.unshift(send);
  26992. return $globals.CascadeNode._new()
  26993. ._location_(location())
  26994. ._source_(text())
  26995. ._dagChildren_(messages);
  26996. },
  26997. peg$c119 = function(pattern, sequence) {
  26998. return $globals.MethodNode._new()
  26999. ._location_(location())
  27000. ._source_(text())
  27001. ._selector_(pattern[0])
  27002. ._arguments_(pattern[1])
  27003. ._dagChildren_([sequence]);
  27004. },
  27005. peg$c120 = function(send) { return send._isSendNode() && send._selector() === '->' },
  27006. peg$c121 = function(send) {
  27007. return [send._receiver(), send._arguments()[0]];
  27008. },
  27009. peg$c122 = function(first, others) {
  27010. return first.concat.apply(first, others);
  27011. },
  27012. peg$currPos = 0,
  27013. peg$savedPos = 0,
  27014. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  27015. peg$maxFailPos = 0,
  27016. peg$maxFailExpected = [],
  27017. peg$silentFails = 0,
  27018. peg$resultsCache = {},
  27019. peg$result;
  27020. if ("startRule" in options) {
  27021. if (!(options.startRule in peg$startRuleFunctions)) {
  27022. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27023. }
  27024. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27025. }
  27026. function text() {
  27027. return input.substring(peg$savedPos, peg$currPos);
  27028. }
  27029. function location() {
  27030. return peg$computeLocation(peg$savedPos, peg$currPos);
  27031. }
  27032. function expected(description) {
  27033. throw peg$buildException(
  27034. null,
  27035. [{ type: "other", description: description }],
  27036. input.substring(peg$savedPos, peg$currPos),
  27037. peg$computeLocation(peg$savedPos, peg$currPos)
  27038. );
  27039. }
  27040. function error(message) {
  27041. throw peg$buildException(
  27042. message,
  27043. null,
  27044. input.substring(peg$savedPos, peg$currPos),
  27045. peg$computeLocation(peg$savedPos, peg$currPos)
  27046. );
  27047. }
  27048. function peg$computePosDetails(pos) {
  27049. var details = peg$posDetailsCache[pos],
  27050. p, ch;
  27051. if (details) {
  27052. return details;
  27053. } else {
  27054. p = pos - 1;
  27055. while (!peg$posDetailsCache[p]) {
  27056. p--;
  27057. }
  27058. details = peg$posDetailsCache[p];
  27059. details = {
  27060. line: details.line,
  27061. column: details.column,
  27062. seenCR: details.seenCR
  27063. };
  27064. while (p < pos) {
  27065. ch = input.charAt(p);
  27066. if (ch === "\n") {
  27067. if (!details.seenCR) { details.line++; }
  27068. details.column = 1;
  27069. details.seenCR = false;
  27070. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27071. details.line++;
  27072. details.column = 1;
  27073. details.seenCR = true;
  27074. } else {
  27075. details.column++;
  27076. details.seenCR = false;
  27077. }
  27078. p++;
  27079. }
  27080. peg$posDetailsCache[pos] = details;
  27081. return details;
  27082. }
  27083. }
  27084. function peg$computeLocation(startPos, endPos) {
  27085. var startPosDetails = peg$computePosDetails(startPos),
  27086. endPosDetails = peg$computePosDetails(endPos);
  27087. return {
  27088. start: {
  27089. offset: startPos,
  27090. line: startPosDetails.line,
  27091. column: startPosDetails.column
  27092. },
  27093. end: {
  27094. offset: endPos,
  27095. line: endPosDetails.line,
  27096. column: endPosDetails.column
  27097. }
  27098. };
  27099. }
  27100. function peg$fail(expected) {
  27101. if (peg$currPos < peg$maxFailPos) { return; }
  27102. if (peg$currPos > peg$maxFailPos) {
  27103. peg$maxFailPos = peg$currPos;
  27104. peg$maxFailExpected = [];
  27105. }
  27106. peg$maxFailExpected.push(expected);
  27107. }
  27108. function peg$buildException(message, expected, found, location) {
  27109. function cleanupExpected(expected) {
  27110. var i = 1;
  27111. expected.sort(function(a, b) {
  27112. if (a.description < b.description) {
  27113. return -1;
  27114. } else if (a.description > b.description) {
  27115. return 1;
  27116. } else {
  27117. return 0;
  27118. }
  27119. });
  27120. while (i < expected.length) {
  27121. if (expected[i - 1] === expected[i]) {
  27122. expected.splice(i, 1);
  27123. } else {
  27124. i++;
  27125. }
  27126. }
  27127. }
  27128. function buildMessage(expected, found) {
  27129. function stringEscape(s) {
  27130. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27131. return s
  27132. .replace(/\\/g, '\\\\')
  27133. .replace(/"/g, '\\"')
  27134. .replace(/\x08/g, '\\b')
  27135. .replace(/\t/g, '\\t')
  27136. .replace(/\n/g, '\\n')
  27137. .replace(/\f/g, '\\f')
  27138. .replace(/\r/g, '\\r')
  27139. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27140. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27141. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27142. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27143. }
  27144. var expectedDescs = new Array(expected.length),
  27145. expectedDesc, foundDesc, i;
  27146. for (i = 0; i < expected.length; i++) {
  27147. expectedDescs[i] = expected[i].description;
  27148. }
  27149. expectedDesc = expected.length > 1
  27150. ? expectedDescs.slice(0, -1).join(", ")
  27151. + " or "
  27152. + expectedDescs[expected.length - 1]
  27153. : expectedDescs[0];
  27154. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27155. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27156. }
  27157. if (expected !== null) {
  27158. cleanupExpected(expected);
  27159. }
  27160. return new peg$SyntaxError(
  27161. message !== null ? message : buildMessage(expected, found),
  27162. expected,
  27163. found,
  27164. location
  27165. );
  27166. }
  27167. function peg$parsestart() {
  27168. var s0;
  27169. var key = peg$currPos * 63 + 0,
  27170. cached = peg$resultsCache[key];
  27171. if (cached) {
  27172. peg$currPos = cached.nextPos;
  27173. return cached.result;
  27174. }
  27175. s0 = peg$parsemethod();
  27176. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27177. return s0;
  27178. }
  27179. function peg$parseseparator() {
  27180. var s0, s1;
  27181. var key = peg$currPos * 63 + 1,
  27182. cached = peg$resultsCache[key];
  27183. if (cached) {
  27184. peg$currPos = cached.nextPos;
  27185. return cached.result;
  27186. }
  27187. s0 = [];
  27188. if (peg$c0.test(input.charAt(peg$currPos))) {
  27189. s1 = input.charAt(peg$currPos);
  27190. peg$currPos++;
  27191. } else {
  27192. s1 = peg$FAILED;
  27193. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27194. }
  27195. if (s1 !== peg$FAILED) {
  27196. while (s1 !== peg$FAILED) {
  27197. s0.push(s1);
  27198. if (peg$c0.test(input.charAt(peg$currPos))) {
  27199. s1 = input.charAt(peg$currPos);
  27200. peg$currPos++;
  27201. } else {
  27202. s1 = peg$FAILED;
  27203. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27204. }
  27205. }
  27206. } else {
  27207. s0 = peg$FAILED;
  27208. }
  27209. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27210. return s0;
  27211. }
  27212. function peg$parsecomments() {
  27213. var s0, s1, s2, s3, s4;
  27214. var key = peg$currPos * 63 + 2,
  27215. cached = peg$resultsCache[key];
  27216. if (cached) {
  27217. peg$currPos = cached.nextPos;
  27218. return cached.result;
  27219. }
  27220. s0 = [];
  27221. s1 = peg$currPos;
  27222. if (input.charCodeAt(peg$currPos) === 34) {
  27223. s2 = peg$c2;
  27224. peg$currPos++;
  27225. } else {
  27226. s2 = peg$FAILED;
  27227. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27228. }
  27229. if (s2 !== peg$FAILED) {
  27230. s3 = [];
  27231. if (peg$c4.test(input.charAt(peg$currPos))) {
  27232. s4 = input.charAt(peg$currPos);
  27233. peg$currPos++;
  27234. } else {
  27235. s4 = peg$FAILED;
  27236. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27237. }
  27238. while (s4 !== peg$FAILED) {
  27239. s3.push(s4);
  27240. if (peg$c4.test(input.charAt(peg$currPos))) {
  27241. s4 = input.charAt(peg$currPos);
  27242. peg$currPos++;
  27243. } else {
  27244. s4 = peg$FAILED;
  27245. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27246. }
  27247. }
  27248. if (s3 !== peg$FAILED) {
  27249. if (input.charCodeAt(peg$currPos) === 34) {
  27250. s4 = peg$c2;
  27251. peg$currPos++;
  27252. } else {
  27253. s4 = peg$FAILED;
  27254. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27255. }
  27256. if (s4 !== peg$FAILED) {
  27257. s2 = [s2, s3, s4];
  27258. s1 = s2;
  27259. } else {
  27260. peg$currPos = s1;
  27261. s1 = peg$FAILED;
  27262. }
  27263. } else {
  27264. peg$currPos = s1;
  27265. s1 = peg$FAILED;
  27266. }
  27267. } else {
  27268. peg$currPos = s1;
  27269. s1 = peg$FAILED;
  27270. }
  27271. if (s1 !== peg$FAILED) {
  27272. while (s1 !== peg$FAILED) {
  27273. s0.push(s1);
  27274. s1 = peg$currPos;
  27275. if (input.charCodeAt(peg$currPos) === 34) {
  27276. s2 = peg$c2;
  27277. peg$currPos++;
  27278. } else {
  27279. s2 = peg$FAILED;
  27280. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27281. }
  27282. if (s2 !== peg$FAILED) {
  27283. s3 = [];
  27284. if (peg$c4.test(input.charAt(peg$currPos))) {
  27285. s4 = input.charAt(peg$currPos);
  27286. peg$currPos++;
  27287. } else {
  27288. s4 = peg$FAILED;
  27289. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27290. }
  27291. while (s4 !== peg$FAILED) {
  27292. s3.push(s4);
  27293. if (peg$c4.test(input.charAt(peg$currPos))) {
  27294. s4 = input.charAt(peg$currPos);
  27295. peg$currPos++;
  27296. } else {
  27297. s4 = peg$FAILED;
  27298. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27299. }
  27300. }
  27301. if (s3 !== peg$FAILED) {
  27302. if (input.charCodeAt(peg$currPos) === 34) {
  27303. s4 = peg$c2;
  27304. peg$currPos++;
  27305. } else {
  27306. s4 = peg$FAILED;
  27307. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27308. }
  27309. if (s4 !== peg$FAILED) {
  27310. s2 = [s2, s3, s4];
  27311. s1 = s2;
  27312. } else {
  27313. peg$currPos = s1;
  27314. s1 = peg$FAILED;
  27315. }
  27316. } else {
  27317. peg$currPos = s1;
  27318. s1 = peg$FAILED;
  27319. }
  27320. } else {
  27321. peg$currPos = s1;
  27322. s1 = peg$FAILED;
  27323. }
  27324. }
  27325. } else {
  27326. s0 = peg$FAILED;
  27327. }
  27328. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27329. return s0;
  27330. }
  27331. function peg$parsews() {
  27332. var s0, s1;
  27333. var key = peg$currPos * 63 + 3,
  27334. cached = peg$resultsCache[key];
  27335. if (cached) {
  27336. peg$currPos = cached.nextPos;
  27337. return cached.result;
  27338. }
  27339. s0 = [];
  27340. s1 = peg$parseseparator();
  27341. if (s1 === peg$FAILED) {
  27342. s1 = peg$parsecomments();
  27343. }
  27344. while (s1 !== peg$FAILED) {
  27345. s0.push(s1);
  27346. s1 = peg$parseseparator();
  27347. if (s1 === peg$FAILED) {
  27348. s1 = peg$parsecomments();
  27349. }
  27350. }
  27351. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27352. return s0;
  27353. }
  27354. function peg$parsemaybeDotsWs() {
  27355. var s0, s1;
  27356. var key = peg$currPos * 63 + 4,
  27357. cached = peg$resultsCache[key];
  27358. if (cached) {
  27359. peg$currPos = cached.nextPos;
  27360. return cached.result;
  27361. }
  27362. s0 = [];
  27363. if (input.charCodeAt(peg$currPos) === 46) {
  27364. s1 = peg$c6;
  27365. peg$currPos++;
  27366. } else {
  27367. s1 = peg$FAILED;
  27368. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27369. }
  27370. if (s1 === peg$FAILED) {
  27371. s1 = peg$parseseparator();
  27372. if (s1 === peg$FAILED) {
  27373. s1 = peg$parsecomments();
  27374. }
  27375. }
  27376. while (s1 !== peg$FAILED) {
  27377. s0.push(s1);
  27378. if (input.charCodeAt(peg$currPos) === 46) {
  27379. s1 = peg$c6;
  27380. peg$currPos++;
  27381. } else {
  27382. s1 = peg$FAILED;
  27383. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27384. }
  27385. if (s1 === peg$FAILED) {
  27386. s1 = peg$parseseparator();
  27387. if (s1 === peg$FAILED) {
  27388. s1 = peg$parsecomments();
  27389. }
  27390. }
  27391. }
  27392. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27393. return s0;
  27394. }
  27395. function peg$parsesomeDotsWs() {
  27396. var s0, s1, s2, s3;
  27397. var key = peg$currPos * 63 + 5,
  27398. cached = peg$resultsCache[key];
  27399. if (cached) {
  27400. peg$currPos = cached.nextPos;
  27401. return cached.result;
  27402. }
  27403. s0 = peg$currPos;
  27404. s1 = peg$parsews();
  27405. if (s1 !== peg$FAILED) {
  27406. if (input.charCodeAt(peg$currPos) === 46) {
  27407. s2 = peg$c6;
  27408. peg$currPos++;
  27409. } else {
  27410. s2 = peg$FAILED;
  27411. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27412. }
  27413. if (s2 !== peg$FAILED) {
  27414. s3 = peg$parsemaybeDotsWs();
  27415. if (s3 !== peg$FAILED) {
  27416. s1 = [s1, s2, s3];
  27417. s0 = s1;
  27418. } else {
  27419. peg$currPos = s0;
  27420. s0 = peg$FAILED;
  27421. }
  27422. } else {
  27423. peg$currPos = s0;
  27424. s0 = peg$FAILED;
  27425. }
  27426. } else {
  27427. peg$currPos = s0;
  27428. s0 = peg$FAILED;
  27429. }
  27430. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27431. return s0;
  27432. }
  27433. function peg$parseidentifier() {
  27434. var s0, s1, s2, s3, s4;
  27435. var key = peg$currPos * 63 + 6,
  27436. cached = peg$resultsCache[key];
  27437. if (cached) {
  27438. peg$currPos = cached.nextPos;
  27439. return cached.result;
  27440. }
  27441. s0 = peg$currPos;
  27442. s1 = peg$currPos;
  27443. if (peg$c8.test(input.charAt(peg$currPos))) {
  27444. s2 = input.charAt(peg$currPos);
  27445. peg$currPos++;
  27446. } else {
  27447. s2 = peg$FAILED;
  27448. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27449. }
  27450. if (s2 !== peg$FAILED) {
  27451. s3 = [];
  27452. if (peg$c10.test(input.charAt(peg$currPos))) {
  27453. s4 = input.charAt(peg$currPos);
  27454. peg$currPos++;
  27455. } else {
  27456. s4 = peg$FAILED;
  27457. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27458. }
  27459. while (s4 !== peg$FAILED) {
  27460. s3.push(s4);
  27461. if (peg$c10.test(input.charAt(peg$currPos))) {
  27462. s4 = input.charAt(peg$currPos);
  27463. peg$currPos++;
  27464. } else {
  27465. s4 = peg$FAILED;
  27466. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27467. }
  27468. }
  27469. if (s3 !== peg$FAILED) {
  27470. s2 = [s2, s3];
  27471. s1 = s2;
  27472. } else {
  27473. peg$currPos = s1;
  27474. s1 = peg$FAILED;
  27475. }
  27476. } else {
  27477. peg$currPos = s1;
  27478. s1 = peg$FAILED;
  27479. }
  27480. if (s1 !== peg$FAILED) {
  27481. s0 = input.substring(s0, peg$currPos);
  27482. } else {
  27483. s0 = s1;
  27484. }
  27485. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27486. return s0;
  27487. }
  27488. function peg$parsekeyword() {
  27489. var s0, s1, s2, s3;
  27490. var key = peg$currPos * 63 + 7,
  27491. cached = peg$resultsCache[key];
  27492. if (cached) {
  27493. peg$currPos = cached.nextPos;
  27494. return cached.result;
  27495. }
  27496. s0 = peg$currPos;
  27497. s1 = peg$currPos;
  27498. s2 = peg$parseidentifier();
  27499. if (s2 !== peg$FAILED) {
  27500. if (input.charCodeAt(peg$currPos) === 58) {
  27501. s3 = peg$c12;
  27502. peg$currPos++;
  27503. } else {
  27504. s3 = peg$FAILED;
  27505. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27506. }
  27507. if (s3 !== peg$FAILED) {
  27508. s2 = [s2, s3];
  27509. s1 = s2;
  27510. } else {
  27511. peg$currPos = s1;
  27512. s1 = peg$FAILED;
  27513. }
  27514. } else {
  27515. peg$currPos = s1;
  27516. s1 = peg$FAILED;
  27517. }
  27518. if (s1 !== peg$FAILED) {
  27519. s0 = input.substring(s0, peg$currPos);
  27520. } else {
  27521. s0 = s1;
  27522. }
  27523. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27524. return s0;
  27525. }
  27526. function peg$parseclassName() {
  27527. var s0, s1, s2, s3, s4;
  27528. var key = peg$currPos * 63 + 8,
  27529. cached = peg$resultsCache[key];
  27530. if (cached) {
  27531. peg$currPos = cached.nextPos;
  27532. return cached.result;
  27533. }
  27534. s0 = peg$currPos;
  27535. s1 = peg$currPos;
  27536. if (peg$c14.test(input.charAt(peg$currPos))) {
  27537. s2 = input.charAt(peg$currPos);
  27538. peg$currPos++;
  27539. } else {
  27540. s2 = peg$FAILED;
  27541. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27542. }
  27543. if (s2 !== peg$FAILED) {
  27544. s3 = [];
  27545. if (peg$c10.test(input.charAt(peg$currPos))) {
  27546. s4 = input.charAt(peg$currPos);
  27547. peg$currPos++;
  27548. } else {
  27549. s4 = peg$FAILED;
  27550. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27551. }
  27552. while (s4 !== peg$FAILED) {
  27553. s3.push(s4);
  27554. if (peg$c10.test(input.charAt(peg$currPos))) {
  27555. s4 = input.charAt(peg$currPos);
  27556. peg$currPos++;
  27557. } else {
  27558. s4 = peg$FAILED;
  27559. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27560. }
  27561. }
  27562. if (s3 !== peg$FAILED) {
  27563. s2 = [s2, s3];
  27564. s1 = s2;
  27565. } else {
  27566. peg$currPos = s1;
  27567. s1 = peg$FAILED;
  27568. }
  27569. } else {
  27570. peg$currPos = s1;
  27571. s1 = peg$FAILED;
  27572. }
  27573. if (s1 !== peg$FAILED) {
  27574. s0 = input.substring(s0, peg$currPos);
  27575. } else {
  27576. s0 = s1;
  27577. }
  27578. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27579. return s0;
  27580. }
  27581. function peg$parsestring() {
  27582. var s0, s1;
  27583. var key = peg$currPos * 63 + 9,
  27584. cached = peg$resultsCache[key];
  27585. if (cached) {
  27586. peg$currPos = cached.nextPos;
  27587. return cached.result;
  27588. }
  27589. s0 = peg$currPos;
  27590. s1 = peg$parserawString();
  27591. if (s1 !== peg$FAILED) {
  27592. peg$savedPos = s0;
  27593. s1 = peg$c16(s1);
  27594. }
  27595. s0 = s1;
  27596. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27597. return s0;
  27598. }
  27599. function peg$parserawString() {
  27600. var s0, s1, s2, s3, s4;
  27601. var key = peg$currPos * 63 + 10,
  27602. cached = peg$resultsCache[key];
  27603. if (cached) {
  27604. peg$currPos = cached.nextPos;
  27605. return cached.result;
  27606. }
  27607. s0 = peg$currPos;
  27608. if (input.charCodeAt(peg$currPos) === 39) {
  27609. s1 = peg$c17;
  27610. peg$currPos++;
  27611. } else {
  27612. s1 = peg$FAILED;
  27613. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27614. }
  27615. if (s1 !== peg$FAILED) {
  27616. s2 = [];
  27617. s3 = peg$currPos;
  27618. if (input.substr(peg$currPos, 2) === peg$c19) {
  27619. s4 = peg$c19;
  27620. peg$currPos += 2;
  27621. } else {
  27622. s4 = peg$FAILED;
  27623. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27624. }
  27625. if (s4 !== peg$FAILED) {
  27626. peg$savedPos = s3;
  27627. s4 = peg$c21();
  27628. }
  27629. s3 = s4;
  27630. if (s3 === peg$FAILED) {
  27631. if (peg$c22.test(input.charAt(peg$currPos))) {
  27632. s3 = input.charAt(peg$currPos);
  27633. peg$currPos++;
  27634. } else {
  27635. s3 = peg$FAILED;
  27636. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27637. }
  27638. }
  27639. while (s3 !== peg$FAILED) {
  27640. s2.push(s3);
  27641. s3 = peg$currPos;
  27642. if (input.substr(peg$currPos, 2) === peg$c19) {
  27643. s4 = peg$c19;
  27644. peg$currPos += 2;
  27645. } else {
  27646. s4 = peg$FAILED;
  27647. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27648. }
  27649. if (s4 !== peg$FAILED) {
  27650. peg$savedPos = s3;
  27651. s4 = peg$c21();
  27652. }
  27653. s3 = s4;
  27654. if (s3 === peg$FAILED) {
  27655. if (peg$c22.test(input.charAt(peg$currPos))) {
  27656. s3 = input.charAt(peg$currPos);
  27657. peg$currPos++;
  27658. } else {
  27659. s3 = peg$FAILED;
  27660. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27661. }
  27662. }
  27663. }
  27664. if (s2 !== peg$FAILED) {
  27665. if (input.charCodeAt(peg$currPos) === 39) {
  27666. s3 = peg$c17;
  27667. peg$currPos++;
  27668. } else {
  27669. s3 = peg$FAILED;
  27670. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27671. }
  27672. if (s3 !== peg$FAILED) {
  27673. peg$savedPos = s0;
  27674. s1 = peg$c24(s2);
  27675. s0 = s1;
  27676. } else {
  27677. peg$currPos = s0;
  27678. s0 = peg$FAILED;
  27679. }
  27680. } else {
  27681. peg$currPos = s0;
  27682. s0 = peg$FAILED;
  27683. }
  27684. } else {
  27685. peg$currPos = s0;
  27686. s0 = peg$FAILED;
  27687. }
  27688. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27689. return s0;
  27690. }
  27691. function peg$parsecharacter() {
  27692. var s0, s1, s2;
  27693. var key = peg$currPos * 63 + 11,
  27694. cached = peg$resultsCache[key];
  27695. if (cached) {
  27696. peg$currPos = cached.nextPos;
  27697. return cached.result;
  27698. }
  27699. s0 = peg$currPos;
  27700. if (input.charCodeAt(peg$currPos) === 36) {
  27701. s1 = peg$c25;
  27702. peg$currPos++;
  27703. } else {
  27704. s1 = peg$FAILED;
  27705. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27706. }
  27707. if (s1 !== peg$FAILED) {
  27708. if (input.length > peg$currPos) {
  27709. s2 = input.charAt(peg$currPos);
  27710. peg$currPos++;
  27711. } else {
  27712. s2 = peg$FAILED;
  27713. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27714. }
  27715. if (s2 !== peg$FAILED) {
  27716. peg$savedPos = s0;
  27717. s1 = peg$c28(s2);
  27718. s0 = s1;
  27719. } else {
  27720. peg$currPos = s0;
  27721. s0 = peg$FAILED;
  27722. }
  27723. } else {
  27724. peg$currPos = s0;
  27725. s0 = peg$FAILED;
  27726. }
  27727. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27728. return s0;
  27729. }
  27730. function peg$parsesymbol() {
  27731. var s0, s1, s2;
  27732. var key = peg$currPos * 63 + 12,
  27733. cached = peg$resultsCache[key];
  27734. if (cached) {
  27735. peg$currPos = cached.nextPos;
  27736. return cached.result;
  27737. }
  27738. s0 = peg$currPos;
  27739. if (input.charCodeAt(peg$currPos) === 35) {
  27740. s1 = peg$c29;
  27741. peg$currPos++;
  27742. } else {
  27743. s1 = peg$FAILED;
  27744. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27745. }
  27746. if (s1 !== peg$FAILED) {
  27747. s2 = peg$parsebareSymbol();
  27748. if (s2 !== peg$FAILED) {
  27749. peg$savedPos = s0;
  27750. s1 = peg$c31(s2);
  27751. s0 = s1;
  27752. } else {
  27753. peg$currPos = s0;
  27754. s0 = peg$FAILED;
  27755. }
  27756. } else {
  27757. peg$currPos = s0;
  27758. s0 = peg$FAILED;
  27759. }
  27760. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27761. return s0;
  27762. }
  27763. function peg$parsebareSymbol() {
  27764. var s0, s1, s2, s3;
  27765. var key = peg$currPos * 63 + 13,
  27766. cached = peg$resultsCache[key];
  27767. if (cached) {
  27768. peg$currPos = cached.nextPos;
  27769. return cached.result;
  27770. }
  27771. s0 = peg$currPos;
  27772. s1 = peg$currPos;
  27773. s2 = [];
  27774. s3 = peg$parsekeyword();
  27775. if (s3 !== peg$FAILED) {
  27776. while (s3 !== peg$FAILED) {
  27777. s2.push(s3);
  27778. s3 = peg$parsekeyword();
  27779. }
  27780. } else {
  27781. s2 = peg$FAILED;
  27782. }
  27783. if (s2 !== peg$FAILED) {
  27784. s1 = input.substring(s1, peg$currPos);
  27785. } else {
  27786. s1 = s2;
  27787. }
  27788. if (s1 === peg$FAILED) {
  27789. s1 = peg$parsebinarySelector();
  27790. if (s1 === peg$FAILED) {
  27791. s1 = peg$parseidentifier();
  27792. if (s1 === peg$FAILED) {
  27793. s1 = peg$parserawString();
  27794. }
  27795. }
  27796. }
  27797. if (s1 !== peg$FAILED) {
  27798. peg$savedPos = s0;
  27799. s1 = peg$c16(s1);
  27800. }
  27801. s0 = s1;
  27802. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27803. return s0;
  27804. }
  27805. function peg$parsenumber() {
  27806. var s0, s1;
  27807. var key = peg$currPos * 63 + 14,
  27808. cached = peg$resultsCache[key];
  27809. if (cached) {
  27810. peg$currPos = cached.nextPos;
  27811. return cached.result;
  27812. }
  27813. s0 = peg$currPos;
  27814. s1 = peg$parserawNumber();
  27815. if (s1 !== peg$FAILED) {
  27816. peg$savedPos = s0;
  27817. s1 = peg$c16(s1);
  27818. }
  27819. s0 = s1;
  27820. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27821. return s0;
  27822. }
  27823. function peg$parserawNumber() {
  27824. var s0;
  27825. var key = peg$currPos * 63 + 15,
  27826. cached = peg$resultsCache[key];
  27827. if (cached) {
  27828. peg$currPos = cached.nextPos;
  27829. return cached.result;
  27830. }
  27831. s0 = peg$parsenumberExp();
  27832. if (s0 === peg$FAILED) {
  27833. s0 = peg$parsehex();
  27834. if (s0 === peg$FAILED) {
  27835. s0 = peg$parsefloat();
  27836. if (s0 === peg$FAILED) {
  27837. s0 = peg$parseinteger();
  27838. }
  27839. }
  27840. }
  27841. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27842. return s0;
  27843. }
  27844. function peg$parsenumberExp() {
  27845. var s0, s1, s2, s3, s4, s5;
  27846. var key = peg$currPos * 63 + 16,
  27847. cached = peg$resultsCache[key];
  27848. if (cached) {
  27849. peg$currPos = cached.nextPos;
  27850. return cached.result;
  27851. }
  27852. s0 = peg$currPos;
  27853. s1 = peg$currPos;
  27854. s2 = peg$currPos;
  27855. s3 = peg$parsefloat();
  27856. if (s3 === peg$FAILED) {
  27857. s3 = peg$parseinteger();
  27858. }
  27859. if (s3 !== peg$FAILED) {
  27860. if (input.charCodeAt(peg$currPos) === 101) {
  27861. s4 = peg$c32;
  27862. peg$currPos++;
  27863. } else {
  27864. s4 = peg$FAILED;
  27865. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27866. }
  27867. if (s4 !== peg$FAILED) {
  27868. s5 = peg$parseinteger();
  27869. if (s5 !== peg$FAILED) {
  27870. s3 = [s3, s4, s5];
  27871. s2 = s3;
  27872. } else {
  27873. peg$currPos = s2;
  27874. s2 = peg$FAILED;
  27875. }
  27876. } else {
  27877. peg$currPos = s2;
  27878. s2 = peg$FAILED;
  27879. }
  27880. } else {
  27881. peg$currPos = s2;
  27882. s2 = peg$FAILED;
  27883. }
  27884. if (s2 !== peg$FAILED) {
  27885. s1 = input.substring(s1, peg$currPos);
  27886. } else {
  27887. s1 = s2;
  27888. }
  27889. if (s1 !== peg$FAILED) {
  27890. peg$savedPos = s0;
  27891. s1 = peg$c34(s1);
  27892. }
  27893. s0 = s1;
  27894. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27895. return s0;
  27896. }
  27897. function peg$parsehex() {
  27898. var s0, s1, s2, s3, s4, s5;
  27899. var key = peg$currPos * 63 + 17,
  27900. cached = peg$resultsCache[key];
  27901. if (cached) {
  27902. peg$currPos = cached.nextPos;
  27903. return cached.result;
  27904. }
  27905. s0 = peg$currPos;
  27906. if (input.charCodeAt(peg$currPos) === 45) {
  27907. s1 = peg$c35;
  27908. peg$currPos++;
  27909. } else {
  27910. s1 = peg$FAILED;
  27911. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27912. }
  27913. if (s1 === peg$FAILED) {
  27914. s1 = null;
  27915. }
  27916. if (s1 !== peg$FAILED) {
  27917. if (input.substr(peg$currPos, 3) === peg$c37) {
  27918. s2 = peg$c37;
  27919. peg$currPos += 3;
  27920. } else {
  27921. s2 = peg$FAILED;
  27922. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27923. }
  27924. if (s2 !== peg$FAILED) {
  27925. s3 = peg$currPos;
  27926. s4 = [];
  27927. if (peg$c39.test(input.charAt(peg$currPos))) {
  27928. s5 = input.charAt(peg$currPos);
  27929. peg$currPos++;
  27930. } else {
  27931. s5 = peg$FAILED;
  27932. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27933. }
  27934. if (s5 !== peg$FAILED) {
  27935. while (s5 !== peg$FAILED) {
  27936. s4.push(s5);
  27937. if (peg$c39.test(input.charAt(peg$currPos))) {
  27938. s5 = input.charAt(peg$currPos);
  27939. peg$currPos++;
  27940. } else {
  27941. s5 = peg$FAILED;
  27942. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27943. }
  27944. }
  27945. } else {
  27946. s4 = peg$FAILED;
  27947. }
  27948. if (s4 !== peg$FAILED) {
  27949. s3 = input.substring(s3, peg$currPos);
  27950. } else {
  27951. s3 = s4;
  27952. }
  27953. if (s3 !== peg$FAILED) {
  27954. peg$savedPos = s0;
  27955. s1 = peg$c41(s1, s3);
  27956. s0 = s1;
  27957. } else {
  27958. peg$currPos = s0;
  27959. s0 = peg$FAILED;
  27960. }
  27961. } else {
  27962. peg$currPos = s0;
  27963. s0 = peg$FAILED;
  27964. }
  27965. } else {
  27966. peg$currPos = s0;
  27967. s0 = peg$FAILED;
  27968. }
  27969. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27970. return s0;
  27971. }
  27972. function peg$parsefloat() {
  27973. var s0, s1, s2, s3, s4, s5, s6, s7;
  27974. var key = peg$currPos * 63 + 18,
  27975. cached = peg$resultsCache[key];
  27976. if (cached) {
  27977. peg$currPos = cached.nextPos;
  27978. return cached.result;
  27979. }
  27980. s0 = peg$currPos;
  27981. s1 = peg$currPos;
  27982. s2 = peg$currPos;
  27983. if (input.charCodeAt(peg$currPos) === 45) {
  27984. s3 = peg$c35;
  27985. peg$currPos++;
  27986. } else {
  27987. s3 = peg$FAILED;
  27988. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27989. }
  27990. if (s3 === peg$FAILED) {
  27991. s3 = null;
  27992. }
  27993. if (s3 !== peg$FAILED) {
  27994. s4 = [];
  27995. if (peg$c42.test(input.charAt(peg$currPos))) {
  27996. s5 = input.charAt(peg$currPos);
  27997. peg$currPos++;
  27998. } else {
  27999. s5 = peg$FAILED;
  28000. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28001. }
  28002. if (s5 !== peg$FAILED) {
  28003. while (s5 !== peg$FAILED) {
  28004. s4.push(s5);
  28005. if (peg$c42.test(input.charAt(peg$currPos))) {
  28006. s5 = input.charAt(peg$currPos);
  28007. peg$currPos++;
  28008. } else {
  28009. s5 = peg$FAILED;
  28010. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28011. }
  28012. }
  28013. } else {
  28014. s4 = peg$FAILED;
  28015. }
  28016. if (s4 !== peg$FAILED) {
  28017. if (input.charCodeAt(peg$currPos) === 46) {
  28018. s5 = peg$c6;
  28019. peg$currPos++;
  28020. } else {
  28021. s5 = peg$FAILED;
  28022. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28023. }
  28024. if (s5 !== peg$FAILED) {
  28025. s6 = [];
  28026. if (peg$c42.test(input.charAt(peg$currPos))) {
  28027. s7 = input.charAt(peg$currPos);
  28028. peg$currPos++;
  28029. } else {
  28030. s7 = peg$FAILED;
  28031. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28032. }
  28033. if (s7 !== peg$FAILED) {
  28034. while (s7 !== peg$FAILED) {
  28035. s6.push(s7);
  28036. if (peg$c42.test(input.charAt(peg$currPos))) {
  28037. s7 = input.charAt(peg$currPos);
  28038. peg$currPos++;
  28039. } else {
  28040. s7 = peg$FAILED;
  28041. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28042. }
  28043. }
  28044. } else {
  28045. s6 = peg$FAILED;
  28046. }
  28047. if (s6 !== peg$FAILED) {
  28048. s3 = [s3, s4, s5, s6];
  28049. s2 = s3;
  28050. } else {
  28051. peg$currPos = s2;
  28052. s2 = peg$FAILED;
  28053. }
  28054. } else {
  28055. peg$currPos = s2;
  28056. s2 = peg$FAILED;
  28057. }
  28058. } else {
  28059. peg$currPos = s2;
  28060. s2 = peg$FAILED;
  28061. }
  28062. } else {
  28063. peg$currPos = s2;
  28064. s2 = peg$FAILED;
  28065. }
  28066. if (s2 !== peg$FAILED) {
  28067. s1 = input.substring(s1, peg$currPos);
  28068. } else {
  28069. s1 = s2;
  28070. }
  28071. if (s1 !== peg$FAILED) {
  28072. peg$savedPos = s0;
  28073. s1 = peg$c44(s1);
  28074. }
  28075. s0 = s1;
  28076. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28077. return s0;
  28078. }
  28079. function peg$parseinteger() {
  28080. var s0, s1, s2, s3, s4, s5;
  28081. var key = peg$currPos * 63 + 19,
  28082. cached = peg$resultsCache[key];
  28083. if (cached) {
  28084. peg$currPos = cached.nextPos;
  28085. return cached.result;
  28086. }
  28087. s0 = peg$currPos;
  28088. s1 = peg$currPos;
  28089. s2 = peg$currPos;
  28090. if (input.charCodeAt(peg$currPos) === 45) {
  28091. s3 = peg$c35;
  28092. peg$currPos++;
  28093. } else {
  28094. s3 = peg$FAILED;
  28095. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28096. }
  28097. if (s3 === peg$FAILED) {
  28098. s3 = null;
  28099. }
  28100. if (s3 !== peg$FAILED) {
  28101. s4 = [];
  28102. if (peg$c42.test(input.charAt(peg$currPos))) {
  28103. s5 = input.charAt(peg$currPos);
  28104. peg$currPos++;
  28105. } else {
  28106. s5 = peg$FAILED;
  28107. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28108. }
  28109. if (s5 !== peg$FAILED) {
  28110. while (s5 !== peg$FAILED) {
  28111. s4.push(s5);
  28112. if (peg$c42.test(input.charAt(peg$currPos))) {
  28113. s5 = input.charAt(peg$currPos);
  28114. peg$currPos++;
  28115. } else {
  28116. s5 = peg$FAILED;
  28117. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28118. }
  28119. }
  28120. } else {
  28121. s4 = peg$FAILED;
  28122. }
  28123. if (s4 !== peg$FAILED) {
  28124. s3 = [s3, s4];
  28125. s2 = s3;
  28126. } else {
  28127. peg$currPos = s2;
  28128. s2 = peg$FAILED;
  28129. }
  28130. } else {
  28131. peg$currPos = s2;
  28132. s2 = peg$FAILED;
  28133. }
  28134. if (s2 !== peg$FAILED) {
  28135. s1 = input.substring(s1, peg$currPos);
  28136. } else {
  28137. s1 = s2;
  28138. }
  28139. if (s1 !== peg$FAILED) {
  28140. peg$savedPos = s0;
  28141. s1 = peg$c45(s1);
  28142. }
  28143. s0 = s1;
  28144. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28145. return s0;
  28146. }
  28147. function peg$parseliteralArray() {
  28148. var s0, s1, s2, s3, s4;
  28149. var key = peg$currPos * 63 + 20,
  28150. cached = peg$resultsCache[key];
  28151. if (cached) {
  28152. peg$currPos = cached.nextPos;
  28153. return cached.result;
  28154. }
  28155. s0 = peg$currPos;
  28156. if (input.substr(peg$currPos, 2) === peg$c46) {
  28157. s1 = peg$c46;
  28158. peg$currPos += 2;
  28159. } else {
  28160. s1 = peg$FAILED;
  28161. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28162. }
  28163. if (s1 !== peg$FAILED) {
  28164. s2 = peg$parsewsLiteralArrayContents();
  28165. if (s2 !== peg$FAILED) {
  28166. s3 = peg$parsews();
  28167. if (s3 !== peg$FAILED) {
  28168. if (input.charCodeAt(peg$currPos) === 41) {
  28169. s4 = peg$c48;
  28170. peg$currPos++;
  28171. } else {
  28172. s4 = peg$FAILED;
  28173. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28174. }
  28175. if (s4 !== peg$FAILED) {
  28176. peg$savedPos = s0;
  28177. s1 = peg$c50(s2);
  28178. s0 = s1;
  28179. } else {
  28180. peg$currPos = s0;
  28181. s0 = peg$FAILED;
  28182. }
  28183. } else {
  28184. peg$currPos = s0;
  28185. s0 = peg$FAILED;
  28186. }
  28187. } else {
  28188. peg$currPos = s0;
  28189. s0 = peg$FAILED;
  28190. }
  28191. } else {
  28192. peg$currPos = s0;
  28193. s0 = peg$FAILED;
  28194. }
  28195. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28196. return s0;
  28197. }
  28198. function peg$parsebareLiteralArray() {
  28199. var s0, s1, s2, s3, s4;
  28200. var key = peg$currPos * 63 + 21,
  28201. cached = peg$resultsCache[key];
  28202. if (cached) {
  28203. peg$currPos = cached.nextPos;
  28204. return cached.result;
  28205. }
  28206. s0 = peg$currPos;
  28207. if (input.charCodeAt(peg$currPos) === 40) {
  28208. s1 = peg$c51;
  28209. peg$currPos++;
  28210. } else {
  28211. s1 = peg$FAILED;
  28212. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28213. }
  28214. if (s1 !== peg$FAILED) {
  28215. s2 = peg$parsewsLiteralArrayContents();
  28216. if (s2 !== peg$FAILED) {
  28217. s3 = peg$parsews();
  28218. if (s3 !== peg$FAILED) {
  28219. if (input.charCodeAt(peg$currPos) === 41) {
  28220. s4 = peg$c48;
  28221. peg$currPos++;
  28222. } else {
  28223. s4 = peg$FAILED;
  28224. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28225. }
  28226. if (s4 !== peg$FAILED) {
  28227. peg$savedPos = s0;
  28228. s1 = peg$c50(s2);
  28229. s0 = s1;
  28230. } else {
  28231. peg$currPos = s0;
  28232. s0 = peg$FAILED;
  28233. }
  28234. } else {
  28235. peg$currPos = s0;
  28236. s0 = peg$FAILED;
  28237. }
  28238. } else {
  28239. peg$currPos = s0;
  28240. s0 = peg$FAILED;
  28241. }
  28242. } else {
  28243. peg$currPos = s0;
  28244. s0 = peg$FAILED;
  28245. }
  28246. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28247. return s0;
  28248. }
  28249. function peg$parseliteralArrayElement() {
  28250. var s0;
  28251. var key = peg$currPos * 63 + 22,
  28252. cached = peg$resultsCache[key];
  28253. if (cached) {
  28254. peg$currPos = cached.nextPos;
  28255. return cached.result;
  28256. }
  28257. s0 = peg$parseparseTimeLiteral();
  28258. if (s0 === peg$FAILED) {
  28259. s0 = peg$parsebareLiteralArray();
  28260. if (s0 === peg$FAILED) {
  28261. s0 = peg$parsebareSymbol();
  28262. }
  28263. }
  28264. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28265. return s0;
  28266. }
  28267. function peg$parsewsLiteralArrayContents() {
  28268. var s0, s1, s2, s3, s4;
  28269. var key = peg$currPos * 63 + 23,
  28270. cached = peg$resultsCache[key];
  28271. if (cached) {
  28272. peg$currPos = cached.nextPos;
  28273. return cached.result;
  28274. }
  28275. s0 = peg$currPos;
  28276. s1 = [];
  28277. s2 = peg$currPos;
  28278. s3 = peg$parsews();
  28279. if (s3 !== peg$FAILED) {
  28280. s4 = peg$parseliteralArrayElement();
  28281. if (s4 !== peg$FAILED) {
  28282. peg$savedPos = s2;
  28283. s3 = peg$c53(s4);
  28284. s2 = s3;
  28285. } else {
  28286. peg$currPos = s2;
  28287. s2 = peg$FAILED;
  28288. }
  28289. } else {
  28290. peg$currPos = s2;
  28291. s2 = peg$FAILED;
  28292. }
  28293. while (s2 !== peg$FAILED) {
  28294. s1.push(s2);
  28295. s2 = peg$currPos;
  28296. s3 = peg$parsews();
  28297. if (s3 !== peg$FAILED) {
  28298. s4 = peg$parseliteralArrayElement();
  28299. if (s4 !== peg$FAILED) {
  28300. peg$savedPos = s2;
  28301. s3 = peg$c53(s4);
  28302. s2 = s3;
  28303. } else {
  28304. peg$currPos = s2;
  28305. s2 = peg$FAILED;
  28306. }
  28307. } else {
  28308. peg$currPos = s2;
  28309. s2 = peg$FAILED;
  28310. }
  28311. }
  28312. if (s1 !== peg$FAILED) {
  28313. peg$savedPos = s0;
  28314. s1 = peg$c54(s1);
  28315. }
  28316. s0 = s1;
  28317. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28318. return s0;
  28319. }
  28320. function peg$parsedynamicArray() {
  28321. var s0, s1, s2, s3, s4;
  28322. var key = peg$currPos * 63 + 24,
  28323. cached = peg$resultsCache[key];
  28324. if (cached) {
  28325. peg$currPos = cached.nextPos;
  28326. return cached.result;
  28327. }
  28328. s0 = peg$currPos;
  28329. if (input.charCodeAt(peg$currPos) === 123) {
  28330. s1 = peg$c55;
  28331. peg$currPos++;
  28332. } else {
  28333. s1 = peg$FAILED;
  28334. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28335. }
  28336. if (s1 !== peg$FAILED) {
  28337. s2 = peg$parsewsExpressions();
  28338. if (s2 === peg$FAILED) {
  28339. s2 = null;
  28340. }
  28341. if (s2 !== peg$FAILED) {
  28342. s3 = peg$parsemaybeDotsWs();
  28343. if (s3 !== peg$FAILED) {
  28344. if (input.charCodeAt(peg$currPos) === 125) {
  28345. s4 = peg$c57;
  28346. peg$currPos++;
  28347. } else {
  28348. s4 = peg$FAILED;
  28349. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28350. }
  28351. if (s4 !== peg$FAILED) {
  28352. peg$savedPos = s0;
  28353. s1 = peg$c59(s2);
  28354. s0 = s1;
  28355. } else {
  28356. peg$currPos = s0;
  28357. s0 = peg$FAILED;
  28358. }
  28359. } else {
  28360. peg$currPos = s0;
  28361. s0 = peg$FAILED;
  28362. }
  28363. } else {
  28364. peg$currPos = s0;
  28365. s0 = peg$FAILED;
  28366. }
  28367. } else {
  28368. peg$currPos = s0;
  28369. s0 = peg$FAILED;
  28370. }
  28371. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28372. return s0;
  28373. }
  28374. function peg$parsedynamicDictionary() {
  28375. var s0, s1, s2, s3, s4;
  28376. var key = peg$currPos * 63 + 25,
  28377. cached = peg$resultsCache[key];
  28378. if (cached) {
  28379. peg$currPos = cached.nextPos;
  28380. return cached.result;
  28381. }
  28382. s0 = peg$currPos;
  28383. if (input.substr(peg$currPos, 2) === peg$c60) {
  28384. s1 = peg$c60;
  28385. peg$currPos += 2;
  28386. } else {
  28387. s1 = peg$FAILED;
  28388. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28389. }
  28390. if (s1 !== peg$FAILED) {
  28391. s2 = peg$parsewsAssociations();
  28392. if (s2 === peg$FAILED) {
  28393. s2 = null;
  28394. }
  28395. if (s2 !== peg$FAILED) {
  28396. s3 = peg$parsemaybeDotsWs();
  28397. if (s3 !== peg$FAILED) {
  28398. if (input.charCodeAt(peg$currPos) === 125) {
  28399. s4 = peg$c57;
  28400. peg$currPos++;
  28401. } else {
  28402. s4 = peg$FAILED;
  28403. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28404. }
  28405. if (s4 !== peg$FAILED) {
  28406. peg$savedPos = s0;
  28407. s1 = peg$c62(s2);
  28408. s0 = s1;
  28409. } else {
  28410. peg$currPos = s0;
  28411. s0 = peg$FAILED;
  28412. }
  28413. } else {
  28414. peg$currPos = s0;
  28415. s0 = peg$FAILED;
  28416. }
  28417. } else {
  28418. peg$currPos = s0;
  28419. s0 = peg$FAILED;
  28420. }
  28421. } else {
  28422. peg$currPos = s0;
  28423. s0 = peg$FAILED;
  28424. }
  28425. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28426. return s0;
  28427. }
  28428. function peg$parsepseudoVariable() {
  28429. var s0, s1, s2;
  28430. var key = peg$currPos * 63 + 26,
  28431. cached = peg$resultsCache[key];
  28432. if (cached) {
  28433. peg$currPos = cached.nextPos;
  28434. return cached.result;
  28435. }
  28436. s0 = peg$currPos;
  28437. s1 = peg$currPos;
  28438. if (input.substr(peg$currPos, 4) === peg$c63) {
  28439. s2 = peg$c63;
  28440. peg$currPos += 4;
  28441. } else {
  28442. s2 = peg$FAILED;
  28443. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28444. }
  28445. if (s2 !== peg$FAILED) {
  28446. peg$savedPos = s1;
  28447. s2 = peg$c65();
  28448. }
  28449. s1 = s2;
  28450. if (s1 === peg$FAILED) {
  28451. s1 = peg$currPos;
  28452. if (input.substr(peg$currPos, 5) === peg$c66) {
  28453. s2 = peg$c66;
  28454. peg$currPos += 5;
  28455. } else {
  28456. s2 = peg$FAILED;
  28457. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28458. }
  28459. if (s2 !== peg$FAILED) {
  28460. peg$savedPos = s1;
  28461. s2 = peg$c68();
  28462. }
  28463. s1 = s2;
  28464. if (s1 === peg$FAILED) {
  28465. s1 = peg$currPos;
  28466. if (input.substr(peg$currPos, 3) === peg$c69) {
  28467. s2 = peg$c69;
  28468. peg$currPos += 3;
  28469. } else {
  28470. s2 = peg$FAILED;
  28471. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28472. }
  28473. if (s2 !== peg$FAILED) {
  28474. peg$savedPos = s1;
  28475. s2 = peg$c71();
  28476. }
  28477. s1 = s2;
  28478. }
  28479. }
  28480. if (s1 !== peg$FAILED) {
  28481. peg$savedPos = s0;
  28482. s1 = peg$c16(s1);
  28483. }
  28484. s0 = s1;
  28485. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28486. return s0;
  28487. }
  28488. function peg$parseparseTimeLiteral() {
  28489. var s0;
  28490. var key = peg$currPos * 63 + 27,
  28491. cached = peg$resultsCache[key];
  28492. if (cached) {
  28493. peg$currPos = cached.nextPos;
  28494. return cached.result;
  28495. }
  28496. s0 = peg$parsepseudoVariable();
  28497. if (s0 === peg$FAILED) {
  28498. s0 = peg$parsenumber();
  28499. if (s0 === peg$FAILED) {
  28500. s0 = peg$parseliteralArray();
  28501. if (s0 === peg$FAILED) {
  28502. s0 = peg$parsestring();
  28503. if (s0 === peg$FAILED) {
  28504. s0 = peg$parsesymbol();
  28505. if (s0 === peg$FAILED) {
  28506. s0 = peg$parsecharacter();
  28507. }
  28508. }
  28509. }
  28510. }
  28511. }
  28512. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28513. return s0;
  28514. }
  28515. function peg$parseruntimeLiteral() {
  28516. var s0;
  28517. var key = peg$currPos * 63 + 28,
  28518. cached = peg$resultsCache[key];
  28519. if (cached) {
  28520. peg$currPos = cached.nextPos;
  28521. return cached.result;
  28522. }
  28523. s0 = peg$parsedynamicDictionary();
  28524. if (s0 === peg$FAILED) {
  28525. s0 = peg$parsedynamicArray();
  28526. if (s0 === peg$FAILED) {
  28527. s0 = peg$parseblock();
  28528. }
  28529. }
  28530. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28531. return s0;
  28532. }
  28533. function peg$parseliteral() {
  28534. var s0;
  28535. var key = peg$currPos * 63 + 29,
  28536. cached = peg$resultsCache[key];
  28537. if (cached) {
  28538. peg$currPos = cached.nextPos;
  28539. return cached.result;
  28540. }
  28541. s0 = peg$parseruntimeLiteral();
  28542. if (s0 === peg$FAILED) {
  28543. s0 = peg$parseparseTimeLiteral();
  28544. }
  28545. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28546. return s0;
  28547. }
  28548. function peg$parsevariable() {
  28549. var s0, s1;
  28550. var key = peg$currPos * 63 + 30,
  28551. cached = peg$resultsCache[key];
  28552. if (cached) {
  28553. peg$currPos = cached.nextPos;
  28554. return cached.result;
  28555. }
  28556. s0 = peg$currPos;
  28557. s1 = peg$parseidentifier();
  28558. if (s1 !== peg$FAILED) {
  28559. peg$savedPos = s0;
  28560. s1 = peg$c72(s1);
  28561. }
  28562. s0 = s1;
  28563. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28564. return s0;
  28565. }
  28566. function peg$parsebinarySelector() {
  28567. var s0, s1, s2;
  28568. var key = peg$currPos * 63 + 31,
  28569. cached = peg$resultsCache[key];
  28570. if (cached) {
  28571. peg$currPos = cached.nextPos;
  28572. return cached.result;
  28573. }
  28574. s0 = peg$currPos;
  28575. s1 = [];
  28576. if (peg$c73.test(input.charAt(peg$currPos))) {
  28577. s2 = input.charAt(peg$currPos);
  28578. peg$currPos++;
  28579. } else {
  28580. s2 = peg$FAILED;
  28581. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28582. }
  28583. if (s2 !== peg$FAILED) {
  28584. while (s2 !== peg$FAILED) {
  28585. s1.push(s2);
  28586. if (peg$c73.test(input.charAt(peg$currPos))) {
  28587. s2 = input.charAt(peg$currPos);
  28588. peg$currPos++;
  28589. } else {
  28590. s2 = peg$FAILED;
  28591. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28592. }
  28593. }
  28594. } else {
  28595. s1 = peg$FAILED;
  28596. }
  28597. if (s1 !== peg$FAILED) {
  28598. s0 = input.substring(s0, peg$currPos);
  28599. } else {
  28600. s0 = s1;
  28601. }
  28602. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28603. return s0;
  28604. }
  28605. function peg$parsewsKeywordPattern() {
  28606. var s0, s1, s2, s3, s4, s5, s6;
  28607. var key = peg$currPos * 63 + 32,
  28608. cached = peg$resultsCache[key];
  28609. if (cached) {
  28610. peg$currPos = cached.nextPos;
  28611. return cached.result;
  28612. }
  28613. s0 = peg$currPos;
  28614. s1 = [];
  28615. s2 = peg$currPos;
  28616. s3 = peg$parsews();
  28617. if (s3 !== peg$FAILED) {
  28618. s4 = peg$parsekeyword();
  28619. if (s4 !== peg$FAILED) {
  28620. s5 = peg$parsews();
  28621. if (s5 !== peg$FAILED) {
  28622. s6 = peg$parseidentifier();
  28623. if (s6 !== peg$FAILED) {
  28624. peg$savedPos = s2;
  28625. s3 = peg$c75(s4, s6);
  28626. s2 = s3;
  28627. } else {
  28628. peg$currPos = s2;
  28629. s2 = peg$FAILED;
  28630. }
  28631. } else {
  28632. peg$currPos = s2;
  28633. s2 = peg$FAILED;
  28634. }
  28635. } else {
  28636. peg$currPos = s2;
  28637. s2 = peg$FAILED;
  28638. }
  28639. } else {
  28640. peg$currPos = s2;
  28641. s2 = peg$FAILED;
  28642. }
  28643. if (s2 !== peg$FAILED) {
  28644. while (s2 !== peg$FAILED) {
  28645. s1.push(s2);
  28646. s2 = peg$currPos;
  28647. s3 = peg$parsews();
  28648. if (s3 !== peg$FAILED) {
  28649. s4 = peg$parsekeyword();
  28650. if (s4 !== peg$FAILED) {
  28651. s5 = peg$parsews();
  28652. if (s5 !== peg$FAILED) {
  28653. s6 = peg$parseidentifier();
  28654. if (s6 !== peg$FAILED) {
  28655. peg$savedPos = s2;
  28656. s3 = peg$c75(s4, s6);
  28657. s2 = s3;
  28658. } else {
  28659. peg$currPos = s2;
  28660. s2 = peg$FAILED;
  28661. }
  28662. } else {
  28663. peg$currPos = s2;
  28664. s2 = peg$FAILED;
  28665. }
  28666. } else {
  28667. peg$currPos = s2;
  28668. s2 = peg$FAILED;
  28669. }
  28670. } else {
  28671. peg$currPos = s2;
  28672. s2 = peg$FAILED;
  28673. }
  28674. }
  28675. } else {
  28676. s1 = peg$FAILED;
  28677. }
  28678. if (s1 !== peg$FAILED) {
  28679. peg$savedPos = s0;
  28680. s1 = peg$c76(s1);
  28681. }
  28682. s0 = s1;
  28683. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28684. return s0;
  28685. }
  28686. function peg$parsewsBinaryPattern() {
  28687. var s0, s1, s2, s3, s4;
  28688. var key = peg$currPos * 63 + 33,
  28689. cached = peg$resultsCache[key];
  28690. if (cached) {
  28691. peg$currPos = cached.nextPos;
  28692. return cached.result;
  28693. }
  28694. s0 = peg$currPos;
  28695. s1 = peg$parsews();
  28696. if (s1 !== peg$FAILED) {
  28697. s2 = peg$parsebinarySelector();
  28698. if (s2 !== peg$FAILED) {
  28699. s3 = peg$parsews();
  28700. if (s3 !== peg$FAILED) {
  28701. s4 = peg$parseidentifier();
  28702. if (s4 !== peg$FAILED) {
  28703. peg$savedPos = s0;
  28704. s1 = peg$c77(s2, s4);
  28705. s0 = s1;
  28706. } else {
  28707. peg$currPos = s0;
  28708. s0 = peg$FAILED;
  28709. }
  28710. } else {
  28711. peg$currPos = s0;
  28712. s0 = peg$FAILED;
  28713. }
  28714. } else {
  28715. peg$currPos = s0;
  28716. s0 = peg$FAILED;
  28717. }
  28718. } else {
  28719. peg$currPos = s0;
  28720. s0 = peg$FAILED;
  28721. }
  28722. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28723. return s0;
  28724. }
  28725. function peg$parsewsUnaryPattern() {
  28726. var s0, s1, s2;
  28727. var key = peg$currPos * 63 + 34,
  28728. cached = peg$resultsCache[key];
  28729. if (cached) {
  28730. peg$currPos = cached.nextPos;
  28731. return cached.result;
  28732. }
  28733. s0 = peg$currPos;
  28734. s1 = peg$parsews();
  28735. if (s1 !== peg$FAILED) {
  28736. s2 = peg$parseidentifier();
  28737. if (s2 !== peg$FAILED) {
  28738. peg$savedPos = s0;
  28739. s1 = peg$c78(s2);
  28740. s0 = s1;
  28741. } else {
  28742. peg$currPos = s0;
  28743. s0 = peg$FAILED;
  28744. }
  28745. } else {
  28746. peg$currPos = s0;
  28747. s0 = peg$FAILED;
  28748. }
  28749. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28750. return s0;
  28751. }
  28752. function peg$parseexpression() {
  28753. var s0;
  28754. var key = peg$currPos * 63 + 35,
  28755. cached = peg$resultsCache[key];
  28756. if (cached) {
  28757. peg$currPos = cached.nextPos;
  28758. return cached.result;
  28759. }
  28760. s0 = peg$parseassignment();
  28761. if (s0 === peg$FAILED) {
  28762. s0 = peg$parsecascade();
  28763. if (s0 === peg$FAILED) {
  28764. s0 = peg$parsekeywordSend();
  28765. }
  28766. }
  28767. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28768. return s0;
  28769. }
  28770. function peg$parsewsExpressionsRest() {
  28771. var s0, s1, s2;
  28772. var key = peg$currPos * 63 + 36,
  28773. cached = peg$resultsCache[key];
  28774. if (cached) {
  28775. peg$currPos = cached.nextPos;
  28776. return cached.result;
  28777. }
  28778. s0 = peg$currPos;
  28779. s1 = peg$parsesomeDotsWs();
  28780. if (s1 !== peg$FAILED) {
  28781. s2 = peg$parseexpression();
  28782. if (s2 !== peg$FAILED) {
  28783. peg$savedPos = s0;
  28784. s1 = peg$c79(s2);
  28785. s0 = s1;
  28786. } else {
  28787. peg$currPos = s0;
  28788. s0 = peg$FAILED;
  28789. }
  28790. } else {
  28791. peg$currPos = s0;
  28792. s0 = peg$FAILED;
  28793. }
  28794. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28795. return s0;
  28796. }
  28797. function peg$parsewsExpressions() {
  28798. var s0, s1, s2, s3, s4;
  28799. var key = peg$currPos * 63 + 37,
  28800. cached = peg$resultsCache[key];
  28801. if (cached) {
  28802. peg$currPos = cached.nextPos;
  28803. return cached.result;
  28804. }
  28805. s0 = peg$currPos;
  28806. s1 = peg$parsemaybeDotsWs();
  28807. if (s1 !== peg$FAILED) {
  28808. s2 = peg$parseexpression();
  28809. if (s2 !== peg$FAILED) {
  28810. s3 = [];
  28811. s4 = peg$parsewsExpressionsRest();
  28812. while (s4 !== peg$FAILED) {
  28813. s3.push(s4);
  28814. s4 = peg$parsewsExpressionsRest();
  28815. }
  28816. if (s3 !== peg$FAILED) {
  28817. peg$savedPos = s0;
  28818. s1 = peg$c80(s2, s3);
  28819. s0 = s1;
  28820. } else {
  28821. peg$currPos = s0;
  28822. s0 = peg$FAILED;
  28823. }
  28824. } else {
  28825. peg$currPos = s0;
  28826. s0 = peg$FAILED;
  28827. }
  28828. } else {
  28829. peg$currPos = s0;
  28830. s0 = peg$FAILED;
  28831. }
  28832. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28833. return s0;
  28834. }
  28835. function peg$parsewsUnaryPragmaMessage() {
  28836. var s0, s1, s2, s3, s4;
  28837. var key = peg$currPos * 63 + 38,
  28838. cached = peg$resultsCache[key];
  28839. if (cached) {
  28840. peg$currPos = cached.nextPos;
  28841. return cached.result;
  28842. }
  28843. s0 = peg$currPos;
  28844. s1 = peg$parsews();
  28845. if (s1 !== peg$FAILED) {
  28846. s2 = peg$parseidentifier();
  28847. if (s2 !== peg$FAILED) {
  28848. s3 = peg$currPos;
  28849. peg$silentFails++;
  28850. if (input.charCodeAt(peg$currPos) === 58) {
  28851. s4 = peg$c12;
  28852. peg$currPos++;
  28853. } else {
  28854. s4 = peg$FAILED;
  28855. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28856. }
  28857. peg$silentFails--;
  28858. if (s4 === peg$FAILED) {
  28859. s3 = void 0;
  28860. } else {
  28861. peg$currPos = s3;
  28862. s3 = peg$FAILED;
  28863. }
  28864. if (s3 !== peg$FAILED) {
  28865. peg$savedPos = s0;
  28866. s1 = peg$c81(s2);
  28867. s0 = s1;
  28868. } else {
  28869. peg$currPos = s0;
  28870. s0 = peg$FAILED;
  28871. }
  28872. } else {
  28873. peg$currPos = s0;
  28874. s0 = peg$FAILED;
  28875. }
  28876. } else {
  28877. peg$currPos = s0;
  28878. s0 = peg$FAILED;
  28879. }
  28880. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28881. return s0;
  28882. }
  28883. function peg$parsewsKeywordPragmaMessage() {
  28884. var s0, s1, s2, s3, s4, s5, s6;
  28885. var key = peg$currPos * 63 + 39,
  28886. cached = peg$resultsCache[key];
  28887. if (cached) {
  28888. peg$currPos = cached.nextPos;
  28889. return cached.result;
  28890. }
  28891. s0 = peg$currPos;
  28892. s1 = [];
  28893. s2 = peg$currPos;
  28894. s3 = peg$parsews();
  28895. if (s3 !== peg$FAILED) {
  28896. s4 = peg$parsekeyword();
  28897. if (s4 !== peg$FAILED) {
  28898. s5 = peg$parsews();
  28899. if (s5 !== peg$FAILED) {
  28900. s6 = peg$parseparseTimeLiteral();
  28901. if (s6 !== peg$FAILED) {
  28902. peg$savedPos = s2;
  28903. s3 = peg$c75(s4, s6);
  28904. s2 = s3;
  28905. } else {
  28906. peg$currPos = s2;
  28907. s2 = peg$FAILED;
  28908. }
  28909. } else {
  28910. peg$currPos = s2;
  28911. s2 = peg$FAILED;
  28912. }
  28913. } else {
  28914. peg$currPos = s2;
  28915. s2 = peg$FAILED;
  28916. }
  28917. } else {
  28918. peg$currPos = s2;
  28919. s2 = peg$FAILED;
  28920. }
  28921. if (s2 !== peg$FAILED) {
  28922. while (s2 !== peg$FAILED) {
  28923. s1.push(s2);
  28924. s2 = peg$currPos;
  28925. s3 = peg$parsews();
  28926. if (s3 !== peg$FAILED) {
  28927. s4 = peg$parsekeyword();
  28928. if (s4 !== peg$FAILED) {
  28929. s5 = peg$parsews();
  28930. if (s5 !== peg$FAILED) {
  28931. s6 = peg$parseparseTimeLiteral();
  28932. if (s6 !== peg$FAILED) {
  28933. peg$savedPos = s2;
  28934. s3 = peg$c75(s4, s6);
  28935. s2 = s3;
  28936. } else {
  28937. peg$currPos = s2;
  28938. s2 = peg$FAILED;
  28939. }
  28940. } else {
  28941. peg$currPos = s2;
  28942. s2 = peg$FAILED;
  28943. }
  28944. } else {
  28945. peg$currPos = s2;
  28946. s2 = peg$FAILED;
  28947. }
  28948. } else {
  28949. peg$currPos = s2;
  28950. s2 = peg$FAILED;
  28951. }
  28952. }
  28953. } else {
  28954. s1 = peg$FAILED;
  28955. }
  28956. if (s1 !== peg$FAILED) {
  28957. peg$savedPos = s0;
  28958. s1 = peg$c82(s1);
  28959. }
  28960. s0 = s1;
  28961. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28962. return s0;
  28963. }
  28964. function peg$parsewsPragmaMessage() {
  28965. var s0;
  28966. var key = peg$currPos * 63 + 40,
  28967. cached = peg$resultsCache[key];
  28968. if (cached) {
  28969. peg$currPos = cached.nextPos;
  28970. return cached.result;
  28971. }
  28972. s0 = peg$parsewsUnaryPragmaMessage();
  28973. if (s0 === peg$FAILED) {
  28974. s0 = peg$parsewsKeywordPragmaMessage();
  28975. }
  28976. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28977. return s0;
  28978. }
  28979. function peg$parsewsPragmas() {
  28980. var s0, s1, s2, s3, s4, s5, s6;
  28981. var key = peg$currPos * 63 + 41,
  28982. cached = peg$resultsCache[key];
  28983. if (cached) {
  28984. peg$currPos = cached.nextPos;
  28985. return cached.result;
  28986. }
  28987. s0 = [];
  28988. s1 = peg$currPos;
  28989. s2 = peg$parsews();
  28990. if (s2 !== peg$FAILED) {
  28991. if (input.charCodeAt(peg$currPos) === 60) {
  28992. s3 = peg$c83;
  28993. peg$currPos++;
  28994. } else {
  28995. s3 = peg$FAILED;
  28996. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  28997. }
  28998. if (s3 !== peg$FAILED) {
  28999. s4 = peg$parsewsPragmaMessage();
  29000. if (s4 !== peg$FAILED) {
  29001. s5 = peg$parsews();
  29002. if (s5 !== peg$FAILED) {
  29003. if (input.charCodeAt(peg$currPos) === 62) {
  29004. s6 = peg$c85;
  29005. peg$currPos++;
  29006. } else {
  29007. s6 = peg$FAILED;
  29008. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29009. }
  29010. if (s6 !== peg$FAILED) {
  29011. peg$savedPos = s1;
  29012. s2 = peg$c87(s4);
  29013. s1 = s2;
  29014. } else {
  29015. peg$currPos = s1;
  29016. s1 = peg$FAILED;
  29017. }
  29018. } else {
  29019. peg$currPos = s1;
  29020. s1 = peg$FAILED;
  29021. }
  29022. } else {
  29023. peg$currPos = s1;
  29024. s1 = peg$FAILED;
  29025. }
  29026. } else {
  29027. peg$currPos = s1;
  29028. s1 = peg$FAILED;
  29029. }
  29030. } else {
  29031. peg$currPos = s1;
  29032. s1 = peg$FAILED;
  29033. }
  29034. while (s1 !== peg$FAILED) {
  29035. s0.push(s1);
  29036. s1 = peg$currPos;
  29037. s2 = peg$parsews();
  29038. if (s2 !== peg$FAILED) {
  29039. if (input.charCodeAt(peg$currPos) === 60) {
  29040. s3 = peg$c83;
  29041. peg$currPos++;
  29042. } else {
  29043. s3 = peg$FAILED;
  29044. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29045. }
  29046. if (s3 !== peg$FAILED) {
  29047. s4 = peg$parsewsPragmaMessage();
  29048. if (s4 !== peg$FAILED) {
  29049. s5 = peg$parsews();
  29050. if (s5 !== peg$FAILED) {
  29051. if (input.charCodeAt(peg$currPos) === 62) {
  29052. s6 = peg$c85;
  29053. peg$currPos++;
  29054. } else {
  29055. s6 = peg$FAILED;
  29056. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29057. }
  29058. if (s6 !== peg$FAILED) {
  29059. peg$savedPos = s1;
  29060. s2 = peg$c87(s4);
  29061. s1 = s2;
  29062. } else {
  29063. peg$currPos = s1;
  29064. s1 = peg$FAILED;
  29065. }
  29066. } else {
  29067. peg$currPos = s1;
  29068. s1 = peg$FAILED;
  29069. }
  29070. } else {
  29071. peg$currPos = s1;
  29072. s1 = peg$FAILED;
  29073. }
  29074. } else {
  29075. peg$currPos = s1;
  29076. s1 = peg$FAILED;
  29077. }
  29078. } else {
  29079. peg$currPos = s1;
  29080. s1 = peg$FAILED;
  29081. }
  29082. }
  29083. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29084. return s0;
  29085. }
  29086. function peg$parseassignment() {
  29087. var s0, s1, s2, s3, s4, s5;
  29088. var key = peg$currPos * 63 + 42,
  29089. cached = peg$resultsCache[key];
  29090. if (cached) {
  29091. peg$currPos = cached.nextPos;
  29092. return cached.result;
  29093. }
  29094. s0 = peg$currPos;
  29095. s1 = peg$parsevariable();
  29096. if (s1 !== peg$FAILED) {
  29097. s2 = peg$parsews();
  29098. if (s2 !== peg$FAILED) {
  29099. if (input.substr(peg$currPos, 2) === peg$c88) {
  29100. s3 = peg$c88;
  29101. peg$currPos += 2;
  29102. } else {
  29103. s3 = peg$FAILED;
  29104. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  29105. }
  29106. if (s3 !== peg$FAILED) {
  29107. s4 = peg$parsews();
  29108. if (s4 !== peg$FAILED) {
  29109. s5 = peg$parseexpression();
  29110. if (s5 !== peg$FAILED) {
  29111. peg$savedPos = s0;
  29112. s1 = peg$c90(s1, s5);
  29113. s0 = s1;
  29114. } else {
  29115. peg$currPos = s0;
  29116. s0 = peg$FAILED;
  29117. }
  29118. } else {
  29119. peg$currPos = s0;
  29120. s0 = peg$FAILED;
  29121. }
  29122. } else {
  29123. peg$currPos = s0;
  29124. s0 = peg$FAILED;
  29125. }
  29126. } else {
  29127. peg$currPos = s0;
  29128. s0 = peg$FAILED;
  29129. }
  29130. } else {
  29131. peg$currPos = s0;
  29132. s0 = peg$FAILED;
  29133. }
  29134. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29135. return s0;
  29136. }
  29137. function peg$parseret() {
  29138. var s0, s1, s2, s3;
  29139. var key = peg$currPos * 63 + 43,
  29140. cached = peg$resultsCache[key];
  29141. if (cached) {
  29142. peg$currPos = cached.nextPos;
  29143. return cached.result;
  29144. }
  29145. s0 = peg$currPos;
  29146. if (input.charCodeAt(peg$currPos) === 94) {
  29147. s1 = peg$c91;
  29148. peg$currPos++;
  29149. } else {
  29150. s1 = peg$FAILED;
  29151. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  29152. }
  29153. if (s1 !== peg$FAILED) {
  29154. s2 = peg$parsews();
  29155. if (s2 !== peg$FAILED) {
  29156. s3 = peg$parseexpression();
  29157. if (s3 !== peg$FAILED) {
  29158. peg$savedPos = s0;
  29159. s1 = peg$c93(s3);
  29160. s0 = s1;
  29161. } else {
  29162. peg$currPos = s0;
  29163. s0 = peg$FAILED;
  29164. }
  29165. } else {
  29166. peg$currPos = s0;
  29167. s0 = peg$FAILED;
  29168. }
  29169. } else {
  29170. peg$currPos = s0;
  29171. s0 = peg$FAILED;
  29172. }
  29173. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29174. return s0;
  29175. }
  29176. function peg$parsetemps() {
  29177. var s0, s1, s2, s3, s4, s5;
  29178. var key = peg$currPos * 63 + 44,
  29179. cached = peg$resultsCache[key];
  29180. if (cached) {
  29181. peg$currPos = cached.nextPos;
  29182. return cached.result;
  29183. }
  29184. s0 = peg$currPos;
  29185. if (input.charCodeAt(peg$currPos) === 124) {
  29186. s1 = peg$c94;
  29187. peg$currPos++;
  29188. } else {
  29189. s1 = peg$FAILED;
  29190. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29191. }
  29192. if (s1 !== peg$FAILED) {
  29193. s2 = [];
  29194. s3 = peg$currPos;
  29195. s4 = peg$parsews();
  29196. if (s4 !== peg$FAILED) {
  29197. s5 = peg$parseidentifier();
  29198. if (s5 !== peg$FAILED) {
  29199. peg$savedPos = s3;
  29200. s4 = peg$c96(s5);
  29201. s3 = s4;
  29202. } else {
  29203. peg$currPos = s3;
  29204. s3 = peg$FAILED;
  29205. }
  29206. } else {
  29207. peg$currPos = s3;
  29208. s3 = peg$FAILED;
  29209. }
  29210. while (s3 !== peg$FAILED) {
  29211. s2.push(s3);
  29212. s3 = peg$currPos;
  29213. s4 = peg$parsews();
  29214. if (s4 !== peg$FAILED) {
  29215. s5 = peg$parseidentifier();
  29216. if (s5 !== peg$FAILED) {
  29217. peg$savedPos = s3;
  29218. s4 = peg$c96(s5);
  29219. s3 = s4;
  29220. } else {
  29221. peg$currPos = s3;
  29222. s3 = peg$FAILED;
  29223. }
  29224. } else {
  29225. peg$currPos = s3;
  29226. s3 = peg$FAILED;
  29227. }
  29228. }
  29229. if (s2 !== peg$FAILED) {
  29230. s3 = peg$parsews();
  29231. if (s3 !== peg$FAILED) {
  29232. if (input.charCodeAt(peg$currPos) === 124) {
  29233. s4 = peg$c94;
  29234. peg$currPos++;
  29235. } else {
  29236. s4 = peg$FAILED;
  29237. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29238. }
  29239. if (s4 !== peg$FAILED) {
  29240. peg$savedPos = s0;
  29241. s1 = peg$c97(s2);
  29242. s0 = s1;
  29243. } else {
  29244. peg$currPos = s0;
  29245. s0 = peg$FAILED;
  29246. }
  29247. } else {
  29248. peg$currPos = s0;
  29249. s0 = peg$FAILED;
  29250. }
  29251. } else {
  29252. peg$currPos = s0;
  29253. s0 = peg$FAILED;
  29254. }
  29255. } else {
  29256. peg$currPos = s0;
  29257. s0 = peg$FAILED;
  29258. }
  29259. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29260. return s0;
  29261. }
  29262. function peg$parsewsBlockParamList() {
  29263. var s0, s1, s2, s3, s4, s5, s6;
  29264. var key = peg$currPos * 63 + 45,
  29265. cached = peg$resultsCache[key];
  29266. if (cached) {
  29267. peg$currPos = cached.nextPos;
  29268. return cached.result;
  29269. }
  29270. s0 = peg$currPos;
  29271. s1 = [];
  29272. s2 = peg$currPos;
  29273. s3 = peg$parsews();
  29274. if (s3 !== peg$FAILED) {
  29275. if (input.charCodeAt(peg$currPos) === 58) {
  29276. s4 = peg$c12;
  29277. peg$currPos++;
  29278. } else {
  29279. s4 = peg$FAILED;
  29280. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29281. }
  29282. if (s4 !== peg$FAILED) {
  29283. s5 = peg$parsews();
  29284. if (s5 !== peg$FAILED) {
  29285. s6 = peg$parseidentifier();
  29286. if (s6 !== peg$FAILED) {
  29287. peg$savedPos = s2;
  29288. s3 = peg$c98(s6);
  29289. s2 = s3;
  29290. } else {
  29291. peg$currPos = s2;
  29292. s2 = peg$FAILED;
  29293. }
  29294. } else {
  29295. peg$currPos = s2;
  29296. s2 = peg$FAILED;
  29297. }
  29298. } else {
  29299. peg$currPos = s2;
  29300. s2 = peg$FAILED;
  29301. }
  29302. } else {
  29303. peg$currPos = s2;
  29304. s2 = peg$FAILED;
  29305. }
  29306. if (s2 !== peg$FAILED) {
  29307. while (s2 !== peg$FAILED) {
  29308. s1.push(s2);
  29309. s2 = peg$currPos;
  29310. s3 = peg$parsews();
  29311. if (s3 !== peg$FAILED) {
  29312. if (input.charCodeAt(peg$currPos) === 58) {
  29313. s4 = peg$c12;
  29314. peg$currPos++;
  29315. } else {
  29316. s4 = peg$FAILED;
  29317. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29318. }
  29319. if (s4 !== peg$FAILED) {
  29320. s5 = peg$parsews();
  29321. if (s5 !== peg$FAILED) {
  29322. s6 = peg$parseidentifier();
  29323. if (s6 !== peg$FAILED) {
  29324. peg$savedPos = s2;
  29325. s3 = peg$c98(s6);
  29326. s2 = s3;
  29327. } else {
  29328. peg$currPos = s2;
  29329. s2 = peg$FAILED;
  29330. }
  29331. } else {
  29332. peg$currPos = s2;
  29333. s2 = peg$FAILED;
  29334. }
  29335. } else {
  29336. peg$currPos = s2;
  29337. s2 = peg$FAILED;
  29338. }
  29339. } else {
  29340. peg$currPos = s2;
  29341. s2 = peg$FAILED;
  29342. }
  29343. }
  29344. } else {
  29345. s1 = peg$FAILED;
  29346. }
  29347. if (s1 !== peg$FAILED) {
  29348. s2 = peg$parsews();
  29349. if (s2 !== peg$FAILED) {
  29350. if (input.charCodeAt(peg$currPos) === 124) {
  29351. s3 = peg$c94;
  29352. peg$currPos++;
  29353. } else {
  29354. s3 = peg$FAILED;
  29355. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29356. }
  29357. if (s3 !== peg$FAILED) {
  29358. peg$savedPos = s0;
  29359. s1 = peg$c99(s1);
  29360. s0 = s1;
  29361. } else {
  29362. peg$currPos = s0;
  29363. s0 = peg$FAILED;
  29364. }
  29365. } else {
  29366. peg$currPos = s0;
  29367. s0 = peg$FAILED;
  29368. }
  29369. } else {
  29370. peg$currPos = s0;
  29371. s0 = peg$FAILED;
  29372. }
  29373. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29374. return s0;
  29375. }
  29376. function peg$parsesubexpression() {
  29377. var s0, s1, s2, s3, s4, s5;
  29378. var key = peg$currPos * 63 + 46,
  29379. cached = peg$resultsCache[key];
  29380. if (cached) {
  29381. peg$currPos = cached.nextPos;
  29382. return cached.result;
  29383. }
  29384. s0 = peg$currPos;
  29385. if (input.charCodeAt(peg$currPos) === 40) {
  29386. s1 = peg$c51;
  29387. peg$currPos++;
  29388. } else {
  29389. s1 = peg$FAILED;
  29390. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29391. }
  29392. if (s1 !== peg$FAILED) {
  29393. s2 = peg$parsews();
  29394. if (s2 !== peg$FAILED) {
  29395. s3 = peg$parseexpression();
  29396. if (s3 !== peg$FAILED) {
  29397. s4 = peg$parsews();
  29398. if (s4 !== peg$FAILED) {
  29399. if (input.charCodeAt(peg$currPos) === 41) {
  29400. s5 = peg$c48;
  29401. peg$currPos++;
  29402. } else {
  29403. s5 = peg$FAILED;
  29404. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29405. }
  29406. if (s5 !== peg$FAILED) {
  29407. peg$savedPos = s0;
  29408. s1 = peg$c79(s3);
  29409. s0 = s1;
  29410. } else {
  29411. peg$currPos = s0;
  29412. s0 = peg$FAILED;
  29413. }
  29414. } else {
  29415. peg$currPos = s0;
  29416. s0 = peg$FAILED;
  29417. }
  29418. } else {
  29419. peg$currPos = s0;
  29420. s0 = peg$FAILED;
  29421. }
  29422. } else {
  29423. peg$currPos = s0;
  29424. s0 = peg$FAILED;
  29425. }
  29426. } else {
  29427. peg$currPos = s0;
  29428. s0 = peg$FAILED;
  29429. }
  29430. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29431. return s0;
  29432. }
  29433. function peg$parsewsStatements() {
  29434. var s0, s1, s2, s3;
  29435. var key = peg$currPos * 63 + 47,
  29436. cached = peg$resultsCache[key];
  29437. if (cached) {
  29438. peg$currPos = cached.nextPos;
  29439. return cached.result;
  29440. }
  29441. s0 = peg$currPos;
  29442. s1 = peg$parsemaybeDotsWs();
  29443. if (s1 !== peg$FAILED) {
  29444. s2 = peg$parseret();
  29445. if (s2 !== peg$FAILED) {
  29446. peg$savedPos = s0;
  29447. s1 = peg$c100(s2);
  29448. s0 = s1;
  29449. } else {
  29450. peg$currPos = s0;
  29451. s0 = peg$FAILED;
  29452. }
  29453. } else {
  29454. peg$currPos = s0;
  29455. s0 = peg$FAILED;
  29456. }
  29457. if (s0 === peg$FAILED) {
  29458. s0 = peg$currPos;
  29459. s1 = peg$parsewsExpressions();
  29460. if (s1 !== peg$FAILED) {
  29461. s2 = peg$parsesomeDotsWs();
  29462. if (s2 !== peg$FAILED) {
  29463. s3 = peg$parseret();
  29464. if (s3 !== peg$FAILED) {
  29465. peg$savedPos = s0;
  29466. s1 = peg$c101(s1, s3);
  29467. s0 = s1;
  29468. } else {
  29469. peg$currPos = s0;
  29470. s0 = peg$FAILED;
  29471. }
  29472. } else {
  29473. peg$currPos = s0;
  29474. s0 = peg$FAILED;
  29475. }
  29476. } else {
  29477. peg$currPos = s0;
  29478. s0 = peg$FAILED;
  29479. }
  29480. if (s0 === peg$FAILED) {
  29481. s0 = peg$currPos;
  29482. s1 = peg$parsewsExpressions();
  29483. if (s1 === peg$FAILED) {
  29484. s1 = null;
  29485. }
  29486. if (s1 !== peg$FAILED) {
  29487. peg$savedPos = s0;
  29488. s1 = peg$c102(s1);
  29489. }
  29490. s0 = s1;
  29491. }
  29492. }
  29493. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29494. return s0;
  29495. }
  29496. function peg$parsewsSequenceWs() {
  29497. var s0, s1, s2, s3, s4, s5, s6;
  29498. var key = peg$currPos * 63 + 48,
  29499. cached = peg$resultsCache[key];
  29500. if (cached) {
  29501. peg$currPos = cached.nextPos;
  29502. return cached.result;
  29503. }
  29504. s0 = peg$currPos;
  29505. s1 = peg$parsewsPragmas();
  29506. if (s1 === peg$FAILED) {
  29507. s1 = null;
  29508. }
  29509. if (s1 !== peg$FAILED) {
  29510. s2 = peg$parsews();
  29511. if (s2 !== peg$FAILED) {
  29512. s3 = peg$parsetemps();
  29513. if (s3 === peg$FAILED) {
  29514. s3 = null;
  29515. }
  29516. if (s3 !== peg$FAILED) {
  29517. s4 = peg$parsewsPragmas();
  29518. if (s4 === peg$FAILED) {
  29519. s4 = null;
  29520. }
  29521. if (s4 !== peg$FAILED) {
  29522. s5 = peg$parsewsStatements();
  29523. if (s5 === peg$FAILED) {
  29524. s5 = null;
  29525. }
  29526. if (s5 !== peg$FAILED) {
  29527. s6 = peg$parsemaybeDotsWs();
  29528. if (s6 !== peg$FAILED) {
  29529. peg$savedPos = s0;
  29530. s1 = peg$c103(s1, s3, s4, s5);
  29531. s0 = s1;
  29532. } else {
  29533. peg$currPos = s0;
  29534. s0 = peg$FAILED;
  29535. }
  29536. } else {
  29537. peg$currPos = s0;
  29538. s0 = peg$FAILED;
  29539. }
  29540. } else {
  29541. peg$currPos = s0;
  29542. s0 = peg$FAILED;
  29543. }
  29544. } else {
  29545. peg$currPos = s0;
  29546. s0 = peg$FAILED;
  29547. }
  29548. } else {
  29549. peg$currPos = s0;
  29550. s0 = peg$FAILED;
  29551. }
  29552. } else {
  29553. peg$currPos = s0;
  29554. s0 = peg$FAILED;
  29555. }
  29556. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29557. return s0;
  29558. }
  29559. function peg$parseblock() {
  29560. var s0, s1, s2, s3, s4;
  29561. var key = peg$currPos * 63 + 49,
  29562. cached = peg$resultsCache[key];
  29563. if (cached) {
  29564. peg$currPos = cached.nextPos;
  29565. return cached.result;
  29566. }
  29567. s0 = peg$currPos;
  29568. if (input.charCodeAt(peg$currPos) === 91) {
  29569. s1 = peg$c104;
  29570. peg$currPos++;
  29571. } else {
  29572. s1 = peg$FAILED;
  29573. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29574. }
  29575. if (s1 !== peg$FAILED) {
  29576. s2 = peg$parsewsBlockParamList();
  29577. if (s2 === peg$FAILED) {
  29578. s2 = null;
  29579. }
  29580. if (s2 !== peg$FAILED) {
  29581. s3 = peg$parsewsSequenceWs();
  29582. if (s3 !== peg$FAILED) {
  29583. if (input.charCodeAt(peg$currPos) === 93) {
  29584. s4 = peg$c106;
  29585. peg$currPos++;
  29586. } else {
  29587. s4 = peg$FAILED;
  29588. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  29589. }
  29590. if (s4 !== peg$FAILED) {
  29591. peg$savedPos = s0;
  29592. s1 = peg$c108(s2, s3);
  29593. s0 = s1;
  29594. } else {
  29595. peg$currPos = s0;
  29596. s0 = peg$FAILED;
  29597. }
  29598. } else {
  29599. peg$currPos = s0;
  29600. s0 = peg$FAILED;
  29601. }
  29602. } else {
  29603. peg$currPos = s0;
  29604. s0 = peg$FAILED;
  29605. }
  29606. } else {
  29607. peg$currPos = s0;
  29608. s0 = peg$FAILED;
  29609. }
  29610. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29611. return s0;
  29612. }
  29613. function peg$parseoperand() {
  29614. var s0;
  29615. var key = peg$currPos * 63 + 50,
  29616. cached = peg$resultsCache[key];
  29617. if (cached) {
  29618. peg$currPos = cached.nextPos;
  29619. return cached.result;
  29620. }
  29621. s0 = peg$parseliteral();
  29622. if (s0 === peg$FAILED) {
  29623. s0 = peg$parsevariable();
  29624. if (s0 === peg$FAILED) {
  29625. s0 = peg$parsesubexpression();
  29626. }
  29627. }
  29628. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29629. return s0;
  29630. }
  29631. function peg$parsewsUnaryMessage() {
  29632. var s0, s1, s2, s3, s4;
  29633. var key = peg$currPos * 63 + 51,
  29634. cached = peg$resultsCache[key];
  29635. if (cached) {
  29636. peg$currPos = cached.nextPos;
  29637. return cached.result;
  29638. }
  29639. s0 = peg$currPos;
  29640. s1 = peg$parsews();
  29641. if (s1 !== peg$FAILED) {
  29642. s2 = peg$parseidentifier();
  29643. if (s2 !== peg$FAILED) {
  29644. s3 = peg$currPos;
  29645. peg$silentFails++;
  29646. if (input.charCodeAt(peg$currPos) === 58) {
  29647. s4 = peg$c12;
  29648. peg$currPos++;
  29649. } else {
  29650. s4 = peg$FAILED;
  29651. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29652. }
  29653. peg$silentFails--;
  29654. if (s4 === peg$FAILED) {
  29655. s3 = void 0;
  29656. } else {
  29657. peg$currPos = s3;
  29658. s3 = peg$FAILED;
  29659. }
  29660. if (s3 !== peg$FAILED) {
  29661. peg$savedPos = s0;
  29662. s1 = peg$c109(s2);
  29663. s0 = s1;
  29664. } else {
  29665. peg$currPos = s0;
  29666. s0 = peg$FAILED;
  29667. }
  29668. } else {
  29669. peg$currPos = s0;
  29670. s0 = peg$FAILED;
  29671. }
  29672. } else {
  29673. peg$currPos = s0;
  29674. s0 = peg$FAILED;
  29675. }
  29676. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29677. return s0;
  29678. }
  29679. function peg$parseunarySend() {
  29680. var s0, s1, s2, s3;
  29681. var key = peg$currPos * 63 + 52,
  29682. cached = peg$resultsCache[key];
  29683. if (cached) {
  29684. peg$currPos = cached.nextPos;
  29685. return cached.result;
  29686. }
  29687. s0 = peg$currPos;
  29688. s1 = peg$parseoperand();
  29689. if (s1 !== peg$FAILED) {
  29690. s2 = [];
  29691. s3 = peg$parsewsUnaryMessage();
  29692. while (s3 !== peg$FAILED) {
  29693. s2.push(s3);
  29694. s3 = peg$parsewsUnaryMessage();
  29695. }
  29696. if (s2 !== peg$FAILED) {
  29697. peg$savedPos = s0;
  29698. s1 = peg$c110(s1, s2);
  29699. s0 = s1;
  29700. } else {
  29701. peg$currPos = s0;
  29702. s0 = peg$FAILED;
  29703. }
  29704. } else {
  29705. peg$currPos = s0;
  29706. s0 = peg$FAILED;
  29707. }
  29708. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29709. return s0;
  29710. }
  29711. function peg$parsewsBinaryMessage() {
  29712. var s0, s1, s2, s3, s4;
  29713. var key = peg$currPos * 63 + 53,
  29714. cached = peg$resultsCache[key];
  29715. if (cached) {
  29716. peg$currPos = cached.nextPos;
  29717. return cached.result;
  29718. }
  29719. s0 = peg$currPos;
  29720. s1 = peg$parsews();
  29721. if (s1 !== peg$FAILED) {
  29722. s2 = peg$parsebinarySelector();
  29723. if (s2 !== peg$FAILED) {
  29724. s3 = peg$parsews();
  29725. if (s3 !== peg$FAILED) {
  29726. s4 = peg$parseunarySend();
  29727. if (s4 !== peg$FAILED) {
  29728. peg$savedPos = s0;
  29729. s1 = peg$c111(s2, s4);
  29730. s0 = s1;
  29731. } else {
  29732. peg$currPos = s0;
  29733. s0 = peg$FAILED;
  29734. }
  29735. } else {
  29736. peg$currPos = s0;
  29737. s0 = peg$FAILED;
  29738. }
  29739. } else {
  29740. peg$currPos = s0;
  29741. s0 = peg$FAILED;
  29742. }
  29743. } else {
  29744. peg$currPos = s0;
  29745. s0 = peg$FAILED;
  29746. }
  29747. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29748. return s0;
  29749. }
  29750. function peg$parsebinarySend() {
  29751. var s0, s1, s2, s3;
  29752. var key = peg$currPos * 63 + 54,
  29753. cached = peg$resultsCache[key];
  29754. if (cached) {
  29755. peg$currPos = cached.nextPos;
  29756. return cached.result;
  29757. }
  29758. s0 = peg$currPos;
  29759. s1 = peg$parseunarySend();
  29760. if (s1 !== peg$FAILED) {
  29761. s2 = [];
  29762. s3 = peg$parsewsBinaryMessage();
  29763. while (s3 !== peg$FAILED) {
  29764. s2.push(s3);
  29765. s3 = peg$parsewsBinaryMessage();
  29766. }
  29767. if (s2 !== peg$FAILED) {
  29768. peg$savedPos = s0;
  29769. s1 = peg$c110(s1, s2);
  29770. s0 = s1;
  29771. } else {
  29772. peg$currPos = s0;
  29773. s0 = peg$FAILED;
  29774. }
  29775. } else {
  29776. peg$currPos = s0;
  29777. s0 = peg$FAILED;
  29778. }
  29779. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29780. return s0;
  29781. }
  29782. function peg$parsewsKeywordMessage() {
  29783. var s0, s1, s2, s3, s4, s5, s6;
  29784. var key = peg$currPos * 63 + 55,
  29785. cached = peg$resultsCache[key];
  29786. if (cached) {
  29787. peg$currPos = cached.nextPos;
  29788. return cached.result;
  29789. }
  29790. s0 = peg$currPos;
  29791. s1 = [];
  29792. s2 = peg$currPos;
  29793. s3 = peg$parsews();
  29794. if (s3 !== peg$FAILED) {
  29795. s4 = peg$parsekeyword();
  29796. if (s4 !== peg$FAILED) {
  29797. s5 = peg$parsews();
  29798. if (s5 !== peg$FAILED) {
  29799. s6 = peg$parsebinarySend();
  29800. if (s6 !== peg$FAILED) {
  29801. peg$savedPos = s2;
  29802. s3 = peg$c75(s4, s6);
  29803. s2 = s3;
  29804. } else {
  29805. peg$currPos = s2;
  29806. s2 = peg$FAILED;
  29807. }
  29808. } else {
  29809. peg$currPos = s2;
  29810. s2 = peg$FAILED;
  29811. }
  29812. } else {
  29813. peg$currPos = s2;
  29814. s2 = peg$FAILED;
  29815. }
  29816. } else {
  29817. peg$currPos = s2;
  29818. s2 = peg$FAILED;
  29819. }
  29820. if (s2 !== peg$FAILED) {
  29821. while (s2 !== peg$FAILED) {
  29822. s1.push(s2);
  29823. s2 = peg$currPos;
  29824. s3 = peg$parsews();
  29825. if (s3 !== peg$FAILED) {
  29826. s4 = peg$parsekeyword();
  29827. if (s4 !== peg$FAILED) {
  29828. s5 = peg$parsews();
  29829. if (s5 !== peg$FAILED) {
  29830. s6 = peg$parsebinarySend();
  29831. if (s6 !== peg$FAILED) {
  29832. peg$savedPos = s2;
  29833. s3 = peg$c75(s4, s6);
  29834. s2 = s3;
  29835. } else {
  29836. peg$currPos = s2;
  29837. s2 = peg$FAILED;
  29838. }
  29839. } else {
  29840. peg$currPos = s2;
  29841. s2 = peg$FAILED;
  29842. }
  29843. } else {
  29844. peg$currPos = s2;
  29845. s2 = peg$FAILED;
  29846. }
  29847. } else {
  29848. peg$currPos = s2;
  29849. s2 = peg$FAILED;
  29850. }
  29851. }
  29852. } else {
  29853. s1 = peg$FAILED;
  29854. }
  29855. if (s1 !== peg$FAILED) {
  29856. peg$savedPos = s0;
  29857. s1 = peg$c112(s1);
  29858. }
  29859. s0 = s1;
  29860. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29861. return s0;
  29862. }
  29863. function peg$parsekeywordSend() {
  29864. var s0, s1, s2;
  29865. var key = peg$currPos * 63 + 56,
  29866. cached = peg$resultsCache[key];
  29867. if (cached) {
  29868. peg$currPos = cached.nextPos;
  29869. return cached.result;
  29870. }
  29871. s0 = peg$currPos;
  29872. s1 = peg$parsebinarySend();
  29873. if (s1 !== peg$FAILED) {
  29874. s2 = peg$parsewsKeywordMessage();
  29875. if (s2 === peg$FAILED) {
  29876. s2 = null;
  29877. }
  29878. if (s2 !== peg$FAILED) {
  29879. peg$savedPos = s0;
  29880. s1 = peg$c113(s1, s2);
  29881. s0 = s1;
  29882. } else {
  29883. peg$currPos = s0;
  29884. s0 = peg$FAILED;
  29885. }
  29886. } else {
  29887. peg$currPos = s0;
  29888. s0 = peg$FAILED;
  29889. }
  29890. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29891. return s0;
  29892. }
  29893. function peg$parsewsMessage() {
  29894. var s0;
  29895. var key = peg$currPos * 63 + 57,
  29896. cached = peg$resultsCache[key];
  29897. if (cached) {
  29898. peg$currPos = cached.nextPos;
  29899. return cached.result;
  29900. }
  29901. s0 = peg$parsewsBinaryMessage();
  29902. if (s0 === peg$FAILED) {
  29903. s0 = peg$parsewsUnaryMessage();
  29904. if (s0 === peg$FAILED) {
  29905. s0 = peg$parsewsKeywordMessage();
  29906. }
  29907. }
  29908. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29909. return s0;
  29910. }
  29911. function peg$parsecascade() {
  29912. var s0, s1, s2, s3, s4, s5, s6, s7;
  29913. var key = peg$currPos * 63 + 58,
  29914. cached = peg$resultsCache[key];
  29915. if (cached) {
  29916. peg$currPos = cached.nextPos;
  29917. return cached.result;
  29918. }
  29919. s0 = peg$currPos;
  29920. s1 = peg$parsekeywordSend();
  29921. if (s1 !== peg$FAILED) {
  29922. peg$savedPos = peg$currPos;
  29923. s2 = peg$c114(s1);
  29924. if (s2) {
  29925. s2 = void 0;
  29926. } else {
  29927. s2 = peg$FAILED;
  29928. }
  29929. if (s2 !== peg$FAILED) {
  29930. s3 = [];
  29931. s4 = peg$currPos;
  29932. s5 = peg$parsews();
  29933. if (s5 !== peg$FAILED) {
  29934. if (input.charCodeAt(peg$currPos) === 59) {
  29935. s6 = peg$c115;
  29936. peg$currPos++;
  29937. } else {
  29938. s6 = peg$FAILED;
  29939. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29940. }
  29941. if (s6 !== peg$FAILED) {
  29942. s7 = peg$parsewsMessage();
  29943. if (s7 !== peg$FAILED) {
  29944. peg$savedPos = s4;
  29945. s5 = peg$c117(s1, s7);
  29946. s4 = s5;
  29947. } else {
  29948. peg$currPos = s4;
  29949. s4 = peg$FAILED;
  29950. }
  29951. } else {
  29952. peg$currPos = s4;
  29953. s4 = peg$FAILED;
  29954. }
  29955. } else {
  29956. peg$currPos = s4;
  29957. s4 = peg$FAILED;
  29958. }
  29959. if (s4 !== peg$FAILED) {
  29960. while (s4 !== peg$FAILED) {
  29961. s3.push(s4);
  29962. s4 = peg$currPos;
  29963. s5 = peg$parsews();
  29964. if (s5 !== peg$FAILED) {
  29965. if (input.charCodeAt(peg$currPos) === 59) {
  29966. s6 = peg$c115;
  29967. peg$currPos++;
  29968. } else {
  29969. s6 = peg$FAILED;
  29970. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29971. }
  29972. if (s6 !== peg$FAILED) {
  29973. s7 = peg$parsewsMessage();
  29974. if (s7 !== peg$FAILED) {
  29975. peg$savedPos = s4;
  29976. s5 = peg$c117(s1, s7);
  29977. s4 = s5;
  29978. } else {
  29979. peg$currPos = s4;
  29980. s4 = peg$FAILED;
  29981. }
  29982. } else {
  29983. peg$currPos = s4;
  29984. s4 = peg$FAILED;
  29985. }
  29986. } else {
  29987. peg$currPos = s4;
  29988. s4 = peg$FAILED;
  29989. }
  29990. }
  29991. } else {
  29992. s3 = peg$FAILED;
  29993. }
  29994. if (s3 !== peg$FAILED) {
  29995. peg$savedPos = s0;
  29996. s1 = peg$c118(s1, s3);
  29997. s0 = s1;
  29998. } else {
  29999. peg$currPos = s0;
  30000. s0 = peg$FAILED;
  30001. }
  30002. } else {
  30003. peg$currPos = s0;
  30004. s0 = peg$FAILED;
  30005. }
  30006. } else {
  30007. peg$currPos = s0;
  30008. s0 = peg$FAILED;
  30009. }
  30010. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30011. return s0;
  30012. }
  30013. function peg$parsemethod() {
  30014. var s0, s1, s2;
  30015. var key = peg$currPos * 63 + 59,
  30016. cached = peg$resultsCache[key];
  30017. if (cached) {
  30018. peg$currPos = cached.nextPos;
  30019. return cached.result;
  30020. }
  30021. s0 = peg$currPos;
  30022. s1 = peg$parsewsKeywordPattern();
  30023. if (s1 === peg$FAILED) {
  30024. s1 = peg$parsewsBinaryPattern();
  30025. if (s1 === peg$FAILED) {
  30026. s1 = peg$parsewsUnaryPattern();
  30027. }
  30028. }
  30029. if (s1 !== peg$FAILED) {
  30030. s2 = peg$parsewsSequenceWs();
  30031. if (s2 !== peg$FAILED) {
  30032. peg$savedPos = s0;
  30033. s1 = peg$c119(s1, s2);
  30034. s0 = s1;
  30035. } else {
  30036. peg$currPos = s0;
  30037. s0 = peg$FAILED;
  30038. }
  30039. } else {
  30040. peg$currPos = s0;
  30041. s0 = peg$FAILED;
  30042. }
  30043. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30044. return s0;
  30045. }
  30046. function peg$parseassociationSend() {
  30047. var s0, s1, s2;
  30048. var key = peg$currPos * 63 + 60,
  30049. cached = peg$resultsCache[key];
  30050. if (cached) {
  30051. peg$currPos = cached.nextPos;
  30052. return cached.result;
  30053. }
  30054. s0 = peg$currPos;
  30055. s1 = peg$parsebinarySend();
  30056. if (s1 !== peg$FAILED) {
  30057. peg$savedPos = peg$currPos;
  30058. s2 = peg$c120(s1);
  30059. if (s2) {
  30060. s2 = void 0;
  30061. } else {
  30062. s2 = peg$FAILED;
  30063. }
  30064. if (s2 !== peg$FAILED) {
  30065. peg$savedPos = s0;
  30066. s1 = peg$c121(s1);
  30067. s0 = s1;
  30068. } else {
  30069. peg$currPos = s0;
  30070. s0 = peg$FAILED;
  30071. }
  30072. } else {
  30073. peg$currPos = s0;
  30074. s0 = peg$FAILED;
  30075. }
  30076. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30077. return s0;
  30078. }
  30079. function peg$parsewsAssociationsRest() {
  30080. var s0, s1, s2;
  30081. var key = peg$currPos * 63 + 61,
  30082. cached = peg$resultsCache[key];
  30083. if (cached) {
  30084. peg$currPos = cached.nextPos;
  30085. return cached.result;
  30086. }
  30087. s0 = peg$currPos;
  30088. s1 = peg$parsesomeDotsWs();
  30089. if (s1 !== peg$FAILED) {
  30090. s2 = peg$parseassociationSend();
  30091. if (s2 !== peg$FAILED) {
  30092. peg$savedPos = s0;
  30093. s1 = peg$c79(s2);
  30094. s0 = s1;
  30095. } else {
  30096. peg$currPos = s0;
  30097. s0 = peg$FAILED;
  30098. }
  30099. } else {
  30100. peg$currPos = s0;
  30101. s0 = peg$FAILED;
  30102. }
  30103. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30104. return s0;
  30105. }
  30106. function peg$parsewsAssociations() {
  30107. var s0, s1, s2, s3, s4;
  30108. var key = peg$currPos * 63 + 62,
  30109. cached = peg$resultsCache[key];
  30110. if (cached) {
  30111. peg$currPos = cached.nextPos;
  30112. return cached.result;
  30113. }
  30114. s0 = peg$currPos;
  30115. s1 = peg$parsemaybeDotsWs();
  30116. if (s1 !== peg$FAILED) {
  30117. s2 = peg$parseassociationSend();
  30118. if (s2 !== peg$FAILED) {
  30119. s3 = [];
  30120. s4 = peg$parsewsAssociationsRest();
  30121. while (s4 !== peg$FAILED) {
  30122. s3.push(s4);
  30123. s4 = peg$parsewsAssociationsRest();
  30124. }
  30125. if (s3 !== peg$FAILED) {
  30126. peg$savedPos = s0;
  30127. s1 = peg$c122(s2, s3);
  30128. s0 = s1;
  30129. } else {
  30130. peg$currPos = s0;
  30131. s0 = peg$FAILED;
  30132. }
  30133. } else {
  30134. peg$currPos = s0;
  30135. s0 = peg$FAILED;
  30136. }
  30137. } else {
  30138. peg$currPos = s0;
  30139. s0 = peg$FAILED;
  30140. }
  30141. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30142. return s0;
  30143. }
  30144. peg$result = peg$startRuleFunction();
  30145. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30146. return peg$result;
  30147. } else {
  30148. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30149. peg$fail({ type: "end", description: "end of input" });
  30150. }
  30151. throw peg$buildException(
  30152. null,
  30153. peg$maxFailExpected,
  30154. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30155. peg$maxFailPos < input.length
  30156. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30157. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30158. );
  30159. }
  30160. }
  30161. return {
  30162. SyntaxError: peg$SyntaxError,
  30163. parse: peg$parse
  30164. };
  30165. })();
  30166. });
  30167. define('amber_core/Platform-ImportExport',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  30168. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30169. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30170. $core.addPackage("Platform-ImportExport");
  30171. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  30172. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30173. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30174. $globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream.";
  30175. $core.addMethod(
  30176. $core.method({
  30177. selector: "exportPackage:on:",
  30178. protocol: "output",
  30179. fn: function (aPackage,aStream){
  30180. var self=this,$self=this;
  30181. return $core.withContext(function($ctx1) {
  30182. $self._subclassResponsibility();
  30183. return self;
  30184. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30185. },
  30186. args: ["aPackage", "aStream"],
  30187. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30188. referencedClasses: [],
  30189. messageSends: ["subclassResponsibility"]
  30190. }),
  30191. $globals.AbstractExporter);
  30192. $core.addMethod(
  30193. $core.method({
  30194. selector: "extensionMethodsOfPackage:",
  30195. protocol: "accessing",
  30196. fn: function (aPackage){
  30197. var self=this,$self=this;
  30198. var result;
  30199. return $core.withContext(function($ctx1) {
  30200. result=$recv($globals.OrderedCollection)._new();
  30201. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30202. return $core.withContext(function($ctx2) {
  30203. return $recv(result)._addAll_($recv(each)._ownMethods());
  30204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30205. }));
  30206. return result;
  30207. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30208. },
  30209. args: ["aPackage"],
  30210. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each ownMethods ].\x0a\x09\x09\x0a\x09^ result",
  30211. referencedClasses: ["OrderedCollection"],
  30212. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30213. }),
  30214. $globals.AbstractExporter);
  30215. $core.addMethod(
  30216. $core.method({
  30217. selector: "extensionProtocolsOfPackage:",
  30218. protocol: "accessing",
  30219. fn: function (aPackage){
  30220. var self=this,$self=this;
  30221. var extensionName,result;
  30222. return $core.withContext(function($ctx1) {
  30223. var $1,$2,$3;
  30224. $1=$recv(aPackage)._name();
  30225. $ctx1.sendIdx["name"]=1;
  30226. extensionName="*".__comma($1);
  30227. result=$recv($globals.OrderedCollection)._new();
  30228. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30229. return $core.withContext(function($ctx2) {
  30230. $2=$recv(a)._name();
  30231. $ctx2.sendIdx["name"]=2;
  30232. return $recv($2).__lt($recv(b)._name());
  30233. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30234. })))._do_((function(each){
  30235. return $core.withContext(function($ctx2) {
  30236. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30237. return $core.withContext(function($ctx3) {
  30238. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30239. if($core.assert($3)){
  30240. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30241. }
  30242. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30243. }));
  30244. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30245. }));
  30246. $ctx1.sendIdx["do:"]=1;
  30247. return result;
  30248. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30249. },
  30250. args: ["aPackage"],
  30251. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09({each. each theMetaClass} copyWithout: nil) do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
  30252. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30253. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30254. }),
  30255. $globals.AbstractExporter);
  30256. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30257. $globals.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code.";
  30258. $core.addMethod(
  30259. $core.method({
  30260. selector: "chunkEscape:",
  30261. protocol: "convenience",
  30262. fn: function (aString){
  30263. var self=this,$self=this;
  30264. return $core.withContext(function($ctx1) {
  30265. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30266. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30267. },
  30268. args: ["aString"],
  30269. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30270. referencedClasses: [],
  30271. messageSends: ["trimBoth", "replace:with:"]
  30272. }),
  30273. $globals.ChunkExporter);
  30274. $core.addMethod(
  30275. $core.method({
  30276. selector: "exportBehavior:on:",
  30277. protocol: "output",
  30278. fn: function (aBehavior,aStream){
  30279. var self=this,$self=this;
  30280. return $core.withContext(function($ctx1) {
  30281. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30282. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30283. return self;
  30284. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30285. },
  30286. args: ["aBehavior", "aStream"],
  30287. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30288. referencedClasses: [],
  30289. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30290. }),
  30291. $globals.ChunkExporter);
  30292. $core.addMethod(
  30293. $core.method({
  30294. selector: "exportCategoryEpilogueOf:on:",
  30295. protocol: "output",
  30296. fn: function (aCategory,aStream){
  30297. var self=this,$self=this;
  30298. return $core.withContext(function($ctx1) {
  30299. $recv(aStream)._write_(" !");
  30300. $recv(aStream)._lf();
  30301. $ctx1.sendIdx["lf"]=1;
  30302. $recv(aStream)._lf();
  30303. return self;
  30304. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30305. },
  30306. args: ["aCategory", "aStream"],
  30307. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30308. referencedClasses: [],
  30309. messageSends: ["write:", "lf"]
  30310. }),
  30311. $globals.ChunkExporter);
  30312. $core.addMethod(
  30313. $core.method({
  30314. selector: "exportCategoryPrologueOf:on:",
  30315. protocol: "output",
  30316. fn: function (aCategory,aStream){
  30317. var self=this,$self=this;
  30318. return $core.withContext(function($ctx1) {
  30319. $recv(aStream)._write_("!");
  30320. $ctx1.sendIdx["write:"]=1;
  30321. $recv(aStream)._print_($recv(aCategory)._theClass());
  30322. $ctx1.sendIdx["print:"]=1;
  30323. $recv(aStream)._write_(" methodsFor: ");
  30324. $ctx1.sendIdx["write:"]=2;
  30325. $recv(aStream)._print_(aCategory);
  30326. $recv(aStream)._write_("!");
  30327. return self;
  30328. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30329. },
  30330. args: ["aCategory", "aStream"],
  30331. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09write: '!';\x0a\x09\x09print: aCategory theClass;\x0a\x09\x09write: ' methodsFor: ';\x0a\x09\x09print: aCategory;\x0a\x09\x09write: '!'",
  30332. referencedClasses: [],
  30333. messageSends: ["write:", "print:", "theClass"]
  30334. }),
  30335. $globals.ChunkExporter);
  30336. $core.addMethod(
  30337. $core.method({
  30338. selector: "exportDefinitionOf:on:",
  30339. protocol: "output",
  30340. fn: function (aClass,aStream){
  30341. var self=this,$self=this;
  30342. return $core.withContext(function($ctx1) {
  30343. var $1,$2,$3,$4;
  30344. $recv(aStream)._print_($recv(aClass)._superclass());
  30345. $ctx1.sendIdx["print:"]=1;
  30346. $recv(aStream)._write_(" subclass: ");
  30347. $ctx1.sendIdx["write:"]=1;
  30348. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30349. $1=$recv(aStream)._lf();
  30350. $ctx1.sendIdx["lf"]=1;
  30351. $recv(aStream)._tab();
  30352. $ctx1.sendIdx["tab"]=1;
  30353. $recv(aStream)._write_("instanceVariableNames: ");
  30354. $ctx1.sendIdx["write:"]=2;
  30355. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30356. $ctx1.sendIdx["print:"]=2;
  30357. $recv(aStream)._lf();
  30358. $ctx1.sendIdx["lf"]=2;
  30359. $recv(aStream)._tab();
  30360. $recv(aStream)._write_("package: ");
  30361. $ctx1.sendIdx["write:"]=3;
  30362. $recv(aStream)._print_($recv(aClass)._category());
  30363. $ctx1.sendIdx["print:"]=3;
  30364. $recv(aStream)._write_("!");
  30365. $ctx1.sendIdx["write:"]=4;
  30366. $2=$recv(aStream)._lf();
  30367. $ctx1.sendIdx["lf"]=3;
  30368. $3=$recv(aClass)._comment();
  30369. $ctx1.sendIdx["comment"]=1;
  30370. $recv($3)._ifNotEmpty_((function(){
  30371. return $core.withContext(function($ctx2) {
  30372. $recv(aStream)._write_("!");
  30373. $ctx2.sendIdx["write:"]=5;
  30374. $recv(aStream)._print_(aClass);
  30375. $recv(aStream)._write_(" commentStamp!");
  30376. $ctx2.sendIdx["write:"]=6;
  30377. $recv(aStream)._lf();
  30378. $ctx2.sendIdx["lf"]=4;
  30379. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30380. $4=$recv(aStream)._lf();
  30381. $ctx2.sendIdx["lf"]=5;
  30382. return $4;
  30383. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30384. }));
  30385. $recv(aStream)._lf();
  30386. return self;
  30387. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30388. },
  30389. args: ["aClass", "aStream"],
  30390. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09print: aClass superclass;\x0a\x09\x09write: ' subclass: ';\x0a\x09\x09printSymbol: aClass name;\x0a\x09\x09lf.\x0a\x09\x22aClass traitComposition\x0a\x09\x09ifNotEmpty: [ aStream tab; write: {'uses: '. aClass traitCompositionDefinition}; lf ].\x22\x0a\x09aStream\x0a\x09\x09tab;\x0a\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09print: (' ' join: aClass instanceVariableNames);\x0a\x09\x09lf;\x0a\x09\x09tab;\x0a\x09\x09write: 'package: ';\x0a\x09\x09print: aClass category;\x0a\x09\x09write: '!';\x0a\x09\x09lf.\x0a\x09aClass comment ifNotEmpty: [ aStream\x0a\x09\x09write: '!'; print: aClass; write: ' commentStamp!'; lf;\x0a\x09\x09write: { self chunkEscape: aClass comment. '!' }; lf ].\x0a\x09aStream lf",
  30391. referencedClasses: [],
  30392. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30393. }),
  30394. $globals.ChunkExporter);
  30395. $core.addMethod(
  30396. $core.method({
  30397. selector: "exportMetaDefinitionOf:on:",
  30398. protocol: "output",
  30399. fn: function (aClass,aStream){
  30400. var self=this,$self=this;
  30401. var classIvars,classTraitComposition;
  30402. return $core.withContext(function($ctx1) {
  30403. var $1,$2;
  30404. $1=$recv(aClass)._class();
  30405. $ctx1.sendIdx["class"]=1;
  30406. classIvars=$recv($1)._instanceVariableNames();
  30407. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30408. $2=$recv(classIvars)._notEmpty();
  30409. if($core.assert($2)){
  30410. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30411. $ctx1.sendIdx["print:"]=1;
  30412. $recv(aStream)._space();
  30413. $recv(aStream)._write_("instanceVariableNames: ");
  30414. $ctx1.sendIdx["write:"]=1;
  30415. $recv(aStream)._print_(" "._join_(classIvars));
  30416. $recv(aStream)._write_("!");
  30417. $recv(aStream)._lf();
  30418. $ctx1.sendIdx["lf"]=1;
  30419. $recv(aStream)._lf();
  30420. }
  30421. return self;
  30422. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30423. },
  30424. args: ["aClass", "aStream"],
  30425. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09| classIvars classTraitComposition |\x0a\x09classIvars := aClass class instanceVariableNames.\x0a\x09classTraitComposition := aClass class traitComposition.\x0a\x0a\x09(classIvars notEmpty \x22or: [classTraitComposition notEmpty]\x22) ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09print: aClass theMetaClass.\x0a\x09\x09aStream space. \x22classTraitComposition\x0a\x09\x09\x09ifEmpty: [ aStream space ]\x0a\x09\x09\x09ifNotEmpty: [ aStream lf; tab; write: {'uses: '. aClass class traitCompositionDefinition}; lf; tab ].\x22\x0a\x09\x09aStream\x0a\x09\x09\x09write: 'instanceVariableNames: ';\x0a\x09\x09\x09print: (' ' join: classIvars);\x0a\x09\x09\x09write: '!'; lf; lf ]",
  30426. referencedClasses: [],
  30427. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30428. }),
  30429. $globals.ChunkExporter);
  30430. $core.addMethod(
  30431. $core.method({
  30432. selector: "exportMethod:on:",
  30433. protocol: "output",
  30434. fn: function (aMethod,aStream){
  30435. var self=this,$self=this;
  30436. return $core.withContext(function($ctx1) {
  30437. $recv(aStream)._lf();
  30438. $ctx1.sendIdx["lf"]=1;
  30439. $recv(aStream)._lf();
  30440. $ctx1.sendIdx["lf"]=2;
  30441. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30442. $ctx1.sendIdx["write:"]=1;
  30443. $recv(aStream)._lf();
  30444. $recv(aStream)._write_("!");
  30445. return self;
  30446. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30447. },
  30448. args: ["aMethod", "aStream"],
  30449. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30450. referencedClasses: [],
  30451. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30452. }),
  30453. $globals.ChunkExporter);
  30454. $core.addMethod(
  30455. $core.method({
  30456. selector: "exportPackage:on:",
  30457. protocol: "output",
  30458. fn: function (aPackage,aStream){
  30459. var self=this,$self=this;
  30460. return $core.withContext(function($ctx1) {
  30461. var $1,$receiver;
  30462. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30463. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30464. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30465. return $core.withContext(function($ctx2) {
  30466. $self._exportBehavior_on_(each,aStream);
  30467. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30468. $1=$recv(each)._theMetaClass();
  30469. if(($receiver = $1) == null || $receiver.a$nil){
  30470. return $1;
  30471. } else {
  30472. var meta;
  30473. meta=$receiver;
  30474. return $self._exportBehavior_on_(meta,aStream);
  30475. }
  30476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30477. }));
  30478. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30479. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30480. return self;
  30481. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30482. },
  30483. args: ["aPackage", "aStream"],
  30484. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | self exportBehavior: meta on: aStream ] ].\x0a\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  30485. referencedClasses: [],
  30486. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30487. }),
  30488. $globals.ChunkExporter);
  30489. $core.addMethod(
  30490. $core.method({
  30491. selector: "exportPackageDefinitionOf:on:",
  30492. protocol: "output",
  30493. fn: function (aPackage,aStream){
  30494. var self=this,$self=this;
  30495. return $core.withContext(function($ctx1) {
  30496. $recv(aStream)._write_("Smalltalk createPackage: ");
  30497. $ctx1.sendIdx["write:"]=1;
  30498. $recv(aStream)._print_($recv(aPackage)._name());
  30499. $recv(aStream)._write_("!");
  30500. $recv(aStream)._lf();
  30501. return self;
  30502. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30503. },
  30504. args: ["aPackage", "aStream"],
  30505. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30506. referencedClasses: [],
  30507. messageSends: ["write:", "print:", "name", "lf"]
  30508. }),
  30509. $globals.ChunkExporter);
  30510. $core.addMethod(
  30511. $core.method({
  30512. selector: "exportPackageImportsOf:on:",
  30513. protocol: "output",
  30514. fn: function (aPackage,aStream){
  30515. var self=this,$self=this;
  30516. return $core.withContext(function($ctx1) {
  30517. var $1;
  30518. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30519. return $core.withContext(function($ctx2) {
  30520. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30521. $ctx2.sendIdx["write:"]=1;
  30522. $1=$recv(aPackage)._name();
  30523. $ctx2.sendIdx["name"]=1;
  30524. $recv(aStream)._print_($1);
  30525. $ctx2.sendIdx["print:"]=1;
  30526. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30527. $ctx2.sendIdx["write:"]=2;
  30528. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30529. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30530. return $recv(aStream)._lf();
  30531. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30532. }));
  30533. return self;
  30534. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30535. },
  30536. args: ["aPackage", "aStream"],
  30537. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports | aStream\x0a\x09\x09write: '(Smalltalk packageAt: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: ' ifAbsent: [ self error: ';\x0a\x09\x09print: 'Package not created: ', aPackage name;\x0a\x09\x09write: { ' ]) imports: '. self chunkEscape: aPackage importsDefinition. '!' };\x0a\x09\x09lf ]",
  30538. referencedClasses: [],
  30539. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30540. }),
  30541. $globals.ChunkExporter);
  30542. $core.addMethod(
  30543. $core.method({
  30544. selector: "exportPackageTraitCompositionsOf:on:",
  30545. protocol: "output",
  30546. fn: function (aPackage,aStream){
  30547. var self=this,$self=this;
  30548. return $core.withContext(function($ctx1) {
  30549. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30550. return $core.withContext(function($ctx2) {
  30551. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30552. return $core.withContext(function($ctx3) {
  30553. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30554. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30555. }));
  30556. $recv(aStream)._write_("! !");
  30557. $recv(aStream)._lf();
  30558. $ctx2.sendIdx["lf"]=1;
  30559. return $recv(aStream)._lf();
  30560. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30561. }));
  30562. return self;
  30563. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30564. },
  30565. args: ["aPackage", "aStream"],
  30566. source: "exportPackageTraitCompositionsOf: aPackage on: aStream\x0a\x09aPackage traitCompositions ifNotEmpty: [ :traitCompositions |\x0a\x09\x09traitCompositions keysAndValuesDo: [ :key :value | self exportTraitComposition: value of: key on: aStream ].\x0a\x09\x09aStream write: '! !'; lf; lf ]",
  30567. referencedClasses: [],
  30568. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30569. }),
  30570. $globals.ChunkExporter);
  30571. $core.addMethod(
  30572. $core.method({
  30573. selector: "exportProtocol:on:",
  30574. protocol: "output",
  30575. fn: function (aProtocol,aStream){
  30576. var self=this,$self=this;
  30577. return $core.withContext(function($ctx1) {
  30578. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30579. return $core.withContext(function($ctx2) {
  30580. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30581. $recv(methods)._do_((function(method){
  30582. return $core.withContext(function($ctx3) {
  30583. return $self._exportMethod_on_(method,aStream);
  30584. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30585. }));
  30586. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30587. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30588. }));
  30589. return self;
  30590. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30591. },
  30592. args: ["aProtocol", "aStream"],
  30593. source: "exportProtocol: aProtocol on: aStream\x0a\x09aProtocol ownMethods ifNotEmpty: [ :methods |\x0a\x09\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09\x09methods do: [ :method | \x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09self exportProtocolEpilogueOf: aProtocol on: aStream ]",
  30594. referencedClasses: [],
  30595. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30596. }),
  30597. $globals.ChunkExporter);
  30598. $core.addMethod(
  30599. $core.method({
  30600. selector: "exportProtocolEpilogueOf:on:",
  30601. protocol: "output",
  30602. fn: function (aProtocol,aStream){
  30603. var self=this,$self=this;
  30604. return $core.withContext(function($ctx1) {
  30605. $recv(aStream)._write_(" !");
  30606. $recv(aStream)._lf();
  30607. $ctx1.sendIdx["lf"]=1;
  30608. $recv(aStream)._lf();
  30609. return self;
  30610. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30611. },
  30612. args: ["aProtocol", "aStream"],
  30613. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30614. referencedClasses: [],
  30615. messageSends: ["write:", "lf"]
  30616. }),
  30617. $globals.ChunkExporter);
  30618. $core.addMethod(
  30619. $core.method({
  30620. selector: "exportProtocolPrologueOf:on:",
  30621. protocol: "output",
  30622. fn: function (aProtocol,aStream){
  30623. var self=this,$self=this;
  30624. return $core.withContext(function($ctx1) {
  30625. $recv(aStream)._write_("!");
  30626. $ctx1.sendIdx["write:"]=1;
  30627. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30628. $ctx1.sendIdx["print:"]=1;
  30629. $recv(aStream)._write_(" methodsFor: ");
  30630. $ctx1.sendIdx["write:"]=2;
  30631. $recv(aStream)._print_($recv(aProtocol)._name());
  30632. $recv(aStream)._write_("!");
  30633. return self;
  30634. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30635. },
  30636. args: ["aProtocol", "aStream"],
  30637. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09write: '!';\x0a\x09\x09print: aProtocol theClass;\x0a\x09\x09write: ' methodsFor: ';\x0a\x09\x09print: aProtocol name;\x0a\x09\x09write: '!'",
  30638. referencedClasses: [],
  30639. messageSends: ["write:", "print:", "theClass", "name"]
  30640. }),
  30641. $globals.ChunkExporter);
  30642. $core.addMethod(
  30643. $core.method({
  30644. selector: "exportProtocols:on:",
  30645. protocol: "output",
  30646. fn: function (aCollection,aStream){
  30647. var self=this,$self=this;
  30648. return $core.withContext(function($ctx1) {
  30649. $recv(aCollection)._do_((function(each){
  30650. return $core.withContext(function($ctx2) {
  30651. return $self._exportProtocol_on_(each,aStream);
  30652. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30653. }));
  30654. return self;
  30655. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30656. },
  30657. args: ["aCollection", "aStream"],
  30658. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30659. referencedClasses: [],
  30660. messageSends: ["do:", "exportProtocol:on:"]
  30661. }),
  30662. $globals.ChunkExporter);
  30663. $core.addMethod(
  30664. $core.method({
  30665. selector: "exportTraitComposition:of:on:",
  30666. protocol: "output",
  30667. fn: function (aTraitComposition,aBehavior,aStream){
  30668. var self=this,$self=this;
  30669. return $core.withContext(function($ctx1) {
  30670. $recv(aStream)._print_(aBehavior);
  30671. $recv(aStream)._write_(" setTraitComposition: ");
  30672. $ctx1.sendIdx["write:"]=1;
  30673. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30674. $ctx1.sendIdx["write:"]=2;
  30675. $recv(aStream)._write_(" asTraitComposition!");
  30676. $recv(aStream)._lf();
  30677. return self;
  30678. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30679. },
  30680. args: ["aTraitComposition", "aBehavior", "aStream"],
  30681. source: "exportTraitComposition: aTraitComposition of: aBehavior on: aStream\x0a\x09aStream \x0a\x09\x09print: aBehavior;\x0a\x09\x09write: ' setTraitComposition: ';\x0a\x09\x09write: aBehavior traitCompositionDefinition;\x0a\x09\x09write: ' asTraitComposition!';\x0a\x09\x09lf",
  30682. referencedClasses: [],
  30683. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30684. }),
  30685. $globals.ChunkExporter);
  30686. $core.addMethod(
  30687. $core.method({
  30688. selector: "exportTraitDefinitionOf:on:",
  30689. protocol: "output",
  30690. fn: function (aClass,aStream){
  30691. var self=this,$self=this;
  30692. return $core.withContext(function($ctx1) {
  30693. var $1,$2,$3,$4;
  30694. $recv(aStream)._write_("Trait named: ");
  30695. $ctx1.sendIdx["write:"]=1;
  30696. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30697. $1=$recv(aStream)._lf();
  30698. $ctx1.sendIdx["lf"]=1;
  30699. $recv(aStream)._tab();
  30700. $recv(aStream)._write_("package: ");
  30701. $ctx1.sendIdx["write:"]=2;
  30702. $recv(aStream)._print_($recv(aClass)._category());
  30703. $ctx1.sendIdx["print:"]=1;
  30704. $recv(aStream)._write_("!");
  30705. $ctx1.sendIdx["write:"]=3;
  30706. $2=$recv(aStream)._lf();
  30707. $ctx1.sendIdx["lf"]=2;
  30708. $3=$recv(aClass)._comment();
  30709. $ctx1.sendIdx["comment"]=1;
  30710. $recv($3)._ifNotEmpty_((function(){
  30711. return $core.withContext(function($ctx2) {
  30712. $recv(aStream)._write_("!");
  30713. $ctx2.sendIdx["write:"]=4;
  30714. $recv(aStream)._print_(aClass);
  30715. $recv(aStream)._write_(" commentStamp!");
  30716. $ctx2.sendIdx["write:"]=5;
  30717. $recv(aStream)._lf();
  30718. $ctx2.sendIdx["lf"]=3;
  30719. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30720. $4=$recv(aStream)._lf();
  30721. $ctx2.sendIdx["lf"]=4;
  30722. return $4;
  30723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30724. }));
  30725. $recv(aStream)._lf();
  30726. return self;
  30727. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30728. },
  30729. args: ["aClass", "aStream"],
  30730. source: "exportTraitDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09write: 'Trait named: '; printSymbol: aClass name; lf.\x0a\x09\x22aClass traitComposition\x0a\x09\x09ifNotEmpty: [ aStream tab; write: {'uses: '. aClass traitCompositionDefinition}; lf ].\x22\x0a\x09aStream\x0a\x09\x09tab; write: 'package: '; print:\x09aClass category; write: '!'; lf.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09write: '!'; print: aClass; write: ' commentStamp!'; lf;\x0a\x09\x09write: { self chunkEscape: aClass comment. '!' }; lf ].\x0a\x09aStream lf",
  30731. referencedClasses: [],
  30732. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30733. }),
  30734. $globals.ChunkExporter);
  30735. $core.addMethod(
  30736. $core.method({
  30737. selector: "extensionCategoriesOfPackage:",
  30738. protocol: "accessing",
  30739. fn: function (aPackage){
  30740. var self=this,$self=this;
  30741. var name,map,result;
  30742. return $core.withContext(function($ctx1) {
  30743. var $1;
  30744. name=$recv(aPackage)._name();
  30745. result=$recv($globals.OrderedCollection)._new();
  30746. $ctx1.sendIdx["new"]=1;
  30747. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30748. return $core.withContext(function($ctx2) {
  30749. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30750. return $core.withContext(function($ctx3) {
  30751. map=$recv($globals.Dictionary)._new();
  30752. $recv(aClass)._protocolsDo_((function(category,methods){
  30753. return $core.withContext(function($ctx4) {
  30754. $1=$recv(category).__eq("*".__comma(name));
  30755. if($core.assert($1)){
  30756. return $recv(map)._at_put_(category,methods);
  30757. }
  30758. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30759. }));
  30760. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30761. return $core.withContext(function($ctx4) {
  30762. return $recv(a).__lt_eq(b);
  30763. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30764. })))._collect_((function(category){
  30765. return $core.withContext(function($ctx4) {
  30766. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30767. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30768. })));
  30769. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30770. }));
  30771. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30772. }));
  30773. $ctx1.sendIdx["do:"]=1;
  30774. return result;
  30775. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30776. },
  30777. args: ["aPackage"],
  30778. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each theMetaClass} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
  30779. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30780. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30781. }),
  30782. $globals.ChunkExporter);
  30783. $core.addMethod(
  30784. $core.method({
  30785. selector: "ownCategoriesOfClass:",
  30786. protocol: "accessing",
  30787. fn: function (aClass){
  30788. var self=this,$self=this;
  30789. var map;
  30790. return $core.withContext(function($ctx1) {
  30791. var $1;
  30792. map=$recv($globals.Dictionary)._new();
  30793. $recv(aClass)._protocolsDo_((function(each,methods){
  30794. return $core.withContext(function($ctx2) {
  30795. $1=$recv(each)._match_("^\x5c*");
  30796. if(!$core.assert($1)){
  30797. return $recv(map)._at_put_(each,methods);
  30798. }
  30799. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30800. }));
  30801. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30802. return $core.withContext(function($ctx2) {
  30803. return $recv(a).__lt_eq(b);
  30804. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30805. })))._collect_((function(each){
  30806. return $core.withContext(function($ctx2) {
  30807. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30809. }));
  30810. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30811. },
  30812. args: ["aClass"],
  30813. source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]",
  30814. referencedClasses: ["Dictionary", "MethodCategory"],
  30815. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30816. }),
  30817. $globals.ChunkExporter);
  30818. $core.addMethod(
  30819. $core.method({
  30820. selector: "ownCategoriesOfMetaClass:",
  30821. protocol: "accessing",
  30822. fn: function (aClass){
  30823. var self=this,$self=this;
  30824. return $core.withContext(function($ctx1) {
  30825. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30826. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30827. },
  30828. args: ["aClass"],
  30829. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30830. referencedClasses: [],
  30831. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30832. }),
  30833. $globals.ChunkExporter);
  30834. $core.addMethod(
  30835. $core.method({
  30836. selector: "ownMethodProtocolsOfClass:",
  30837. protocol: "accessing",
  30838. fn: function (aClass){
  30839. var self=this,$self=this;
  30840. return $core.withContext(function($ctx1) {
  30841. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30842. return $core.withContext(function($ctx2) {
  30843. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30844. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30845. }));
  30846. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30847. },
  30848. args: ["aClass"],
  30849. source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]",
  30850. referencedClasses: ["ExportMethodProtocol"],
  30851. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30852. }),
  30853. $globals.ChunkExporter);
  30854. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30855. $globals.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).";
  30856. $core.addMethod(
  30857. $core.method({
  30858. selector: "exportBehavior:on:",
  30859. protocol: "output",
  30860. fn: function (aBehavior,aStream){
  30861. var self=this,$self=this;
  30862. return $core.withContext(function($ctx1) {
  30863. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30864. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30865. return $core.withContext(function($ctx2) {
  30866. return $self._exportMethod_on_(method,aStream);
  30867. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30868. }));
  30869. return self;
  30870. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30871. },
  30872. args: ["aBehavior", "aStream"],
  30873. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30874. referencedClasses: [],
  30875. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30876. }),
  30877. $globals.Exporter);
  30878. $core.addMethod(
  30879. $core.method({
  30880. selector: "exportDefinitionOf:on:",
  30881. protocol: "output",
  30882. fn: function (aClass,aStream){
  30883. var self=this,$self=this;
  30884. return $core.withContext(function($ctx1) {
  30885. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  30886. $recv(aStream)._lf();
  30887. $ctx1.sendIdx["lf"]=1;
  30888. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30889. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30890. $5=$recv(aClass)._superclass();
  30891. if(($receiver = $5) == null || $receiver.a$nil){
  30892. $4="null";
  30893. } else {
  30894. var superclass;
  30895. superclass=$receiver;
  30896. $4=$recv(superclass)._asJavaScriptSource();
  30897. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30898. }
  30899. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  30900. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30901. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  30902. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30903. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  30904. $1=$recv(aStream)._write_($2);
  30905. $ctx1.sendIdx["write:"]=1;
  30906. $8=$recv(aClass)._comment();
  30907. $ctx1.sendIdx["comment"]=1;
  30908. $recv($8)._ifNotEmpty_((function(){
  30909. return $core.withContext(function($ctx2) {
  30910. $recv(aStream)._lf();
  30911. $ctx2.sendIdx["lf"]=2;
  30912. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30913. $ctx2.sendIdx["write:"]=2;
  30914. $recv(aStream)._lf();
  30915. $ctx2.sendIdx["lf"]=3;
  30916. $10=$recv(aClass)._asJavaScriptSource();
  30917. $ctx2.sendIdx["asJavaScriptSource"]=5;
  30918. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30919. $recv(aStream)._write_($9);
  30920. $ctx2.sendIdx["write:"]=3;
  30921. $recv(aStream)._lf();
  30922. $ctx2.sendIdx["lf"]=4;
  30923. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30925. }));
  30926. $recv(aStream)._lf();
  30927. return self;
  30928. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30929. },
  30930. args: ["aClass", "aStream"],
  30931. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.addClass('.\x0a\x09\x09\x09aClass name asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass superclass ifNil: [ 'null' ] ifNotNil: [ :superclass | superclass asJavaScriptSource ]. ', '.\x0a\x09\x09\x09aClass instanceVariableNames asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass category asJavaScriptSource.\x0a\x09\x09\x09');' }.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09\x09write: { aClass asJavaScriptSource. '.comment='. aClass comment crlfSanitized asJavaScriptSource. ';' }; lf;\x0a\x09\x09\x09write: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  30932. referencedClasses: [],
  30933. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30934. }),
  30935. $globals.Exporter);
  30936. $core.addMethod(
  30937. $core.method({
  30938. selector: "exportMetaDefinitionOf:on:",
  30939. protocol: "output",
  30940. fn: function (aClass,aStream){
  30941. var self=this,$self=this;
  30942. return $core.withContext(function($ctx1) {
  30943. var $2,$1,$4,$3;
  30944. $recv(aStream)._lf();
  30945. $ctx1.sendIdx["lf"]=1;
  30946. $2=$recv(aClass)._theMetaClass();
  30947. $ctx1.sendIdx["theMetaClass"]=1;
  30948. $1=$recv($2)._instanceVariableNames();
  30949. $recv($1)._ifNotEmpty_((function(classIvars){
  30950. return $core.withContext(function($ctx2) {
  30951. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  30952. $ctx2.sendIdx["asJavaScriptSource"]=1;
  30953. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  30954. $recv(aStream)._write_($3);
  30955. return $recv(aStream)._lf();
  30956. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  30957. }));
  30958. return self;
  30959. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30960. },
  30961. args: ["aClass", "aStream"],
  30962. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass theMetaClass instanceVariableNames ifNotEmpty: [ :classIvars | aStream\x0a\x09\x09write: { aClass theMetaClass asJavaScriptSource. '.iVarNames = '. classIvars asJavaScriptSource. ';' };\x0a\x09\x09lf ]",
  30963. referencedClasses: [],
  30964. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  30965. }),
  30966. $globals.Exporter);
  30967. $core.addMethod(
  30968. $core.method({
  30969. selector: "exportMethod:on:",
  30970. protocol: "output",
  30971. fn: function (aMethod,aStream){
  30972. var self=this,$self=this;
  30973. return $core.withContext(function($ctx1) {
  30974. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  30975. $recv(aStream)._write_("$core.addMethod(");
  30976. $ctx1.sendIdx["write:"]=1;
  30977. $recv(aStream)._lf();
  30978. $ctx1.sendIdx["lf"]=1;
  30979. $recv(aStream)._write_("$core.method({");
  30980. $ctx1.sendIdx["write:"]=2;
  30981. $recv(aStream)._lf();
  30982. $ctx1.sendIdx["lf"]=2;
  30983. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  30984. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30985. $1=["selector: ",$2,","];
  30986. $recv(aStream)._write_($1);
  30987. $ctx1.sendIdx["write:"]=3;
  30988. $recv(aStream)._lf();
  30989. $ctx1.sendIdx["lf"]=3;
  30990. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  30991. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30992. $3=["protocol: ",$4,","];
  30993. $recv(aStream)._write_($3);
  30994. $ctx1.sendIdx["write:"]=4;
  30995. $recv(aStream)._lf();
  30996. $ctx1.sendIdx["lf"]=4;
  30997. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  30998. $ctx1.sendIdx["write:"]=5;
  30999. $recv(aStream)._lf();
  31000. $ctx1.sendIdx["lf"]=5;
  31001. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31002. $ctx1.sendIdx["write:"]=6;
  31003. $recv(aStream)._lf();
  31004. $ctx1.sendIdx["lf"]=6;
  31005. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31006. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31007. $5=["args: ",$6,","];
  31008. $recv(aStream)._write_($5);
  31009. $ctx1.sendIdx["write:"]=7;
  31010. $recv(aStream)._lf();
  31011. $ctx1.sendIdx["lf"]=7;
  31012. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31013. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31014. $7=["source: ",$8,","];
  31015. $recv(aStream)._write_($7);
  31016. $ctx1.sendIdx["write:"]=8;
  31017. $recv(aStream)._lf();
  31018. $ctx1.sendIdx["lf"]=8;
  31019. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31020. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31021. $9=["referencedClasses: ",$10,","];
  31022. $recv(aStream)._write_($9);
  31023. $ctx1.sendIdx["write:"]=9;
  31024. $recv(aStream)._lf();
  31025. $ctx1.sendIdx["lf"]=9;
  31026. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31027. $ctx1.sendIdx["write:"]=10;
  31028. $recv(aStream)._lf();
  31029. $ctx1.sendIdx["lf"]=10;
  31030. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31031. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31032. $11=["messageSends: ",$12];
  31033. $recv(aStream)._write_($11);
  31034. $ctx1.sendIdx["write:"]=11;
  31035. $recv(aStream)._lf();
  31036. $ctx1.sendIdx["lf"]=11;
  31037. $recv(aStream)._write_("}),");
  31038. $ctx1.sendIdx["write:"]=12;
  31039. $recv(aStream)._lf();
  31040. $ctx1.sendIdx["lf"]=12;
  31041. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31042. $recv(aStream)._lf();
  31043. $ctx1.sendIdx["lf"]=13;
  31044. $recv(aStream)._lf();
  31045. return self;
  31046. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31047. },
  31048. args: ["aMethod", "aStream"],
  31049. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09write: '$core.addMethod('; lf;\x0a\x09\x09write: '$core.method({'; lf;\x0a\x09\x09write: { 'selector: '. aMethod selector asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'protocol: '. aMethod protocol asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'fn: '. aMethod fn compiledSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09write: { 'args: '. aMethod arguments asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'source: '. aMethod source asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: { 'referencedClasses: '. aMethod referencedClasses asJavaScriptSource. ',' }; lf;\x0a\x09\x09write: '//>>excludeEnd(\x22ide\x22);'; lf;\x0a\x09\x09write: { 'messageSends: '. aMethod messageSends asJavaScriptSource }; lf;\x0a\x09\x09write: '}),'; lf;\x0a\x09\x09write: { aMethod methodClass asJavaScriptSource. ');' }; lf; lf",
  31050. referencedClasses: [],
  31051. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31052. }),
  31053. $globals.Exporter);
  31054. $core.addMethod(
  31055. $core.method({
  31056. selector: "exportPackage:on:",
  31057. protocol: "output",
  31058. fn: function (aPackage,aStream){
  31059. var self=this,$self=this;
  31060. return $core.withContext(function($ctx1) {
  31061. var $1,$receiver;
  31062. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31063. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31064. $self._exportPackageContextOf_on_(aPackage,aStream);
  31065. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31066. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31067. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31068. return $core.withContext(function($ctx2) {
  31069. $self._exportBehavior_on_(each,aStream);
  31070. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31071. $1=$recv(each)._theMetaClass();
  31072. if(($receiver = $1) == null || $receiver.a$nil){
  31073. return $1;
  31074. } else {
  31075. var meta;
  31076. meta=$receiver;
  31077. return $self._exportBehavior_on_(meta,aStream);
  31078. }
  31079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31080. }));
  31081. $ctx1.sendIdx["do:"]=1;
  31082. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31083. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31084. return $core.withContext(function($ctx2) {
  31085. return $self._exportMethod_on_(each,aStream);
  31086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31087. }));
  31088. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31089. return self;
  31090. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31091. },
  31092. args: ["aPackage", "aStream"],
  31093. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageContextOf: aPackage on: aStream;\x0a\x09\x09exportPackageImportsOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportBehavior: each on: aStream.\x0a\x09\x09each theMetaClass ifNotNil: [ :meta | self exportBehavior: meta on: aStream ] ].\x0a\x09\x09\x09\x0a\x09self exportPackageTraitCompositionsOf: aPackage on: aStream.\x0a\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  31094. referencedClasses: [],
  31095. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31096. }),
  31097. $globals.Exporter);
  31098. $core.addMethod(
  31099. $core.method({
  31100. selector: "exportPackageBodyBlockPrologueOf:on:",
  31101. protocol: "output",
  31102. fn: function (aPackage,aStream){
  31103. var self=this,$self=this;
  31104. return $core.withContext(function($ctx1) {
  31105. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31106. $ctx1.sendIdx["write:"]=1;
  31107. $recv(aStream)._lf();
  31108. $ctx1.sendIdx["lf"]=1;
  31109. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31110. $recv(aStream)._lf();
  31111. return self;
  31112. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31113. },
  31114. args: ["aPackage", "aStream"],
  31115. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;'; lf;\x0a\x09\x09write: 'var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;'; lf",
  31116. referencedClasses: [],
  31117. messageSends: ["write:", "lf"]
  31118. }),
  31119. $globals.Exporter);
  31120. $core.addMethod(
  31121. $core.method({
  31122. selector: "exportPackageContextOf:on:",
  31123. protocol: "output",
  31124. fn: function (aPackage,aStream){
  31125. var self=this,$self=this;
  31126. return $core.withContext(function($ctx1) {
  31127. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  31128. $recv(aStream)._lf();
  31129. return self;
  31130. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31131. },
  31132. args: ["aPackage", "aStream"],
  31133. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'($core.packageDescriptors||$core.packages)['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].innerEval = '.\x0a\x09\x09\x09'function (expr) { return eval(expr); }'.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  31134. referencedClasses: [],
  31135. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31136. }),
  31137. $globals.Exporter);
  31138. $core.addMethod(
  31139. $core.method({
  31140. selector: "exportPackageDefinitionOf:on:",
  31141. protocol: "output",
  31142. fn: function (aPackage,aStream){
  31143. var self=this,$self=this;
  31144. return $core.withContext(function($ctx1) {
  31145. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31146. $recv(aStream)._lf();
  31147. return self;
  31148. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31149. },
  31150. args: ["aPackage", "aStream"],
  31151. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31152. referencedClasses: [],
  31153. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31154. }),
  31155. $globals.Exporter);
  31156. $core.addMethod(
  31157. $core.method({
  31158. selector: "exportPackageEpilogueOf:on:",
  31159. protocol: "output",
  31160. fn: function (aPackage,aStream){
  31161. var self=this,$self=this;
  31162. return $core.withContext(function($ctx1) {
  31163. $self._subclassResponsibility();
  31164. return self;
  31165. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31166. },
  31167. args: ["aPackage", "aStream"],
  31168. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31169. referencedClasses: [],
  31170. messageSends: ["subclassResponsibility"]
  31171. }),
  31172. $globals.Exporter);
  31173. $core.addMethod(
  31174. $core.method({
  31175. selector: "exportPackageImportsOf:on:",
  31176. protocol: "output",
  31177. fn: function (aPackage,aStream){
  31178. var self=this,$self=this;
  31179. return $core.withContext(function($ctx1) {
  31180. var $2,$1;
  31181. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31182. return $core.withContext(function($ctx2) {
  31183. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  31184. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31185. $1=["($core.packageDescriptors||$core.packages)[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  31186. $recv(aStream)._write_($1);
  31187. return $recv(aStream)._lf();
  31188. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31189. }));
  31190. return self;
  31191. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31192. },
  31193. args: ["aPackage", "aStream"],
  31194. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'($core.packageDescriptors||$core.packages)['.\x0a\x09\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09\x09'].imports = '.\x0a\x09\x09\x09\x09imports asJavaScriptSource.\x0a\x09\x09\x09\x09';' };\x0a\x09\x09\x09lf ]",
  31195. referencedClasses: [],
  31196. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  31197. }),
  31198. $globals.Exporter);
  31199. $core.addMethod(
  31200. $core.method({
  31201. selector: "exportPackagePrologueOf:on:",
  31202. protocol: "output",
  31203. fn: function (aPackage,aStream){
  31204. var self=this,$self=this;
  31205. return $core.withContext(function($ctx1) {
  31206. $self._subclassResponsibility();
  31207. return self;
  31208. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31209. },
  31210. args: ["aPackage", "aStream"],
  31211. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31212. referencedClasses: [],
  31213. messageSends: ["subclassResponsibility"]
  31214. }),
  31215. $globals.Exporter);
  31216. $core.addMethod(
  31217. $core.method({
  31218. selector: "exportPackageTraitCompositionsOf:on:",
  31219. protocol: "output",
  31220. fn: function (aPackage,aStream){
  31221. var self=this,$self=this;
  31222. return $core.withContext(function($ctx1) {
  31223. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31224. return $core.withContext(function($ctx2) {
  31225. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31226. return $core.withContext(function($ctx3) {
  31227. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31228. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31229. }));
  31230. return $recv(aStream)._lf();
  31231. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31232. }));
  31233. return self;
  31234. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31235. },
  31236. args: ["aPackage", "aStream"],
  31237. source: "exportPackageTraitCompositionsOf: aPackage on: aStream\x0a\x09aPackage traitCompositions ifNotEmpty: [ :traitCompositions |\x0a\x09\x09traitCompositions keysAndValuesDo: [ :key :value | self exportTraitComposition: value of: key on: aStream ].\x0a\x09\x09aStream lf ]",
  31238. referencedClasses: [],
  31239. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31240. }),
  31241. $globals.Exporter);
  31242. $core.addMethod(
  31243. $core.method({
  31244. selector: "exportPackageTransportOf:on:",
  31245. protocol: "output",
  31246. fn: function (aPackage,aStream){
  31247. var self=this,$self=this;
  31248. return $core.withContext(function($ctx1) {
  31249. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31250. $recv(aStream)._lf();
  31251. return self;
  31252. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31253. },
  31254. args: ["aPackage", "aStream"],
  31255. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'($core.packageDescriptors||$core.packages)['.\x0a\x09\x09\x09aPackage name asJavaScriptSource.\x0a\x09\x09\x09'].transport = '.\x0a\x09\x09\x09aPackage transport asJSONString.\x0a\x09\x09\x09';' };\x0a\x09\x09lf",
  31256. referencedClasses: [],
  31257. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  31258. }),
  31259. $globals.Exporter);
  31260. $core.addMethod(
  31261. $core.method({
  31262. selector: "exportTraitComposition:of:on:",
  31263. protocol: "output",
  31264. fn: function (aTraitComposition,aBehavior,aStream){
  31265. var self=this,$self=this;
  31266. return $core.withContext(function($ctx1) {
  31267. var $2,$1;
  31268. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31269. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31270. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31271. $recv(aStream)._write_($1);
  31272. $recv(aStream)._lf();
  31273. return self;
  31274. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31275. },
  31276. args: ["aTraitComposition", "aBehavior", "aStream"],
  31277. source: "exportTraitComposition: aTraitComposition of: aBehavior on: aStream\x0a\x09aStream write: {\x0a\x09\x09'$core.setTraitComposition('.\x0a\x09\x09aTraitComposition asJavaScriptSource.\x0a\x09\x09', '.\x0a\x09\x09aBehavior asJavaScriptSource.\x0a\x09\x09');' };\x0a\x09lf",
  31278. referencedClasses: [],
  31279. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31280. }),
  31281. $globals.Exporter);
  31282. $core.addMethod(
  31283. $core.method({
  31284. selector: "exportTraitDefinitionOf:on:",
  31285. protocol: "output",
  31286. fn: function (aClass,aStream){
  31287. var self=this,$self=this;
  31288. return $core.withContext(function($ctx1) {
  31289. var $3,$4,$2,$1,$5,$7,$6;
  31290. $recv(aStream)._lf();
  31291. $ctx1.sendIdx["lf"]=1;
  31292. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31293. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31294. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31295. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31296. $2=["$core.addTrait(",$3,", ",$4,");"];
  31297. $1=$recv(aStream)._write_($2);
  31298. $ctx1.sendIdx["write:"]=1;
  31299. $5=$recv(aClass)._comment();
  31300. $ctx1.sendIdx["comment"]=1;
  31301. $recv($5)._ifNotEmpty_((function(){
  31302. return $core.withContext(function($ctx2) {
  31303. $recv(aStream)._lf();
  31304. $ctx2.sendIdx["lf"]=2;
  31305. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31306. $ctx2.sendIdx["write:"]=2;
  31307. $recv(aStream)._lf();
  31308. $ctx2.sendIdx["lf"]=3;
  31309. $7=$recv(aClass)._asJavaScriptSource();
  31310. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31311. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31312. $recv(aStream)._write_($6);
  31313. $ctx2.sendIdx["write:"]=3;
  31314. $recv(aStream)._lf();
  31315. $ctx2.sendIdx["lf"]=4;
  31316. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31318. }));
  31319. $recv(aStream)._lf();
  31320. return self;
  31321. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31322. },
  31323. args: ["aClass", "aStream"],
  31324. source: "exportTraitDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09write: {\x0a\x09\x09\x09'$core.addTrait('.\x0a\x09\x09\x09aClass name asJavaScriptSource. ', '.\x0a\x09\x09\x09aClass category asJavaScriptSource.\x0a\x09\x09\x09');' }.\x0a\x09aClass comment ifNotEmpty: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09\x09write: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);'; lf;\x0a\x09\x09\x09write: { aClass asJavaScriptSource. '.comment='. aClass comment crlfSanitized asJavaScriptSource. ';' }; lf;\x0a\x09\x09\x09write: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  31325. referencedClasses: [],
  31326. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31327. }),
  31328. $globals.Exporter);
  31329. $core.addMethod(
  31330. $core.method({
  31331. selector: "ownMethodsOfClass:",
  31332. protocol: "accessing",
  31333. fn: function (aClass){
  31334. var self=this,$self=this;
  31335. return $core.withContext(function($ctx1) {
  31336. var $1;
  31337. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31338. return $core.withContext(function($ctx2) {
  31339. $1=$recv(a)._selector();
  31340. $ctx2.sendIdx["selector"]=1;
  31341. return $recv($1).__lt_eq($recv(b)._selector());
  31342. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31343. })))._reject_((function(each){
  31344. return $core.withContext(function($ctx2) {
  31345. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31346. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31347. }));
  31348. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31349. },
  31350. args: ["aClass"],
  31351. source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])\x0a\x09\x09reject: [ :each | (each protocol match: '^\x5c*') ]",
  31352. referencedClasses: [],
  31353. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31354. }),
  31355. $globals.Exporter);
  31356. $core.addMethod(
  31357. $core.method({
  31358. selector: "ownMethodsOfMetaClass:",
  31359. protocol: "accessing",
  31360. fn: function (aClass){
  31361. var self=this,$self=this;
  31362. return $core.withContext(function($ctx1) {
  31363. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31364. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31365. },
  31366. args: ["aClass"],
  31367. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31368. referencedClasses: [],
  31369. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31370. }),
  31371. $globals.Exporter);
  31372. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31373. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31374. $core.addMethod(
  31375. $core.method({
  31376. selector: "amdNamesOfPackages:",
  31377. protocol: "private",
  31378. fn: function (anArray){
  31379. var self=this,$self=this;
  31380. return $core.withContext(function($ctx1) {
  31381. var $1;
  31382. return $recv($recv(anArray)._select_((function(each){
  31383. return $core.withContext(function($ctx2) {
  31384. $1=$self._amdNamespaceOfPackage_(each);
  31385. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31386. return $recv($1)._notNil();
  31387. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31388. })))._collect_((function(each){
  31389. return $core.withContext(function($ctx2) {
  31390. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31391. $ctx2.sendIdx[","]=1;
  31392. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31393. }));
  31394. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31395. },
  31396. args: ["anArray"],
  31397. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31398. referencedClasses: [],
  31399. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31400. }),
  31401. $globals.AmdExporter);
  31402. $core.addMethod(
  31403. $core.method({
  31404. selector: "amdNamespaceOfPackage:",
  31405. protocol: "private",
  31406. fn: function (aPackage){
  31407. var self=this,$self=this;
  31408. return $core.withContext(function($ctx1) {
  31409. var $3,$2,$1;
  31410. $3=$recv(aPackage)._transport();
  31411. $ctx1.sendIdx["transport"]=1;
  31412. $2=$recv($3)._type();
  31413. $1=$recv($2).__eq("amd");
  31414. if($core.assert($1)){
  31415. return $recv($recv(aPackage)._transport())._namespace();
  31416. } else {
  31417. return nil;
  31418. }
  31419. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31420. },
  31421. args: ["aPackage"],
  31422. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31423. referencedClasses: [],
  31424. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31425. }),
  31426. $globals.AmdExporter);
  31427. $core.addMethod(
  31428. $core.method({
  31429. selector: "exportPackageEpilogueOf:on:",
  31430. protocol: "output",
  31431. fn: function (aPackage,aStream){
  31432. var self=this,$self=this;
  31433. return $core.withContext(function($ctx1) {
  31434. $recv(aStream)._write_("});");
  31435. $recv(aStream)._lf();
  31436. return self;
  31437. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31438. },
  31439. args: ["aPackage", "aStream"],
  31440. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31441. referencedClasses: [],
  31442. messageSends: ["write:", "lf"]
  31443. }),
  31444. $globals.AmdExporter);
  31445. $core.addMethod(
  31446. $core.method({
  31447. selector: "exportPackagePrologueOf:on:",
  31448. protocol: "output",
  31449. fn: function (aPackage,aStream){
  31450. var self=this,$self=this;
  31451. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31452. return $core.withContext(function($ctx1) {
  31453. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31454. pragmaStart="";
  31455. pragmaEnd="";
  31456. importsForOutput=$self._importsForOutput_(aPackage);
  31457. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31458. $1=$recv(importsForOutput)._value();
  31459. $ctx1.sendIdx["value"]=1;
  31460. $recv($1)._ifNotEmpty_((function(){
  31461. return $core.withContext(function($ctx2) {
  31462. $3=$recv($globals.String)._lf();
  31463. $ctx2.sendIdx["lf"]=1;
  31464. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31465. $ctx2.sendIdx[","]=2;
  31466. $4=$recv($globals.String)._lf();
  31467. $ctx2.sendIdx["lf"]=2;
  31468. pragmaStart=$recv($2).__comma($4);
  31469. $ctx2.sendIdx[","]=1;
  31470. $6=$recv($globals.String)._lf();
  31471. $ctx2.sendIdx["lf"]=3;
  31472. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31473. $ctx2.sendIdx[","]=4;
  31474. $7=$recv($globals.String)._lf();
  31475. $ctx2.sendIdx["lf"]=4;
  31476. pragmaEnd=$recv($5).__comma($7);
  31477. $ctx2.sendIdx[","]=3;
  31478. return pragmaEnd;
  31479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31480. }));
  31481. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31482. $ctx1.sendIdx[","]=7;
  31483. $13=$recv($14).__comma([":2:"]);
  31484. $ctx1.sendIdx[","]=6;
  31485. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31486. $ctx1.sendIdx[","]=5;
  31487. $11=$recv($12)._asJavaScriptSource();
  31488. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31489. $ctx1.sendIdx["replace:with:"]=2;
  31490. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31491. $ctx1.sendIdx["replace:with:"]=1;
  31492. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31493. $ctx1.sendIdx[","]=8;
  31494. $17=$recv($18)._join_(",");
  31495. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31496. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31497. $ctx1.sendIdx["replace:with:"]=3;
  31498. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31499. $recv(aStream)._write_($8);
  31500. $recv(aStream)._lf();
  31501. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31502. return self;
  31503. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31504. },
  31505. args: ["aPackage", "aStream"],
  31506. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09| importsForOutput loadDependencies pragmaStart pragmaEnd |\x0a\x09pragmaStart := ''.\x0a\x09pragmaEnd := ''.\x0a\x09importsForOutput := self importsForOutput: aPackage.\x0a\x09loadDependencies := self amdNamesOfPackages: aPackage loadDependencies.\x0a\x09importsForOutput value ifNotEmpty: [\x0a\x09\x09pragmaStart := String lf, '//>>excludeStart(\x22imports\x22, pragmas.excludeImports);', String lf.\x0a\x09\x09pragmaEnd := String lf, '//>>excludeEnd(\x22imports\x22);', String lf ].\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'define('.\x0a\x09\x09\x09((#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies asArray sorted) asJavaScriptSource\x0a\x09\x09\x09\x09replace: ',\x5cs*[\x22'']:1:[\x22'']' with: pragmaStart)\x0a\x09\x09\x09\x09replace: ',\x5cs*[\x22'']:2:[\x22'']' with: pragmaEnd.\x0a\x09\x09\x09', function('.\x0a\x09\x09\x09((((#('$boot' ':1:'), importsForOutput key, #(':2:')) join: ',') \x0a\x09\x09\x09\x09replace: ',\x5cs*:1:' with: pragmaStart)\x0a\x09\x09\x09\x09replace: ',\x5cs*:2:' with: pragmaEnd).\x0a\x09\x09\x09'){\x22use strict\x22;' };\x0a\x09\x09lf.\x0a\x09self exportPackageBodyBlockPrologueOf: aPackage on: aStream",
  31507. referencedClasses: ["String"],
  31508. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31509. }),
  31510. $globals.AmdExporter);
  31511. $core.addMethod(
  31512. $core.method({
  31513. selector: "importsForOutput:",
  31514. protocol: "private",
  31515. fn: function (aPackage){
  31516. var self=this,$self=this;
  31517. var namedImports,anonImports,importVarNames;
  31518. return $core.withContext(function($ctx1) {
  31519. var $1;
  31520. namedImports=[];
  31521. anonImports=[];
  31522. importVarNames=[];
  31523. $recv($recv(aPackage)._imports())._do_((function(each){
  31524. return $core.withContext(function($ctx2) {
  31525. $1=$recv(each)._isString();
  31526. if($core.assert($1)){
  31527. return $recv(anonImports)._add_(each);
  31528. $ctx2.sendIdx["add:"]=1;
  31529. } else {
  31530. $recv(namedImports)._add_($recv(each)._value());
  31531. $ctx2.sendIdx["add:"]=2;
  31532. return $recv(importVarNames)._add_($recv(each)._key());
  31533. }
  31534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31535. }));
  31536. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31537. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31538. },
  31539. args: ["aPackage"],
  31540. source: "importsForOutput: aPackage\x0a\x09\x22Returns an association where key is list of import variables\x0a\x09and value is list of external dependencies, with ones imported as variables\x0a\x09put at the beginning with same order as is in key.\x0a\x09\x0a\x09For example imports:{'jQuery'->'jquery'. 'bootstrap'} would yield\x0a\x09#('jQuery') -> #('jquery' 'bootstrap')\x22\x0a\x09| namedImports anonImports importVarNames |\x0a\x09namedImports := #().\x0a\x09anonImports := #().\x0a\x09importVarNames := #().\x0a\x09aPackage imports do: [ :each | each isString\x0a\x09\x09ifTrue: [ anonImports add: each ]\x0a\x09\x09ifFalse: [ namedImports add: each value.\x0a\x09\x09\x09importVarNames add: each key ]].\x0a\x09^ importVarNames -> (namedImports, anonImports)",
  31541. referencedClasses: [],
  31542. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31543. }),
  31544. $globals.AmdExporter);
  31545. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31546. $globals.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk";
  31547. $core.addMethod(
  31548. $core.method({
  31549. selector: "last",
  31550. protocol: "accessing",
  31551. fn: function (){
  31552. var self=this,$self=this;
  31553. return $self["@last"];
  31554. },
  31555. args: [],
  31556. source: "last\x0a\x09^ last",
  31557. referencedClasses: [],
  31558. messageSends: []
  31559. }),
  31560. $globals.ChunkParser);
  31561. $core.addMethod(
  31562. $core.method({
  31563. selector: "nextChunk",
  31564. protocol: "reading",
  31565. fn: function (){
  31566. var self=this,$self=this;
  31567. var char,result,chunk;
  31568. return $core.withContext(function($ctx1) {
  31569. var $1,$2,$3,$4;
  31570. var $early={};
  31571. try {
  31572. result=""._writeStream();
  31573. $recv((function(){
  31574. return $core.withContext(function($ctx2) {
  31575. char=$recv($self["@stream"])._next();
  31576. $ctx2.sendIdx["next"]=1;
  31577. return $recv(char)._notNil();
  31578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31579. }))._whileTrue_((function(){
  31580. return $core.withContext(function($ctx2) {
  31581. $1=$recv(char).__eq("!");
  31582. $ctx2.sendIdx["="]=1;
  31583. if($core.assert($1)){
  31584. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31585. if($core.assert($2)){
  31586. $recv($self["@stream"])._next();
  31587. } else {
  31588. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31589. $3=$self["@last"];
  31590. throw $early=[$3];
  31591. }
  31592. }
  31593. return $recv(result)._nextPut_(char);
  31594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31595. }));
  31596. $self["@last"]=nil;
  31597. $4=$self["@last"];
  31598. return $4;
  31599. }
  31600. catch(e) {if(e===$early)return e[0]; throw e}
  31601. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31602. },
  31603. args: [],
  31604. source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[ char := stream next.\x0a\x09\x09char notNil ] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [ stream next \x22skipping the escape double\x22 ]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22",
  31605. referencedClasses: [],
  31606. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31607. }),
  31608. $globals.ChunkParser);
  31609. $core.addMethod(
  31610. $core.method({
  31611. selector: "stream:",
  31612. protocol: "accessing",
  31613. fn: function (aStream){
  31614. var self=this,$self=this;
  31615. $self["@stream"]=aStream;
  31616. return self;
  31617. },
  31618. args: ["aStream"],
  31619. source: "stream: aStream\x0a\x09stream := aStream",
  31620. referencedClasses: [],
  31621. messageSends: []
  31622. }),
  31623. $globals.ChunkParser);
  31624. $core.addMethod(
  31625. $core.method({
  31626. selector: "on:",
  31627. protocol: "instance creation",
  31628. fn: function (aStream){
  31629. var self=this,$self=this;
  31630. return $core.withContext(function($ctx1) {
  31631. return $recv($self._new())._stream_(aStream);
  31632. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31633. },
  31634. args: ["aStream"],
  31635. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31636. referencedClasses: [],
  31637. messageSends: ["stream:", "new"]
  31638. }),
  31639. $globals.ChunkParser.a$cls);
  31640. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31641. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31642. $core.addMethod(
  31643. $core.method({
  31644. selector: "class:",
  31645. protocol: "accessing",
  31646. fn: function (aClass){
  31647. var self=this,$self=this;
  31648. $self["@class"]=aClass;
  31649. return self;
  31650. },
  31651. args: ["aClass"],
  31652. source: "class: aClass\x0a\x09class := aClass",
  31653. referencedClasses: [],
  31654. messageSends: []
  31655. }),
  31656. $globals.ClassCommentReader);
  31657. $core.addMethod(
  31658. $core.method({
  31659. selector: "initialize",
  31660. protocol: "initialization",
  31661. fn: function (){
  31662. var self=this,$self=this;
  31663. return $core.withContext(function($ctx1) {
  31664. (
  31665. $ctx1.supercall = true,
  31666. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31667. $ctx1.supercall = false;
  31668. return self;
  31669. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31670. },
  31671. args: [],
  31672. source: "initialize\x0a\x09super initialize.",
  31673. referencedClasses: [],
  31674. messageSends: ["initialize"]
  31675. }),
  31676. $globals.ClassCommentReader);
  31677. $core.addMethod(
  31678. $core.method({
  31679. selector: "scanFrom:",
  31680. protocol: "fileIn",
  31681. fn: function (aChunkParser){
  31682. var self=this,$self=this;
  31683. var chunk;
  31684. return $core.withContext(function($ctx1) {
  31685. chunk=$recv(aChunkParser)._nextChunk();
  31686. $recv(chunk)._ifNotEmpty_((function(){
  31687. return $core.withContext(function($ctx2) {
  31688. return $self._setComment_(chunk);
  31689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31690. }));
  31691. return self;
  31692. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31693. },
  31694. args: ["aChunkParser"],
  31695. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31696. referencedClasses: [],
  31697. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31698. }),
  31699. $globals.ClassCommentReader);
  31700. $core.addMethod(
  31701. $core.method({
  31702. selector: "setComment:",
  31703. protocol: "private",
  31704. fn: function (aString){
  31705. var self=this,$self=this;
  31706. return $core.withContext(function($ctx1) {
  31707. $recv($self["@class"])._comment_(aString);
  31708. return self;
  31709. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31710. },
  31711. args: ["aString"],
  31712. source: "setComment: aString\x0a\x09class comment: aString",
  31713. referencedClasses: [],
  31714. messageSends: ["comment:"]
  31715. }),
  31716. $globals.ClassCommentReader);
  31717. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31718. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31719. $core.addMethod(
  31720. $core.method({
  31721. selector: "class:category:",
  31722. protocol: "accessing",
  31723. fn: function (aClass,aString){
  31724. var self=this,$self=this;
  31725. $self["@class"]=aClass;
  31726. $self["@category"]=aString;
  31727. return self;
  31728. },
  31729. args: ["aClass", "aString"],
  31730. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31731. referencedClasses: [],
  31732. messageSends: []
  31733. }),
  31734. $globals.ClassProtocolReader);
  31735. $core.addMethod(
  31736. $core.method({
  31737. selector: "compileMethod:",
  31738. protocol: "private",
  31739. fn: function (aString){
  31740. var self=this,$self=this;
  31741. return $core.withContext(function($ctx1) {
  31742. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31743. return self;
  31744. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31745. },
  31746. args: ["aString"],
  31747. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31748. referencedClasses: ["Compiler"],
  31749. messageSends: ["install:forClass:protocol:", "new"]
  31750. }),
  31751. $globals.ClassProtocolReader);
  31752. $core.addMethod(
  31753. $core.method({
  31754. selector: "initialize",
  31755. protocol: "initialization",
  31756. fn: function (){
  31757. var self=this,$self=this;
  31758. return $core.withContext(function($ctx1) {
  31759. (
  31760. $ctx1.supercall = true,
  31761. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31762. $ctx1.supercall = false;
  31763. return self;
  31764. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31765. },
  31766. args: [],
  31767. source: "initialize\x0a\x09super initialize.",
  31768. referencedClasses: [],
  31769. messageSends: ["initialize"]
  31770. }),
  31771. $globals.ClassProtocolReader);
  31772. $core.addMethod(
  31773. $core.method({
  31774. selector: "scanFrom:",
  31775. protocol: "fileIn",
  31776. fn: function (aChunkParser){
  31777. var self=this,$self=this;
  31778. var chunk;
  31779. return $core.withContext(function($ctx1) {
  31780. $recv((function(){
  31781. return $core.withContext(function($ctx2) {
  31782. chunk=$recv(aChunkParser)._nextChunk();
  31783. return $recv(chunk)._isEmpty();
  31784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31785. }))._whileFalse_((function(){
  31786. return $core.withContext(function($ctx2) {
  31787. return $self._compileMethod_(chunk);
  31788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31789. }));
  31790. return self;
  31791. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31792. },
  31793. args: ["aChunkParser"],
  31794. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31795. referencedClasses: [],
  31796. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31797. }),
  31798. $globals.ClassProtocolReader);
  31799. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31800. $globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
  31801. $core.addMethod(
  31802. $core.method({
  31803. selector: "methods",
  31804. protocol: "accessing",
  31805. fn: function (){
  31806. var self=this,$self=this;
  31807. return $core.withContext(function($ctx1) {
  31808. var $1;
  31809. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31810. return $core.withContext(function($ctx2) {
  31811. $1=$recv(a)._selector();
  31812. $ctx2.sendIdx["selector"]=1;
  31813. return $recv($1).__lt_eq($recv(b)._selector());
  31814. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31815. }));
  31816. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31817. },
  31818. args: [],
  31819. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31820. referencedClasses: [],
  31821. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31822. }),
  31823. $globals.ExportMethodProtocol);
  31824. $core.addMethod(
  31825. $core.method({
  31826. selector: "name",
  31827. protocol: "accessing",
  31828. fn: function (){
  31829. var self=this,$self=this;
  31830. return $self["@name"];
  31831. },
  31832. args: [],
  31833. source: "name\x0a\x09^ name",
  31834. referencedClasses: [],
  31835. messageSends: []
  31836. }),
  31837. $globals.ExportMethodProtocol);
  31838. $core.addMethod(
  31839. $core.method({
  31840. selector: "name:",
  31841. protocol: "accessing",
  31842. fn: function (aString){
  31843. var self=this,$self=this;
  31844. $self["@name"]=aString;
  31845. return self;
  31846. },
  31847. args: ["aString"],
  31848. source: "name: aString\x0a\x09name := aString",
  31849. referencedClasses: [],
  31850. messageSends: []
  31851. }),
  31852. $globals.ExportMethodProtocol);
  31853. $core.addMethod(
  31854. $core.method({
  31855. selector: "ownMethods",
  31856. protocol: "accessing",
  31857. fn: function (){
  31858. var self=this,$self=this;
  31859. return $core.withContext(function($ctx1) {
  31860. var $1;
  31861. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31862. return $core.withContext(function($ctx2) {
  31863. $1=$recv(a)._selector();
  31864. $ctx2.sendIdx["selector"]=1;
  31865. return $recv($1).__lt_eq($recv(b)._selector());
  31866. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31867. }));
  31868. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31869. },
  31870. args: [],
  31871. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31872. referencedClasses: [],
  31873. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31874. }),
  31875. $globals.ExportMethodProtocol);
  31876. $core.addMethod(
  31877. $core.method({
  31878. selector: "theClass",
  31879. protocol: "accessing",
  31880. fn: function (){
  31881. var self=this,$self=this;
  31882. return $self["@theClass"];
  31883. },
  31884. args: [],
  31885. source: "theClass\x0a\x09^ theClass",
  31886. referencedClasses: [],
  31887. messageSends: []
  31888. }),
  31889. $globals.ExportMethodProtocol);
  31890. $core.addMethod(
  31891. $core.method({
  31892. selector: "theClass:",
  31893. protocol: "accessing",
  31894. fn: function (aClass){
  31895. var self=this,$self=this;
  31896. $self["@theClass"]=aClass;
  31897. return self;
  31898. },
  31899. args: ["aClass"],
  31900. source: "theClass: aClass\x0a\x09theClass := aClass",
  31901. referencedClasses: [],
  31902. messageSends: []
  31903. }),
  31904. $globals.ExportMethodProtocol);
  31905. $core.addMethod(
  31906. $core.method({
  31907. selector: "name:theClass:",
  31908. protocol: "instance creation",
  31909. fn: function (aString,aClass){
  31910. var self=this,$self=this;
  31911. return $core.withContext(function($ctx1) {
  31912. var $1;
  31913. $1=$self._new();
  31914. $recv($1)._name_(aString);
  31915. $recv($1)._theClass_(aClass);
  31916. return $recv($1)._yourself();
  31917. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  31918. },
  31919. args: ["aString", "aClass"],
  31920. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  31921. referencedClasses: [],
  31922. messageSends: ["name:", "new", "theClass:", "yourself"]
  31923. }),
  31924. $globals.ExportMethodProtocol.a$cls);
  31925. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  31926. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  31927. $core.addMethod(
  31928. $core.method({
  31929. selector: "import:",
  31930. protocol: "fileIn",
  31931. fn: function (aStream){
  31932. var self=this,$self=this;
  31933. var chunk,result,parser,lastEmpty;
  31934. return $core.withContext(function($ctx1) {
  31935. var $1;
  31936. parser=$recv($globals.ChunkParser)._on_(aStream);
  31937. lastEmpty=false;
  31938. $self["@lastSection"]="n/a, not started";
  31939. $self["@lastChunk"]=nil;
  31940. $recv((function(){
  31941. return $core.withContext(function($ctx2) {
  31942. $recv((function(){
  31943. return $core.withContext(function($ctx3) {
  31944. chunk=$recv(parser)._nextChunk();
  31945. return $recv(chunk)._isNil();
  31946. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31947. }))._whileFalse_((function(){
  31948. return $core.withContext(function($ctx3) {
  31949. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  31950. lastEmpty=true;
  31951. return lastEmpty;
  31952. }),(function(){
  31953. return $core.withContext(function($ctx4) {
  31954. $self["@lastSection"]=chunk;
  31955. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  31956. $1=lastEmpty;
  31957. if($core.assert($1)){
  31958. lastEmpty=false;
  31959. return $recv(result)._scanFrom_(parser);
  31960. }
  31961. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  31962. }));
  31963. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  31964. }));
  31965. $self["@lastSection"]="n/a, finished";
  31966. return $self["@lastSection"];
  31967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31968. }))._on_do_($globals.Error,(function(e){
  31969. return $core.withContext(function($ctx2) {
  31970. $self["@lastChunk"]=$recv(parser)._last();
  31971. return $recv(e)._resignal();
  31972. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  31973. }));
  31974. return self;
  31975. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  31976. },
  31977. args: ["aStream"],
  31978. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk\x0a\x09\x09\x09ifEmpty: [ lastEmpty := true ]\x0a\x09\x09\x09ifNotEmpty: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e resignal ].",
  31979. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  31980. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  31981. }),
  31982. $globals.Importer);
  31983. $core.addMethod(
  31984. $core.method({
  31985. selector: "lastChunk",
  31986. protocol: "accessing",
  31987. fn: function (){
  31988. var self=this,$self=this;
  31989. return $self["@lastChunk"];
  31990. },
  31991. args: [],
  31992. source: "lastChunk\x0a\x09^ lastChunk",
  31993. referencedClasses: [],
  31994. messageSends: []
  31995. }),
  31996. $globals.Importer);
  31997. $core.addMethod(
  31998. $core.method({
  31999. selector: "lastSection",
  32000. protocol: "accessing",
  32001. fn: function (){
  32002. var self=this,$self=this;
  32003. return $self["@lastSection"];
  32004. },
  32005. args: [],
  32006. source: "lastSection\x0a\x09^ lastSection",
  32007. referencedClasses: [],
  32008. messageSends: []
  32009. }),
  32010. $globals.Importer);
  32011. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32012. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32013. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32014. $globals.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  32015. $core.addMethod(
  32016. $core.method({
  32017. selector: "ajaxPutAt:data:onSuccess:onError:",
  32018. protocol: "private",
  32019. fn: function (aURL,aString,aBlock,anotherBlock){
  32020. var self=this,$self=this;
  32021. var xhr;
  32022. return $core.withContext(function($ctx1) {
  32023. var $1,$4,$3,$2;
  32024. xhr=$recv($globals.Platform)._newXhr();
  32025. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32026. $recv(xhr)._onreadystatechange_((function(){
  32027. return $core.withContext(function($ctx2) {
  32028. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32029. if($core.assert($1)){
  32030. $4=$recv(xhr)._status();
  32031. $ctx2.sendIdx["status"]=1;
  32032. $3=$recv($4).__gt_eq((200));
  32033. $2=$recv($3)._and_((function(){
  32034. return $core.withContext(function($ctx3) {
  32035. return $recv($recv(xhr)._status()).__lt((300));
  32036. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32037. }));
  32038. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32039. }
  32040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32041. }));
  32042. $recv(xhr)._send_(aString);
  32043. return self;
  32044. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32045. },
  32046. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32047. source: "ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock\x0a\x09| xhr |\x0a\x09xhr := Platform newXhr.\x0a\x09xhr open: 'PUT' url: aURL async: true.\x0a\x09xhr onreadystatechange: [\x0a\x09\x09xhr readyState = 4 ifTrue: [\x0a\x09\x09\x09(xhr status >= 200 and: [ xhr status < 300 ])\x0a\x09\x09\x09\x09ifTrue: aBlock\x0a\x09\x09\x09\x09ifFalse: anotherBlock ]].\x0a\x09xhr send: aString",
  32048. referencedClasses: ["Platform"],
  32049. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32050. }),
  32051. $globals.PackageHandler);
  32052. $core.addMethod(
  32053. $core.method({
  32054. selector: "chunkContentsFor:",
  32055. protocol: "accessing",
  32056. fn: function (aPackage){
  32057. var self=this,$self=this;
  32058. return $core.withContext(function($ctx1) {
  32059. return $recv($globals.String)._streamContents_((function(str){
  32060. return $core.withContext(function($ctx2) {
  32061. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32062. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32063. }));
  32064. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32065. },
  32066. args: ["aPackage"],
  32067. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32068. referencedClasses: ["String"],
  32069. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32070. }),
  32071. $globals.PackageHandler);
  32072. $core.addMethod(
  32073. $core.method({
  32074. selector: "chunkExporter",
  32075. protocol: "factory",
  32076. fn: function (){
  32077. var self=this,$self=this;
  32078. return $core.withContext(function($ctx1) {
  32079. return $recv($self._chunkExporterClass())._new();
  32080. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32081. },
  32082. args: [],
  32083. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32084. referencedClasses: [],
  32085. messageSends: ["new", "chunkExporterClass"]
  32086. }),
  32087. $globals.PackageHandler);
  32088. $core.addMethod(
  32089. $core.method({
  32090. selector: "chunkExporterClass",
  32091. protocol: "accessing",
  32092. fn: function (){
  32093. var self=this,$self=this;
  32094. return $globals.ChunkExporter;
  32095. },
  32096. args: [],
  32097. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32098. referencedClasses: ["ChunkExporter"],
  32099. messageSends: []
  32100. }),
  32101. $globals.PackageHandler);
  32102. $core.addMethod(
  32103. $core.method({
  32104. selector: "commit:",
  32105. protocol: "committing",
  32106. fn: function (aPackage){
  32107. var self=this,$self=this;
  32108. return $core.withContext(function($ctx1) {
  32109. var $1,$2;
  32110. $self._commit_onSuccess_onError_(aPackage,(function(){
  32111. }),(function(error){
  32112. return $core.withContext(function($ctx2) {
  32113. $1=$recv($globals.PackageCommitError)._new();
  32114. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32115. $ctx2.sendIdx[","]=1;
  32116. $recv($1)._messageText_($2);
  32117. return $recv($1)._signal();
  32118. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32119. }));
  32120. return self;
  32121. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32122. },
  32123. args: ["aPackage"],
  32124. source: "commit: aPackage\x0a\x09self \x0a\x09\x09commit: aPackage\x0a\x09\x09onSuccess: []\x0a\x09\x09onError: [ :error |\x0a\x09\x09\x09PackageCommitError new\x0a\x09\x09\x09\x09messageText: 'Commiting failed with reason: \x22' , (error responseText) , '\x22';\x0a\x09\x09\x09\x09signal ]",
  32125. referencedClasses: ["PackageCommitError"],
  32126. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32127. }),
  32128. $globals.PackageHandler);
  32129. $core.addMethod(
  32130. $core.method({
  32131. selector: "commit:onSuccess:onError:",
  32132. protocol: "committing",
  32133. fn: function (aPackage,aBlock,anotherBlock){
  32134. var self=this,$self=this;
  32135. return $core.withContext(function($ctx1) {
  32136. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32137. return $core.withContext(function($ctx2) {
  32138. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32139. return $core.withContext(function($ctx3) {
  32140. $recv(aPackage)._beClean();
  32141. return $recv(aBlock)._value();
  32142. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32143. }),anotherBlock);
  32144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32145. }),anotherBlock);
  32146. return self;
  32147. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32148. },
  32149. args: ["aPackage", "aBlock", "anotherBlock"],
  32150. source: "commit: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09commitJsFileFor: aPackage \x0a\x09\x09onSuccess: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09commitStFileFor: aPackage \x0a\x09\x09\x09\x09onSuccess: [ aPackage beClean. aBlock value ]\x0a\x09\x09\x09\x09onError: anotherBlock ] \x0a\x09\x09onError: anotherBlock",
  32151. referencedClasses: [],
  32152. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32153. }),
  32154. $globals.PackageHandler);
  32155. $core.addMethod(
  32156. $core.method({
  32157. selector: "commitJsFileFor:onSuccess:onError:",
  32158. protocol: "committing",
  32159. fn: function (aPackage,aBlock,anotherBlock){
  32160. var self=this,$self=this;
  32161. return $core.withContext(function($ctx1) {
  32162. var $2,$1;
  32163. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32164. $ctx1.sendIdx[","]=2;
  32165. $1=$recv($2).__comma(".js");
  32166. $ctx1.sendIdx[","]=1;
  32167. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32168. return self;
  32169. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32170. },
  32171. args: ["aPackage", "aBlock", "anotherBlock"],
  32172. source: "commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32173. referencedClasses: [],
  32174. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32175. }),
  32176. $globals.PackageHandler);
  32177. $core.addMethod(
  32178. $core.method({
  32179. selector: "commitPathJsFor:",
  32180. protocol: "accessing",
  32181. fn: function (aPackage){
  32182. var self=this,$self=this;
  32183. return $core.withContext(function($ctx1) {
  32184. $self._subclassResponsibility();
  32185. return self;
  32186. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32187. },
  32188. args: ["aPackage"],
  32189. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32190. referencedClasses: [],
  32191. messageSends: ["subclassResponsibility"]
  32192. }),
  32193. $globals.PackageHandler);
  32194. $core.addMethod(
  32195. $core.method({
  32196. selector: "commitPathStFor:",
  32197. protocol: "accessing",
  32198. fn: function (aPackage){
  32199. var self=this,$self=this;
  32200. return $core.withContext(function($ctx1) {
  32201. $self._subclassResponsibility();
  32202. return self;
  32203. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32204. },
  32205. args: ["aPackage"],
  32206. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32207. referencedClasses: [],
  32208. messageSends: ["subclassResponsibility"]
  32209. }),
  32210. $globals.PackageHandler);
  32211. $core.addMethod(
  32212. $core.method({
  32213. selector: "commitStFileFor:onSuccess:onError:",
  32214. protocol: "committing",
  32215. fn: function (aPackage,aBlock,anotherBlock){
  32216. var self=this,$self=this;
  32217. return $core.withContext(function($ctx1) {
  32218. var $2,$1;
  32219. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32220. $ctx1.sendIdx[","]=2;
  32221. $1=$recv($2).__comma(".st");
  32222. $ctx1.sendIdx[","]=1;
  32223. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32224. return self;
  32225. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32226. },
  32227. args: ["aPackage", "aBlock", "anotherBlock"],
  32228. source: "commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32229. referencedClasses: [],
  32230. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32231. }),
  32232. $globals.PackageHandler);
  32233. $core.addMethod(
  32234. $core.method({
  32235. selector: "contentsFor:",
  32236. protocol: "accessing",
  32237. fn: function (aPackage){
  32238. var self=this,$self=this;
  32239. return $core.withContext(function($ctx1) {
  32240. return $recv($globals.String)._streamContents_((function(str){
  32241. return $core.withContext(function($ctx2) {
  32242. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32243. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32244. }));
  32245. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32246. },
  32247. args: ["aPackage"],
  32248. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32249. referencedClasses: ["String"],
  32250. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32251. }),
  32252. $globals.PackageHandler);
  32253. $core.addMethod(
  32254. $core.method({
  32255. selector: "exporter",
  32256. protocol: "factory",
  32257. fn: function (){
  32258. var self=this,$self=this;
  32259. return $core.withContext(function($ctx1) {
  32260. return $recv($self._exporterClass())._new();
  32261. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32262. },
  32263. args: [],
  32264. source: "exporter\x0a\x09^ self exporterClass new",
  32265. referencedClasses: [],
  32266. messageSends: ["new", "exporterClass"]
  32267. }),
  32268. $globals.PackageHandler);
  32269. $core.addMethod(
  32270. $core.method({
  32271. selector: "exporterClass",
  32272. protocol: "accessing",
  32273. fn: function (){
  32274. var self=this,$self=this;
  32275. return $core.withContext(function($ctx1) {
  32276. $self._subclassResponsibility();
  32277. return self;
  32278. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32279. },
  32280. args: [],
  32281. source: "exporterClass\x0a\x09self subclassResponsibility",
  32282. referencedClasses: [],
  32283. messageSends: ["subclassResponsibility"]
  32284. }),
  32285. $globals.PackageHandler);
  32286. $core.addMethod(
  32287. $core.method({
  32288. selector: "load:",
  32289. protocol: "loading",
  32290. fn: function (aPackage){
  32291. var self=this,$self=this;
  32292. return $core.withContext(function($ctx1) {
  32293. $self._subclassResponsibility();
  32294. return self;
  32295. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32296. },
  32297. args: ["aPackage"],
  32298. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32299. referencedClasses: [],
  32300. messageSends: ["subclassResponsibility"]
  32301. }),
  32302. $globals.PackageHandler);
  32303. $core.addMethod(
  32304. $core.method({
  32305. selector: "onCommitError:",
  32306. protocol: "error handling",
  32307. fn: function (anError){
  32308. var self=this,$self=this;
  32309. return $core.withContext(function($ctx1) {
  32310. var $1,$2;
  32311. $1=$recv($globals.PackageCommitError)._new();
  32312. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32313. $ctx1.sendIdx[","]=1;
  32314. $recv($1)._messageText_($2);
  32315. $recv($1)._signal();
  32316. return self;
  32317. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32318. },
  32319. args: ["anError"],
  32320. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32321. referencedClasses: ["PackageCommitError"],
  32322. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32323. }),
  32324. $globals.PackageHandler);
  32325. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32326. $globals.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  32327. $core.addMethod(
  32328. $core.method({
  32329. selector: "commitPathJsFor:",
  32330. protocol: "accessing",
  32331. fn: function (aPackage){
  32332. var self=this,$self=this;
  32333. return $core.withContext(function($ctx1) {
  32334. return $self._toUrl_($self._namespaceFor_(aPackage));
  32335. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32336. },
  32337. args: ["aPackage"],
  32338. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32339. referencedClasses: [],
  32340. messageSends: ["toUrl:", "namespaceFor:"]
  32341. }),
  32342. $globals.AmdPackageHandler);
  32343. $core.addMethod(
  32344. $core.method({
  32345. selector: "commitPathStFor:",
  32346. protocol: "accessing",
  32347. fn: function (aPackage){
  32348. var self=this,$self=this;
  32349. var path,pathWithout;
  32350. return $core.withContext(function($ctx1) {
  32351. var $1,$2;
  32352. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32353. $ctx1.sendIdx[","]=1;
  32354. path=$self._toUrl_($1);
  32355. pathWithout=$self._commitPathJsFor_(aPackage);
  32356. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32357. if($core.assert($2)){
  32358. return pathWithout;
  32359. } else {
  32360. return path;
  32361. }
  32362. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32363. },
  32364. args: ["aPackage"],
  32365. source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]",
  32366. referencedClasses: [],
  32367. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32368. }),
  32369. $globals.AmdPackageHandler);
  32370. $core.addMethod(
  32371. $core.method({
  32372. selector: "exporterClass",
  32373. protocol: "accessing",
  32374. fn: function (){
  32375. var self=this,$self=this;
  32376. return $globals.AmdExporter;
  32377. },
  32378. args: [],
  32379. source: "exporterClass\x0a\x09^ AmdExporter",
  32380. referencedClasses: ["AmdExporter"],
  32381. messageSends: []
  32382. }),
  32383. $globals.AmdPackageHandler);
  32384. $core.addMethod(
  32385. $core.method({
  32386. selector: "load:",
  32387. protocol: "loading",
  32388. fn: function (aPackage){
  32389. var self=this,$self=this;
  32390. return $core.withContext(function($ctx1) {
  32391. var $1,$3,$2,$receiver;
  32392. return $recv($globals.Promise)._new_((function(model){
  32393. return $core.withContext(function($ctx2) {
  32394. $1=$recv($globals.Smalltalk)._amdRequire();
  32395. if(($receiver = $1) == null || $receiver.a$nil){
  32396. return $self._error_("AMD loader not present");
  32397. } else {
  32398. var require;
  32399. require=$receiver;
  32400. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32401. $ctx2.sendIdx[","]=1;
  32402. $2=[$3];
  32403. return $recv(require)._value_value_value_($2,(function(result){
  32404. return $core.withContext(function($ctx3) {
  32405. return $recv(model)._value_(result);
  32406. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32407. }),(function(error){
  32408. return $core.withContext(function($ctx3) {
  32409. return $recv(model)._signal_(error);
  32410. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32411. }));
  32412. }
  32413. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32414. }));
  32415. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32416. },
  32417. args: ["aPackage"],
  32418. source: "load: aPackage\x0a\x09^ Promise new: [ :model |\x0a\x09\x09Smalltalk amdRequire\x0a\x09\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09\x09require\x0a\x09\x09\x09\x09\x09value: { (self namespaceFor: aPackage), '/', aPackage name }\x0a\x09\x09\x09\x09\x09value: [ :result | model value: result ]\x0a\x09\x09\x09\x09\x09value: [ :error | model signal: error ] ] ]",
  32419. referencedClasses: ["Promise", "Smalltalk"],
  32420. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32421. }),
  32422. $globals.AmdPackageHandler);
  32423. $core.addMethod(
  32424. $core.method({
  32425. selector: "namespaceFor:",
  32426. protocol: "committing",
  32427. fn: function (aPackage){
  32428. var self=this,$self=this;
  32429. return $core.withContext(function($ctx1) {
  32430. return $recv($recv(aPackage)._transport())._namespace();
  32431. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32432. },
  32433. args: ["aPackage"],
  32434. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32435. referencedClasses: [],
  32436. messageSends: ["namespace", "transport"]
  32437. }),
  32438. $globals.AmdPackageHandler);
  32439. $core.addMethod(
  32440. $core.method({
  32441. selector: "toUrl:",
  32442. protocol: "private",
  32443. fn: function (aString){
  32444. var self=this,$self=this;
  32445. return $core.withContext(function($ctx1) {
  32446. var $1,$receiver;
  32447. $1=$recv($globals.Smalltalk)._amdRequire();
  32448. if(($receiver = $1) == null || $receiver.a$nil){
  32449. return $self._error_("AMD loader not present");
  32450. } else {
  32451. var require;
  32452. require=$receiver;
  32453. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  32454. }
  32455. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32456. },
  32457. args: ["aString"],
  32458. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  32459. referencedClasses: ["Smalltalk"],
  32460. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  32461. }),
  32462. $globals.AmdPackageHandler);
  32463. $core.addMethod(
  32464. $core.method({
  32465. selector: "defaultNamespace",
  32466. protocol: "commit paths",
  32467. fn: function (){
  32468. var self=this,$self=this;
  32469. return $core.withContext(function($ctx1) {
  32470. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32471. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32472. },
  32473. args: [],
  32474. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32475. referencedClasses: ["Smalltalk"],
  32476. messageSends: ["defaultAmdNamespace"]
  32477. }),
  32478. $globals.AmdPackageHandler.a$cls);
  32479. $core.addMethod(
  32480. $core.method({
  32481. selector: "defaultNamespace:",
  32482. protocol: "commit paths",
  32483. fn: function (aString){
  32484. var self=this,$self=this;
  32485. return $core.withContext(function($ctx1) {
  32486. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32487. return self;
  32488. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32489. },
  32490. args: ["aString"],
  32491. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32492. referencedClasses: ["Smalltalk"],
  32493. messageSends: ["defaultAmdNamespace:"]
  32494. }),
  32495. $globals.AmdPackageHandler.a$cls);
  32496. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32497. $globals.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated.";
  32498. $core.addMethod(
  32499. $core.method({
  32500. selector: "asJavaScriptObject",
  32501. protocol: "converting",
  32502. fn: function (){
  32503. var self=this,$self=this;
  32504. return $core.withContext(function($ctx1) {
  32505. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32506. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32507. },
  32508. args: [],
  32509. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32510. referencedClasses: [],
  32511. messageSends: ["type"]
  32512. }),
  32513. $globals.PackageTransport);
  32514. $core.addMethod(
  32515. $core.method({
  32516. selector: "commit",
  32517. protocol: "committing",
  32518. fn: function (){
  32519. var self=this,$self=this;
  32520. return $core.withContext(function($ctx1) {
  32521. $recv($self._commitHandler())._commit_($self._package());
  32522. return self;
  32523. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32524. },
  32525. args: [],
  32526. source: "commit\x0a\x09self commitHandler commit: self package",
  32527. referencedClasses: [],
  32528. messageSends: ["commit:", "commitHandler", "package"]
  32529. }),
  32530. $globals.PackageTransport);
  32531. $core.addMethod(
  32532. $core.method({
  32533. selector: "commitHandler",
  32534. protocol: "factory",
  32535. fn: function (){
  32536. var self=this,$self=this;
  32537. return $core.withContext(function($ctx1) {
  32538. return $recv($self._commitHandlerClass())._new();
  32539. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32540. },
  32541. args: [],
  32542. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32543. referencedClasses: [],
  32544. messageSends: ["new", "commitHandlerClass"]
  32545. }),
  32546. $globals.PackageTransport);
  32547. $core.addMethod(
  32548. $core.method({
  32549. selector: "commitHandlerClass",
  32550. protocol: "accessing",
  32551. fn: function (){
  32552. var self=this,$self=this;
  32553. return $core.withContext(function($ctx1) {
  32554. $self._subclassResponsibility();
  32555. return self;
  32556. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32557. },
  32558. args: [],
  32559. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32560. referencedClasses: [],
  32561. messageSends: ["subclassResponsibility"]
  32562. }),
  32563. $globals.PackageTransport);
  32564. $core.addMethod(
  32565. $core.method({
  32566. selector: "commitOnSuccess:onError:",
  32567. protocol: "committing",
  32568. fn: function (aBlock,anotherBlock){
  32569. var self=this,$self=this;
  32570. return $core.withContext(function($ctx1) {
  32571. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32572. return self;
  32573. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32574. },
  32575. args: ["aBlock", "anotherBlock"],
  32576. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32577. referencedClasses: [],
  32578. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32579. }),
  32580. $globals.PackageTransport);
  32581. $core.addMethod(
  32582. $core.method({
  32583. selector: "definition",
  32584. protocol: "accessing",
  32585. fn: function (){
  32586. var self=this,$self=this;
  32587. return "";
  32588. },
  32589. args: [],
  32590. source: "definition\x0a\x09^ ''",
  32591. referencedClasses: [],
  32592. messageSends: []
  32593. }),
  32594. $globals.PackageTransport);
  32595. $core.addMethod(
  32596. $core.method({
  32597. selector: "load",
  32598. protocol: "loading",
  32599. fn: function (){
  32600. var self=this,$self=this;
  32601. return $core.withContext(function($ctx1) {
  32602. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  32603. return $core.withContext(function($ctx2) {
  32604. return $recv($globals.Smalltalk)._postLoad();
  32605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32606. }));
  32607. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32608. },
  32609. args: [],
  32610. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  32611. referencedClasses: ["Smalltalk"],
  32612. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  32613. }),
  32614. $globals.PackageTransport);
  32615. $core.addMethod(
  32616. $core.method({
  32617. selector: "package",
  32618. protocol: "accessing",
  32619. fn: function (){
  32620. var self=this,$self=this;
  32621. return $self["@package"];
  32622. },
  32623. args: [],
  32624. source: "package\x0a\x09^ package",
  32625. referencedClasses: [],
  32626. messageSends: []
  32627. }),
  32628. $globals.PackageTransport);
  32629. $core.addMethod(
  32630. $core.method({
  32631. selector: "package:",
  32632. protocol: "accessing",
  32633. fn: function (aPackage){
  32634. var self=this,$self=this;
  32635. $self["@package"]=aPackage;
  32636. return self;
  32637. },
  32638. args: ["aPackage"],
  32639. source: "package: aPackage\x0a\x09package := aPackage",
  32640. referencedClasses: [],
  32641. messageSends: []
  32642. }),
  32643. $globals.PackageTransport);
  32644. $core.addMethod(
  32645. $core.method({
  32646. selector: "setupFromJson:",
  32647. protocol: "initialization",
  32648. fn: function (anObject){
  32649. var self=this,$self=this;
  32650. return self;
  32651. },
  32652. args: ["anObject"],
  32653. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32654. referencedClasses: [],
  32655. messageSends: []
  32656. }),
  32657. $globals.PackageTransport);
  32658. $core.addMethod(
  32659. $core.method({
  32660. selector: "type",
  32661. protocol: "accessing",
  32662. fn: function (){
  32663. var self=this,$self=this;
  32664. return $core.withContext(function($ctx1) {
  32665. return $recv($self._class())._type();
  32666. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32667. },
  32668. args: [],
  32669. source: "type\x0a\x09^ self class type",
  32670. referencedClasses: [],
  32671. messageSends: ["type", "class"]
  32672. }),
  32673. $globals.PackageTransport);
  32674. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32675. $core.addMethod(
  32676. $core.method({
  32677. selector: "classRegisteredFor:",
  32678. protocol: "accessing",
  32679. fn: function (aString){
  32680. var self=this,$self=this;
  32681. return $core.withContext(function($ctx1) {
  32682. return $recv($self["@registry"])._at_(aString);
  32683. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32684. },
  32685. args: ["aString"],
  32686. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32687. referencedClasses: [],
  32688. messageSends: ["at:"]
  32689. }),
  32690. $globals.PackageTransport.a$cls);
  32691. $core.addMethod(
  32692. $core.method({
  32693. selector: "defaultType",
  32694. protocol: "accessing",
  32695. fn: function (){
  32696. var self=this,$self=this;
  32697. return $core.withContext(function($ctx1) {
  32698. return $recv($globals.AmdPackageTransport)._type();
  32699. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32700. },
  32701. args: [],
  32702. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32703. referencedClasses: ["AmdPackageTransport"],
  32704. messageSends: ["type"]
  32705. }),
  32706. $globals.PackageTransport.a$cls);
  32707. $core.addMethod(
  32708. $core.method({
  32709. selector: "for:",
  32710. protocol: "instance creation",
  32711. fn: function (aString){
  32712. var self=this,$self=this;
  32713. return $core.withContext(function($ctx1) {
  32714. return $recv($self._classRegisteredFor_(aString))._new();
  32715. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32716. },
  32717. args: ["aString"],
  32718. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32719. referencedClasses: [],
  32720. messageSends: ["new", "classRegisteredFor:"]
  32721. }),
  32722. $globals.PackageTransport.a$cls);
  32723. $core.addMethod(
  32724. $core.method({
  32725. selector: "fromJson:",
  32726. protocol: "instance creation",
  32727. fn: function (anObject){
  32728. var self=this,$self=this;
  32729. return $core.withContext(function($ctx1) {
  32730. var $1,$2,$receiver;
  32731. if(($receiver = anObject) == null || $receiver.a$nil){
  32732. $1=$self._for_($self._defaultType());
  32733. $ctx1.sendIdx["for:"]=1;
  32734. return $1;
  32735. } else {
  32736. anObject;
  32737. }
  32738. $2=$self._for_($recv(anObject)._type());
  32739. $recv($2)._setupFromJson_(anObject);
  32740. return $recv($2)._yourself();
  32741. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32742. },
  32743. args: ["anObject"],
  32744. source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself",
  32745. referencedClasses: [],
  32746. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32747. }),
  32748. $globals.PackageTransport.a$cls);
  32749. $core.addMethod(
  32750. $core.method({
  32751. selector: "initialize",
  32752. protocol: "initialization",
  32753. fn: function (){
  32754. var self=this,$self=this;
  32755. return $core.withContext(function($ctx1) {
  32756. var $1;
  32757. (
  32758. $ctx1.supercall = true,
  32759. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32760. $ctx1.supercall = false;
  32761. $1=$self.__eq_eq($globals.PackageTransport);
  32762. if($core.assert($1)){
  32763. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32764. $self["@registry"];
  32765. } else {
  32766. $self._register();
  32767. }
  32768. return self;
  32769. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32770. },
  32771. args: [],
  32772. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32773. referencedClasses: ["PackageTransport"],
  32774. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32775. }),
  32776. $globals.PackageTransport.a$cls);
  32777. $core.addMethod(
  32778. $core.method({
  32779. selector: "register",
  32780. protocol: "registration",
  32781. fn: function (){
  32782. var self=this,$self=this;
  32783. return $core.withContext(function($ctx1) {
  32784. $recv($globals.PackageTransport)._register_(self);
  32785. return self;
  32786. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32787. },
  32788. args: [],
  32789. source: "register\x0a\x09PackageTransport register: self",
  32790. referencedClasses: ["PackageTransport"],
  32791. messageSends: ["register:"]
  32792. }),
  32793. $globals.PackageTransport.a$cls);
  32794. $core.addMethod(
  32795. $core.method({
  32796. selector: "register:",
  32797. protocol: "registration",
  32798. fn: function (aClass){
  32799. var self=this,$self=this;
  32800. return $core.withContext(function($ctx1) {
  32801. var $1,$receiver;
  32802. $1=$recv(aClass)._type();
  32803. $ctx1.sendIdx["type"]=1;
  32804. if(($receiver = $1) == null || $receiver.a$nil){
  32805. $1;
  32806. } else {
  32807. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32808. }
  32809. return self;
  32810. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32811. },
  32812. args: ["aClass"],
  32813. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32814. referencedClasses: [],
  32815. messageSends: ["ifNotNil:", "type", "at:put:"]
  32816. }),
  32817. $globals.PackageTransport.a$cls);
  32818. $core.addMethod(
  32819. $core.method({
  32820. selector: "type",
  32821. protocol: "accessing",
  32822. fn: function (){
  32823. var self=this,$self=this;
  32824. return nil;
  32825. },
  32826. args: [],
  32827. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32828. referencedClasses: [],
  32829. messageSends: []
  32830. }),
  32831. $globals.PackageTransport.a$cls);
  32832. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32833. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32834. $core.addMethod(
  32835. $core.method({
  32836. selector: "asJavaScriptObject",
  32837. protocol: "converting",
  32838. fn: function (){
  32839. var self=this,$self=this;
  32840. return $core.withContext(function($ctx1) {
  32841. var $1;
  32842. $1=(
  32843. $ctx1.supercall = true,
  32844. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32845. $ctx1.supercall = false;
  32846. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32847. return $recv($1)._yourself();
  32848. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32849. },
  32850. args: [],
  32851. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32852. referencedClasses: [],
  32853. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32854. }),
  32855. $globals.AmdPackageTransport);
  32856. $core.addMethod(
  32857. $core.method({
  32858. selector: "commitHandlerClass",
  32859. protocol: "accessing",
  32860. fn: function (){
  32861. var self=this,$self=this;
  32862. return $globals.AmdPackageHandler;
  32863. },
  32864. args: [],
  32865. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32866. referencedClasses: ["AmdPackageHandler"],
  32867. messageSends: []
  32868. }),
  32869. $globals.AmdPackageTransport);
  32870. $core.addMethod(
  32871. $core.method({
  32872. selector: "defaultNamespace",
  32873. protocol: "defaults",
  32874. fn: function (){
  32875. var self=this,$self=this;
  32876. return $core.withContext(function($ctx1) {
  32877. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32878. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32879. },
  32880. args: [],
  32881. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32882. referencedClasses: ["Smalltalk"],
  32883. messageSends: ["defaultAmdNamespace"]
  32884. }),
  32885. $globals.AmdPackageTransport);
  32886. $core.addMethod(
  32887. $core.method({
  32888. selector: "definition",
  32889. protocol: "accessing",
  32890. fn: function (){
  32891. var self=this,$self=this;
  32892. return $core.withContext(function($ctx1) {
  32893. return $recv($globals.String)._streamContents_((function(stream){
  32894. return $core.withContext(function($ctx2) {
  32895. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  32896. return $recv(stream)._print_($self._namespace());
  32897. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  32898. }));
  32899. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  32900. },
  32901. args: [],
  32902. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  32903. referencedClasses: ["String"],
  32904. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  32905. }),
  32906. $globals.AmdPackageTransport);
  32907. $core.addMethod(
  32908. $core.method({
  32909. selector: "namespace",
  32910. protocol: "accessing",
  32911. fn: function (){
  32912. var self=this,$self=this;
  32913. return $core.withContext(function($ctx1) {
  32914. var $1,$receiver;
  32915. $1=$self["@namespace"];
  32916. if(($receiver = $1) == null || $receiver.a$nil){
  32917. return $self._defaultNamespace();
  32918. } else {
  32919. return $1;
  32920. }
  32921. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  32922. },
  32923. args: [],
  32924. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  32925. referencedClasses: [],
  32926. messageSends: ["ifNil:", "defaultNamespace"]
  32927. }),
  32928. $globals.AmdPackageTransport);
  32929. $core.addMethod(
  32930. $core.method({
  32931. selector: "namespace:",
  32932. protocol: "accessing",
  32933. fn: function (aString){
  32934. var self=this,$self=this;
  32935. $self["@namespace"]=aString;
  32936. return self;
  32937. },
  32938. args: ["aString"],
  32939. source: "namespace: aString\x0a\x09namespace := aString",
  32940. referencedClasses: [],
  32941. messageSends: []
  32942. }),
  32943. $globals.AmdPackageTransport);
  32944. $core.addMethod(
  32945. $core.method({
  32946. selector: "printOn:",
  32947. protocol: "printing",
  32948. fn: function (aStream){
  32949. var self=this,$self=this;
  32950. return $core.withContext(function($ctx1) {
  32951. (
  32952. $ctx1.supercall = true,
  32953. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  32954. $ctx1.supercall = false;
  32955. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  32956. $ctx1.sendIdx["nextPutAll:"]=1;
  32957. $recv(aStream)._nextPutAll_($self._namespace());
  32958. $ctx1.sendIdx["nextPutAll:"]=2;
  32959. $recv(aStream)._nextPutAll_(")");
  32960. return self;
  32961. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  32962. },
  32963. args: ["aStream"],
  32964. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  32965. referencedClasses: [],
  32966. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  32967. }),
  32968. $globals.AmdPackageTransport);
  32969. $core.addMethod(
  32970. $core.method({
  32971. selector: "setPath:",
  32972. protocol: "actions",
  32973. fn: function (aString){
  32974. var self=this,$self=this;
  32975. return $core.withContext(function($ctx1) {
  32976. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  32977. return self;
  32978. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  32979. },
  32980. args: ["aString"],
  32981. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  32982. referencedClasses: [],
  32983. messageSends: ["value:", "basicAt:", "namespace"]
  32984. }),
  32985. $globals.AmdPackageTransport);
  32986. $core.addMethod(
  32987. $core.method({
  32988. selector: "setupFromJson:",
  32989. protocol: "initialization",
  32990. fn: function (anObject){
  32991. var self=this,$self=this;
  32992. return $core.withContext(function($ctx1) {
  32993. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  32994. return self;
  32995. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  32996. },
  32997. args: ["anObject"],
  32998. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  32999. referencedClasses: [],
  33000. messageSends: ["namespace:", "at:"]
  33001. }),
  33002. $globals.AmdPackageTransport);
  33003. $core.addMethod(
  33004. $core.method({
  33005. selector: "namespace:",
  33006. protocol: "instance creation",
  33007. fn: function (aString){
  33008. var self=this,$self=this;
  33009. return $core.withContext(function($ctx1) {
  33010. var $1;
  33011. $1=$self._new();
  33012. $recv($1)._namespace_(aString);
  33013. return $recv($1)._yourself();
  33014. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33015. },
  33016. args: ["aString"],
  33017. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33018. referencedClasses: [],
  33019. messageSends: ["namespace:", "new", "yourself"]
  33020. }),
  33021. $globals.AmdPackageTransport.a$cls);
  33022. $core.addMethod(
  33023. $core.method({
  33024. selector: "type",
  33025. protocol: "accessing",
  33026. fn: function (){
  33027. var self=this,$self=this;
  33028. return "amd";
  33029. },
  33030. args: [],
  33031. source: "type\x0a\x09^ 'amd'",
  33032. referencedClasses: [],
  33033. messageSends: []
  33034. }),
  33035. $globals.AmdPackageTransport.a$cls);
  33036. $core.addMethod(
  33037. $core.method({
  33038. selector: "exportBehaviorDefinitionTo:using:",
  33039. protocol: "*Platform-ImportExport",
  33040. fn: function (aStream,anExporter){
  33041. var self=this,$self=this;
  33042. return $core.withContext(function($ctx1) {
  33043. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33044. return self;
  33045. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33046. },
  33047. args: ["aStream", "anExporter"],
  33048. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33049. referencedClasses: [],
  33050. messageSends: ["exportDefinitionOf:on:"]
  33051. }),
  33052. $globals.Class);
  33053. $core.addMethod(
  33054. $core.method({
  33055. selector: "exportBehaviorDefinitionTo:using:",
  33056. protocol: "*Platform-ImportExport",
  33057. fn: function (aStream,anExporter){
  33058. var self=this,$self=this;
  33059. return $core.withContext(function($ctx1) {
  33060. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33061. return self;
  33062. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33063. },
  33064. args: ["aStream", "anExporter"],
  33065. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33066. referencedClasses: [],
  33067. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33068. }),
  33069. $globals.Metaclass);
  33070. $core.addMethod(
  33071. $core.method({
  33072. selector: "commit",
  33073. protocol: "*Platform-ImportExport",
  33074. fn: function (){
  33075. var self=this,$self=this;
  33076. return $core.withContext(function($ctx1) {
  33077. return $recv($self._transport())._commit();
  33078. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33079. },
  33080. args: [],
  33081. source: "commit\x0a\x09^ self transport commit",
  33082. referencedClasses: [],
  33083. messageSends: ["commit", "transport"]
  33084. }),
  33085. $globals.Package);
  33086. $core.addMethod(
  33087. $core.method({
  33088. selector: "load",
  33089. protocol: "*Platform-ImportExport",
  33090. fn: function (){
  33091. var self=this,$self=this;
  33092. return $core.withContext(function($ctx1) {
  33093. return $recv($self._transport())._load();
  33094. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33095. },
  33096. args: [],
  33097. source: "load\x0a\x09^ self transport load",
  33098. referencedClasses: [],
  33099. messageSends: ["load", "transport"]
  33100. }),
  33101. $globals.Package);
  33102. $core.addMethod(
  33103. $core.method({
  33104. selector: "loadFromNamespace:",
  33105. protocol: "*Platform-ImportExport",
  33106. fn: function (aString){
  33107. var self=this,$self=this;
  33108. return $core.withContext(function($ctx1) {
  33109. var $1;
  33110. $1=$self._transport();
  33111. $recv($1)._namespace_(aString);
  33112. return $recv($1)._load();
  33113. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33114. },
  33115. args: ["aString"],
  33116. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33117. referencedClasses: [],
  33118. messageSends: ["namespace:", "transport", "load"]
  33119. }),
  33120. $globals.Package);
  33121. $core.addMethod(
  33122. $core.method({
  33123. selector: "load:",
  33124. protocol: "*Platform-ImportExport",
  33125. fn: function (aPackageName){
  33126. var self=this,$self=this;
  33127. return $core.withContext(function($ctx1) {
  33128. return $recv($self._named_(aPackageName))._load();
  33129. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33130. },
  33131. args: ["aPackageName"],
  33132. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33133. referencedClasses: [],
  33134. messageSends: ["load", "named:"]
  33135. }),
  33136. $globals.Package.a$cls);
  33137. $core.addMethod(
  33138. $core.method({
  33139. selector: "load:fromNamespace:",
  33140. protocol: "*Platform-ImportExport",
  33141. fn: function (aPackageName,aString){
  33142. var self=this,$self=this;
  33143. return $core.withContext(function($ctx1) {
  33144. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33145. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33146. },
  33147. args: ["aPackageName", "aString"],
  33148. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33149. referencedClasses: [],
  33150. messageSends: ["loadFromNamespace:", "named:"]
  33151. }),
  33152. $globals.Package.a$cls);
  33153. $core.addMethod(
  33154. $core.method({
  33155. selector: "methodsFor:",
  33156. protocol: "*Platform-ImportExport",
  33157. fn: function (aString){
  33158. var self=this,$self=this;
  33159. return $core.withContext(function($ctx1) {
  33160. var $1;
  33161. $1=$recv($globals.ClassProtocolReader)._new();
  33162. $recv($1)._class_category_(self,aString);
  33163. return $recv($1)._yourself();
  33164. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33165. },
  33166. args: ["aString"],
  33167. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33168. referencedClasses: ["ClassProtocolReader"],
  33169. messageSends: ["class:category:", "new", "yourself"]
  33170. }),
  33171. $globals.TBehaviorProvider);
  33172. $core.addMethod(
  33173. $core.method({
  33174. selector: "methodsFor:stamp:",
  33175. protocol: "*Platform-ImportExport",
  33176. fn: function (aString,aStamp){
  33177. var self=this,$self=this;
  33178. return $core.withContext(function($ctx1) {
  33179. return $self._methodsFor_(aString);
  33180. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33181. },
  33182. args: ["aString", "aStamp"],
  33183. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33184. referencedClasses: [],
  33185. messageSends: ["methodsFor:"]
  33186. }),
  33187. $globals.TBehaviorProvider);
  33188. $core.addMethod(
  33189. $core.method({
  33190. selector: "commentStamp",
  33191. protocol: "*Platform-ImportExport",
  33192. fn: function (){
  33193. var self=this,$self=this;
  33194. return $core.withContext(function($ctx1) {
  33195. var $1;
  33196. $1=$recv($globals.ClassCommentReader)._new();
  33197. $recv($1)._class_(self);
  33198. return $recv($1)._yourself();
  33199. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33200. },
  33201. args: [],
  33202. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33203. referencedClasses: ["ClassCommentReader"],
  33204. messageSends: ["class:", "new", "yourself"]
  33205. }),
  33206. $globals.TMasterBehavior);
  33207. $core.addMethod(
  33208. $core.method({
  33209. selector: "commentStamp:prior:",
  33210. protocol: "*Platform-ImportExport",
  33211. fn: function (aStamp,prior){
  33212. var self=this,$self=this;
  33213. return $core.withContext(function($ctx1) {
  33214. return $self._commentStamp();
  33215. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33216. },
  33217. args: ["aStamp", "prior"],
  33218. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33219. referencedClasses: [],
  33220. messageSends: ["commentStamp"]
  33221. }),
  33222. $globals.TMasterBehavior);
  33223. $core.addMethod(
  33224. $core.method({
  33225. selector: "exportBehaviorDefinitionTo:using:",
  33226. protocol: "*Platform-ImportExport",
  33227. fn: function (aStream,anExporter){
  33228. var self=this,$self=this;
  33229. return $core.withContext(function($ctx1) {
  33230. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33231. return self;
  33232. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33233. },
  33234. args: ["aStream", "anExporter"],
  33235. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33236. referencedClasses: [],
  33237. messageSends: ["exportTraitDefinitionOf:on:"]
  33238. }),
  33239. $globals.Trait);
  33240. });
  33241. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33242. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33243. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33244. $core.addPackage("Compiler-AST");
  33245. ($core.packageDescriptors||$core.packages)["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  33246. ($core.packageDescriptors||$core.packages)["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33247. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33248. $globals.ASTNode.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
  33249. $core.addMethod(
  33250. $core.method({
  33251. selector: "inPosition:",
  33252. protocol: "testing",
  33253. fn: function (aPoint){
  33254. var self=this,$self=this;
  33255. return $core.withContext(function($ctx1) {
  33256. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33257. return $core.withContext(function($ctx2) {
  33258. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33260. }));
  33261. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33262. },
  33263. args: ["aPoint"],
  33264. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33265. referencedClasses: [],
  33266. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33267. }),
  33268. $globals.ASTNode);
  33269. $core.addMethod(
  33270. $core.method({
  33271. selector: "isAssignmentNode",
  33272. protocol: "testing",
  33273. fn: function (){
  33274. var self=this,$self=this;
  33275. return false;
  33276. },
  33277. args: [],
  33278. source: "isAssignmentNode\x0a\x09^ false",
  33279. referencedClasses: [],
  33280. messageSends: []
  33281. }),
  33282. $globals.ASTNode);
  33283. $core.addMethod(
  33284. $core.method({
  33285. selector: "isBlockNode",
  33286. protocol: "testing",
  33287. fn: function (){
  33288. var self=this,$self=this;
  33289. return false;
  33290. },
  33291. args: [],
  33292. source: "isBlockNode\x0a\x09^ false",
  33293. referencedClasses: [],
  33294. messageSends: []
  33295. }),
  33296. $globals.ASTNode);
  33297. $core.addMethod(
  33298. $core.method({
  33299. selector: "isBlockSequenceNode",
  33300. protocol: "testing",
  33301. fn: function (){
  33302. var self=this,$self=this;
  33303. return false;
  33304. },
  33305. args: [],
  33306. source: "isBlockSequenceNode\x0a\x09^ false",
  33307. referencedClasses: [],
  33308. messageSends: []
  33309. }),
  33310. $globals.ASTNode);
  33311. $core.addMethod(
  33312. $core.method({
  33313. selector: "isCascadeNode",
  33314. protocol: "testing",
  33315. fn: function (){
  33316. var self=this,$self=this;
  33317. return false;
  33318. },
  33319. args: [],
  33320. source: "isCascadeNode\x0a\x09^ false",
  33321. referencedClasses: [],
  33322. messageSends: []
  33323. }),
  33324. $globals.ASTNode);
  33325. $core.addMethod(
  33326. $core.method({
  33327. selector: "isImmutable",
  33328. protocol: "testing",
  33329. fn: function (){
  33330. var self=this,$self=this;
  33331. return false;
  33332. },
  33333. args: [],
  33334. source: "isImmutable\x0a\x09^ false",
  33335. referencedClasses: [],
  33336. messageSends: []
  33337. }),
  33338. $globals.ASTNode);
  33339. $core.addMethod(
  33340. $core.method({
  33341. selector: "isJSStatementNode",
  33342. protocol: "testing",
  33343. fn: function (){
  33344. var self=this,$self=this;
  33345. return false;
  33346. },
  33347. args: [],
  33348. source: "isJSStatementNode\x0a\x09^ false",
  33349. referencedClasses: [],
  33350. messageSends: []
  33351. }),
  33352. $globals.ASTNode);
  33353. $core.addMethod(
  33354. $core.method({
  33355. selector: "isNavigationNode",
  33356. protocol: "testing",
  33357. fn: function (){
  33358. var self=this,$self=this;
  33359. return false;
  33360. },
  33361. args: [],
  33362. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33363. referencedClasses: [],
  33364. messageSends: []
  33365. }),
  33366. $globals.ASTNode);
  33367. $core.addMethod(
  33368. $core.method({
  33369. selector: "isReturnNode",
  33370. protocol: "testing",
  33371. fn: function (){
  33372. var self=this,$self=this;
  33373. return false;
  33374. },
  33375. args: [],
  33376. source: "isReturnNode\x0a\x09^ false",
  33377. referencedClasses: [],
  33378. messageSends: []
  33379. }),
  33380. $globals.ASTNode);
  33381. $core.addMethod(
  33382. $core.method({
  33383. selector: "isSendNode",
  33384. protocol: "testing",
  33385. fn: function (){
  33386. var self=this,$self=this;
  33387. return false;
  33388. },
  33389. args: [],
  33390. source: "isSendNode\x0a\x09^ false",
  33391. referencedClasses: [],
  33392. messageSends: []
  33393. }),
  33394. $globals.ASTNode);
  33395. $core.addMethod(
  33396. $core.method({
  33397. selector: "isSequenceNode",
  33398. protocol: "testing",
  33399. fn: function (){
  33400. var self=this,$self=this;
  33401. return false;
  33402. },
  33403. args: [],
  33404. source: "isSequenceNode\x0a\x09^ false",
  33405. referencedClasses: [],
  33406. messageSends: []
  33407. }),
  33408. $globals.ASTNode);
  33409. $core.addMethod(
  33410. $core.method({
  33411. selector: "isSuperKeyword",
  33412. protocol: "testing",
  33413. fn: function (){
  33414. var self=this,$self=this;
  33415. return false;
  33416. },
  33417. args: [],
  33418. source: "isSuperKeyword\x0a\x09^ false",
  33419. referencedClasses: [],
  33420. messageSends: []
  33421. }),
  33422. $globals.ASTNode);
  33423. $core.addMethod(
  33424. $core.method({
  33425. selector: "isValueNode",
  33426. protocol: "testing",
  33427. fn: function (){
  33428. var self=this,$self=this;
  33429. return false;
  33430. },
  33431. args: [],
  33432. source: "isValueNode\x0a\x09^ false",
  33433. referencedClasses: [],
  33434. messageSends: []
  33435. }),
  33436. $globals.ASTNode);
  33437. $core.addMethod(
  33438. $core.method({
  33439. selector: "isVariableNode",
  33440. protocol: "testing",
  33441. fn: function (){
  33442. var self=this,$self=this;
  33443. return false;
  33444. },
  33445. args: [],
  33446. source: "isVariableNode\x0a\x09^ false",
  33447. referencedClasses: [],
  33448. messageSends: []
  33449. }),
  33450. $globals.ASTNode);
  33451. $core.addMethod(
  33452. $core.method({
  33453. selector: "location:",
  33454. protocol: "accessing",
  33455. fn: function (aLocation){
  33456. var self=this,$self=this;
  33457. return $core.withContext(function($ctx1) {
  33458. var $3,$2,$1;
  33459. $3=$recv(aLocation)._start();
  33460. $ctx1.sendIdx["start"]=1;
  33461. $2=$recv($3)._line();
  33462. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33463. $self._position_($1);
  33464. return self;
  33465. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33466. },
  33467. args: ["aLocation"],
  33468. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33469. referencedClasses: [],
  33470. messageSends: ["position:", "@", "line", "start", "column"]
  33471. }),
  33472. $globals.ASTNode);
  33473. $core.addMethod(
  33474. $core.method({
  33475. selector: "method",
  33476. protocol: "accessing",
  33477. fn: function (){
  33478. var self=this,$self=this;
  33479. return $core.withContext(function($ctx1) {
  33480. var $1,$receiver;
  33481. $1=$self._parent();
  33482. if(($receiver = $1) == null || $receiver.a$nil){
  33483. return $1;
  33484. } else {
  33485. var node;
  33486. node=$receiver;
  33487. return $recv(node)._method();
  33488. }
  33489. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33490. },
  33491. args: [],
  33492. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33493. referencedClasses: [],
  33494. messageSends: ["ifNotNil:", "parent", "method"]
  33495. }),
  33496. $globals.ASTNode);
  33497. $core.addMethod(
  33498. $core.method({
  33499. selector: "navigationNodeAt:ifAbsent:",
  33500. protocol: "accessing",
  33501. fn: function (aPoint,aBlock){
  33502. var self=this,$self=this;
  33503. var children;
  33504. return $core.withContext(function($ctx1) {
  33505. var $2,$1;
  33506. var $early={};
  33507. try {
  33508. children=$recv($self._allDagChildren())._select_((function(each){
  33509. return $core.withContext(function($ctx2) {
  33510. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33511. return $core.withContext(function($ctx3) {
  33512. return $recv(each)._inPosition_(aPoint);
  33513. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33514. }));
  33515. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33516. }));
  33517. $recv(children)._ifEmpty_((function(){
  33518. return $core.withContext(function($ctx2) {
  33519. throw $early=[$recv(aBlock)._value()];
  33520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33521. }));
  33522. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33523. return $core.withContext(function($ctx2) {
  33524. $2=$recv(a)._positionStart();
  33525. $ctx2.sendIdx["positionStart"]=1;
  33526. $1=$recv($2)._dist_(aPoint);
  33527. $ctx2.sendIdx["dist:"]=1;
  33528. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33529. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33530. })))._first();
  33531. }
  33532. catch(e) {if(e===$early)return e[0]; throw e}
  33533. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33534. },
  33535. args: ["aPoint", "aBlock"],
  33536. source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allDagChildren select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first",
  33537. referencedClasses: [],
  33538. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33539. }),
  33540. $globals.ASTNode);
  33541. $core.addMethod(
  33542. $core.method({
  33543. selector: "parent",
  33544. protocol: "accessing",
  33545. fn: function (){
  33546. var self=this,$self=this;
  33547. return $self["@parent"];
  33548. },
  33549. args: [],
  33550. source: "parent\x0a\x09^ parent",
  33551. referencedClasses: [],
  33552. messageSends: []
  33553. }),
  33554. $globals.ASTNode);
  33555. $core.addMethod(
  33556. $core.method({
  33557. selector: "parent:",
  33558. protocol: "accessing",
  33559. fn: function (aNode){
  33560. var self=this,$self=this;
  33561. $self["@parent"]=aNode;
  33562. return self;
  33563. },
  33564. args: ["aNode"],
  33565. source: "parent: aNode\x0a\x09parent := aNode",
  33566. referencedClasses: [],
  33567. messageSends: []
  33568. }),
  33569. $globals.ASTNode);
  33570. $core.addMethod(
  33571. $core.method({
  33572. selector: "position",
  33573. protocol: "accessing",
  33574. fn: function (){
  33575. var self=this,$self=this;
  33576. return $core.withContext(function($ctx1) {
  33577. var $1,$2,$receiver;
  33578. $1=$self["@position"];
  33579. if(($receiver = $1) == null || $receiver.a$nil){
  33580. $2=$self._parent();
  33581. if(($receiver = $2) == null || $receiver.a$nil){
  33582. return $2;
  33583. } else {
  33584. var node;
  33585. node=$receiver;
  33586. return $recv(node)._position();
  33587. }
  33588. } else {
  33589. return $1;
  33590. }
  33591. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33592. },
  33593. args: [],
  33594. source: "position\x0a\x09\x22answer the line and column of the receiver in the source code\x22\x0a\x09\x0a\x09^ position ifNil: [ \x0a\x09\x09self parent ifNotNil: [ :node | node position ] ]",
  33595. referencedClasses: [],
  33596. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33597. }),
  33598. $globals.ASTNode);
  33599. $core.addMethod(
  33600. $core.method({
  33601. selector: "position:",
  33602. protocol: "accessing",
  33603. fn: function (aPosition){
  33604. var self=this,$self=this;
  33605. $self["@position"]=aPosition;
  33606. return self;
  33607. },
  33608. args: ["aPosition"],
  33609. source: "position: aPosition\x0a\x09position := aPosition",
  33610. referencedClasses: [],
  33611. messageSends: []
  33612. }),
  33613. $globals.ASTNode);
  33614. $core.addMethod(
  33615. $core.method({
  33616. selector: "positionEnd",
  33617. protocol: "accessing",
  33618. fn: function (){
  33619. var self=this,$self=this;
  33620. return $core.withContext(function($ctx1) {
  33621. var $1,$6,$5,$4,$3,$2;
  33622. $1=$self._positionStart();
  33623. $6=$self._source();
  33624. $ctx1.sendIdx["source"]=1;
  33625. $5=$recv($6)._lines();
  33626. $ctx1.sendIdx["lines"]=1;
  33627. $4=$recv($5)._size();
  33628. $ctx1.sendIdx["size"]=1;
  33629. $3=$recv($4).__minus((1));
  33630. $ctx1.sendIdx["-"]=1;
  33631. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  33632. return $recv($1).__plus($2);
  33633. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33634. },
  33635. args: [],
  33636. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33637. referencedClasses: [],
  33638. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33639. }),
  33640. $globals.ASTNode);
  33641. $core.addMethod(
  33642. $core.method({
  33643. selector: "positionStart",
  33644. protocol: "accessing",
  33645. fn: function (){
  33646. var self=this,$self=this;
  33647. return $core.withContext(function($ctx1) {
  33648. return $self._position();
  33649. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33650. },
  33651. args: [],
  33652. source: "positionStart\x0a\x09^ self position",
  33653. referencedClasses: [],
  33654. messageSends: ["position"]
  33655. }),
  33656. $globals.ASTNode);
  33657. $core.addMethod(
  33658. $core.method({
  33659. selector: "requiresSmalltalkContext",
  33660. protocol: "testing",
  33661. fn: function (){
  33662. var self=this,$self=this;
  33663. return $core.withContext(function($ctx1) {
  33664. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33665. return $core.withContext(function($ctx2) {
  33666. return $recv(each)._requiresSmalltalkContext();
  33667. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33668. }),(function(){
  33669. return nil;
  33670. })))._notNil();
  33671. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33672. },
  33673. args: [],
  33674. source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self dagChildren \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  33675. referencedClasses: [],
  33676. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33677. }),
  33678. $globals.ASTNode);
  33679. $core.addMethod(
  33680. $core.method({
  33681. selector: "shouldBeAliased",
  33682. protocol: "accessing",
  33683. fn: function (){
  33684. var self=this,$self=this;
  33685. return $core.withContext(function($ctx1) {
  33686. var $1,$receiver;
  33687. $1=$self["@shouldBeAliased"];
  33688. if(($receiver = $1) == null || $receiver.a$nil){
  33689. return false;
  33690. } else {
  33691. return $1;
  33692. }
  33693. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33694. },
  33695. args: [],
  33696. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33697. referencedClasses: [],
  33698. messageSends: ["ifNil:"]
  33699. }),
  33700. $globals.ASTNode);
  33701. $core.addMethod(
  33702. $core.method({
  33703. selector: "shouldBeAliased:",
  33704. protocol: "accessing",
  33705. fn: function (aBoolean){
  33706. var self=this,$self=this;
  33707. $self["@shouldBeAliased"]=aBoolean;
  33708. return self;
  33709. },
  33710. args: ["aBoolean"],
  33711. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33712. referencedClasses: [],
  33713. messageSends: []
  33714. }),
  33715. $globals.ASTNode);
  33716. $core.addMethod(
  33717. $core.method({
  33718. selector: "size",
  33719. protocol: "accessing",
  33720. fn: function (){
  33721. var self=this,$self=this;
  33722. return $core.withContext(function($ctx1) {
  33723. return $recv($self._source())._size();
  33724. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33725. },
  33726. args: [],
  33727. source: "size\x0a\x09^ self source size",
  33728. referencedClasses: [],
  33729. messageSends: ["size", "source"]
  33730. }),
  33731. $globals.ASTNode);
  33732. $core.addMethod(
  33733. $core.method({
  33734. selector: "source",
  33735. protocol: "accessing",
  33736. fn: function (){
  33737. var self=this,$self=this;
  33738. return $core.withContext(function($ctx1) {
  33739. var $1,$receiver;
  33740. $1=$self["@source"];
  33741. if(($receiver = $1) == null || $receiver.a$nil){
  33742. return "";
  33743. } else {
  33744. return $1;
  33745. }
  33746. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33747. },
  33748. args: [],
  33749. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33750. referencedClasses: [],
  33751. messageSends: ["ifNil:"]
  33752. }),
  33753. $globals.ASTNode);
  33754. $core.addMethod(
  33755. $core.method({
  33756. selector: "source:",
  33757. protocol: "accessing",
  33758. fn: function (aString){
  33759. var self=this,$self=this;
  33760. $self["@source"]=aString;
  33761. return self;
  33762. },
  33763. args: ["aString"],
  33764. source: "source: aString\x0a\x09source := aString",
  33765. referencedClasses: [],
  33766. messageSends: []
  33767. }),
  33768. $globals.ASTNode);
  33769. $core.addMethod(
  33770. $core.method({
  33771. selector: "withTail:",
  33772. protocol: "building",
  33773. fn: function (aCollection){
  33774. var self=this,$self=this;
  33775. return $core.withContext(function($ctx1) {
  33776. var $1;
  33777. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33778. return $core.withContext(function($ctx2) {
  33779. $1=$recv($globals.SendNode)._new();
  33780. $recv($1)._position_($recv(send)._position());
  33781. $recv($1)._source_($recv(send)._source());
  33782. $recv($1)._receiver_(receiver);
  33783. $recv($1)._selector_($recv(send)._selector());
  33784. $recv($1)._arguments_($recv(send)._arguments());
  33785. return $recv($1)._yourself();
  33786. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33787. }));
  33788. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33789. },
  33790. args: ["aCollection"],
  33791. source: "withTail: aCollection\x0a\x09^ aCollection inject: self into: [\x0a\x09\x09:receiver :send | SendNode new\x0a\x09\x09\x09position: send position;\x0a\x09\x09\x09source: send source;\x0a\x09\x09\x09receiver: receiver;\x0a\x09\x09\x09selector: send selector;\x0a\x09\x09\x09arguments: send arguments;\x0a\x09\x09\x09yourself ]",
  33792. referencedClasses: ["SendNode"],
  33793. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33794. }),
  33795. $globals.ASTNode);
  33796. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33797. $globals.AssignmentNode.comment="I represent an assignment node.";
  33798. $core.addMethod(
  33799. $core.method({
  33800. selector: "acceptDagVisitor:",
  33801. protocol: "visiting",
  33802. fn: function (aVisitor){
  33803. var self=this,$self=this;
  33804. return $core.withContext(function($ctx1) {
  33805. return $recv(aVisitor)._visitAssignmentNode_(self);
  33806. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33807. },
  33808. args: ["aVisitor"],
  33809. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33810. referencedClasses: [],
  33811. messageSends: ["visitAssignmentNode:"]
  33812. }),
  33813. $globals.AssignmentNode);
  33814. $core.addMethod(
  33815. $core.method({
  33816. selector: "dagChildren",
  33817. protocol: "accessing",
  33818. fn: function (){
  33819. var self=this,$self=this;
  33820. return $core.withContext(function($ctx1) {
  33821. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  33822. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33823. },
  33824. args: [],
  33825. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33826. referencedClasses: ["Array"],
  33827. messageSends: ["with:with:", "left", "right"]
  33828. }),
  33829. $globals.AssignmentNode);
  33830. $core.addMethod(
  33831. $core.method({
  33832. selector: "isAssignmentNode",
  33833. protocol: "testing",
  33834. fn: function (){
  33835. var self=this,$self=this;
  33836. return true;
  33837. },
  33838. args: [],
  33839. source: "isAssignmentNode\x0a\x09^ true",
  33840. referencedClasses: [],
  33841. messageSends: []
  33842. }),
  33843. $globals.AssignmentNode);
  33844. $core.addMethod(
  33845. $core.method({
  33846. selector: "left",
  33847. protocol: "accessing",
  33848. fn: function (){
  33849. var self=this,$self=this;
  33850. return $self["@left"];
  33851. },
  33852. args: [],
  33853. source: "left\x0a\x09^ left",
  33854. referencedClasses: [],
  33855. messageSends: []
  33856. }),
  33857. $globals.AssignmentNode);
  33858. $core.addMethod(
  33859. $core.method({
  33860. selector: "left:",
  33861. protocol: "accessing",
  33862. fn: function (aNode){
  33863. var self=this,$self=this;
  33864. $self["@left"]=aNode;
  33865. return self;
  33866. },
  33867. args: ["aNode"],
  33868. source: "left: aNode\x0a\x09left := aNode",
  33869. referencedClasses: [],
  33870. messageSends: []
  33871. }),
  33872. $globals.AssignmentNode);
  33873. $core.addMethod(
  33874. $core.method({
  33875. selector: "right",
  33876. protocol: "accessing",
  33877. fn: function (){
  33878. var self=this,$self=this;
  33879. return $self["@right"];
  33880. },
  33881. args: [],
  33882. source: "right\x0a\x09^ right",
  33883. referencedClasses: [],
  33884. messageSends: []
  33885. }),
  33886. $globals.AssignmentNode);
  33887. $core.addMethod(
  33888. $core.method({
  33889. selector: "right:",
  33890. protocol: "accessing",
  33891. fn: function (aNode){
  33892. var self=this,$self=this;
  33893. $self["@right"]=aNode;
  33894. return self;
  33895. },
  33896. args: ["aNode"],
  33897. source: "right: aNode\x0a\x09right := aNode",
  33898. referencedClasses: [],
  33899. messageSends: []
  33900. }),
  33901. $globals.AssignmentNode);
  33902. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  33903. $globals.BlockNode.comment="I represent an block closure node.";
  33904. $core.addMethod(
  33905. $core.method({
  33906. selector: "acceptDagVisitor:",
  33907. protocol: "visiting",
  33908. fn: function (aVisitor){
  33909. var self=this,$self=this;
  33910. return $core.withContext(function($ctx1) {
  33911. return $recv(aVisitor)._visitBlockNode_(self);
  33912. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  33913. },
  33914. args: ["aVisitor"],
  33915. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33916. referencedClasses: [],
  33917. messageSends: ["visitBlockNode:"]
  33918. }),
  33919. $globals.BlockNode);
  33920. $core.addMethod(
  33921. $core.method({
  33922. selector: "isBlockNode",
  33923. protocol: "testing",
  33924. fn: function (){
  33925. var self=this,$self=this;
  33926. return true;
  33927. },
  33928. args: [],
  33929. source: "isBlockNode\x0a\x09^ true",
  33930. referencedClasses: [],
  33931. messageSends: []
  33932. }),
  33933. $globals.BlockNode);
  33934. $core.addMethod(
  33935. $core.method({
  33936. selector: "parameters",
  33937. protocol: "accessing",
  33938. fn: function (){
  33939. var self=this,$self=this;
  33940. return $core.withContext(function($ctx1) {
  33941. var $1,$receiver;
  33942. $1=$self["@parameters"];
  33943. if(($receiver = $1) == null || $receiver.a$nil){
  33944. $self["@parameters"]=$recv($globals.Array)._new();
  33945. return $self["@parameters"];
  33946. } else {
  33947. return $1;
  33948. }
  33949. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  33950. },
  33951. args: [],
  33952. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  33953. referencedClasses: ["Array"],
  33954. messageSends: ["ifNil:", "new"]
  33955. }),
  33956. $globals.BlockNode);
  33957. $core.addMethod(
  33958. $core.method({
  33959. selector: "parameters:",
  33960. protocol: "accessing",
  33961. fn: function (aCollection){
  33962. var self=this,$self=this;
  33963. $self["@parameters"]=aCollection;
  33964. return self;
  33965. },
  33966. args: ["aCollection"],
  33967. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  33968. referencedClasses: [],
  33969. messageSends: []
  33970. }),
  33971. $globals.BlockNode);
  33972. $core.addMethod(
  33973. $core.method({
  33974. selector: "scope",
  33975. protocol: "accessing",
  33976. fn: function (){
  33977. var self=this,$self=this;
  33978. return $self["@scope"];
  33979. },
  33980. args: [],
  33981. source: "scope\x0a\x09^ scope",
  33982. referencedClasses: [],
  33983. messageSends: []
  33984. }),
  33985. $globals.BlockNode);
  33986. $core.addMethod(
  33987. $core.method({
  33988. selector: "scope:",
  33989. protocol: "accessing",
  33990. fn: function (aLexicalScope){
  33991. var self=this,$self=this;
  33992. $self["@scope"]=aLexicalScope;
  33993. return self;
  33994. },
  33995. args: ["aLexicalScope"],
  33996. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33997. referencedClasses: [],
  33998. messageSends: []
  33999. }),
  34000. $globals.BlockNode);
  34001. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34002. $globals.CascadeNode.comment="I represent an cascade node.";
  34003. $core.addMethod(
  34004. $core.method({
  34005. selector: "acceptDagVisitor:",
  34006. protocol: "visiting",
  34007. fn: function (aVisitor){
  34008. var self=this,$self=this;
  34009. return $core.withContext(function($ctx1) {
  34010. return $recv(aVisitor)._visitCascadeNode_(self);
  34011. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34012. },
  34013. args: ["aVisitor"],
  34014. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34015. referencedClasses: [],
  34016. messageSends: ["visitCascadeNode:"]
  34017. }),
  34018. $globals.CascadeNode);
  34019. $core.addMethod(
  34020. $core.method({
  34021. selector: "isCascadeNode",
  34022. protocol: "testing",
  34023. fn: function (){
  34024. var self=this,$self=this;
  34025. return true;
  34026. },
  34027. args: [],
  34028. source: "isCascadeNode\x0a\x09^ true",
  34029. referencedClasses: [],
  34030. messageSends: []
  34031. }),
  34032. $globals.CascadeNode);
  34033. $core.addMethod(
  34034. $core.method({
  34035. selector: "receiver",
  34036. protocol: "accessing",
  34037. fn: function (){
  34038. var self=this,$self=this;
  34039. return $self["@receiver"];
  34040. },
  34041. args: [],
  34042. source: "receiver\x0a\x09^ receiver",
  34043. referencedClasses: [],
  34044. messageSends: []
  34045. }),
  34046. $globals.CascadeNode);
  34047. $core.addMethod(
  34048. $core.method({
  34049. selector: "receiver:",
  34050. protocol: "accessing",
  34051. fn: function (aNode){
  34052. var self=this,$self=this;
  34053. $self["@receiver"]=aNode;
  34054. return self;
  34055. },
  34056. args: ["aNode"],
  34057. source: "receiver: aNode\x0a\x09receiver := aNode",
  34058. referencedClasses: [],
  34059. messageSends: []
  34060. }),
  34061. $globals.CascadeNode);
  34062. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34063. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34064. $core.addMethod(
  34065. $core.method({
  34066. selector: "acceptDagVisitor:",
  34067. protocol: "visiting",
  34068. fn: function (aVisitor){
  34069. var self=this,$self=this;
  34070. return $core.withContext(function($ctx1) {
  34071. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34072. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34073. },
  34074. args: ["aVisitor"],
  34075. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34076. referencedClasses: [],
  34077. messageSends: ["visitDynamicArrayNode:"]
  34078. }),
  34079. $globals.DynamicArrayNode);
  34080. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34081. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34082. $core.addMethod(
  34083. $core.method({
  34084. selector: "acceptDagVisitor:",
  34085. protocol: "visiting",
  34086. fn: function (aVisitor){
  34087. var self=this,$self=this;
  34088. return $core.withContext(function($ctx1) {
  34089. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34090. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34091. },
  34092. args: ["aVisitor"],
  34093. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34094. referencedClasses: [],
  34095. messageSends: ["visitDynamicDictionaryNode:"]
  34096. }),
  34097. $globals.DynamicDictionaryNode);
  34098. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34099. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34100. $core.addMethod(
  34101. $core.method({
  34102. selector: "acceptDagVisitor:",
  34103. protocol: "visiting",
  34104. fn: function (aVisitor){
  34105. var self=this,$self=this;
  34106. return $core.withContext(function($ctx1) {
  34107. return $recv(aVisitor)._visitJSStatementNode_(self);
  34108. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34109. },
  34110. args: ["aVisitor"],
  34111. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34112. referencedClasses: [],
  34113. messageSends: ["visitJSStatementNode:"]
  34114. }),
  34115. $globals.JSStatementNode);
  34116. $core.addMethod(
  34117. $core.method({
  34118. selector: "isJSStatementNode",
  34119. protocol: "testing",
  34120. fn: function (){
  34121. var self=this,$self=this;
  34122. return true;
  34123. },
  34124. args: [],
  34125. source: "isJSStatementNode\x0a\x09^ true",
  34126. referencedClasses: [],
  34127. messageSends: []
  34128. }),
  34129. $globals.JSStatementNode);
  34130. $core.addMethod(
  34131. $core.method({
  34132. selector: "requiresSmalltalkContext",
  34133. protocol: "testing",
  34134. fn: function (){
  34135. var self=this,$self=this;
  34136. return true;
  34137. },
  34138. args: [],
  34139. source: "requiresSmalltalkContext\x0a\x09^ true",
  34140. referencedClasses: [],
  34141. messageSends: []
  34142. }),
  34143. $globals.JSStatementNode);
  34144. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34145. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34146. $core.addMethod(
  34147. $core.method({
  34148. selector: "acceptDagVisitor:",
  34149. protocol: "visiting",
  34150. fn: function (aVisitor){
  34151. var self=this,$self=this;
  34152. return $core.withContext(function($ctx1) {
  34153. return $recv(aVisitor)._visitMethodNode_(self);
  34154. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34155. },
  34156. args: ["aVisitor"],
  34157. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34158. referencedClasses: [],
  34159. messageSends: ["visitMethodNode:"]
  34160. }),
  34161. $globals.MethodNode);
  34162. $core.addMethod(
  34163. $core.method({
  34164. selector: "arguments",
  34165. protocol: "accessing",
  34166. fn: function (){
  34167. var self=this,$self=this;
  34168. return $core.withContext(function($ctx1) {
  34169. var $1,$receiver;
  34170. $1=$self["@arguments"];
  34171. if(($receiver = $1) == null || $receiver.a$nil){
  34172. return [];
  34173. } else {
  34174. return $1;
  34175. }
  34176. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34177. },
  34178. args: [],
  34179. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34180. referencedClasses: [],
  34181. messageSends: ["ifNil:"]
  34182. }),
  34183. $globals.MethodNode);
  34184. $core.addMethod(
  34185. $core.method({
  34186. selector: "arguments:",
  34187. protocol: "accessing",
  34188. fn: function (aCollection){
  34189. var self=this,$self=this;
  34190. $self["@arguments"]=aCollection;
  34191. return self;
  34192. },
  34193. args: ["aCollection"],
  34194. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34195. referencedClasses: [],
  34196. messageSends: []
  34197. }),
  34198. $globals.MethodNode);
  34199. $core.addMethod(
  34200. $core.method({
  34201. selector: "classReferences",
  34202. protocol: "accessing",
  34203. fn: function (){
  34204. var self=this,$self=this;
  34205. return $self["@classReferences"];
  34206. },
  34207. args: [],
  34208. source: "classReferences\x0a\x09^ classReferences",
  34209. referencedClasses: [],
  34210. messageSends: []
  34211. }),
  34212. $globals.MethodNode);
  34213. $core.addMethod(
  34214. $core.method({
  34215. selector: "classReferences:",
  34216. protocol: "accessing",
  34217. fn: function (aCollection){
  34218. var self=this,$self=this;
  34219. $self["@classReferences"]=aCollection;
  34220. return self;
  34221. },
  34222. args: ["aCollection"],
  34223. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34224. referencedClasses: [],
  34225. messageSends: []
  34226. }),
  34227. $globals.MethodNode);
  34228. $core.addMethod(
  34229. $core.method({
  34230. selector: "messageSends",
  34231. protocol: "accessing",
  34232. fn: function (){
  34233. var self=this,$self=this;
  34234. return $core.withContext(function($ctx1) {
  34235. return $recv($self._sendIndexes())._keys();
  34236. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34237. },
  34238. args: [],
  34239. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34240. referencedClasses: [],
  34241. messageSends: ["keys", "sendIndexes"]
  34242. }),
  34243. $globals.MethodNode);
  34244. $core.addMethod(
  34245. $core.method({
  34246. selector: "method",
  34247. protocol: "accessing",
  34248. fn: function (){
  34249. var self=this,$self=this;
  34250. return self;
  34251. },
  34252. args: [],
  34253. source: "method\x0a\x09^ self",
  34254. referencedClasses: [],
  34255. messageSends: []
  34256. }),
  34257. $globals.MethodNode);
  34258. $core.addMethod(
  34259. $core.method({
  34260. selector: "scope",
  34261. protocol: "accessing",
  34262. fn: function (){
  34263. var self=this,$self=this;
  34264. return $self["@scope"];
  34265. },
  34266. args: [],
  34267. source: "scope\x0a\x09^ scope",
  34268. referencedClasses: [],
  34269. messageSends: []
  34270. }),
  34271. $globals.MethodNode);
  34272. $core.addMethod(
  34273. $core.method({
  34274. selector: "scope:",
  34275. protocol: "accessing",
  34276. fn: function (aMethodScope){
  34277. var self=this,$self=this;
  34278. $self["@scope"]=aMethodScope;
  34279. return self;
  34280. },
  34281. args: ["aMethodScope"],
  34282. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34283. referencedClasses: [],
  34284. messageSends: []
  34285. }),
  34286. $globals.MethodNode);
  34287. $core.addMethod(
  34288. $core.method({
  34289. selector: "selector",
  34290. protocol: "accessing",
  34291. fn: function (){
  34292. var self=this,$self=this;
  34293. return $self["@selector"];
  34294. },
  34295. args: [],
  34296. source: "selector\x0a\x09^ selector",
  34297. referencedClasses: [],
  34298. messageSends: []
  34299. }),
  34300. $globals.MethodNode);
  34301. $core.addMethod(
  34302. $core.method({
  34303. selector: "selector:",
  34304. protocol: "accessing",
  34305. fn: function (aString){
  34306. var self=this,$self=this;
  34307. $self["@selector"]=aString;
  34308. return self;
  34309. },
  34310. args: ["aString"],
  34311. source: "selector: aString\x0a\x09selector := aString",
  34312. referencedClasses: [],
  34313. messageSends: []
  34314. }),
  34315. $globals.MethodNode);
  34316. $core.addMethod(
  34317. $core.method({
  34318. selector: "sendIndexes",
  34319. protocol: "accessing",
  34320. fn: function (){
  34321. var self=this,$self=this;
  34322. return $self["@sendIndexes"];
  34323. },
  34324. args: [],
  34325. source: "sendIndexes\x0a\x09^ sendIndexes",
  34326. referencedClasses: [],
  34327. messageSends: []
  34328. }),
  34329. $globals.MethodNode);
  34330. $core.addMethod(
  34331. $core.method({
  34332. selector: "sendIndexes:",
  34333. protocol: "accessing",
  34334. fn: function (aDictionary){
  34335. var self=this,$self=this;
  34336. $self["@sendIndexes"]=aDictionary;
  34337. return self;
  34338. },
  34339. args: ["aDictionary"],
  34340. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34341. referencedClasses: [],
  34342. messageSends: []
  34343. }),
  34344. $globals.MethodNode);
  34345. $core.addMethod(
  34346. $core.method({
  34347. selector: "sequenceNode",
  34348. protocol: "accessing",
  34349. fn: function (){
  34350. var self=this,$self=this;
  34351. return $core.withContext(function($ctx1) {
  34352. var $1;
  34353. var $early={};
  34354. try {
  34355. $recv($self._dagChildren())._do_((function(each){
  34356. return $core.withContext(function($ctx2) {
  34357. $1=$recv(each)._isSequenceNode();
  34358. if($core.assert($1)){
  34359. throw $early=[each];
  34360. }
  34361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34362. }));
  34363. return nil;
  34364. }
  34365. catch(e) {if(e===$early)return e[0]; throw e}
  34366. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34367. },
  34368. args: [],
  34369. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34370. referencedClasses: [],
  34371. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34372. }),
  34373. $globals.MethodNode);
  34374. $core.addMethod(
  34375. $core.method({
  34376. selector: "source",
  34377. protocol: "accessing",
  34378. fn: function (){
  34379. var self=this,$self=this;
  34380. return $self["@source"];
  34381. },
  34382. args: [],
  34383. source: "source\x0a\x09^ source",
  34384. referencedClasses: [],
  34385. messageSends: []
  34386. }),
  34387. $globals.MethodNode);
  34388. $core.addMethod(
  34389. $core.method({
  34390. selector: "source:",
  34391. protocol: "accessing",
  34392. fn: function (aString){
  34393. var self=this,$self=this;
  34394. $self["@source"]=aString;
  34395. return self;
  34396. },
  34397. args: ["aString"],
  34398. source: "source: aString\x0a\x09source := aString",
  34399. referencedClasses: [],
  34400. messageSends: []
  34401. }),
  34402. $globals.MethodNode);
  34403. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34404. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34405. $core.addMethod(
  34406. $core.method({
  34407. selector: "acceptDagVisitor:",
  34408. protocol: "visiting",
  34409. fn: function (aVisitor){
  34410. var self=this,$self=this;
  34411. return $core.withContext(function($ctx1) {
  34412. return $recv(aVisitor)._visitReturnNode_(self);
  34413. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34414. },
  34415. args: ["aVisitor"],
  34416. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34417. referencedClasses: [],
  34418. messageSends: ["visitReturnNode:"]
  34419. }),
  34420. $globals.ReturnNode);
  34421. $core.addMethod(
  34422. $core.method({
  34423. selector: "isReturnNode",
  34424. protocol: "testing",
  34425. fn: function (){
  34426. var self=this,$self=this;
  34427. return true;
  34428. },
  34429. args: [],
  34430. source: "isReturnNode\x0a\x09^ true",
  34431. referencedClasses: [],
  34432. messageSends: []
  34433. }),
  34434. $globals.ReturnNode);
  34435. $core.addMethod(
  34436. $core.method({
  34437. selector: "nonLocalReturn",
  34438. protocol: "testing",
  34439. fn: function (){
  34440. var self=this,$self=this;
  34441. return $core.withContext(function($ctx1) {
  34442. return $recv($recv($self._scope())._isMethodScope())._not();
  34443. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34444. },
  34445. args: [],
  34446. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34447. referencedClasses: [],
  34448. messageSends: ["not", "isMethodScope", "scope"]
  34449. }),
  34450. $globals.ReturnNode);
  34451. $core.addMethod(
  34452. $core.method({
  34453. selector: "scope",
  34454. protocol: "accessing",
  34455. fn: function (){
  34456. var self=this,$self=this;
  34457. return $self["@scope"];
  34458. },
  34459. args: [],
  34460. source: "scope\x0a\x09^ scope",
  34461. referencedClasses: [],
  34462. messageSends: []
  34463. }),
  34464. $globals.ReturnNode);
  34465. $core.addMethod(
  34466. $core.method({
  34467. selector: "scope:",
  34468. protocol: "accessing",
  34469. fn: function (aLexicalScope){
  34470. var self=this,$self=this;
  34471. $self["@scope"]=aLexicalScope;
  34472. return self;
  34473. },
  34474. args: ["aLexicalScope"],
  34475. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34476. referencedClasses: [],
  34477. messageSends: []
  34478. }),
  34479. $globals.ReturnNode);
  34480. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34481. $globals.SendNode.comment="I represent an message send node.";
  34482. $core.addMethod(
  34483. $core.method({
  34484. selector: "acceptDagVisitor:",
  34485. protocol: "visiting",
  34486. fn: function (aVisitor){
  34487. var self=this,$self=this;
  34488. return $core.withContext(function($ctx1) {
  34489. return $recv(aVisitor)._visitSendNode_(self);
  34490. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34491. },
  34492. args: ["aVisitor"],
  34493. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34494. referencedClasses: [],
  34495. messageSends: ["visitSendNode:"]
  34496. }),
  34497. $globals.SendNode);
  34498. $core.addMethod(
  34499. $core.method({
  34500. selector: "arguments",
  34501. protocol: "accessing",
  34502. fn: function (){
  34503. var self=this,$self=this;
  34504. return $core.withContext(function($ctx1) {
  34505. var $1,$receiver;
  34506. $1=$self["@arguments"];
  34507. if(($receiver = $1) == null || $receiver.a$nil){
  34508. $self["@arguments"]=[];
  34509. return $self["@arguments"];
  34510. } else {
  34511. return $1;
  34512. }
  34513. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34514. },
  34515. args: [],
  34516. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34517. referencedClasses: [],
  34518. messageSends: ["ifNil:"]
  34519. }),
  34520. $globals.SendNode);
  34521. $core.addMethod(
  34522. $core.method({
  34523. selector: "arguments:",
  34524. protocol: "accessing",
  34525. fn: function (aCollection){
  34526. var self=this,$self=this;
  34527. $self["@arguments"]=aCollection;
  34528. return self;
  34529. },
  34530. args: ["aCollection"],
  34531. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34532. referencedClasses: [],
  34533. messageSends: []
  34534. }),
  34535. $globals.SendNode);
  34536. $core.addMethod(
  34537. $core.method({
  34538. selector: "dagChildren",
  34539. protocol: "accessing",
  34540. fn: function (){
  34541. var self=this,$self=this;
  34542. return $core.withContext(function($ctx1) {
  34543. var $1,$2,$3,$receiver;
  34544. $1=$self._receiver();
  34545. $ctx1.sendIdx["receiver"]=1;
  34546. if(($receiver = $1) == null || $receiver.a$nil){
  34547. $2=$self._arguments();
  34548. $ctx1.sendIdx["arguments"]=1;
  34549. return $recv($2)._copy();
  34550. } else {
  34551. $1;
  34552. }
  34553. $3=$recv($globals.Array)._with_($self._receiver());
  34554. $recv($3)._addAll_($self._arguments());
  34555. return $recv($3)._yourself();
  34556. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34557. },
  34558. args: [],
  34559. source: "dagChildren\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  34560. referencedClasses: ["Array"],
  34561. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34562. }),
  34563. $globals.SendNode);
  34564. $core.addMethod(
  34565. $core.method({
  34566. selector: "index",
  34567. protocol: "accessing",
  34568. fn: function (){
  34569. var self=this,$self=this;
  34570. return $self["@index"];
  34571. },
  34572. args: [],
  34573. source: "index\x0a\x09^ index",
  34574. referencedClasses: [],
  34575. messageSends: []
  34576. }),
  34577. $globals.SendNode);
  34578. $core.addMethod(
  34579. $core.method({
  34580. selector: "index:",
  34581. protocol: "accessing",
  34582. fn: function (anInteger){
  34583. var self=this,$self=this;
  34584. $self["@index"]=anInteger;
  34585. return self;
  34586. },
  34587. args: ["anInteger"],
  34588. source: "index: anInteger\x0a\x09index := anInteger",
  34589. referencedClasses: [],
  34590. messageSends: []
  34591. }),
  34592. $globals.SendNode);
  34593. $core.addMethod(
  34594. $core.method({
  34595. selector: "isNavigationNode",
  34596. protocol: "testing",
  34597. fn: function (){
  34598. var self=this,$self=this;
  34599. return true;
  34600. },
  34601. args: [],
  34602. source: "isNavigationNode\x0a\x09^ true",
  34603. referencedClasses: [],
  34604. messageSends: []
  34605. }),
  34606. $globals.SendNode);
  34607. $core.addMethod(
  34608. $core.method({
  34609. selector: "isSendNode",
  34610. protocol: "testing",
  34611. fn: function (){
  34612. var self=this,$self=this;
  34613. return true;
  34614. },
  34615. args: [],
  34616. source: "isSendNode\x0a\x09^ true",
  34617. referencedClasses: [],
  34618. messageSends: []
  34619. }),
  34620. $globals.SendNode);
  34621. $core.addMethod(
  34622. $core.method({
  34623. selector: "navigationLink",
  34624. protocol: "accessing",
  34625. fn: function (){
  34626. var self=this,$self=this;
  34627. return $core.withContext(function($ctx1) {
  34628. return $self._selector();
  34629. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34630. },
  34631. args: [],
  34632. source: "navigationLink\x0a\x09^ self selector",
  34633. referencedClasses: [],
  34634. messageSends: ["selector"]
  34635. }),
  34636. $globals.SendNode);
  34637. $core.addMethod(
  34638. $core.method({
  34639. selector: "receiver",
  34640. protocol: "accessing",
  34641. fn: function (){
  34642. var self=this,$self=this;
  34643. return $self["@receiver"];
  34644. },
  34645. args: [],
  34646. source: "receiver\x0a\x09^ receiver",
  34647. referencedClasses: [],
  34648. messageSends: []
  34649. }),
  34650. $globals.SendNode);
  34651. $core.addMethod(
  34652. $core.method({
  34653. selector: "receiver:",
  34654. protocol: "accessing",
  34655. fn: function (aNode){
  34656. var self=this,$self=this;
  34657. $self["@receiver"]=aNode;
  34658. return self;
  34659. },
  34660. args: ["aNode"],
  34661. source: "receiver: aNode\x0a\x09receiver := aNode",
  34662. referencedClasses: [],
  34663. messageSends: []
  34664. }),
  34665. $globals.SendNode);
  34666. $core.addMethod(
  34667. $core.method({
  34668. selector: "requiresSmalltalkContext",
  34669. protocol: "testing",
  34670. fn: function (){
  34671. var self=this,$self=this;
  34672. return true;
  34673. },
  34674. args: [],
  34675. source: "requiresSmalltalkContext\x0a\x09^ true",
  34676. referencedClasses: [],
  34677. messageSends: []
  34678. }),
  34679. $globals.SendNode);
  34680. $core.addMethod(
  34681. $core.method({
  34682. selector: "selector",
  34683. protocol: "accessing",
  34684. fn: function (){
  34685. var self=this,$self=this;
  34686. return $self["@selector"];
  34687. },
  34688. args: [],
  34689. source: "selector\x0a\x09^ selector",
  34690. referencedClasses: [],
  34691. messageSends: []
  34692. }),
  34693. $globals.SendNode);
  34694. $core.addMethod(
  34695. $core.method({
  34696. selector: "selector:",
  34697. protocol: "accessing",
  34698. fn: function (aString){
  34699. var self=this,$self=this;
  34700. $self["@selector"]=aString;
  34701. return self;
  34702. },
  34703. args: ["aString"],
  34704. source: "selector: aString\x0a\x09selector := aString",
  34705. referencedClasses: [],
  34706. messageSends: []
  34707. }),
  34708. $globals.SendNode);
  34709. $core.addMethod(
  34710. $core.method({
  34711. selector: "shouldBeInlined",
  34712. protocol: "accessing",
  34713. fn: function (){
  34714. var self=this,$self=this;
  34715. return $core.withContext(function($ctx1) {
  34716. var $1,$receiver;
  34717. $1=$self["@shouldBeInlined"];
  34718. if(($receiver = $1) == null || $receiver.a$nil){
  34719. return false;
  34720. } else {
  34721. return $1;
  34722. }
  34723. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34724. },
  34725. args: [],
  34726. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34727. referencedClasses: [],
  34728. messageSends: ["ifNil:"]
  34729. }),
  34730. $globals.SendNode);
  34731. $core.addMethod(
  34732. $core.method({
  34733. selector: "shouldBeInlined:",
  34734. protocol: "accessing",
  34735. fn: function (aBoolean){
  34736. var self=this,$self=this;
  34737. $self["@shouldBeInlined"]=aBoolean;
  34738. return self;
  34739. },
  34740. args: ["aBoolean"],
  34741. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34742. referencedClasses: [],
  34743. messageSends: []
  34744. }),
  34745. $globals.SendNode);
  34746. $core.addMethod(
  34747. $core.method({
  34748. selector: "superSend",
  34749. protocol: "accessing",
  34750. fn: function (){
  34751. var self=this,$self=this;
  34752. return $core.withContext(function($ctx1) {
  34753. var $2,$1;
  34754. $2=$self._receiver();
  34755. $ctx1.sendIdx["receiver"]=1;
  34756. $1=$recv($2)._notNil();
  34757. return $recv($1)._and_((function(){
  34758. return $core.withContext(function($ctx2) {
  34759. return $recv($self._receiver())._isSuperKeyword();
  34760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34761. }));
  34762. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34763. },
  34764. args: [],
  34765. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34766. referencedClasses: [],
  34767. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34768. }),
  34769. $globals.SendNode);
  34770. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "pragmas", "scope"], "Compiler-AST");
  34771. $globals.SequenceNode.comment="I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope).";
  34772. $core.addMethod(
  34773. $core.method({
  34774. selector: "acceptDagVisitor:",
  34775. protocol: "visiting",
  34776. fn: function (aVisitor){
  34777. var self=this,$self=this;
  34778. return $core.withContext(function($ctx1) {
  34779. return $recv(aVisitor)._visitSequenceNode_(self);
  34780. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34781. },
  34782. args: ["aVisitor"],
  34783. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34784. referencedClasses: [],
  34785. messageSends: ["visitSequenceNode:"]
  34786. }),
  34787. $globals.SequenceNode);
  34788. $core.addMethod(
  34789. $core.method({
  34790. selector: "asBlockSequenceNode",
  34791. protocol: "building",
  34792. fn: function (){
  34793. var self=this,$self=this;
  34794. return $core.withContext(function($ctx1) {
  34795. var $1;
  34796. $1=$recv($globals.BlockSequenceNode)._new();
  34797. $recv($1)._position_($self._position());
  34798. $recv($1)._source_($self._source());
  34799. $recv($1)._dagChildren_($self._dagChildren());
  34800. $recv($1)._temps_($self._temps());
  34801. $recv($1)._pragmas_($self._pragmas());
  34802. return $recv($1)._yourself();
  34803. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34804. },
  34805. args: [],
  34806. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09dagChildren: self dagChildren;\x0a\x09\x09temps: self temps;\x0a\x09\x09pragmas: self pragmas;\x0a\x09\x09yourself",
  34807. referencedClasses: ["BlockSequenceNode"],
  34808. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "pragmas:", "pragmas", "yourself"]
  34809. }),
  34810. $globals.SequenceNode);
  34811. $core.addMethod(
  34812. $core.method({
  34813. selector: "isSequenceNode",
  34814. protocol: "testing",
  34815. fn: function (){
  34816. var self=this,$self=this;
  34817. return true;
  34818. },
  34819. args: [],
  34820. source: "isSequenceNode\x0a\x09^ true",
  34821. referencedClasses: [],
  34822. messageSends: []
  34823. }),
  34824. $globals.SequenceNode);
  34825. $core.addMethod(
  34826. $core.method({
  34827. selector: "pragmas",
  34828. protocol: "accessing",
  34829. fn: function (){
  34830. var self=this,$self=this;
  34831. return $core.withContext(function($ctx1) {
  34832. var $1,$receiver;
  34833. $1=$self["@pragmas"];
  34834. if(($receiver = $1) == null || $receiver.a$nil){
  34835. return [];
  34836. } else {
  34837. return $1;
  34838. }
  34839. }, function($ctx1) {$ctx1.fill(self,"pragmas",{},$globals.SequenceNode)});
  34840. },
  34841. args: [],
  34842. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  34843. referencedClasses: [],
  34844. messageSends: ["ifNil:"]
  34845. }),
  34846. $globals.SequenceNode);
  34847. $core.addMethod(
  34848. $core.method({
  34849. selector: "pragmas:",
  34850. protocol: "accessing",
  34851. fn: function (aCollection){
  34852. var self=this,$self=this;
  34853. $self["@pragmas"]=aCollection;
  34854. return self;
  34855. },
  34856. args: ["aCollection"],
  34857. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  34858. referencedClasses: [],
  34859. messageSends: []
  34860. }),
  34861. $globals.SequenceNode);
  34862. $core.addMethod(
  34863. $core.method({
  34864. selector: "scope",
  34865. protocol: "accessing",
  34866. fn: function (){
  34867. var self=this,$self=this;
  34868. return $self["@scope"];
  34869. },
  34870. args: [],
  34871. source: "scope\x0a\x09^ scope",
  34872. referencedClasses: [],
  34873. messageSends: []
  34874. }),
  34875. $globals.SequenceNode);
  34876. $core.addMethod(
  34877. $core.method({
  34878. selector: "scope:",
  34879. protocol: "accessing",
  34880. fn: function (aLexicalScope){
  34881. var self=this,$self=this;
  34882. $self["@scope"]=aLexicalScope;
  34883. return self;
  34884. },
  34885. args: ["aLexicalScope"],
  34886. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34887. referencedClasses: [],
  34888. messageSends: []
  34889. }),
  34890. $globals.SequenceNode);
  34891. $core.addMethod(
  34892. $core.method({
  34893. selector: "temps",
  34894. protocol: "accessing",
  34895. fn: function (){
  34896. var self=this,$self=this;
  34897. return $core.withContext(function($ctx1) {
  34898. var $1,$receiver;
  34899. $1=$self["@temps"];
  34900. if(($receiver = $1) == null || $receiver.a$nil){
  34901. return [];
  34902. } else {
  34903. return $1;
  34904. }
  34905. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  34906. },
  34907. args: [],
  34908. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34909. referencedClasses: [],
  34910. messageSends: ["ifNil:"]
  34911. }),
  34912. $globals.SequenceNode);
  34913. $core.addMethod(
  34914. $core.method({
  34915. selector: "temps:",
  34916. protocol: "accessing",
  34917. fn: function (aCollection){
  34918. var self=this,$self=this;
  34919. $self["@temps"]=aCollection;
  34920. return self;
  34921. },
  34922. args: ["aCollection"],
  34923. source: "temps: aCollection\x0a\x09temps := aCollection",
  34924. referencedClasses: [],
  34925. messageSends: []
  34926. }),
  34927. $globals.SequenceNode);
  34928. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  34929. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34930. $core.addMethod(
  34931. $core.method({
  34932. selector: "acceptDagVisitor:",
  34933. protocol: "visiting",
  34934. fn: function (aVisitor){
  34935. var self=this,$self=this;
  34936. return $core.withContext(function($ctx1) {
  34937. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  34938. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  34939. },
  34940. args: ["aVisitor"],
  34941. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  34942. referencedClasses: [],
  34943. messageSends: ["visitBlockSequenceNode:"]
  34944. }),
  34945. $globals.BlockSequenceNode);
  34946. $core.addMethod(
  34947. $core.method({
  34948. selector: "isBlockSequenceNode",
  34949. protocol: "testing",
  34950. fn: function (){
  34951. var self=this,$self=this;
  34952. return true;
  34953. },
  34954. args: [],
  34955. source: "isBlockSequenceNode\x0a\x09^ true",
  34956. referencedClasses: [],
  34957. messageSends: []
  34958. }),
  34959. $globals.BlockSequenceNode);
  34960. $core.addMethod(
  34961. $core.method({
  34962. selector: "pragmas:",
  34963. protocol: "visiting",
  34964. fn: function (aCollection){
  34965. var self=this,$self=this;
  34966. return $core.withContext(function($ctx1) {
  34967. var $1;
  34968. $recv(aCollection)._ifNotEmpty_((function(){
  34969. return $core.withContext(function($ctx2) {
  34970. return $self._error_("Block must have no pragmas.");
  34971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34972. }));
  34973. $1=(
  34974. $ctx1.supercall = true,
  34975. ($globals.BlockSequenceNode.superclass||$boot.nilAsClass).fn.prototype._pragmas_.apply($self, [aCollection]));
  34976. $ctx1.supercall = false;
  34977. return $1;
  34978. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{aCollection:aCollection},$globals.BlockSequenceNode)});
  34979. },
  34980. args: ["aCollection"],
  34981. source: "pragmas: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09self error: 'Block must have no pragmas.' ].\x0a\x09^ super pragmas: aCollection",
  34982. referencedClasses: [],
  34983. messageSends: ["ifNotEmpty:", "error:", "pragmas:"]
  34984. }),
  34985. $globals.BlockSequenceNode);
  34986. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  34987. $globals.ValueNode.comment="I represent a value node.";
  34988. $core.addMethod(
  34989. $core.method({
  34990. selector: "acceptDagVisitor:",
  34991. protocol: "visiting",
  34992. fn: function (aVisitor){
  34993. var self=this,$self=this;
  34994. return $core.withContext(function($ctx1) {
  34995. return $recv(aVisitor)._visitValueNode_(self);
  34996. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  34997. },
  34998. args: ["aVisitor"],
  34999. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35000. referencedClasses: [],
  35001. messageSends: ["visitValueNode:"]
  35002. }),
  35003. $globals.ValueNode);
  35004. $core.addMethod(
  35005. $core.method({
  35006. selector: "isImmutable",
  35007. protocol: "testing",
  35008. fn: function (){
  35009. var self=this,$self=this;
  35010. return $core.withContext(function($ctx1) {
  35011. return $recv($self._value())._isImmutable();
  35012. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35013. },
  35014. args: [],
  35015. source: "isImmutable\x0a\x09^ self value isImmutable",
  35016. referencedClasses: [],
  35017. messageSends: ["isImmutable", "value"]
  35018. }),
  35019. $globals.ValueNode);
  35020. $core.addMethod(
  35021. $core.method({
  35022. selector: "isValueNode",
  35023. protocol: "testing",
  35024. fn: function (){
  35025. var self=this,$self=this;
  35026. return true;
  35027. },
  35028. args: [],
  35029. source: "isValueNode\x0a\x09^ true",
  35030. referencedClasses: [],
  35031. messageSends: []
  35032. }),
  35033. $globals.ValueNode);
  35034. $core.addMethod(
  35035. $core.method({
  35036. selector: "value",
  35037. protocol: "accessing",
  35038. fn: function (){
  35039. var self=this,$self=this;
  35040. return $self["@value"];
  35041. },
  35042. args: [],
  35043. source: "value\x0a\x09^ value",
  35044. referencedClasses: [],
  35045. messageSends: []
  35046. }),
  35047. $globals.ValueNode);
  35048. $core.addMethod(
  35049. $core.method({
  35050. selector: "value:",
  35051. protocol: "accessing",
  35052. fn: function (anObject){
  35053. var self=this,$self=this;
  35054. $self["@value"]=anObject;
  35055. return self;
  35056. },
  35057. args: ["anObject"],
  35058. source: "value: anObject\x0a\x09value := anObject",
  35059. referencedClasses: [],
  35060. messageSends: []
  35061. }),
  35062. $globals.ValueNode);
  35063. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35064. $globals.VariableNode.comment="I represent an variable node.";
  35065. $core.addMethod(
  35066. $core.method({
  35067. selector: "acceptDagVisitor:",
  35068. protocol: "visiting",
  35069. fn: function (aVisitor){
  35070. var self=this,$self=this;
  35071. return $core.withContext(function($ctx1) {
  35072. return $recv(aVisitor)._visitVariableNode_(self);
  35073. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35074. },
  35075. args: ["aVisitor"],
  35076. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35077. referencedClasses: [],
  35078. messageSends: ["visitVariableNode:"]
  35079. }),
  35080. $globals.VariableNode);
  35081. $core.addMethod(
  35082. $core.method({
  35083. selector: "alias",
  35084. protocol: "accessing",
  35085. fn: function (){
  35086. var self=this,$self=this;
  35087. return $core.withContext(function($ctx1) {
  35088. return $recv($self._binding())._alias();
  35089. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35090. },
  35091. args: [],
  35092. source: "alias\x0a\x09^ self binding alias",
  35093. referencedClasses: [],
  35094. messageSends: ["alias", "binding"]
  35095. }),
  35096. $globals.VariableNode);
  35097. $core.addMethod(
  35098. $core.method({
  35099. selector: "assigned",
  35100. protocol: "accessing",
  35101. fn: function (){
  35102. var self=this,$self=this;
  35103. return $core.withContext(function($ctx1) {
  35104. var $1,$receiver;
  35105. $1=$self["@assigned"];
  35106. if(($receiver = $1) == null || $receiver.a$nil){
  35107. return false;
  35108. } else {
  35109. return $1;
  35110. }
  35111. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35112. },
  35113. args: [],
  35114. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35115. referencedClasses: [],
  35116. messageSends: ["ifNil:"]
  35117. }),
  35118. $globals.VariableNode);
  35119. $core.addMethod(
  35120. $core.method({
  35121. selector: "assigned:",
  35122. protocol: "accessing",
  35123. fn: function (aBoolean){
  35124. var self=this,$self=this;
  35125. $self["@assigned"]=aBoolean;
  35126. return self;
  35127. },
  35128. args: ["aBoolean"],
  35129. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35130. referencedClasses: [],
  35131. messageSends: []
  35132. }),
  35133. $globals.VariableNode);
  35134. $core.addMethod(
  35135. $core.method({
  35136. selector: "beAssigned",
  35137. protocol: "accessing",
  35138. fn: function (){
  35139. var self=this,$self=this;
  35140. return $core.withContext(function($ctx1) {
  35141. $recv($self._binding())._validateAssignment();
  35142. $self["@assigned"]=true;
  35143. return self;
  35144. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35145. },
  35146. args: [],
  35147. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35148. referencedClasses: [],
  35149. messageSends: ["validateAssignment", "binding"]
  35150. }),
  35151. $globals.VariableNode);
  35152. $core.addMethod(
  35153. $core.method({
  35154. selector: "binding",
  35155. protocol: "accessing",
  35156. fn: function (){
  35157. var self=this,$self=this;
  35158. return $self["@binding"];
  35159. },
  35160. args: [],
  35161. source: "binding\x0a\x09^ binding",
  35162. referencedClasses: [],
  35163. messageSends: []
  35164. }),
  35165. $globals.VariableNode);
  35166. $core.addMethod(
  35167. $core.method({
  35168. selector: "binding:",
  35169. protocol: "accessing",
  35170. fn: function (aScopeVar){
  35171. var self=this,$self=this;
  35172. $self["@binding"]=aScopeVar;
  35173. return self;
  35174. },
  35175. args: ["aScopeVar"],
  35176. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35177. referencedClasses: [],
  35178. messageSends: []
  35179. }),
  35180. $globals.VariableNode);
  35181. $core.addMethod(
  35182. $core.method({
  35183. selector: "isArgument",
  35184. protocol: "testing",
  35185. fn: function (){
  35186. var self=this,$self=this;
  35187. return $core.withContext(function($ctx1) {
  35188. return $recv($self._binding())._isArgVar();
  35189. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35190. },
  35191. args: [],
  35192. source: "isArgument\x0a\x09^ self binding isArgVar",
  35193. referencedClasses: [],
  35194. messageSends: ["isArgVar", "binding"]
  35195. }),
  35196. $globals.VariableNode);
  35197. $core.addMethod(
  35198. $core.method({
  35199. selector: "isImmutable",
  35200. protocol: "testing",
  35201. fn: function (){
  35202. var self=this,$self=this;
  35203. return $core.withContext(function($ctx1) {
  35204. return $recv($self._binding())._isImmutable();
  35205. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35206. },
  35207. args: [],
  35208. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35209. referencedClasses: [],
  35210. messageSends: ["isImmutable", "binding"]
  35211. }),
  35212. $globals.VariableNode);
  35213. $core.addMethod(
  35214. $core.method({
  35215. selector: "isNavigationNode",
  35216. protocol: "testing",
  35217. fn: function (){
  35218. var self=this,$self=this;
  35219. return true;
  35220. },
  35221. args: [],
  35222. source: "isNavigationNode\x0a\x09^ true",
  35223. referencedClasses: [],
  35224. messageSends: []
  35225. }),
  35226. $globals.VariableNode);
  35227. $core.addMethod(
  35228. $core.method({
  35229. selector: "isSuperKeyword",
  35230. protocol: "testing",
  35231. fn: function (){
  35232. var self=this,$self=this;
  35233. return $core.withContext(function($ctx1) {
  35234. return $recv($self._value()).__eq("super");
  35235. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35236. },
  35237. args: [],
  35238. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35239. referencedClasses: [],
  35240. messageSends: ["=", "value"]
  35241. }),
  35242. $globals.VariableNode);
  35243. $core.addMethod(
  35244. $core.method({
  35245. selector: "isVariableNode",
  35246. protocol: "testing",
  35247. fn: function (){
  35248. var self=this,$self=this;
  35249. return true;
  35250. },
  35251. args: [],
  35252. source: "isVariableNode\x0a\x09^ true",
  35253. referencedClasses: [],
  35254. messageSends: []
  35255. }),
  35256. $globals.VariableNode);
  35257. $core.addMethod(
  35258. $core.method({
  35259. selector: "navigationLink",
  35260. protocol: "accessing",
  35261. fn: function (){
  35262. var self=this,$self=this;
  35263. return $core.withContext(function($ctx1) {
  35264. return $self._value();
  35265. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35266. },
  35267. args: [],
  35268. source: "navigationLink\x0a\x09^ self value",
  35269. referencedClasses: [],
  35270. messageSends: ["value"]
  35271. }),
  35272. $globals.VariableNode);
  35273. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35274. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35275. $core.addMethod(
  35276. $core.method({
  35277. selector: "visit:",
  35278. protocol: "visiting",
  35279. fn: function (aNode){
  35280. var self=this,$self=this;
  35281. return $core.withContext(function($ctx1) {
  35282. var $1;
  35283. $recv($self._path())._ifNotEmpty_((function(p){
  35284. return $core.withContext(function($ctx2) {
  35285. return $recv(aNode)._parent_($recv(p)._last());
  35286. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35287. }));
  35288. $1=(
  35289. $ctx1.supercall = true,
  35290. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35291. $ctx1.supercall = false;
  35292. return $1;
  35293. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35294. },
  35295. args: ["aNode"],
  35296. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35297. referencedClasses: [],
  35298. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35299. }),
  35300. $globals.ParentFakingPathDagVisitor);
  35301. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35302. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35303. $core.addMethod(
  35304. $core.method({
  35305. selector: "visitAssignmentNode:",
  35306. protocol: "visiting",
  35307. fn: function (aNode){
  35308. var self=this,$self=this;
  35309. return $core.withContext(function($ctx1) {
  35310. return $self._visitDagNode_(aNode);
  35311. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35312. },
  35313. args: ["aNode"],
  35314. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35315. referencedClasses: [],
  35316. messageSends: ["visitDagNode:"]
  35317. }),
  35318. $globals.NodeVisitor);
  35319. $core.addMethod(
  35320. $core.method({
  35321. selector: "visitBlockNode:",
  35322. protocol: "visiting",
  35323. fn: function (aNode){
  35324. var self=this,$self=this;
  35325. return $core.withContext(function($ctx1) {
  35326. return $self._visitDagNode_(aNode);
  35327. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35328. },
  35329. args: ["aNode"],
  35330. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35331. referencedClasses: [],
  35332. messageSends: ["visitDagNode:"]
  35333. }),
  35334. $globals.NodeVisitor);
  35335. $core.addMethod(
  35336. $core.method({
  35337. selector: "visitBlockSequenceNode:",
  35338. protocol: "visiting",
  35339. fn: function (aNode){
  35340. var self=this,$self=this;
  35341. return $core.withContext(function($ctx1) {
  35342. return $self._visitSequenceNode_(aNode);
  35343. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35344. },
  35345. args: ["aNode"],
  35346. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35347. referencedClasses: [],
  35348. messageSends: ["visitSequenceNode:"]
  35349. }),
  35350. $globals.NodeVisitor);
  35351. $core.addMethod(
  35352. $core.method({
  35353. selector: "visitCascadeNode:",
  35354. protocol: "visiting",
  35355. fn: function (aNode){
  35356. var self=this,$self=this;
  35357. return $core.withContext(function($ctx1) {
  35358. return $self._visitDagNode_(aNode);
  35359. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  35360. },
  35361. args: ["aNode"],
  35362. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35363. referencedClasses: [],
  35364. messageSends: ["visitDagNode:"]
  35365. }),
  35366. $globals.NodeVisitor);
  35367. $core.addMethod(
  35368. $core.method({
  35369. selector: "visitDagNode:",
  35370. protocol: "visiting",
  35371. fn: function (aNode){
  35372. var self=this,$self=this;
  35373. return $core.withContext(function($ctx1) {
  35374. return $self._visitDagNodeVariantSimple_(aNode);
  35375. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  35376. },
  35377. args: ["aNode"],
  35378. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  35379. referencedClasses: [],
  35380. messageSends: ["visitDagNodeVariantSimple:"]
  35381. }),
  35382. $globals.NodeVisitor);
  35383. $core.addMethod(
  35384. $core.method({
  35385. selector: "visitDynamicArrayNode:",
  35386. protocol: "visiting",
  35387. fn: function (aNode){
  35388. var self=this,$self=this;
  35389. return $core.withContext(function($ctx1) {
  35390. return $self._visitDagNode_(aNode);
  35391. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35392. },
  35393. args: ["aNode"],
  35394. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35395. referencedClasses: [],
  35396. messageSends: ["visitDagNode:"]
  35397. }),
  35398. $globals.NodeVisitor);
  35399. $core.addMethod(
  35400. $core.method({
  35401. selector: "visitDynamicDictionaryNode:",
  35402. protocol: "visiting",
  35403. fn: function (aNode){
  35404. var self=this,$self=this;
  35405. return $core.withContext(function($ctx1) {
  35406. return $self._visitDagNode_(aNode);
  35407. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35408. },
  35409. args: ["aNode"],
  35410. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35411. referencedClasses: [],
  35412. messageSends: ["visitDagNode:"]
  35413. }),
  35414. $globals.NodeVisitor);
  35415. $core.addMethod(
  35416. $core.method({
  35417. selector: "visitJSStatementNode:",
  35418. protocol: "visiting",
  35419. fn: function (aNode){
  35420. var self=this,$self=this;
  35421. return $core.withContext(function($ctx1) {
  35422. return $self._visitDagNode_(aNode);
  35423. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35424. },
  35425. args: ["aNode"],
  35426. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35427. referencedClasses: [],
  35428. messageSends: ["visitDagNode:"]
  35429. }),
  35430. $globals.NodeVisitor);
  35431. $core.addMethod(
  35432. $core.method({
  35433. selector: "visitMethodNode:",
  35434. protocol: "visiting",
  35435. fn: function (aNode){
  35436. var self=this,$self=this;
  35437. return $core.withContext(function($ctx1) {
  35438. return $self._visitDagNode_(aNode);
  35439. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35440. },
  35441. args: ["aNode"],
  35442. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35443. referencedClasses: [],
  35444. messageSends: ["visitDagNode:"]
  35445. }),
  35446. $globals.NodeVisitor);
  35447. $core.addMethod(
  35448. $core.method({
  35449. selector: "visitReturnNode:",
  35450. protocol: "visiting",
  35451. fn: function (aNode){
  35452. var self=this,$self=this;
  35453. return $core.withContext(function($ctx1) {
  35454. return $self._visitDagNode_(aNode);
  35455. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35456. },
  35457. args: ["aNode"],
  35458. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35459. referencedClasses: [],
  35460. messageSends: ["visitDagNode:"]
  35461. }),
  35462. $globals.NodeVisitor);
  35463. $core.addMethod(
  35464. $core.method({
  35465. selector: "visitSendNode:",
  35466. protocol: "visiting",
  35467. fn: function (aNode){
  35468. var self=this,$self=this;
  35469. return $core.withContext(function($ctx1) {
  35470. return $self._visitDagNode_(aNode);
  35471. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35472. },
  35473. args: ["aNode"],
  35474. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35475. referencedClasses: [],
  35476. messageSends: ["visitDagNode:"]
  35477. }),
  35478. $globals.NodeVisitor);
  35479. $core.addMethod(
  35480. $core.method({
  35481. selector: "visitSequenceNode:",
  35482. protocol: "visiting",
  35483. fn: function (aNode){
  35484. var self=this,$self=this;
  35485. return $core.withContext(function($ctx1) {
  35486. return $self._visitDagNode_(aNode);
  35487. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35488. },
  35489. args: ["aNode"],
  35490. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35491. referencedClasses: [],
  35492. messageSends: ["visitDagNode:"]
  35493. }),
  35494. $globals.NodeVisitor);
  35495. $core.addMethod(
  35496. $core.method({
  35497. selector: "visitValueNode:",
  35498. protocol: "visiting",
  35499. fn: function (aNode){
  35500. var self=this,$self=this;
  35501. return $core.withContext(function($ctx1) {
  35502. return $self._visitDagNode_(aNode);
  35503. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35504. },
  35505. args: ["aNode"],
  35506. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35507. referencedClasses: [],
  35508. messageSends: ["visitDagNode:"]
  35509. }),
  35510. $globals.NodeVisitor);
  35511. $core.addMethod(
  35512. $core.method({
  35513. selector: "visitVariableNode:",
  35514. protocol: "visiting",
  35515. fn: function (aNode){
  35516. var self=this,$self=this;
  35517. return $core.withContext(function($ctx1) {
  35518. return $self._visitDagNode_(aNode);
  35519. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35520. },
  35521. args: ["aNode"],
  35522. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35523. referencedClasses: [],
  35524. messageSends: ["visitDagNode:"]
  35525. }),
  35526. $globals.NodeVisitor);
  35527. $core.addMethod(
  35528. $core.method({
  35529. selector: "ast",
  35530. protocol: "*Compiler-AST",
  35531. fn: function (){
  35532. var self=this,$self=this;
  35533. return $core.withContext(function($ctx1) {
  35534. var $1;
  35535. $1=$self._source();
  35536. $ctx1.sendIdx["source"]=1;
  35537. $recv($1)._ifEmpty_((function(){
  35538. return $core.withContext(function($ctx2) {
  35539. return $self._error_("Method source is empty");
  35540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35541. }));
  35542. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._methodClass(),$self._protocol());
  35543. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35544. },
  35545. args: [],
  35546. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Compiler new\x0a\x09\x09ast: self source\x0a\x09\x09forClass: self methodClass\x0a\x09\x09protocol: self protocol",
  35547. referencedClasses: ["Compiler"],
  35548. messageSends: ["ifEmpty:", "source", "error:", "ast:forClass:protocol:", "new", "methodClass", "protocol"]
  35549. }),
  35550. $globals.CompiledMethod);
  35551. });
  35552. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35553. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  35554. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35555. $core.addPackage("Compiler-Core");
  35556. ($core.packageDescriptors||$core.packages)["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  35557. ($core.packageDescriptors||$core.packages)["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35558. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  35559. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  35560. $core.addMethod(
  35561. $core.method({
  35562. selector: "compileNode:",
  35563. protocol: "compiling",
  35564. fn: function (aNode){
  35565. var self=this,$self=this;
  35566. return $core.withContext(function($ctx1) {
  35567. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35568. return $core.withContext(function($ctx2) {
  35569. return $recv(transformer)._value_(input);
  35570. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35571. }));
  35572. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  35573. },
  35574. args: ["aNode"],
  35575. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35576. referencedClasses: [],
  35577. messageSends: ["inject:into:", "transformers", "value:"]
  35578. }),
  35579. $globals.AbstractCodeGenerator);
  35580. $core.addMethod(
  35581. $core.method({
  35582. selector: "currentClass",
  35583. protocol: "accessing",
  35584. fn: function (){
  35585. var self=this,$self=this;
  35586. return $self["@currentClass"];
  35587. },
  35588. args: [],
  35589. source: "currentClass\x0a\x09^ currentClass",
  35590. referencedClasses: [],
  35591. messageSends: []
  35592. }),
  35593. $globals.AbstractCodeGenerator);
  35594. $core.addMethod(
  35595. $core.method({
  35596. selector: "currentClass:",
  35597. protocol: "accessing",
  35598. fn: function (aClass){
  35599. var self=this,$self=this;
  35600. $self["@currentClass"]=aClass;
  35601. return self;
  35602. },
  35603. args: ["aClass"],
  35604. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35605. referencedClasses: [],
  35606. messageSends: []
  35607. }),
  35608. $globals.AbstractCodeGenerator);
  35609. $core.addMethod(
  35610. $core.method({
  35611. selector: "currentPackage",
  35612. protocol: "accessing",
  35613. fn: function (){
  35614. var self=this,$self=this;
  35615. return $self["@currentPackage"];
  35616. },
  35617. args: [],
  35618. source: "currentPackage\x0a\x09^ currentPackage",
  35619. referencedClasses: [],
  35620. messageSends: []
  35621. }),
  35622. $globals.AbstractCodeGenerator);
  35623. $core.addMethod(
  35624. $core.method({
  35625. selector: "currentPackage:",
  35626. protocol: "accessing",
  35627. fn: function (anObject){
  35628. var self=this,$self=this;
  35629. $self["@currentPackage"]=anObject;
  35630. return self;
  35631. },
  35632. args: ["anObject"],
  35633. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35634. referencedClasses: [],
  35635. messageSends: []
  35636. }),
  35637. $globals.AbstractCodeGenerator);
  35638. $core.addMethod(
  35639. $core.method({
  35640. selector: "pseudoVariables",
  35641. protocol: "accessing",
  35642. fn: function (){
  35643. var self=this,$self=this;
  35644. return $core.withContext(function($ctx1) {
  35645. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35646. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  35647. },
  35648. args: [],
  35649. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35650. referencedClasses: ["Smalltalk"],
  35651. messageSends: ["pseudoVariableNames"]
  35652. }),
  35653. $globals.AbstractCodeGenerator);
  35654. $core.addMethod(
  35655. $core.method({
  35656. selector: "source",
  35657. protocol: "accessing",
  35658. fn: function (){
  35659. var self=this,$self=this;
  35660. return $core.withContext(function($ctx1) {
  35661. var $1,$receiver;
  35662. $1=$self["@source"];
  35663. if(($receiver = $1) == null || $receiver.a$nil){
  35664. return "";
  35665. } else {
  35666. return $1;
  35667. }
  35668. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  35669. },
  35670. args: [],
  35671. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35672. referencedClasses: [],
  35673. messageSends: ["ifNil:"]
  35674. }),
  35675. $globals.AbstractCodeGenerator);
  35676. $core.addMethod(
  35677. $core.method({
  35678. selector: "source:",
  35679. protocol: "accessing",
  35680. fn: function (aString){
  35681. var self=this,$self=this;
  35682. $self["@source"]=aString;
  35683. return self;
  35684. },
  35685. args: ["aString"],
  35686. source: "source: aString\x0a\x09source := aString",
  35687. referencedClasses: [],
  35688. messageSends: []
  35689. }),
  35690. $globals.AbstractCodeGenerator);
  35691. $core.addMethod(
  35692. $core.method({
  35693. selector: "transformers",
  35694. protocol: "compiling",
  35695. fn: function (){
  35696. var self=this,$self=this;
  35697. var dict;
  35698. return $core.withContext(function($ctx1) {
  35699. dict=$self._transformersDictionary();
  35700. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35701. return $core.withContext(function($ctx2) {
  35702. return $recv(dict)._at_(each);
  35703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35704. }));
  35705. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  35706. },
  35707. args: [],
  35708. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35709. referencedClasses: [],
  35710. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35711. }),
  35712. $globals.AbstractCodeGenerator);
  35713. $core.addMethod(
  35714. $core.method({
  35715. selector: "transformersDictionary",
  35716. protocol: "compiling",
  35717. fn: function (){
  35718. var self=this,$self=this;
  35719. return $core.withContext(function($ctx1) {
  35720. $self._subclassResponsibility();
  35721. return self;
  35722. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  35723. },
  35724. args: [],
  35725. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35726. referencedClasses: [],
  35727. messageSends: ["subclassResponsibility"]
  35728. }),
  35729. $globals.AbstractCodeGenerator);
  35730. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35731. $globals.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation.";
  35732. $core.addMethod(
  35733. $core.method({
  35734. selector: "irTranslator",
  35735. protocol: "compiling",
  35736. fn: function (){
  35737. var self=this,$self=this;
  35738. return $core.withContext(function($ctx1) {
  35739. var $1;
  35740. $1=$recv($self._irTranslatorClass())._new();
  35741. $recv($1)._currentClass_($self._currentClass());
  35742. return $recv($1)._yourself();
  35743. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  35744. },
  35745. args: [],
  35746. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35747. referencedClasses: [],
  35748. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35749. }),
  35750. $globals.CodeGenerator);
  35751. $core.addMethod(
  35752. $core.method({
  35753. selector: "irTranslatorClass",
  35754. protocol: "compiling",
  35755. fn: function (){
  35756. var self=this,$self=this;
  35757. return $globals.IRJSTranslator;
  35758. },
  35759. args: [],
  35760. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35761. referencedClasses: ["IRJSTranslator"],
  35762. messageSends: []
  35763. }),
  35764. $globals.CodeGenerator);
  35765. $core.addMethod(
  35766. $core.method({
  35767. selector: "semanticAnalyzer",
  35768. protocol: "compiling",
  35769. fn: function (){
  35770. var self=this,$self=this;
  35771. return $core.withContext(function($ctx1) {
  35772. var $1;
  35773. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35774. $recv($1)._thePackage_($self._currentPackage());
  35775. return $recv($1)._yourself();
  35776. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  35777. },
  35778. args: [],
  35779. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35780. referencedClasses: ["SemanticAnalyzer"],
  35781. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35782. }),
  35783. $globals.CodeGenerator);
  35784. $core.addMethod(
  35785. $core.method({
  35786. selector: "transformersDictionary",
  35787. protocol: "compiling",
  35788. fn: function (){
  35789. var self=this,$self=this;
  35790. return $core.withContext(function($ctx1) {
  35791. var $1,$2,$receiver;
  35792. $1=$self["@transformersDictionary"];
  35793. if(($receiver = $1) == null || $receiver.a$nil){
  35794. $2=$recv($globals.Dictionary)._new();
  35795. $ctx1.sendIdx["new"]=1;
  35796. $recv($2)._at_put_("1000-earlyPragmas",$recv($globals.EarlyPragmator)._new());
  35797. $ctx1.sendIdx["at:put:"]=1;
  35798. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35799. $ctx1.sendIdx["at:put:"]=2;
  35800. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35801. $ctx1.sendIdx["at:put:"]=3;
  35802. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35803. $self["@transformersDictionary"]=$recv($2)._yourself();
  35804. return $self["@transformersDictionary"];
  35805. } else {
  35806. return $1;
  35807. }
  35808. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  35809. },
  35810. args: [],
  35811. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: EarlyPragmator new;\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  35812. referencedClasses: ["Dictionary", "EarlyPragmator"],
  35813. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  35814. }),
  35815. $globals.CodeGenerator);
  35816. $core.addMethod(
  35817. $core.method({
  35818. selector: "translator",
  35819. protocol: "compiling",
  35820. fn: function (){
  35821. var self=this,$self=this;
  35822. return $core.withContext(function($ctx1) {
  35823. var $1;
  35824. $1=$recv($globals.IRASTTranslator)._new();
  35825. $recv($1)._source_($self._source());
  35826. $recv($1)._theClass_($self._currentClass());
  35827. return $recv($1)._yourself();
  35828. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  35829. },
  35830. args: [],
  35831. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  35832. referencedClasses: ["IRASTTranslator"],
  35833. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  35834. }),
  35835. $globals.CodeGenerator);
  35836. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  35837. $globals.Compiler.comment="I provide the public interface for compiling Amber source code into JavaScript.\x0a\x0aThe code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.\x0aThe default code generator is an instance of `InlinedCodeGenerator`";
  35838. $core.addMethod(
  35839. $core.method({
  35840. selector: "ast:forClass:protocol:",
  35841. protocol: "compiling",
  35842. fn: function (aString,aClass,anotherString){
  35843. var self=this,$self=this;
  35844. return $core.withContext(function($ctx1) {
  35845. var $early={};
  35846. try {
  35847. $self._source_(aString);
  35848. $self._forClass_protocol_(aClass,anotherString);
  35849. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  35850. throw $early=[x];
  35851. }));
  35852. $self._compileNode_($self._parse_(aString));
  35853. $self._error_("AST transformation failed.");
  35854. return self;
  35855. }
  35856. catch(e) {if(e===$early)return e[0]; throw e}
  35857. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  35858. },
  35859. args: ["aString", "aClass", "anotherString"],
  35860. source: "ast: aString forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString.\x0a\x0a\x09self codeGenerator transformersDictionary at: '2500-astCheckpoint' put: [ :x | ^x ].\x0a\x09\x0a\x09self compileNode: (self parse: aString).\x0a\x0a\x09self error: 'AST transformation failed.'",
  35861. referencedClasses: [],
  35862. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "error:"]
  35863. }),
  35864. $globals.Compiler);
  35865. $core.addMethod(
  35866. $core.method({
  35867. selector: "cleanCodeGenerator",
  35868. protocol: "accessing",
  35869. fn: function (){
  35870. var self=this,$self=this;
  35871. $self["@codeGenerator"]=nil;
  35872. return self;
  35873. },
  35874. args: [],
  35875. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  35876. referencedClasses: [],
  35877. messageSends: []
  35878. }),
  35879. $globals.Compiler);
  35880. $core.addMethod(
  35881. $core.method({
  35882. selector: "codeGenerator",
  35883. protocol: "accessing",
  35884. fn: function (){
  35885. var self=this,$self=this;
  35886. return $core.withContext(function($ctx1) {
  35887. var $1,$2,$receiver;
  35888. $1=$self["@codeGenerator"];
  35889. if(($receiver = $1) == null || $receiver.a$nil){
  35890. $2=$recv($self._codeGeneratorClass())._new();
  35891. $recv($2)._source_($self._source());
  35892. $recv($2)._currentClass_($self._currentClass());
  35893. $recv($2)._currentPackage_($self._currentPackage());
  35894. $self["@codeGenerator"]=$recv($2)._yourself();
  35895. return $self["@codeGenerator"];
  35896. } else {
  35897. return $1;
  35898. }
  35899. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{},$globals.Compiler)});
  35900. },
  35901. args: [],
  35902. source: "codeGenerator\x0a\x09^ codeGenerator ifNil: [ codeGenerator := self codeGeneratorClass new\x0a\x09\x09\x09source: self source;\x0a\x09\x09\x09currentClass: self currentClass;\x0a\x09\x09\x09currentPackage: self currentPackage;\x0a\x09\x09\x09yourself ]",
  35903. referencedClasses: [],
  35904. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  35905. }),
  35906. $globals.Compiler);
  35907. $core.addMethod(
  35908. $core.method({
  35909. selector: "codeGeneratorClass",
  35910. protocol: "accessing",
  35911. fn: function (){
  35912. var self=this,$self=this;
  35913. return $core.withContext(function($ctx1) {
  35914. var $1,$receiver;
  35915. $1=$self["@codeGeneratorClass"];
  35916. if(($receiver = $1) == null || $receiver.a$nil){
  35917. return $globals.InliningCodeGenerator;
  35918. } else {
  35919. return $1;
  35920. }
  35921. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  35922. },
  35923. args: [],
  35924. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  35925. referencedClasses: ["InliningCodeGenerator"],
  35926. messageSends: ["ifNil:"]
  35927. }),
  35928. $globals.Compiler);
  35929. $core.addMethod(
  35930. $core.method({
  35931. selector: "codeGeneratorClass:",
  35932. protocol: "accessing",
  35933. fn: function (aClass){
  35934. var self=this,$self=this;
  35935. $self["@codeGeneratorClass"]=aClass;
  35936. return self;
  35937. },
  35938. args: ["aClass"],
  35939. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  35940. referencedClasses: [],
  35941. messageSends: []
  35942. }),
  35943. $globals.Compiler);
  35944. $core.addMethod(
  35945. $core.method({
  35946. selector: "compile:forClass:protocol:",
  35947. protocol: "compiling",
  35948. fn: function (aString,aClass,anotherString){
  35949. var self=this,$self=this;
  35950. return $core.withContext(function($ctx1) {
  35951. $self._source_(aString);
  35952. $self._forClass_protocol_(aClass,anotherString);
  35953. return $self._compileNode_($self._parse_(aString));
  35954. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  35955. },
  35956. args: ["aString", "aClass", "anotherString"],
  35957. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  35958. referencedClasses: [],
  35959. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  35960. }),
  35961. $globals.Compiler);
  35962. $core.addMethod(
  35963. $core.method({
  35964. selector: "compileExpression:on:",
  35965. protocol: "compiling",
  35966. fn: function (aString,anObject){
  35967. var self=this,$self=this;
  35968. return $core.withContext(function($ctx1) {
  35969. var $1;
  35970. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  35971. $ctx1.sendIdx[","]=1;
  35972. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  35973. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  35974. },
  35975. args: ["aString", "anObject"],
  35976. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  35977. referencedClasses: [],
  35978. messageSends: ["compile:forClass:protocol:", ",", "class"]
  35979. }),
  35980. $globals.Compiler);
  35981. $core.addMethod(
  35982. $core.method({
  35983. selector: "compileNode:",
  35984. protocol: "compiling",
  35985. fn: function (aNode){
  35986. var self=this,$self=this;
  35987. var result;
  35988. return $core.withContext(function($ctx1) {
  35989. result=$recv($self._codeGenerator())._compileNode_(aNode);
  35990. $self._cleanCodeGenerator();
  35991. return result;
  35992. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result},$globals.Compiler)});
  35993. },
  35994. args: ["aNode"],
  35995. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  35996. referencedClasses: [],
  35997. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  35998. }),
  35999. $globals.Compiler);
  36000. $core.addMethod(
  36001. $core.method({
  36002. selector: "currentClass",
  36003. protocol: "accessing",
  36004. fn: function (){
  36005. var self=this,$self=this;
  36006. return $self["@currentClass"];
  36007. },
  36008. args: [],
  36009. source: "currentClass\x0a\x09^ currentClass",
  36010. referencedClasses: [],
  36011. messageSends: []
  36012. }),
  36013. $globals.Compiler);
  36014. $core.addMethod(
  36015. $core.method({
  36016. selector: "currentClass:",
  36017. protocol: "accessing",
  36018. fn: function (aClass){
  36019. var self=this,$self=this;
  36020. $self["@currentClass"]=aClass;
  36021. return self;
  36022. },
  36023. args: ["aClass"],
  36024. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  36025. referencedClasses: [],
  36026. messageSends: []
  36027. }),
  36028. $globals.Compiler);
  36029. $core.addMethod(
  36030. $core.method({
  36031. selector: "currentPackage",
  36032. protocol: "accessing",
  36033. fn: function (){
  36034. var self=this,$self=this;
  36035. return $self["@currentPackage"];
  36036. },
  36037. args: [],
  36038. source: "currentPackage\x0a\x09^ currentPackage",
  36039. referencedClasses: [],
  36040. messageSends: []
  36041. }),
  36042. $globals.Compiler);
  36043. $core.addMethod(
  36044. $core.method({
  36045. selector: "currentPackage:",
  36046. protocol: "accessing",
  36047. fn: function (anObject){
  36048. var self=this,$self=this;
  36049. $self["@currentPackage"]=anObject;
  36050. return self;
  36051. },
  36052. args: ["anObject"],
  36053. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  36054. referencedClasses: [],
  36055. messageSends: []
  36056. }),
  36057. $globals.Compiler);
  36058. $core.addMethod(
  36059. $core.method({
  36060. selector: "eval:",
  36061. protocol: "compiling",
  36062. fn: function (aString){
  36063. var self=this,$self=this;
  36064. return $core.withContext(function($ctx1) {
  36065. return eval(aString);
  36066. return self;
  36067. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  36068. },
  36069. args: ["aString"],
  36070. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  36071. referencedClasses: [],
  36072. messageSends: []
  36073. }),
  36074. $globals.Compiler);
  36075. $core.addMethod(
  36076. $core.method({
  36077. selector: "eval:forPackage:",
  36078. protocol: "compiling",
  36079. fn: function (aString,aPackage){
  36080. var self=this,$self=this;
  36081. return $core.withContext(function($ctx1) {
  36082. var $receiver;
  36083. if(($receiver = aPackage) == null || $receiver.a$nil){
  36084. return $self._eval_(aString);
  36085. $ctx1.sendIdx["eval:"]=1;
  36086. } else {
  36087. return $recv(aPackage)._eval_(aString);
  36088. }
  36089. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  36090. },
  36091. args: ["aString", "aPackage"],
  36092. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  36093. referencedClasses: [],
  36094. messageSends: ["ifNil:ifNotNil:", "eval:"]
  36095. }),
  36096. $globals.Compiler);
  36097. $core.addMethod(
  36098. $core.method({
  36099. selector: "evaluateExpression:",
  36100. protocol: "compiling",
  36101. fn: function (aString){
  36102. var self=this,$self=this;
  36103. return $core.withContext(function($ctx1) {
  36104. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  36105. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  36106. },
  36107. args: ["aString"],
  36108. source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09^ self evaluateExpression: aString on: DoIt new",
  36109. referencedClasses: ["DoIt"],
  36110. messageSends: ["evaluateExpression:on:", "new"]
  36111. }),
  36112. $globals.Compiler);
  36113. $core.addMethod(
  36114. $core.method({
  36115. selector: "evaluateExpression:on:",
  36116. protocol: "compiling",
  36117. fn: function (aString,anObject){
  36118. var self=this,$self=this;
  36119. var result,method;
  36120. return $core.withContext(function($ctx1) {
  36121. var $1;
  36122. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  36123. $recv(method)._protocol_("**xxxDoIt");
  36124. $1=$recv(anObject)._class();
  36125. $ctx1.sendIdx["class"]=1;
  36126. $recv($1)._addCompiledMethod_(method);
  36127. result=$recv(anObject)._xxxDoIt();
  36128. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  36129. return result;
  36130. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  36131. },
  36132. args: ["aString", "anObject"],
  36133. source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: '**xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  36134. referencedClasses: [],
  36135. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  36136. }),
  36137. $globals.Compiler);
  36138. $core.addMethod(
  36139. $core.method({
  36140. selector: "forClass:protocol:",
  36141. protocol: "compiling",
  36142. fn: function (aClass,anotherString){
  36143. var self=this,$self=this;
  36144. return $core.withContext(function($ctx1) {
  36145. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  36146. $self._currentClass_(aClass);
  36147. return self;
  36148. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36149. },
  36150. args: ["aClass", "anotherString"],
  36151. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  36152. referencedClasses: [],
  36153. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  36154. }),
  36155. $globals.Compiler);
  36156. $core.addMethod(
  36157. $core.method({
  36158. selector: "install:forClass:protocol:",
  36159. protocol: "compiling",
  36160. fn: function (aString,aBehavior,anotherString){
  36161. var self=this,$self=this;
  36162. var compiledMethod;
  36163. return $core.withContext(function($ctx1) {
  36164. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  36165. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  36166. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  36167. },
  36168. args: ["aString", "aBehavior", "anotherString"],
  36169. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09| compiledMethod |\x0a\x09compiledMethod := self\x0a\x09\x09eval: (self compile: aString forClass: aBehavior protocol: anotherString)\x0a\x09\x09forPackage: (aBehavior packageOfProtocol: anotherString).\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: compiledMethod\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
  36170. referencedClasses: ["ClassBuilder"],
  36171. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  36172. }),
  36173. $globals.Compiler);
  36174. $core.addMethod(
  36175. $core.method({
  36176. selector: "parse:",
  36177. protocol: "compiling",
  36178. fn: function (aString){
  36179. var self=this,$self=this;
  36180. return $core.withContext(function($ctx1) {
  36181. return $recv($globals.Smalltalk)._parse_(aString);
  36182. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  36183. },
  36184. args: ["aString"],
  36185. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36186. referencedClasses: ["Smalltalk"],
  36187. messageSends: ["parse:"]
  36188. }),
  36189. $globals.Compiler);
  36190. $core.addMethod(
  36191. $core.method({
  36192. selector: "parseExpression:",
  36193. protocol: "compiling",
  36194. fn: function (aString){
  36195. var self=this,$self=this;
  36196. return $core.withContext(function($ctx1) {
  36197. var $1;
  36198. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  36199. $ctx1.sendIdx[","]=1;
  36200. return $self._parse_($1);
  36201. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  36202. },
  36203. args: ["aString"],
  36204. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  36205. referencedClasses: [],
  36206. messageSends: ["parse:", ","]
  36207. }),
  36208. $globals.Compiler);
  36209. $core.addMethod(
  36210. $core.method({
  36211. selector: "recompile:",
  36212. protocol: "compiling",
  36213. fn: function (aClass){
  36214. var self=this,$self=this;
  36215. return $core.withContext(function($ctx1) {
  36216. var $1,$2,$3,$receiver;
  36217. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  36218. return $core.withContext(function($ctx2) {
  36219. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  36220. $ctx2.sendIdx["="]=1;
  36221. if($core.assert($1)){
  36222. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  36223. }
  36224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36225. }),"Recompiling ".__comma($recv(aClass)._name()));
  36226. $2=$recv(aClass)._theMetaClass();
  36227. if(($receiver = $2) == null || $receiver.a$nil){
  36228. $2;
  36229. } else {
  36230. var meta;
  36231. meta=$receiver;
  36232. $3=$recv(meta).__eq(aClass);
  36233. if(!$core.assert($3)){
  36234. $self._recompile_(meta);
  36235. }
  36236. }
  36237. return self;
  36238. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  36239. },
  36240. args: ["aClass"],
  36241. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | each methodClass = aClass ifTrue: [ \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ] ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass theMetaClass ifNotNil: [ :meta |\x0a\x09\x09meta = aClass ifFalse: [ self recompile: meta ] ]",
  36242. referencedClasses: [],
  36243. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  36244. }),
  36245. $globals.Compiler);
  36246. $core.addMethod(
  36247. $core.method({
  36248. selector: "recompileAll",
  36249. protocol: "compiling",
  36250. fn: function (){
  36251. var self=this,$self=this;
  36252. return $core.withContext(function($ctx1) {
  36253. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  36254. return $core.withContext(function($ctx2) {
  36255. return $self._recompile_(each);
  36256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36257. }),"Compiling all classes...");
  36258. return self;
  36259. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  36260. },
  36261. args: [],
  36262. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  36263. referencedClasses: ["Smalltalk"],
  36264. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  36265. }),
  36266. $globals.Compiler);
  36267. $core.addMethod(
  36268. $core.method({
  36269. selector: "source",
  36270. protocol: "accessing",
  36271. fn: function (){
  36272. var self=this,$self=this;
  36273. return $core.withContext(function($ctx1) {
  36274. var $1,$receiver;
  36275. $1=$self["@source"];
  36276. if(($receiver = $1) == null || $receiver.a$nil){
  36277. return "";
  36278. } else {
  36279. return $1;
  36280. }
  36281. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  36282. },
  36283. args: [],
  36284. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36285. referencedClasses: [],
  36286. messageSends: ["ifNil:"]
  36287. }),
  36288. $globals.Compiler);
  36289. $core.addMethod(
  36290. $core.method({
  36291. selector: "source:",
  36292. protocol: "accessing",
  36293. fn: function (aString){
  36294. var self=this,$self=this;
  36295. $self["@source"]=aString;
  36296. return self;
  36297. },
  36298. args: ["aString"],
  36299. source: "source: aString\x0a\x09source := aString",
  36300. referencedClasses: [],
  36301. messageSends: []
  36302. }),
  36303. $globals.Compiler);
  36304. $core.addMethod(
  36305. $core.method({
  36306. selector: "eval:",
  36307. protocol: "evaluating",
  36308. fn: function (aString){
  36309. var self=this,$self=this;
  36310. return $core.withContext(function($ctx1) {
  36311. return $recv($self._new())._eval_(aString);
  36312. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  36313. },
  36314. args: ["aString"],
  36315. source: "eval: aString\x0a\x09^ self new eval: aString",
  36316. referencedClasses: [],
  36317. messageSends: ["eval:", "new"]
  36318. }),
  36319. $globals.Compiler.a$cls);
  36320. $core.addMethod(
  36321. $core.method({
  36322. selector: "recompile:",
  36323. protocol: "compiling",
  36324. fn: function (aClass){
  36325. var self=this,$self=this;
  36326. return $core.withContext(function($ctx1) {
  36327. $recv($self._new())._recompile_(aClass);
  36328. return self;
  36329. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  36330. },
  36331. args: ["aClass"],
  36332. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  36333. referencedClasses: [],
  36334. messageSends: ["recompile:", "new"]
  36335. }),
  36336. $globals.Compiler.a$cls);
  36337. $core.addMethod(
  36338. $core.method({
  36339. selector: "recompileAll",
  36340. protocol: "compiling",
  36341. fn: function (){
  36342. var self=this,$self=this;
  36343. return $core.withContext(function($ctx1) {
  36344. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  36345. return $core.withContext(function($ctx2) {
  36346. return $self._recompile_(each);
  36347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36348. }));
  36349. return self;
  36350. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  36351. },
  36352. args: [],
  36353. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  36354. referencedClasses: ["Smalltalk"],
  36355. messageSends: ["do:", "classes", "recompile:"]
  36356. }),
  36357. $globals.Compiler.a$cls);
  36358. $core.addClass("CompilerError", $globals.Error, [], "Compiler-Core");
  36359. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  36360. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  36361. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  36362. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  36363. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  36364. $core.addMethod(
  36365. $core.method({
  36366. selector: "evaluate:context:",
  36367. protocol: "evaluating",
  36368. fn: function (aString,aContext){
  36369. var self=this,$self=this;
  36370. var compiler,ast;
  36371. return $core.withContext(function($ctx1) {
  36372. var $1;
  36373. var $early={};
  36374. try {
  36375. compiler=$recv($globals.Compiler)._new();
  36376. $recv((function(){
  36377. return $core.withContext(function($ctx2) {
  36378. ast=$recv(compiler)._parseExpression_(aString);
  36379. return ast;
  36380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36381. }))._on_do_($globals.Error,(function(ex){
  36382. return $core.withContext(function($ctx2) {
  36383. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36384. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36385. }));
  36386. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  36387. $recv($1)._context_(aContext);
  36388. $recv($1)._visit_(ast);
  36389. return $recv(aContext)._evaluateNode_(ast);
  36390. }
  36391. catch(e) {if(e===$early)return e[0]; throw e}
  36392. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  36393. },
  36394. args: ["aString", "aContext"],
  36395. source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ Terminal alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast",
  36396. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  36397. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  36398. }),
  36399. $globals.Evaluator);
  36400. $core.addMethod(
  36401. $core.method({
  36402. selector: "evaluate:for:",
  36403. protocol: "evaluating",
  36404. fn: function (aString,anObject){
  36405. var self=this,$self=this;
  36406. return $core.withContext(function($ctx1) {
  36407. return $recv(anObject)._evaluate_on_(aString,self);
  36408. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  36409. },
  36410. args: ["aString", "anObject"],
  36411. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  36412. referencedClasses: [],
  36413. messageSends: ["evaluate:on:"]
  36414. }),
  36415. $globals.Evaluator);
  36416. $core.addMethod(
  36417. $core.method({
  36418. selector: "evaluate:receiver:",
  36419. protocol: "evaluating",
  36420. fn: function (aString,anObject){
  36421. var self=this,$self=this;
  36422. var compiler;
  36423. return $core.withContext(function($ctx1) {
  36424. var $early={};
  36425. try {
  36426. compiler=$recv($globals.Compiler)._new();
  36427. $recv((function(){
  36428. return $core.withContext(function($ctx2) {
  36429. return $recv(compiler)._parseExpression_(aString);
  36430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36431. }))._on_do_($globals.Error,(function(ex){
  36432. return $core.withContext(function($ctx2) {
  36433. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36434. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36435. }));
  36436. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  36437. }
  36438. catch(e) {if(e===$early)return e[0]; throw e}
  36439. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  36440. },
  36441. args: ["aString", "anObject"],
  36442. source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ Terminal alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
  36443. referencedClasses: ["Compiler", "Error", "Terminal"],
  36444. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  36445. }),
  36446. $globals.Evaluator);
  36447. $core.addMethod(
  36448. $core.method({
  36449. selector: "evaluate:for:",
  36450. protocol: "instance creation",
  36451. fn: function (aString,anObject){
  36452. var self=this,$self=this;
  36453. return $core.withContext(function($ctx1) {
  36454. return $recv($self._new())._evaluate_for_(aString,anObject);
  36455. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  36456. },
  36457. args: ["aString", "anObject"],
  36458. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  36459. referencedClasses: [],
  36460. messageSends: ["evaluate:for:", "new"]
  36461. }),
  36462. $globals.Evaluator.a$cls);
  36463. $core.addClass("Pragmator", $globals.NodeVisitor, ["methodNode", "sequenceNode"], "Compiler-Core");
  36464. $globals.Pragmator.comment="I am abstract superclass for pragma-processing transformer.\x0a\x0aMy subclasses should implement messages for each pragma\x0athey process. Pragma processing checks if a message is known\x0ato a class but not to its superclass. IOW, each and only those\x0apragmas are processed which are defined as methods in the subclass.\x0a\x0aThese messages can access sequence node in which\x0aa pragma occurred and its containing method node\x0aas `self sequenceNode` and `self methodNode`.\x0a\x0aSee `EarlyPragmator` for an example.";
  36465. $core.addMethod(
  36466. $core.method({
  36467. selector: "canProcessPragma:",
  36468. protocol: "pragma processing",
  36469. fn: function (aMessage){
  36470. var self=this,$self=this;
  36471. var selector;
  36472. return $core.withContext(function($ctx1) {
  36473. selector=$recv(aMessage)._selector();
  36474. return $recv($self._respondsTo_(selector))._and_((function(){
  36475. return $core.withContext(function($ctx2) {
  36476. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  36477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36478. }));
  36479. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector},$globals.Pragmator)});
  36480. },
  36481. args: ["aMessage"],
  36482. source: "canProcessPragma: aMessage\x0a\x09| selector |\x0a\x09selector := aMessage selector.\x0a\x09^ (self respondsTo: selector) and: [\x0a\x09\x09(self class superclass canUnderstand: selector) not]",
  36483. referencedClasses: [],
  36484. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  36485. }),
  36486. $globals.Pragmator);
  36487. $core.addMethod(
  36488. $core.method({
  36489. selector: "methodNode",
  36490. protocol: "accessing",
  36491. fn: function (){
  36492. var self=this,$self=this;
  36493. return $self["@methodNode"];
  36494. },
  36495. args: [],
  36496. source: "methodNode\x0a\x09^ methodNode",
  36497. referencedClasses: [],
  36498. messageSends: []
  36499. }),
  36500. $globals.Pragmator);
  36501. $core.addMethod(
  36502. $core.method({
  36503. selector: "methodNode:",
  36504. protocol: "accessing",
  36505. fn: function (anObject){
  36506. var self=this,$self=this;
  36507. $self["@methodNode"]=anObject;
  36508. return self;
  36509. },
  36510. args: ["anObject"],
  36511. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36512. referencedClasses: [],
  36513. messageSends: []
  36514. }),
  36515. $globals.Pragmator);
  36516. $core.addMethod(
  36517. $core.method({
  36518. selector: "processPragma:",
  36519. protocol: "pragma processing",
  36520. fn: function (aMessage){
  36521. var self=this,$self=this;
  36522. return $core.withContext(function($ctx1) {
  36523. var $1;
  36524. $1=$self._canProcessPragma_(aMessage);
  36525. if($core.assert($1)){
  36526. return $recv(aMessage)._sendTo_(self);
  36527. }
  36528. return self;
  36529. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage},$globals.Pragmator)});
  36530. },
  36531. args: ["aMessage"],
  36532. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  36533. referencedClasses: [],
  36534. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  36535. }),
  36536. $globals.Pragmator);
  36537. $core.addMethod(
  36538. $core.method({
  36539. selector: "sequenceNode",
  36540. protocol: "accessing",
  36541. fn: function (){
  36542. var self=this,$self=this;
  36543. return $self["@sequenceNode"];
  36544. },
  36545. args: [],
  36546. source: "sequenceNode\x0a\x09^ sequenceNode",
  36547. referencedClasses: [],
  36548. messageSends: []
  36549. }),
  36550. $globals.Pragmator);
  36551. $core.addMethod(
  36552. $core.method({
  36553. selector: "sequenceNode:",
  36554. protocol: "accessing",
  36555. fn: function (anObject){
  36556. var self=this,$self=this;
  36557. $self["@sequenceNode"]=anObject;
  36558. return self;
  36559. },
  36560. args: ["anObject"],
  36561. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  36562. referencedClasses: [],
  36563. messageSends: []
  36564. }),
  36565. $globals.Pragmator);
  36566. $core.addMethod(
  36567. $core.method({
  36568. selector: "visitMethodNode:",
  36569. protocol: "pragma processing",
  36570. fn: function (aNode){
  36571. var self=this,$self=this;
  36572. return $core.withContext(function($ctx1) {
  36573. var $1;
  36574. $self._methodNode_(aNode);
  36575. $1=(
  36576. $ctx1.supercall = true,
  36577. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36578. $ctx1.supercall = false;
  36579. return $1;
  36580. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.Pragmator)});
  36581. },
  36582. args: ["aNode"],
  36583. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09^ super visitMethodNode: aNode",
  36584. referencedClasses: [],
  36585. messageSends: ["methodNode:", "visitMethodNode:"]
  36586. }),
  36587. $globals.Pragmator);
  36588. $core.addMethod(
  36589. $core.method({
  36590. selector: "visitSequenceNode:",
  36591. protocol: "pragma processing",
  36592. fn: function (aNode){
  36593. var self=this,$self=this;
  36594. return $core.withContext(function($ctx1) {
  36595. var $1;
  36596. $self._sequenceNode_(aNode);
  36597. $recv($recv(aNode)._pragmas())._do_((function(each){
  36598. return $core.withContext(function($ctx2) {
  36599. return $self._processPragma_(each);
  36600. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36601. }));
  36602. $1=(
  36603. $ctx1.supercall = true,
  36604. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36605. $ctx1.supercall = false;
  36606. return $1;
  36607. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.Pragmator)});
  36608. },
  36609. args: ["aNode"],
  36610. source: "visitSequenceNode: aNode\x0a\x09self sequenceNode: aNode.\x0a\x09aNode pragmas do: [ :each | self processPragma: each ].\x0a\x09^ super visitSequenceNode: aNode",
  36611. referencedClasses: [],
  36612. messageSends: ["sequenceNode:", "do:", "pragmas", "processPragma:", "visitSequenceNode:"]
  36613. }),
  36614. $globals.Pragmator);
  36615. $core.addClass("EarlyPragmator", $globals.Pragmator, [], "Compiler-Core");
  36616. $core.addMethod(
  36617. $core.method({
  36618. selector: "asVariableName",
  36619. protocol: "*Compiler-Core",
  36620. fn: function (){
  36621. var self=this,$self=this;
  36622. return $core.withContext(function($ctx1) {
  36623. var $1;
  36624. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  36625. if($core.assert($1)){
  36626. return $self.__comma("_");
  36627. } else {
  36628. return self;
  36629. }
  36630. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  36631. },
  36632. args: [],
  36633. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36634. referencedClasses: ["Smalltalk"],
  36635. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36636. }),
  36637. $globals.String);
  36638. });
  36639. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36640. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36641. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36642. $core.addPackage("Compiler-Semantic");
  36643. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  36644. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36645. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36646. $globals.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope.";
  36647. $core.addMethod(
  36648. $core.method({
  36649. selector: "addArg:",
  36650. protocol: "adding",
  36651. fn: function (aString){
  36652. var self=this,$self=this;
  36653. return $core.withContext(function($ctx1) {
  36654. var $1;
  36655. $1=$self._args();
  36656. $ctx1.sendIdx["args"]=1;
  36657. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36658. $recv($recv($self._args())._at_(aString))._scope_(self);
  36659. return self;
  36660. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36661. },
  36662. args: ["aString"],
  36663. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36664. referencedClasses: ["ArgVar"],
  36665. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36666. }),
  36667. $globals.LexicalScope);
  36668. $core.addMethod(
  36669. $core.method({
  36670. selector: "addTemp:",
  36671. protocol: "adding",
  36672. fn: function (aString){
  36673. var self=this,$self=this;
  36674. return $core.withContext(function($ctx1) {
  36675. var $1;
  36676. $1=$self._temps();
  36677. $ctx1.sendIdx["temps"]=1;
  36678. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36679. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36680. return self;
  36681. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36682. },
  36683. args: ["aString"],
  36684. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36685. referencedClasses: ["TempVar"],
  36686. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36687. }),
  36688. $globals.LexicalScope);
  36689. $core.addMethod(
  36690. $core.method({
  36691. selector: "alias",
  36692. protocol: "accessing",
  36693. fn: function (){
  36694. var self=this,$self=this;
  36695. return $core.withContext(function($ctx1) {
  36696. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36697. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36698. },
  36699. args: [],
  36700. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36701. referencedClasses: [],
  36702. messageSends: [",", "asString", "scopeLevel"]
  36703. }),
  36704. $globals.LexicalScope);
  36705. $core.addMethod(
  36706. $core.method({
  36707. selector: "allVariableNames",
  36708. protocol: "accessing",
  36709. fn: function (){
  36710. var self=this,$self=this;
  36711. return $core.withContext(function($ctx1) {
  36712. var $1;
  36713. $1=$recv($self._args())._keys();
  36714. $ctx1.sendIdx["keys"]=1;
  36715. return $recv($1).__comma($recv($self._temps())._keys());
  36716. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36717. },
  36718. args: [],
  36719. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36720. referencedClasses: [],
  36721. messageSends: [",", "keys", "args", "temps"]
  36722. }),
  36723. $globals.LexicalScope);
  36724. $core.addMethod(
  36725. $core.method({
  36726. selector: "args",
  36727. protocol: "accessing",
  36728. fn: function (){
  36729. var self=this,$self=this;
  36730. return $core.withContext(function($ctx1) {
  36731. var $1,$receiver;
  36732. $1=$self["@args"];
  36733. if(($receiver = $1) == null || $receiver.a$nil){
  36734. $self["@args"]=$recv($globals.Dictionary)._new();
  36735. return $self["@args"];
  36736. } else {
  36737. return $1;
  36738. }
  36739. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36740. },
  36741. args: [],
  36742. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36743. referencedClasses: ["Dictionary"],
  36744. messageSends: ["ifNil:", "new"]
  36745. }),
  36746. $globals.LexicalScope);
  36747. $core.addMethod(
  36748. $core.method({
  36749. selector: "bindingFor:",
  36750. protocol: "accessing",
  36751. fn: function (aStringOrNode){
  36752. var self=this,$self=this;
  36753. return $core.withContext(function($ctx1) {
  36754. var $2,$3,$4,$5,$1;
  36755. $2=$self._pseudoVars();
  36756. $3=$recv(aStringOrNode)._value();
  36757. $ctx1.sendIdx["value"]=1;
  36758. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36759. return $core.withContext(function($ctx2) {
  36760. $4=$self._args();
  36761. $5=$recv(aStringOrNode)._value();
  36762. $ctx2.sendIdx["value"]=2;
  36763. return $recv($4)._at_ifAbsent_($5,(function(){
  36764. return $core.withContext(function($ctx3) {
  36765. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36766. return nil;
  36767. }));
  36768. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36769. }));
  36770. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36772. }));
  36773. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36774. return $1;
  36775. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36776. },
  36777. args: ["aStringOrNode"],
  36778. source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [\x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]",
  36779. referencedClasses: [],
  36780. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36781. }),
  36782. $globals.LexicalScope);
  36783. $core.addMethod(
  36784. $core.method({
  36785. selector: "blockIndex",
  36786. protocol: "accessing",
  36787. fn: function (){
  36788. var self=this,$self=this;
  36789. return $core.withContext(function($ctx1) {
  36790. var $1,$receiver;
  36791. $1=$self["@blockIndex"];
  36792. if(($receiver = $1) == null || $receiver.a$nil){
  36793. return (0);
  36794. } else {
  36795. return $1;
  36796. }
  36797. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36798. },
  36799. args: [],
  36800. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36801. referencedClasses: [],
  36802. messageSends: ["ifNil:"]
  36803. }),
  36804. $globals.LexicalScope);
  36805. $core.addMethod(
  36806. $core.method({
  36807. selector: "blockIndex:",
  36808. protocol: "accessing",
  36809. fn: function (anInteger){
  36810. var self=this,$self=this;
  36811. $self["@blockIndex"]=anInteger;
  36812. return self;
  36813. },
  36814. args: ["anInteger"],
  36815. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36816. referencedClasses: [],
  36817. messageSends: []
  36818. }),
  36819. $globals.LexicalScope);
  36820. $core.addMethod(
  36821. $core.method({
  36822. selector: "canInlineNonLocalReturns",
  36823. protocol: "testing",
  36824. fn: function (){
  36825. var self=this,$self=this;
  36826. return $core.withContext(function($ctx1) {
  36827. return $recv($self._isInlined())._and_((function(){
  36828. return $core.withContext(function($ctx2) {
  36829. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36831. }));
  36832. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36833. },
  36834. args: [],
  36835. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36836. referencedClasses: [],
  36837. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36838. }),
  36839. $globals.LexicalScope);
  36840. $core.addMethod(
  36841. $core.method({
  36842. selector: "instruction",
  36843. protocol: "accessing",
  36844. fn: function (){
  36845. var self=this,$self=this;
  36846. return $self["@instruction"];
  36847. },
  36848. args: [],
  36849. source: "instruction\x0a\x09^ instruction",
  36850. referencedClasses: [],
  36851. messageSends: []
  36852. }),
  36853. $globals.LexicalScope);
  36854. $core.addMethod(
  36855. $core.method({
  36856. selector: "instruction:",
  36857. protocol: "accessing",
  36858. fn: function (anIRInstruction){
  36859. var self=this,$self=this;
  36860. $self["@instruction"]=anIRInstruction;
  36861. return self;
  36862. },
  36863. args: ["anIRInstruction"],
  36864. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36865. referencedClasses: [],
  36866. messageSends: []
  36867. }),
  36868. $globals.LexicalScope);
  36869. $core.addMethod(
  36870. $core.method({
  36871. selector: "isBlockScope",
  36872. protocol: "testing",
  36873. fn: function (){
  36874. var self=this,$self=this;
  36875. return $core.withContext(function($ctx1) {
  36876. return $recv($self._isMethodScope())._not();
  36877. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36878. },
  36879. args: [],
  36880. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36881. referencedClasses: [],
  36882. messageSends: ["not", "isMethodScope"]
  36883. }),
  36884. $globals.LexicalScope);
  36885. $core.addMethod(
  36886. $core.method({
  36887. selector: "isInlined",
  36888. protocol: "testing",
  36889. fn: function (){
  36890. var self=this,$self=this;
  36891. return $core.withContext(function($ctx1) {
  36892. var $2,$1;
  36893. $2=$self._instruction();
  36894. $ctx1.sendIdx["instruction"]=1;
  36895. $1=$recv($2)._notNil();
  36896. return $recv($1)._and_((function(){
  36897. return $core.withContext(function($ctx2) {
  36898. return $recv($self._instruction())._isInlined();
  36899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36900. }));
  36901. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  36902. },
  36903. args: [],
  36904. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  36905. referencedClasses: [],
  36906. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  36907. }),
  36908. $globals.LexicalScope);
  36909. $core.addMethod(
  36910. $core.method({
  36911. selector: "isMethodScope",
  36912. protocol: "testing",
  36913. fn: function (){
  36914. var self=this,$self=this;
  36915. return false;
  36916. },
  36917. args: [],
  36918. source: "isMethodScope\x0a\x09^ false",
  36919. referencedClasses: [],
  36920. messageSends: []
  36921. }),
  36922. $globals.LexicalScope);
  36923. $core.addMethod(
  36924. $core.method({
  36925. selector: "lookupVariable:",
  36926. protocol: "accessing",
  36927. fn: function (aNode){
  36928. var self=this,$self=this;
  36929. var lookup;
  36930. return $core.withContext(function($ctx1) {
  36931. var $1,$2,$receiver;
  36932. lookup=$self._bindingFor_(aNode);
  36933. $1=lookup;
  36934. if(($receiver = $1) == null || $receiver.a$nil){
  36935. $2=$self._outerScope();
  36936. $ctx1.sendIdx["outerScope"]=1;
  36937. if(($receiver = $2) == null || $receiver.a$nil){
  36938. lookup=$2;
  36939. } else {
  36940. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  36941. }
  36942. lookup;
  36943. } else {
  36944. $1;
  36945. }
  36946. return lookup;
  36947. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  36948. },
  36949. args: ["aNode"],
  36950. source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup",
  36951. referencedClasses: [],
  36952. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  36953. }),
  36954. $globals.LexicalScope);
  36955. $core.addMethod(
  36956. $core.method({
  36957. selector: "methodScope",
  36958. protocol: "accessing",
  36959. fn: function (){
  36960. var self=this,$self=this;
  36961. return $core.withContext(function($ctx1) {
  36962. var $1,$receiver;
  36963. $1=$self._outerScope();
  36964. $ctx1.sendIdx["outerScope"]=1;
  36965. if(($receiver = $1) == null || $receiver.a$nil){
  36966. return $1;
  36967. } else {
  36968. return $recv($self._outerScope())._methodScope();
  36969. }
  36970. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  36971. },
  36972. args: [],
  36973. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  36974. referencedClasses: [],
  36975. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  36976. }),
  36977. $globals.LexicalScope);
  36978. $core.addMethod(
  36979. $core.method({
  36980. selector: "node",
  36981. protocol: "accessing",
  36982. fn: function (){
  36983. var self=this,$self=this;
  36984. return $self["@node"];
  36985. },
  36986. args: [],
  36987. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  36988. referencedClasses: [],
  36989. messageSends: []
  36990. }),
  36991. $globals.LexicalScope);
  36992. $core.addMethod(
  36993. $core.method({
  36994. selector: "node:",
  36995. protocol: "accessing",
  36996. fn: function (aNode){
  36997. var self=this,$self=this;
  36998. $self["@node"]=aNode;
  36999. return self;
  37000. },
  37001. args: ["aNode"],
  37002. source: "node: aNode\x0a\x09node := aNode",
  37003. referencedClasses: [],
  37004. messageSends: []
  37005. }),
  37006. $globals.LexicalScope);
  37007. $core.addMethod(
  37008. $core.method({
  37009. selector: "outerScope",
  37010. protocol: "accessing",
  37011. fn: function (){
  37012. var self=this,$self=this;
  37013. return $self["@outerScope"];
  37014. },
  37015. args: [],
  37016. source: "outerScope\x0a\x09^ outerScope",
  37017. referencedClasses: [],
  37018. messageSends: []
  37019. }),
  37020. $globals.LexicalScope);
  37021. $core.addMethod(
  37022. $core.method({
  37023. selector: "outerScope:",
  37024. protocol: "accessing",
  37025. fn: function (aLexicalScope){
  37026. var self=this,$self=this;
  37027. $self["@outerScope"]=aLexicalScope;
  37028. return self;
  37029. },
  37030. args: ["aLexicalScope"],
  37031. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37032. referencedClasses: [],
  37033. messageSends: []
  37034. }),
  37035. $globals.LexicalScope);
  37036. $core.addMethod(
  37037. $core.method({
  37038. selector: "pseudoVars",
  37039. protocol: "accessing",
  37040. fn: function (){
  37041. var self=this,$self=this;
  37042. return $core.withContext(function($ctx1) {
  37043. return $recv($self._methodScope())._pseudoVars();
  37044. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  37045. },
  37046. args: [],
  37047. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37048. referencedClasses: [],
  37049. messageSends: ["pseudoVars", "methodScope"]
  37050. }),
  37051. $globals.LexicalScope);
  37052. $core.addMethod(
  37053. $core.method({
  37054. selector: "scopeLevel",
  37055. protocol: "accessing",
  37056. fn: function (){
  37057. var self=this,$self=this;
  37058. return $core.withContext(function($ctx1) {
  37059. var $1,$2,$4,$3,$receiver;
  37060. $1=$self._outerScope();
  37061. $ctx1.sendIdx["outerScope"]=1;
  37062. if(($receiver = $1) == null || $receiver.a$nil){
  37063. return (1);
  37064. } else {
  37065. $1;
  37066. }
  37067. $2=$self._isInlined();
  37068. if($core.assert($2)){
  37069. $4=$self._outerScope();
  37070. $ctx1.sendIdx["outerScope"]=2;
  37071. $3=$recv($4)._scopeLevel();
  37072. $ctx1.sendIdx["scopeLevel"]=1;
  37073. return $3;
  37074. }
  37075. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37076. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  37077. },
  37078. args: [],
  37079. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37080. referencedClasses: [],
  37081. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37082. }),
  37083. $globals.LexicalScope);
  37084. $core.addMethod(
  37085. $core.method({
  37086. selector: "temps",
  37087. protocol: "accessing",
  37088. fn: function (){
  37089. var self=this,$self=this;
  37090. return $core.withContext(function($ctx1) {
  37091. var $1,$receiver;
  37092. $1=$self["@temps"];
  37093. if(($receiver = $1) == null || $receiver.a$nil){
  37094. $self["@temps"]=$recv($globals.Dictionary)._new();
  37095. return $self["@temps"];
  37096. } else {
  37097. return $1;
  37098. }
  37099. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  37100. },
  37101. args: [],
  37102. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37103. referencedClasses: ["Dictionary"],
  37104. messageSends: ["ifNil:", "new"]
  37105. }),
  37106. $globals.LexicalScope);
  37107. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37108. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37109. $core.addMethod(
  37110. $core.method({
  37111. selector: "addIVar:",
  37112. protocol: "adding",
  37113. fn: function (aString){
  37114. var self=this,$self=this;
  37115. return $core.withContext(function($ctx1) {
  37116. var $1;
  37117. $1=$self._iVars();
  37118. $ctx1.sendIdx["iVars"]=1;
  37119. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37120. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37121. return self;
  37122. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  37123. },
  37124. args: ["aString"],
  37125. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37126. referencedClasses: ["InstanceVar"],
  37127. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37128. }),
  37129. $globals.MethodLexicalScope);
  37130. $core.addMethod(
  37131. $core.method({
  37132. selector: "addNonLocalReturn:",
  37133. protocol: "adding",
  37134. fn: function (aScope){
  37135. var self=this,$self=this;
  37136. return $core.withContext(function($ctx1) {
  37137. $recv($self._nonLocalReturns())._add_(aScope);
  37138. return self;
  37139. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37140. },
  37141. args: ["aScope"],
  37142. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37143. referencedClasses: [],
  37144. messageSends: ["add:", "nonLocalReturns"]
  37145. }),
  37146. $globals.MethodLexicalScope);
  37147. $core.addMethod(
  37148. $core.method({
  37149. selector: "allVariableNames",
  37150. protocol: "accessing",
  37151. fn: function (){
  37152. var self=this,$self=this;
  37153. return $core.withContext(function($ctx1) {
  37154. var $1;
  37155. $1=(
  37156. $ctx1.supercall = true,
  37157. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  37158. $ctx1.supercall = false;
  37159. return $recv($1).__comma($recv($self._iVars())._keys());
  37160. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  37161. },
  37162. args: [],
  37163. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37164. referencedClasses: [],
  37165. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37166. }),
  37167. $globals.MethodLexicalScope);
  37168. $core.addMethod(
  37169. $core.method({
  37170. selector: "bindingFor:",
  37171. protocol: "accessing",
  37172. fn: function (aNode){
  37173. var self=this,$self=this;
  37174. return $core.withContext(function($ctx1) {
  37175. var $1,$receiver;
  37176. $1=(
  37177. $ctx1.supercall = true,
  37178. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  37179. $ctx1.supercall = false;
  37180. if(($receiver = $1) == null || $receiver.a$nil){
  37181. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  37182. return nil;
  37183. }));
  37184. } else {
  37185. return $1;
  37186. }
  37187. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  37188. },
  37189. args: ["aNode"],
  37190. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  37191. referencedClasses: [],
  37192. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  37193. }),
  37194. $globals.MethodLexicalScope);
  37195. $core.addMethod(
  37196. $core.method({
  37197. selector: "canInlineNonLocalReturns",
  37198. protocol: "testing",
  37199. fn: function (){
  37200. var self=this,$self=this;
  37201. return true;
  37202. },
  37203. args: [],
  37204. source: "canInlineNonLocalReturns\x0a\x09^ true",
  37205. referencedClasses: [],
  37206. messageSends: []
  37207. }),
  37208. $globals.MethodLexicalScope);
  37209. $core.addMethod(
  37210. $core.method({
  37211. selector: "hasLocalReturn",
  37212. protocol: "testing",
  37213. fn: function (){
  37214. var self=this,$self=this;
  37215. return $core.withContext(function($ctx1) {
  37216. return $self._localReturn();
  37217. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  37218. },
  37219. args: [],
  37220. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37221. referencedClasses: [],
  37222. messageSends: ["localReturn"]
  37223. }),
  37224. $globals.MethodLexicalScope);
  37225. $core.addMethod(
  37226. $core.method({
  37227. selector: "hasNonLocalReturn",
  37228. protocol: "testing",
  37229. fn: function (){
  37230. var self=this,$self=this;
  37231. return $core.withContext(function($ctx1) {
  37232. return $recv($self._nonLocalReturns())._notEmpty();
  37233. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  37234. },
  37235. args: [],
  37236. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37237. referencedClasses: [],
  37238. messageSends: ["notEmpty", "nonLocalReturns"]
  37239. }),
  37240. $globals.MethodLexicalScope);
  37241. $core.addMethod(
  37242. $core.method({
  37243. selector: "iVars",
  37244. protocol: "accessing",
  37245. fn: function (){
  37246. var self=this,$self=this;
  37247. return $core.withContext(function($ctx1) {
  37248. var $1,$receiver;
  37249. $1=$self["@iVars"];
  37250. if(($receiver = $1) == null || $receiver.a$nil){
  37251. $self["@iVars"]=$recv($globals.Dictionary)._new();
  37252. return $self["@iVars"];
  37253. } else {
  37254. return $1;
  37255. }
  37256. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  37257. },
  37258. args: [],
  37259. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37260. referencedClasses: ["Dictionary"],
  37261. messageSends: ["ifNil:", "new"]
  37262. }),
  37263. $globals.MethodLexicalScope);
  37264. $core.addMethod(
  37265. $core.method({
  37266. selector: "isMethodScope",
  37267. protocol: "testing",
  37268. fn: function (){
  37269. var self=this,$self=this;
  37270. return true;
  37271. },
  37272. args: [],
  37273. source: "isMethodScope\x0a\x09^ true",
  37274. referencedClasses: [],
  37275. messageSends: []
  37276. }),
  37277. $globals.MethodLexicalScope);
  37278. $core.addMethod(
  37279. $core.method({
  37280. selector: "localReturn",
  37281. protocol: "accessing",
  37282. fn: function (){
  37283. var self=this,$self=this;
  37284. return $core.withContext(function($ctx1) {
  37285. var $1,$receiver;
  37286. $1=$self["@localReturn"];
  37287. if(($receiver = $1) == null || $receiver.a$nil){
  37288. return false;
  37289. } else {
  37290. return $1;
  37291. }
  37292. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37293. },
  37294. args: [],
  37295. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37296. referencedClasses: [],
  37297. messageSends: ["ifNil:"]
  37298. }),
  37299. $globals.MethodLexicalScope);
  37300. $core.addMethod(
  37301. $core.method({
  37302. selector: "localReturn:",
  37303. protocol: "accessing",
  37304. fn: function (aBoolean){
  37305. var self=this,$self=this;
  37306. $self["@localReturn"]=aBoolean;
  37307. return self;
  37308. },
  37309. args: ["aBoolean"],
  37310. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37311. referencedClasses: [],
  37312. messageSends: []
  37313. }),
  37314. $globals.MethodLexicalScope);
  37315. $core.addMethod(
  37316. $core.method({
  37317. selector: "methodScope",
  37318. protocol: "accessing",
  37319. fn: function (){
  37320. var self=this,$self=this;
  37321. return self;
  37322. },
  37323. args: [],
  37324. source: "methodScope\x0a\x09^ self",
  37325. referencedClasses: [],
  37326. messageSends: []
  37327. }),
  37328. $globals.MethodLexicalScope);
  37329. $core.addMethod(
  37330. $core.method({
  37331. selector: "nonLocalReturns",
  37332. protocol: "accessing",
  37333. fn: function (){
  37334. var self=this,$self=this;
  37335. return $core.withContext(function($ctx1) {
  37336. var $1,$receiver;
  37337. $1=$self["@nonLocalReturns"];
  37338. if(($receiver = $1) == null || $receiver.a$nil){
  37339. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37340. return $self["@nonLocalReturns"];
  37341. } else {
  37342. return $1;
  37343. }
  37344. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37345. },
  37346. args: [],
  37347. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37348. referencedClasses: ["OrderedCollection"],
  37349. messageSends: ["ifNil:", "new"]
  37350. }),
  37351. $globals.MethodLexicalScope);
  37352. $core.addMethod(
  37353. $core.method({
  37354. selector: "pseudoVars",
  37355. protocol: "accessing",
  37356. fn: function (){
  37357. var self=this,$self=this;
  37358. return $core.withContext(function($ctx1) {
  37359. var $1,$2,$4,$3,$receiver;
  37360. $1=$self["@pseudoVars"];
  37361. if(($receiver = $1) == null || $receiver.a$nil){
  37362. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37363. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37364. return $core.withContext(function($ctx2) {
  37365. $2=$self["@pseudoVars"];
  37366. $4=$recv($globals.PseudoVar)._on_(each);
  37367. $recv($4)._scope_($self._methodScope());
  37368. $3=$recv($4)._yourself();
  37369. return $recv($2)._at_put_(each,$3);
  37370. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37371. }));
  37372. } else {
  37373. $1;
  37374. }
  37375. return $self["@pseudoVars"];
  37376. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37377. },
  37378. args: [],
  37379. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
  37380. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37381. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37382. }),
  37383. $globals.MethodLexicalScope);
  37384. $core.addMethod(
  37385. $core.method({
  37386. selector: "removeNonLocalReturn:",
  37387. protocol: "adding",
  37388. fn: function (aScope){
  37389. var self=this,$self=this;
  37390. return $core.withContext(function($ctx1) {
  37391. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37392. }));
  37393. return self;
  37394. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37395. },
  37396. args: ["aScope"],
  37397. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37398. referencedClasses: [],
  37399. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37400. }),
  37401. $globals.MethodLexicalScope);
  37402. $core.addMethod(
  37403. $core.method({
  37404. selector: "unknownVariables",
  37405. protocol: "accessing",
  37406. fn: function (){
  37407. var self=this,$self=this;
  37408. return $core.withContext(function($ctx1) {
  37409. var $1,$receiver;
  37410. $1=$self["@unknownVariables"];
  37411. if(($receiver = $1) == null || $receiver.a$nil){
  37412. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37413. return $self["@unknownVariables"];
  37414. } else {
  37415. return $1;
  37416. }
  37417. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37418. },
  37419. args: [],
  37420. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37421. referencedClasses: ["OrderedCollection"],
  37422. messageSends: ["ifNil:", "new"]
  37423. }),
  37424. $globals.MethodLexicalScope);
  37425. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37426. $globals.ScopeVar.comment="I am an entry in a LexicalScope that gets associated with variable nodes of the same name.\x0aThere are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars.";
  37427. $core.addMethod(
  37428. $core.method({
  37429. selector: "alias",
  37430. protocol: "accessing",
  37431. fn: function (){
  37432. var self=this,$self=this;
  37433. return $core.withContext(function($ctx1) {
  37434. return $recv($self._name())._asVariableName();
  37435. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37436. },
  37437. args: [],
  37438. source: "alias\x0a\x09^ self name asVariableName",
  37439. referencedClasses: [],
  37440. messageSends: ["asVariableName", "name"]
  37441. }),
  37442. $globals.ScopeVar);
  37443. $core.addMethod(
  37444. $core.method({
  37445. selector: "isArgVar",
  37446. protocol: "testing",
  37447. fn: function (){
  37448. var self=this,$self=this;
  37449. return false;
  37450. },
  37451. args: [],
  37452. source: "isArgVar\x0a\x09^ false",
  37453. referencedClasses: [],
  37454. messageSends: []
  37455. }),
  37456. $globals.ScopeVar);
  37457. $core.addMethod(
  37458. $core.method({
  37459. selector: "isClassRefVar",
  37460. protocol: "testing",
  37461. fn: function (){
  37462. var self=this,$self=this;
  37463. return false;
  37464. },
  37465. args: [],
  37466. source: "isClassRefVar\x0a\x09^ false",
  37467. referencedClasses: [],
  37468. messageSends: []
  37469. }),
  37470. $globals.ScopeVar);
  37471. $core.addMethod(
  37472. $core.method({
  37473. selector: "isImmutable",
  37474. protocol: "testing",
  37475. fn: function (){
  37476. var self=this,$self=this;
  37477. return false;
  37478. },
  37479. args: [],
  37480. source: "isImmutable\x0a\x09^ false",
  37481. referencedClasses: [],
  37482. messageSends: []
  37483. }),
  37484. $globals.ScopeVar);
  37485. $core.addMethod(
  37486. $core.method({
  37487. selector: "isInstanceVar",
  37488. protocol: "testing",
  37489. fn: function (){
  37490. var self=this,$self=this;
  37491. return false;
  37492. },
  37493. args: [],
  37494. source: "isInstanceVar\x0a\x09^ false",
  37495. referencedClasses: [],
  37496. messageSends: []
  37497. }),
  37498. $globals.ScopeVar);
  37499. $core.addMethod(
  37500. $core.method({
  37501. selector: "isPseudoVar",
  37502. protocol: "testing",
  37503. fn: function (){
  37504. var self=this,$self=this;
  37505. return false;
  37506. },
  37507. args: [],
  37508. source: "isPseudoVar\x0a\x09^ false",
  37509. referencedClasses: [],
  37510. messageSends: []
  37511. }),
  37512. $globals.ScopeVar);
  37513. $core.addMethod(
  37514. $core.method({
  37515. selector: "isSelf",
  37516. protocol: "testing",
  37517. fn: function (){
  37518. var self=this,$self=this;
  37519. return false;
  37520. },
  37521. args: [],
  37522. source: "isSelf\x0a\x09^ false",
  37523. referencedClasses: [],
  37524. messageSends: []
  37525. }),
  37526. $globals.ScopeVar);
  37527. $core.addMethod(
  37528. $core.method({
  37529. selector: "isSuper",
  37530. protocol: "testing",
  37531. fn: function (){
  37532. var self=this,$self=this;
  37533. return false;
  37534. },
  37535. args: [],
  37536. source: "isSuper\x0a\x09^ false",
  37537. referencedClasses: [],
  37538. messageSends: []
  37539. }),
  37540. $globals.ScopeVar);
  37541. $core.addMethod(
  37542. $core.method({
  37543. selector: "isTempVar",
  37544. protocol: "testing",
  37545. fn: function (){
  37546. var self=this,$self=this;
  37547. return false;
  37548. },
  37549. args: [],
  37550. source: "isTempVar\x0a\x09^ false",
  37551. referencedClasses: [],
  37552. messageSends: []
  37553. }),
  37554. $globals.ScopeVar);
  37555. $core.addMethod(
  37556. $core.method({
  37557. selector: "isUnknownVar",
  37558. protocol: "testing",
  37559. fn: function (){
  37560. var self=this,$self=this;
  37561. return false;
  37562. },
  37563. args: [],
  37564. source: "isUnknownVar\x0a\x09^ false",
  37565. referencedClasses: [],
  37566. messageSends: []
  37567. }),
  37568. $globals.ScopeVar);
  37569. $core.addMethod(
  37570. $core.method({
  37571. selector: "name",
  37572. protocol: "accessing",
  37573. fn: function (){
  37574. var self=this,$self=this;
  37575. return $self["@name"];
  37576. },
  37577. args: [],
  37578. source: "name\x0a\x09^ name",
  37579. referencedClasses: [],
  37580. messageSends: []
  37581. }),
  37582. $globals.ScopeVar);
  37583. $core.addMethod(
  37584. $core.method({
  37585. selector: "name:",
  37586. protocol: "accessing",
  37587. fn: function (aString){
  37588. var self=this,$self=this;
  37589. $self["@name"]=aString;
  37590. return self;
  37591. },
  37592. args: ["aString"],
  37593. source: "name: aString\x0a\x09name := aString",
  37594. referencedClasses: [],
  37595. messageSends: []
  37596. }),
  37597. $globals.ScopeVar);
  37598. $core.addMethod(
  37599. $core.method({
  37600. selector: "scope",
  37601. protocol: "accessing",
  37602. fn: function (){
  37603. var self=this,$self=this;
  37604. return $self["@scope"];
  37605. },
  37606. args: [],
  37607. source: "scope\x0a\x09^ scope",
  37608. referencedClasses: [],
  37609. messageSends: []
  37610. }),
  37611. $globals.ScopeVar);
  37612. $core.addMethod(
  37613. $core.method({
  37614. selector: "scope:",
  37615. protocol: "accessing",
  37616. fn: function (aScope){
  37617. var self=this,$self=this;
  37618. $self["@scope"]=aScope;
  37619. return self;
  37620. },
  37621. args: ["aScope"],
  37622. source: "scope: aScope\x0a\x09scope := aScope",
  37623. referencedClasses: [],
  37624. messageSends: []
  37625. }),
  37626. $globals.ScopeVar);
  37627. $core.addMethod(
  37628. $core.method({
  37629. selector: "validateAssignment",
  37630. protocol: "testing",
  37631. fn: function (){
  37632. var self=this,$self=this;
  37633. return $core.withContext(function($ctx1) {
  37634. var $1,$2;
  37635. $1=$recv($self._isArgVar())._or_((function(){
  37636. return $core.withContext(function($ctx2) {
  37637. return $self._isPseudoVar();
  37638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37639. }));
  37640. if($core.assert($1)){
  37641. $2=$recv($globals.InvalidAssignmentError)._new();
  37642. $recv($2)._variableName_($self._name());
  37643. $recv($2)._signal();
  37644. }
  37645. return self;
  37646. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37647. },
  37648. args: [],
  37649. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37650. referencedClasses: ["InvalidAssignmentError"],
  37651. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37652. }),
  37653. $globals.ScopeVar);
  37654. $core.addMethod(
  37655. $core.method({
  37656. selector: "on:",
  37657. protocol: "instance creation",
  37658. fn: function (aString){
  37659. var self=this,$self=this;
  37660. return $core.withContext(function($ctx1) {
  37661. var $1;
  37662. $1=$self._new();
  37663. $recv($1)._name_(aString);
  37664. return $recv($1)._yourself();
  37665. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37666. },
  37667. args: ["aString"],
  37668. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37669. referencedClasses: [],
  37670. messageSends: ["name:", "new", "yourself"]
  37671. }),
  37672. $globals.ScopeVar.a$cls);
  37673. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37674. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37675. $core.addMethod(
  37676. $core.method({
  37677. selector: "isImmutable",
  37678. protocol: "testing",
  37679. fn: function (){
  37680. var self=this,$self=this;
  37681. return true;
  37682. },
  37683. args: [],
  37684. source: "isImmutable\x0a\x09^ true",
  37685. referencedClasses: [],
  37686. messageSends: []
  37687. }),
  37688. $globals.AliasVar);
  37689. $core.addMethod(
  37690. $core.method({
  37691. selector: "node",
  37692. protocol: "accessing",
  37693. fn: function (){
  37694. var self=this,$self=this;
  37695. return $self["@node"];
  37696. },
  37697. args: [],
  37698. source: "node\x0a\x09^ node",
  37699. referencedClasses: [],
  37700. messageSends: []
  37701. }),
  37702. $globals.AliasVar);
  37703. $core.addMethod(
  37704. $core.method({
  37705. selector: "node:",
  37706. protocol: "accessing",
  37707. fn: function (aNode){
  37708. var self=this,$self=this;
  37709. $self["@node"]=aNode;
  37710. return self;
  37711. },
  37712. args: ["aNode"],
  37713. source: "node: aNode\x0a\x09node := aNode",
  37714. referencedClasses: [],
  37715. messageSends: []
  37716. }),
  37717. $globals.AliasVar);
  37718. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37719. $globals.ArgVar.comment="I am an argument of a method or block.";
  37720. $core.addMethod(
  37721. $core.method({
  37722. selector: "isArgVar",
  37723. protocol: "testing",
  37724. fn: function (){
  37725. var self=this,$self=this;
  37726. return true;
  37727. },
  37728. args: [],
  37729. source: "isArgVar\x0a\x09^ true",
  37730. referencedClasses: [],
  37731. messageSends: []
  37732. }),
  37733. $globals.ArgVar);
  37734. $core.addMethod(
  37735. $core.method({
  37736. selector: "isImmutable",
  37737. protocol: "testing",
  37738. fn: function (){
  37739. var self=this,$self=this;
  37740. return true;
  37741. },
  37742. args: [],
  37743. source: "isImmutable\x0a\x09^ true",
  37744. referencedClasses: [],
  37745. messageSends: []
  37746. }),
  37747. $globals.ArgVar);
  37748. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37749. $globals.ClassRefVar.comment="I am an class reference variable";
  37750. $core.addMethod(
  37751. $core.method({
  37752. selector: "alias",
  37753. protocol: "accessing",
  37754. fn: function (){
  37755. var self=this,$self=this;
  37756. return $core.withContext(function($ctx1) {
  37757. return "$globals.".__comma($self._name());
  37758. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37759. },
  37760. args: [],
  37761. source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$globals.', self name",
  37762. referencedClasses: [],
  37763. messageSends: [",", "name"]
  37764. }),
  37765. $globals.ClassRefVar);
  37766. $core.addMethod(
  37767. $core.method({
  37768. selector: "isClassRefVar",
  37769. protocol: "testing",
  37770. fn: function (){
  37771. var self=this,$self=this;
  37772. return true;
  37773. },
  37774. args: [],
  37775. source: "isClassRefVar\x0a\x09^ true",
  37776. referencedClasses: [],
  37777. messageSends: []
  37778. }),
  37779. $globals.ClassRefVar);
  37780. $core.addMethod(
  37781. $core.method({
  37782. selector: "isImmutable",
  37783. protocol: "testing",
  37784. fn: function (){
  37785. var self=this,$self=this;
  37786. return true;
  37787. },
  37788. args: [],
  37789. source: "isImmutable\x0a\x09^ true",
  37790. referencedClasses: [],
  37791. messageSends: []
  37792. }),
  37793. $globals.ClassRefVar);
  37794. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37795. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37796. $core.addMethod(
  37797. $core.method({
  37798. selector: "alias",
  37799. protocol: "testing",
  37800. fn: function (){
  37801. var self=this,$self=this;
  37802. return $core.withContext(function($ctx1) {
  37803. var $1;
  37804. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37805. $ctx1.sendIdx[","]=1;
  37806. return $1;
  37807. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37808. },
  37809. args: [],
  37810. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37811. referencedClasses: [],
  37812. messageSends: [",", "name"]
  37813. }),
  37814. $globals.InstanceVar);
  37815. $core.addMethod(
  37816. $core.method({
  37817. selector: "isInstanceVar",
  37818. protocol: "testing",
  37819. fn: function (){
  37820. var self=this,$self=this;
  37821. return true;
  37822. },
  37823. args: [],
  37824. source: "isInstanceVar\x0a\x09^ true",
  37825. referencedClasses: [],
  37826. messageSends: []
  37827. }),
  37828. $globals.InstanceVar);
  37829. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37830. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37831. $core.addMethod(
  37832. $core.method({
  37833. selector: "alias",
  37834. protocol: "accessing",
  37835. fn: function (){
  37836. var self=this,$self=this;
  37837. return $core.withContext(function($ctx1) {
  37838. return $self._name();
  37839. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37840. },
  37841. args: [],
  37842. source: "alias\x0a\x09^ self name",
  37843. referencedClasses: [],
  37844. messageSends: ["name"]
  37845. }),
  37846. $globals.PseudoVar);
  37847. $core.addMethod(
  37848. $core.method({
  37849. selector: "isImmutable",
  37850. protocol: "testing",
  37851. fn: function (){
  37852. var self=this,$self=this;
  37853. return true;
  37854. },
  37855. args: [],
  37856. source: "isImmutable\x0a\x09^ true",
  37857. referencedClasses: [],
  37858. messageSends: []
  37859. }),
  37860. $globals.PseudoVar);
  37861. $core.addMethod(
  37862. $core.method({
  37863. selector: "isPseudoVar",
  37864. protocol: "testing",
  37865. fn: function (){
  37866. var self=this,$self=this;
  37867. return true;
  37868. },
  37869. args: [],
  37870. source: "isPseudoVar\x0a\x09^ true",
  37871. referencedClasses: [],
  37872. messageSends: []
  37873. }),
  37874. $globals.PseudoVar);
  37875. $core.addMethod(
  37876. $core.method({
  37877. selector: "isSelf",
  37878. protocol: "testing",
  37879. fn: function (){
  37880. var self=this,$self=this;
  37881. return $core.withContext(function($ctx1) {
  37882. return $recv($self["@name"]).__eq("self");
  37883. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37884. },
  37885. args: [],
  37886. source: "isSelf\x0a\x09^ name = 'self'",
  37887. referencedClasses: [],
  37888. messageSends: ["="]
  37889. }),
  37890. $globals.PseudoVar);
  37891. $core.addMethod(
  37892. $core.method({
  37893. selector: "isSuper",
  37894. protocol: "testing",
  37895. fn: function (){
  37896. var self=this,$self=this;
  37897. return $core.withContext(function($ctx1) {
  37898. return $recv($self["@name"]).__eq("super");
  37899. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  37900. },
  37901. args: [],
  37902. source: "isSuper\x0a\x09^ name = 'super'",
  37903. referencedClasses: [],
  37904. messageSends: ["="]
  37905. }),
  37906. $globals.PseudoVar);
  37907. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37908. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  37909. $core.addMethod(
  37910. $core.method({
  37911. selector: "isTempVar",
  37912. protocol: "testing",
  37913. fn: function (){
  37914. var self=this,$self=this;
  37915. return true;
  37916. },
  37917. args: [],
  37918. source: "isTempVar\x0a\x09^ true",
  37919. referencedClasses: [],
  37920. messageSends: []
  37921. }),
  37922. $globals.TempVar);
  37923. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37924. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  37925. $core.addMethod(
  37926. $core.method({
  37927. selector: "isUnknownVar",
  37928. protocol: "testing",
  37929. fn: function (){
  37930. var self=this,$self=this;
  37931. return true;
  37932. },
  37933. args: [],
  37934. source: "isUnknownVar\x0a\x09^ true",
  37935. referencedClasses: [],
  37936. messageSends: []
  37937. }),
  37938. $globals.UnknownVar);
  37939. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  37940. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  37941. $core.addMethod(
  37942. $core.method({
  37943. selector: "classReferences",
  37944. protocol: "accessing",
  37945. fn: function (){
  37946. var self=this,$self=this;
  37947. return $core.withContext(function($ctx1) {
  37948. var $1,$receiver;
  37949. $1=$self["@classReferences"];
  37950. if(($receiver = $1) == null || $receiver.a$nil){
  37951. $self["@classReferences"]=$recv($globals.Set)._new();
  37952. return $self["@classReferences"];
  37953. } else {
  37954. return $1;
  37955. }
  37956. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  37957. },
  37958. args: [],
  37959. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  37960. referencedClasses: ["Set"],
  37961. messageSends: ["ifNil:", "new"]
  37962. }),
  37963. $globals.SemanticAnalyzer);
  37964. $core.addMethod(
  37965. $core.method({
  37966. selector: "errorShadowingVariable:",
  37967. protocol: "error handling",
  37968. fn: function (aString){
  37969. var self=this,$self=this;
  37970. return $core.withContext(function($ctx1) {
  37971. var $1;
  37972. $1=$recv($globals.ShadowingVariableError)._new();
  37973. $recv($1)._variableName_(aString);
  37974. $recv($1)._signal();
  37975. return self;
  37976. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  37977. },
  37978. args: ["aString"],
  37979. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  37980. referencedClasses: ["ShadowingVariableError"],
  37981. messageSends: ["variableName:", "new", "signal"]
  37982. }),
  37983. $globals.SemanticAnalyzer);
  37984. $core.addMethod(
  37985. $core.method({
  37986. selector: "errorUnknownVariable:",
  37987. protocol: "error handling",
  37988. fn: function (aNode){
  37989. var self=this,$self=this;
  37990. var identifier;
  37991. return $core.withContext(function($ctx1) {
  37992. var $1,$2,$3;
  37993. identifier=$recv(aNode)._value();
  37994. $ctx1.sendIdx["value"]=1;
  37995. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  37996. return $core.withContext(function($ctx2) {
  37997. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  37998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37999. }));
  38000. if($core.assert($1)){
  38001. $2=$recv($globals.UnknownVariableError)._new();
  38002. $3=$recv(aNode)._value();
  38003. $ctx1.sendIdx["value"]=2;
  38004. $recv($2)._variableName_($3);
  38005. $recv($2)._signal();
  38006. } else {
  38007. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  38008. }
  38009. return self;
  38010. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  38011. },
  38012. args: ["aNode"],
  38013. source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `window`, `document`, `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableUndefined: identifier inPackage: self thePackage ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
  38014. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  38015. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  38016. }),
  38017. $globals.SemanticAnalyzer);
  38018. $core.addMethod(
  38019. $core.method({
  38020. selector: "isVariableUndefined:inPackage:",
  38021. protocol: "testing",
  38022. fn: function (aString,aPackage){
  38023. var self=this,$self=this;
  38024. return $core.withContext(function($ctx1) {
  38025. var $1,$2,$receiver;
  38026. if(($receiver = aPackage) == null || $receiver.a$nil){
  38027. aPackage;
  38028. } else {
  38029. var packageKnownVars;
  38030. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  38031. $1=$recv(packageKnownVars)._includes_(aString);
  38032. if($core.assert($1)){
  38033. return false;
  38034. }
  38035. }
  38036. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  38037. $ctx1.sendIdx[","]=1;
  38038. return $recv($globals.Compiler)._eval_($2);
  38039. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  38040. },
  38041. args: ["aString", "aPackage"],
  38042. source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09aPackage ifNotNil: [\x0a\x09\x09| packageKnownVars |\x0a\x09\x09packageKnownVars := (aPackage imports\x0a\x09\x09\x09reject: #isString)\x0a\x09\x09\x09collect: #key.\x0a\x09\x09(packageKnownVars includes: aString) ifTrue: [ ^ false ]].\x0a\x09^ Compiler eval: 'typeof ', aString, ' === \x22undefined\x22'",
  38043. referencedClasses: ["Compiler"],
  38044. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  38045. }),
  38046. $globals.SemanticAnalyzer);
  38047. $core.addMethod(
  38048. $core.method({
  38049. selector: "messageSends",
  38050. protocol: "accessing",
  38051. fn: function (){
  38052. var self=this,$self=this;
  38053. return $core.withContext(function($ctx1) {
  38054. var $1,$receiver;
  38055. $1=$self["@messageSends"];
  38056. if(($receiver = $1) == null || $receiver.a$nil){
  38057. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  38058. return $self["@messageSends"];
  38059. } else {
  38060. return $1;
  38061. }
  38062. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  38063. },
  38064. args: [],
  38065. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38066. referencedClasses: ["Dictionary"],
  38067. messageSends: ["ifNil:", "new"]
  38068. }),
  38069. $globals.SemanticAnalyzer);
  38070. $core.addMethod(
  38071. $core.method({
  38072. selector: "newBlockScope",
  38073. protocol: "factory",
  38074. fn: function (){
  38075. var self=this,$self=this;
  38076. return $core.withContext(function($ctx1) {
  38077. return $self._newScopeOfClass_($globals.LexicalScope);
  38078. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  38079. },
  38080. args: [],
  38081. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38082. referencedClasses: ["LexicalScope"],
  38083. messageSends: ["newScopeOfClass:"]
  38084. }),
  38085. $globals.SemanticAnalyzer);
  38086. $core.addMethod(
  38087. $core.method({
  38088. selector: "newMethodScope",
  38089. protocol: "factory",
  38090. fn: function (){
  38091. var self=this,$self=this;
  38092. return $core.withContext(function($ctx1) {
  38093. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38094. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  38095. },
  38096. args: [],
  38097. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38098. referencedClasses: ["MethodLexicalScope"],
  38099. messageSends: ["newScopeOfClass:"]
  38100. }),
  38101. $globals.SemanticAnalyzer);
  38102. $core.addMethod(
  38103. $core.method({
  38104. selector: "newScopeOfClass:",
  38105. protocol: "factory",
  38106. fn: function (aLexicalScopeClass){
  38107. var self=this,$self=this;
  38108. return $core.withContext(function($ctx1) {
  38109. var $1;
  38110. $1=$recv(aLexicalScopeClass)._new();
  38111. $recv($1)._outerScope_($self["@currentScope"]);
  38112. return $recv($1)._yourself();
  38113. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  38114. },
  38115. args: ["aLexicalScopeClass"],
  38116. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38117. referencedClasses: [],
  38118. messageSends: ["outerScope:", "new", "yourself"]
  38119. }),
  38120. $globals.SemanticAnalyzer);
  38121. $core.addMethod(
  38122. $core.method({
  38123. selector: "nextBlockIndex",
  38124. protocol: "private",
  38125. fn: function (){
  38126. var self=this,$self=this;
  38127. return $core.withContext(function($ctx1) {
  38128. var $1,$receiver;
  38129. $1=$self["@blockIndex"];
  38130. if(($receiver = $1) == null || $receiver.a$nil){
  38131. $self["@blockIndex"]=(0);
  38132. $self["@blockIndex"];
  38133. } else {
  38134. $1;
  38135. }
  38136. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  38137. return $self["@blockIndex"];
  38138. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  38139. },
  38140. args: [],
  38141. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38142. referencedClasses: [],
  38143. messageSends: ["ifNil:", "+"]
  38144. }),
  38145. $globals.SemanticAnalyzer);
  38146. $core.addMethod(
  38147. $core.method({
  38148. selector: "popScope",
  38149. protocol: "scope",
  38150. fn: function (){
  38151. var self=this,$self=this;
  38152. return $core.withContext(function($ctx1) {
  38153. var $1,$receiver;
  38154. $1=$self["@currentScope"];
  38155. if(($receiver = $1) == null || $receiver.a$nil){
  38156. $1;
  38157. } else {
  38158. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  38159. $self["@currentScope"];
  38160. }
  38161. return self;
  38162. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  38163. },
  38164. args: [],
  38165. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38166. referencedClasses: [],
  38167. messageSends: ["ifNotNil:", "outerScope"]
  38168. }),
  38169. $globals.SemanticAnalyzer);
  38170. $core.addMethod(
  38171. $core.method({
  38172. selector: "pushScope:",
  38173. protocol: "scope",
  38174. fn: function (aScope){
  38175. var self=this,$self=this;
  38176. return $core.withContext(function($ctx1) {
  38177. $recv(aScope)._outerScope_($self["@currentScope"]);
  38178. $self["@currentScope"]=aScope;
  38179. return self;
  38180. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  38181. },
  38182. args: ["aScope"],
  38183. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38184. referencedClasses: [],
  38185. messageSends: ["outerScope:"]
  38186. }),
  38187. $globals.SemanticAnalyzer);
  38188. $core.addMethod(
  38189. $core.method({
  38190. selector: "theClass",
  38191. protocol: "accessing",
  38192. fn: function (){
  38193. var self=this,$self=this;
  38194. return $self["@theClass"];
  38195. },
  38196. args: [],
  38197. source: "theClass\x0a\x09^ theClass",
  38198. referencedClasses: [],
  38199. messageSends: []
  38200. }),
  38201. $globals.SemanticAnalyzer);
  38202. $core.addMethod(
  38203. $core.method({
  38204. selector: "theClass:",
  38205. protocol: "accessing",
  38206. fn: function (aClass){
  38207. var self=this,$self=this;
  38208. $self["@theClass"]=aClass;
  38209. return self;
  38210. },
  38211. args: ["aClass"],
  38212. source: "theClass: aClass\x0a\x09theClass := aClass",
  38213. referencedClasses: [],
  38214. messageSends: []
  38215. }),
  38216. $globals.SemanticAnalyzer);
  38217. $core.addMethod(
  38218. $core.method({
  38219. selector: "thePackage",
  38220. protocol: "accessing",
  38221. fn: function (){
  38222. var self=this,$self=this;
  38223. return $self["@thePackage"];
  38224. },
  38225. args: [],
  38226. source: "thePackage\x0a\x09^ thePackage",
  38227. referencedClasses: [],
  38228. messageSends: []
  38229. }),
  38230. $globals.SemanticAnalyzer);
  38231. $core.addMethod(
  38232. $core.method({
  38233. selector: "thePackage:",
  38234. protocol: "accessing",
  38235. fn: function (aPackage){
  38236. var self=this,$self=this;
  38237. $self["@thePackage"]=aPackage;
  38238. return self;
  38239. },
  38240. args: ["aPackage"],
  38241. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38242. referencedClasses: [],
  38243. messageSends: []
  38244. }),
  38245. $globals.SemanticAnalyzer);
  38246. $core.addMethod(
  38247. $core.method({
  38248. selector: "validateVariableScope:",
  38249. protocol: "scope",
  38250. fn: function (aString){
  38251. var self=this,$self=this;
  38252. return $core.withContext(function($ctx1) {
  38253. var $1,$receiver;
  38254. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  38255. if(($receiver = $1) == null || $receiver.a$nil){
  38256. $1;
  38257. } else {
  38258. $self._errorShadowingVariable_(aString);
  38259. }
  38260. return self;
  38261. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  38262. },
  38263. args: ["aString"],
  38264. source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]",
  38265. referencedClasses: [],
  38266. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38267. }),
  38268. $globals.SemanticAnalyzer);
  38269. $core.addMethod(
  38270. $core.method({
  38271. selector: "visitAssignmentNode:",
  38272. protocol: "visiting",
  38273. fn: function (aNode){
  38274. var self=this,$self=this;
  38275. return $core.withContext(function($ctx1) {
  38276. (
  38277. $ctx1.supercall = true,
  38278. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  38279. $ctx1.supercall = false;
  38280. $recv($recv(aNode)._left())._beAssigned();
  38281. return self;
  38282. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38283. },
  38284. args: ["aNode"],
  38285. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  38286. referencedClasses: [],
  38287. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  38288. }),
  38289. $globals.SemanticAnalyzer);
  38290. $core.addMethod(
  38291. $core.method({
  38292. selector: "visitBlockNode:",
  38293. protocol: "visiting",
  38294. fn: function (aNode){
  38295. var self=this,$self=this;
  38296. return $core.withContext(function($ctx1) {
  38297. $self._pushScope_($self._newBlockScope());
  38298. $recv(aNode)._scope_($self["@currentScope"]);
  38299. $recv($self["@currentScope"])._node_(aNode);
  38300. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  38301. $recv($recv(aNode)._parameters())._do_((function(each){
  38302. return $core.withContext(function($ctx2) {
  38303. $self._validateVariableScope_(each);
  38304. return $recv($self["@currentScope"])._addArg_(each);
  38305. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38306. }));
  38307. (
  38308. $ctx1.supercall = true,
  38309. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38310. $ctx1.supercall = false;
  38311. $self._popScope();
  38312. return self;
  38313. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38314. },
  38315. args: ["aNode"],
  38316. source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
  38317. referencedClasses: [],
  38318. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38319. }),
  38320. $globals.SemanticAnalyzer);
  38321. $core.addMethod(
  38322. $core.method({
  38323. selector: "visitCascadeNode:",
  38324. protocol: "visiting",
  38325. fn: function (aNode){
  38326. var self=this,$self=this;
  38327. return $core.withContext(function($ctx1) {
  38328. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38329. (
  38330. $ctx1.supercall = true,
  38331. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38332. $ctx1.supercall = false;
  38333. return self;
  38334. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38335. },
  38336. args: ["aNode"],
  38337. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38338. referencedClasses: [],
  38339. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38340. }),
  38341. $globals.SemanticAnalyzer);
  38342. $core.addMethod(
  38343. $core.method({
  38344. selector: "visitMethodNode:",
  38345. protocol: "visiting",
  38346. fn: function (aNode){
  38347. var self=this,$self=this;
  38348. return $core.withContext(function($ctx1) {
  38349. $self._pushScope_($self._newMethodScope());
  38350. $recv(aNode)._scope_($self["@currentScope"]);
  38351. $recv($self["@currentScope"])._node_(aNode);
  38352. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38353. return $core.withContext(function($ctx2) {
  38354. return $recv($self["@currentScope"])._addIVar_(each);
  38355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38356. }));
  38357. $ctx1.sendIdx["do:"]=1;
  38358. $recv($recv(aNode)._arguments())._do_((function(each){
  38359. return $core.withContext(function($ctx2) {
  38360. $self._validateVariableScope_(each);
  38361. return $recv($self["@currentScope"])._addArg_(each);
  38362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38363. }));
  38364. (
  38365. $ctx1.supercall = true,
  38366. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38367. $ctx1.supercall = false;
  38368. $recv(aNode)._classReferences_($self._classReferences());
  38369. $recv(aNode)._sendIndexes_($self._messageSends());
  38370. $self._popScope();
  38371. return aNode;
  38372. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38373. },
  38374. args: ["aNode"],
  38375. source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends.\x0a\x09self popScope.\x0a\x09^ aNode",
  38376. referencedClasses: [],
  38377. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38378. }),
  38379. $globals.SemanticAnalyzer);
  38380. $core.addMethod(
  38381. $core.method({
  38382. selector: "visitReturnNode:",
  38383. protocol: "visiting",
  38384. fn: function (aNode){
  38385. var self=this,$self=this;
  38386. return $core.withContext(function($ctx1) {
  38387. var $1;
  38388. $recv(aNode)._scope_($self["@currentScope"]);
  38389. $1=$recv($self["@currentScope"])._isMethodScope();
  38390. if($core.assert($1)){
  38391. $recv($self["@currentScope"])._localReturn_(true);
  38392. } else {
  38393. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38394. }
  38395. (
  38396. $ctx1.supercall = true,
  38397. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38398. $ctx1.supercall = false;
  38399. return self;
  38400. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38401. },
  38402. args: ["aNode"],
  38403. source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
  38404. referencedClasses: [],
  38405. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38406. }),
  38407. $globals.SemanticAnalyzer);
  38408. $core.addMethod(
  38409. $core.method({
  38410. selector: "visitSendNode:",
  38411. protocol: "visiting",
  38412. fn: function (aNode){
  38413. var self=this,$self=this;
  38414. var sends;
  38415. return $core.withContext(function($ctx1) {
  38416. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38417. return $core.withContext(function($ctx2) {
  38418. return $recv($globals.OrderedCollection)._new();
  38419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38420. }));
  38421. $recv(sends)._add_(aNode);
  38422. $recv(aNode)._index_($recv(sends)._size());
  38423. (
  38424. $ctx1.supercall = true,
  38425. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38426. $ctx1.supercall = false;
  38427. return self;
  38428. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38429. },
  38430. args: ["aNode"],
  38431. source: "visitSendNode: aNode\x0a\x0a\x09| sends |\x0a\x09sends := self messageSends at: aNode selector ifAbsentPut: [ OrderedCollection new ].\x0a\x09sends add: aNode.\x0a\x0a\x09aNode index: sends size.\x0a\x0a\x09super visitSendNode: aNode",
  38432. referencedClasses: ["OrderedCollection"],
  38433. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38434. }),
  38435. $globals.SemanticAnalyzer);
  38436. $core.addMethod(
  38437. $core.method({
  38438. selector: "visitSequenceNode:",
  38439. protocol: "visiting",
  38440. fn: function (aNode){
  38441. var self=this,$self=this;
  38442. return $core.withContext(function($ctx1) {
  38443. $recv($recv(aNode)._temps())._do_((function(each){
  38444. return $core.withContext(function($ctx2) {
  38445. $self._validateVariableScope_(each);
  38446. return $recv($self["@currentScope"])._addTemp_(each);
  38447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38448. }));
  38449. (
  38450. $ctx1.supercall = true,
  38451. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38452. $ctx1.supercall = false;
  38453. return self;
  38454. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38455. },
  38456. args: ["aNode"],
  38457. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38458. referencedClasses: [],
  38459. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38460. }),
  38461. $globals.SemanticAnalyzer);
  38462. $core.addMethod(
  38463. $core.method({
  38464. selector: "visitVariableNode:",
  38465. protocol: "visiting",
  38466. fn: function (aNode){
  38467. var self=this,$self=this;
  38468. var binding;
  38469. return $core.withContext(function($ctx1) {
  38470. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38471. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38472. $1=binding;
  38473. if(($receiver = $1) == null || $receiver.a$nil){
  38474. $3=$recv(aNode)._value();
  38475. $ctx1.sendIdx["value"]=1;
  38476. $2=$recv($3)._isCapitalized();
  38477. if($core.assert($2)){
  38478. $4=$recv($globals.ClassRefVar)._new();
  38479. $ctx1.sendIdx["new"]=1;
  38480. $5=$recv(aNode)._value();
  38481. $ctx1.sendIdx["value"]=2;
  38482. $recv($4)._name_($5);
  38483. $ctx1.sendIdx["name:"]=1;
  38484. $6=$recv($4)._yourself();
  38485. $ctx1.sendIdx["yourself"]=1;
  38486. binding=$6;
  38487. $7=$self._classReferences();
  38488. $8=$recv(aNode)._value();
  38489. $ctx1.sendIdx["value"]=3;
  38490. $recv($7)._add_($8);
  38491. } else {
  38492. $self._errorUnknownVariable_(aNode);
  38493. $9=$recv($globals.UnknownVar)._new();
  38494. $recv($9)._name_($recv(aNode)._value());
  38495. binding=$recv($9)._yourself();
  38496. binding;
  38497. }
  38498. } else {
  38499. $1;
  38500. }
  38501. $recv(aNode)._binding_(binding);
  38502. return self;
  38503. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38504. },
  38505. args: ["aNode"],
  38506. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.",
  38507. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38508. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38509. }),
  38510. $globals.SemanticAnalyzer);
  38511. $core.addMethod(
  38512. $core.method({
  38513. selector: "on:",
  38514. protocol: "instance creation",
  38515. fn: function (aClass){
  38516. var self=this,$self=this;
  38517. return $core.withContext(function($ctx1) {
  38518. var $1;
  38519. $1=$self._new();
  38520. $recv($1)._theClass_(aClass);
  38521. return $recv($1)._yourself();
  38522. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38523. },
  38524. args: ["aClass"],
  38525. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38526. referencedClasses: [],
  38527. messageSends: ["theClass:", "new", "yourself"]
  38528. }),
  38529. $globals.SemanticAnalyzer.a$cls);
  38530. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38531. $globals.SemanticError.comment="I represent an abstract semantic error thrown by the SemanticAnalyzer.\x0aSemantic errors can be unknown variable errors, etc.\x0aSee my subclasses for concrete errors.\x0a\x0aThe IDE should catch instances of Semantic error to deal with them when compiling";
  38532. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38533. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38534. $core.addMethod(
  38535. $core.method({
  38536. selector: "messageText",
  38537. protocol: "accessing",
  38538. fn: function (){
  38539. var self=this,$self=this;
  38540. return $core.withContext(function($ctx1) {
  38541. return " Invalid assignment to variable: ".__comma($self._variableName());
  38542. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38543. },
  38544. args: [],
  38545. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38546. referencedClasses: [],
  38547. messageSends: [",", "variableName"]
  38548. }),
  38549. $globals.InvalidAssignmentError);
  38550. $core.addMethod(
  38551. $core.method({
  38552. selector: "variableName",
  38553. protocol: "accessing",
  38554. fn: function (){
  38555. var self=this,$self=this;
  38556. return $self["@variableName"];
  38557. },
  38558. args: [],
  38559. source: "variableName\x0a\x09^ variableName",
  38560. referencedClasses: [],
  38561. messageSends: []
  38562. }),
  38563. $globals.InvalidAssignmentError);
  38564. $core.addMethod(
  38565. $core.method({
  38566. selector: "variableName:",
  38567. protocol: "accessing",
  38568. fn: function (aString){
  38569. var self=this,$self=this;
  38570. $self["@variableName"]=aString;
  38571. return self;
  38572. },
  38573. args: ["aString"],
  38574. source: "variableName: aString\x0a\x09variableName := aString",
  38575. referencedClasses: [],
  38576. messageSends: []
  38577. }),
  38578. $globals.InvalidAssignmentError);
  38579. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38580. $globals.ShadowingVariableError.comment="I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.";
  38581. $core.addMethod(
  38582. $core.method({
  38583. selector: "messageText",
  38584. protocol: "accessing",
  38585. fn: function (){
  38586. var self=this,$self=this;
  38587. return $core.withContext(function($ctx1) {
  38588. var $1;
  38589. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38590. $ctx1.sendIdx[","]=1;
  38591. return $1;
  38592. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38593. },
  38594. args: [],
  38595. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38596. referencedClasses: [],
  38597. messageSends: [",", "variableName"]
  38598. }),
  38599. $globals.ShadowingVariableError);
  38600. $core.addMethod(
  38601. $core.method({
  38602. selector: "variableName",
  38603. protocol: "accessing",
  38604. fn: function (){
  38605. var self=this,$self=this;
  38606. return $self["@variableName"];
  38607. },
  38608. args: [],
  38609. source: "variableName\x0a\x09^ variableName",
  38610. referencedClasses: [],
  38611. messageSends: []
  38612. }),
  38613. $globals.ShadowingVariableError);
  38614. $core.addMethod(
  38615. $core.method({
  38616. selector: "variableName:",
  38617. protocol: "accessing",
  38618. fn: function (aString){
  38619. var self=this,$self=this;
  38620. $self["@variableName"]=aString;
  38621. return self;
  38622. },
  38623. args: ["aString"],
  38624. source: "variableName: aString\x0a\x09variableName := aString",
  38625. referencedClasses: [],
  38626. messageSends: []
  38627. }),
  38628. $globals.ShadowingVariableError);
  38629. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38630. $globals.UnknownVariableError.comment="I get signaled when a variable is not defined.\x0aThe default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.";
  38631. $core.addMethod(
  38632. $core.method({
  38633. selector: "messageText",
  38634. protocol: "accessing",
  38635. fn: function (){
  38636. var self=this,$self=this;
  38637. return $core.withContext(function($ctx1) {
  38638. var $1;
  38639. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38640. $ctx1.sendIdx[","]=1;
  38641. return $1;
  38642. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38643. },
  38644. args: [],
  38645. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38646. referencedClasses: [],
  38647. messageSends: [",", "variableName"]
  38648. }),
  38649. $globals.UnknownVariableError);
  38650. $core.addMethod(
  38651. $core.method({
  38652. selector: "variableName",
  38653. protocol: "accessing",
  38654. fn: function (){
  38655. var self=this,$self=this;
  38656. return $self["@variableName"];
  38657. },
  38658. args: [],
  38659. source: "variableName\x0a\x09^ variableName",
  38660. referencedClasses: [],
  38661. messageSends: []
  38662. }),
  38663. $globals.UnknownVariableError);
  38664. $core.addMethod(
  38665. $core.method({
  38666. selector: "variableName:",
  38667. protocol: "accessing",
  38668. fn: function (aString){
  38669. var self=this,$self=this;
  38670. $self["@variableName"]=aString;
  38671. return self;
  38672. },
  38673. args: ["aString"],
  38674. source: "variableName: aString\x0a\x09variableName := aString",
  38675. referencedClasses: [],
  38676. messageSends: []
  38677. }),
  38678. $globals.UnknownVariableError);
  38679. $core.addMethod(
  38680. $core.method({
  38681. selector: "inlineJS:",
  38682. protocol: "*Compiler-Semantic",
  38683. fn: function (aString){
  38684. var self=this,$self=this;
  38685. return $core.withContext(function($ctx1) {
  38686. var $2,$1,$3,$5,$4;
  38687. $2=$self._sequenceNode();
  38688. $ctx1.sendIdx["sequenceNode"]=1;
  38689. $1=$recv($2)._dagChildren();
  38690. $recv($1)._ifNotEmpty_((function(){
  38691. return $core.withContext(function($ctx2) {
  38692. return $self._error_("inlineJS: does not allow smalltalk statements");
  38693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38694. }));
  38695. $3=$self._sequenceNode();
  38696. $5=$recv($globals.JSStatementNode)._new();
  38697. $recv($5)._source_(aString);
  38698. $4=$recv($5)._yourself();
  38699. $recv($3)._addDagChild_($4);
  38700. return self;
  38701. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString},$globals.EarlyPragmator)});
  38702. },
  38703. args: ["aString"],
  38704. source: "inlineJS: aString\x0a\x09self sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09self error: 'inlineJS: does not allow smalltalk statements' ].\x0a\x09self sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  38705. referencedClasses: ["JSStatementNode"],
  38706. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "error:", "addDagChild:", "source:", "new", "yourself"]
  38707. }),
  38708. $globals.EarlyPragmator);
  38709. });
  38710. define('amber_core/Compiler-IR',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  38711. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38712. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38713. $core.addPackage("Compiler-IR");
  38714. ($core.packageDescriptors||$core.packages)["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  38715. ($core.packageDescriptors||$core.packages)["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38716. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38717. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38718. $core.addMethod(
  38719. $core.method({
  38720. selector: "addToSequence:",
  38721. protocol: "visiting",
  38722. fn: function (anInstruction){
  38723. var self=this,$self=this;
  38724. return $core.withContext(function($ctx1) {
  38725. var $1,$receiver;
  38726. if(($receiver = anInstruction) == null || $receiver.a$nil){
  38727. anInstruction;
  38728. } else {
  38729. $1=$recv(anInstruction)._isVariable();
  38730. if(!$core.assert($1)){
  38731. $recv($self._sequence())._add_(anInstruction);
  38732. }
  38733. }
  38734. return anInstruction;
  38735. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction},$globals.IRASTTranslator)});
  38736. },
  38737. args: ["anInstruction"],
  38738. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  38739. referencedClasses: [],
  38740. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  38741. }),
  38742. $globals.IRASTTranslator);
  38743. $core.addMethod(
  38744. $core.method({
  38745. selector: "alias:",
  38746. protocol: "visiting",
  38747. fn: function (aNode){
  38748. var self=this,$self=this;
  38749. var variable;
  38750. return $core.withContext(function($ctx1) {
  38751. var $1,$2,$3,$5,$4,$6,$8,$7;
  38752. $1=$recv(aNode)._isImmutable();
  38753. if($core.assert($1)){
  38754. $2=$self._visit_(aNode);
  38755. $ctx1.sendIdx["visit:"]=1;
  38756. return $2;
  38757. }
  38758. $3=$recv($globals.IRVariable)._new();
  38759. $ctx1.sendIdx["new"]=1;
  38760. $5=$recv($globals.AliasVar)._new();
  38761. $ctx1.sendIdx["new"]=2;
  38762. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38763. $recv($3)._variable_($4);
  38764. $6=$recv($3)._yourself();
  38765. $ctx1.sendIdx["yourself"]=1;
  38766. variable=$6;
  38767. $8=$recv($globals.IRAssignment)._new();
  38768. $recv($8)._add_(variable);
  38769. $ctx1.sendIdx["add:"]=1;
  38770. $recv($8)._add_($self._visit_(aNode));
  38771. $ctx1.sendIdx["add:"]=2;
  38772. $7=$recv($8)._yourself();
  38773. $self._addToSequence_($7);
  38774. $recv($recv($self._method())._internalVariables())._add_(variable);
  38775. return variable;
  38776. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38777. },
  38778. args: ["aNode"],
  38779. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  38780. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38781. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  38782. }),
  38783. $globals.IRASTTranslator);
  38784. $core.addMethod(
  38785. $core.method({
  38786. selector: "aliasTemporally:",
  38787. protocol: "visiting",
  38788. fn: function (aCollection){
  38789. var self=this,$self=this;
  38790. var threshold,result;
  38791. return $core.withContext(function($ctx1) {
  38792. var $1,$2,$4,$3;
  38793. threshold=(0);
  38794. $recv(aCollection)._withIndexDo_((function(each,i){
  38795. return $core.withContext(function($ctx2) {
  38796. $1=$recv(each)._subtreeNeedsAliasing();
  38797. if($core.assert($1)){
  38798. threshold=i;
  38799. return threshold;
  38800. }
  38801. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38802. }));
  38803. $ctx1.sendIdx["withIndexDo:"]=1;
  38804. result=$recv($globals.OrderedCollection)._new();
  38805. $recv(aCollection)._withIndexDo_((function(each,i){
  38806. return $core.withContext(function($ctx2) {
  38807. $2=result;
  38808. $4=$recv(i).__lt_eq(threshold);
  38809. if($core.assert($4)){
  38810. $3=$self._alias_(each);
  38811. } else {
  38812. $3=$self._visit_(each);
  38813. }
  38814. return $recv($2)._add_($3);
  38815. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38816. }));
  38817. return result;
  38818. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38819. },
  38820. args: ["aCollection"],
  38821. source: "aliasTemporally: aCollection\x0a\x09\x22https://lolg.it/amber/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result",
  38822. referencedClasses: ["OrderedCollection"],
  38823. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38824. }),
  38825. $globals.IRASTTranslator);
  38826. $core.addMethod(
  38827. $core.method({
  38828. selector: "method",
  38829. protocol: "accessing",
  38830. fn: function (){
  38831. var self=this,$self=this;
  38832. return $self["@method"];
  38833. },
  38834. args: [],
  38835. source: "method\x0a\x09^ method",
  38836. referencedClasses: [],
  38837. messageSends: []
  38838. }),
  38839. $globals.IRASTTranslator);
  38840. $core.addMethod(
  38841. $core.method({
  38842. selector: "method:",
  38843. protocol: "accessing",
  38844. fn: function (anIRMethod){
  38845. var self=this,$self=this;
  38846. $self["@method"]=anIRMethod;
  38847. return self;
  38848. },
  38849. args: ["anIRMethod"],
  38850. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38851. referencedClasses: [],
  38852. messageSends: []
  38853. }),
  38854. $globals.IRASTTranslator);
  38855. $core.addMethod(
  38856. $core.method({
  38857. selector: "nextAlias",
  38858. protocol: "accessing",
  38859. fn: function (){
  38860. var self=this,$self=this;
  38861. return $core.withContext(function($ctx1) {
  38862. var $1,$receiver;
  38863. $1=$self["@nextAlias"];
  38864. if(($receiver = $1) == null || $receiver.a$nil){
  38865. $self["@nextAlias"]=(0);
  38866. $self["@nextAlias"];
  38867. } else {
  38868. $1;
  38869. }
  38870. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38871. return $recv($self["@nextAlias"])._asString();
  38872. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38873. },
  38874. args: [],
  38875. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38876. referencedClasses: [],
  38877. messageSends: ["ifNil:", "+", "asString"]
  38878. }),
  38879. $globals.IRASTTranslator);
  38880. $core.addMethod(
  38881. $core.method({
  38882. selector: "sequence",
  38883. protocol: "accessing",
  38884. fn: function (){
  38885. var self=this,$self=this;
  38886. return $self["@sequence"];
  38887. },
  38888. args: [],
  38889. source: "sequence\x0a\x09^ sequence",
  38890. referencedClasses: [],
  38891. messageSends: []
  38892. }),
  38893. $globals.IRASTTranslator);
  38894. $core.addMethod(
  38895. $core.method({
  38896. selector: "sequence:",
  38897. protocol: "accessing",
  38898. fn: function (anIRSequence){
  38899. var self=this,$self=this;
  38900. $self["@sequence"]=anIRSequence;
  38901. return self;
  38902. },
  38903. args: ["anIRSequence"],
  38904. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  38905. referencedClasses: [],
  38906. messageSends: []
  38907. }),
  38908. $globals.IRASTTranslator);
  38909. $core.addMethod(
  38910. $core.method({
  38911. selector: "source",
  38912. protocol: "accessing",
  38913. fn: function (){
  38914. var self=this,$self=this;
  38915. return $self["@source"];
  38916. },
  38917. args: [],
  38918. source: "source\x0a\x09^ source",
  38919. referencedClasses: [],
  38920. messageSends: []
  38921. }),
  38922. $globals.IRASTTranslator);
  38923. $core.addMethod(
  38924. $core.method({
  38925. selector: "source:",
  38926. protocol: "accessing",
  38927. fn: function (aString){
  38928. var self=this,$self=this;
  38929. $self["@source"]=aString;
  38930. return self;
  38931. },
  38932. args: ["aString"],
  38933. source: "source: aString\x0a\x09source := aString",
  38934. referencedClasses: [],
  38935. messageSends: []
  38936. }),
  38937. $globals.IRASTTranslator);
  38938. $core.addMethod(
  38939. $core.method({
  38940. selector: "theClass",
  38941. protocol: "accessing",
  38942. fn: function (){
  38943. var self=this,$self=this;
  38944. return $self["@theClass"];
  38945. },
  38946. args: [],
  38947. source: "theClass\x0a\x09^ theClass",
  38948. referencedClasses: [],
  38949. messageSends: []
  38950. }),
  38951. $globals.IRASTTranslator);
  38952. $core.addMethod(
  38953. $core.method({
  38954. selector: "theClass:",
  38955. protocol: "accessing",
  38956. fn: function (aClass){
  38957. var self=this,$self=this;
  38958. $self["@theClass"]=aClass;
  38959. return self;
  38960. },
  38961. args: ["aClass"],
  38962. source: "theClass: aClass\x0a\x09theClass := aClass",
  38963. referencedClasses: [],
  38964. messageSends: []
  38965. }),
  38966. $globals.IRASTTranslator);
  38967. $core.addMethod(
  38968. $core.method({
  38969. selector: "visitAssignmentNode:",
  38970. protocol: "visiting",
  38971. fn: function (aNode){
  38972. var self=this,$self=this;
  38973. var left,right,assignment;
  38974. return $core.withContext(function($ctx1) {
  38975. var $2,$1;
  38976. right=$self._visit_($recv(aNode)._right());
  38977. $ctx1.sendIdx["visit:"]=1;
  38978. left=$self._visit_($recv(aNode)._left());
  38979. $2=$recv($globals.IRAssignment)._new();
  38980. $recv($2)._add_(left);
  38981. $ctx1.sendIdx["add:"]=1;
  38982. $recv($2)._add_(right);
  38983. $1=$recv($2)._yourself();
  38984. $self._addToSequence_($1);
  38985. return left;
  38986. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  38987. },
  38988. args: ["aNode"],
  38989. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  38990. referencedClasses: ["IRAssignment"],
  38991. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  38992. }),
  38993. $globals.IRASTTranslator);
  38994. $core.addMethod(
  38995. $core.method({
  38996. selector: "visitBlockNode:",
  38997. protocol: "visiting",
  38998. fn: function (aNode){
  38999. var self=this,$self=this;
  39000. var closure;
  39001. return $core.withContext(function($ctx1) {
  39002. var $1,$2,$3,$5,$4,$6,$8,$7;
  39003. $1=$recv($globals.IRClosure)._new();
  39004. $ctx1.sendIdx["new"]=1;
  39005. $recv($1)._arguments_($recv(aNode)._parameters());
  39006. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39007. $2=$recv(aNode)._scope();
  39008. $ctx1.sendIdx["scope"]=1;
  39009. $recv($1)._scope_($2);
  39010. $ctx1.sendIdx["scope:"]=1;
  39011. $3=$recv($1)._yourself();
  39012. $ctx1.sendIdx["yourself"]=1;
  39013. closure=$3;
  39014. $5=$recv(aNode)._scope();
  39015. $ctx1.sendIdx["scope"]=2;
  39016. $4=$recv($5)._temps();
  39017. $recv($4)._do_((function(each){
  39018. return $core.withContext(function($ctx2) {
  39019. $6=closure;
  39020. $8=$recv($globals.IRTempDeclaration)._new();
  39021. $recv($8)._name_($recv(each)._name());
  39022. $recv($8)._scope_($recv(aNode)._scope());
  39023. $7=$recv($8)._yourself();
  39024. return $recv($6)._add_($7);
  39025. $ctx2.sendIdx["add:"]=1;
  39026. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39027. }));
  39028. $ctx1.sendIdx["do:"]=1;
  39029. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39030. return $core.withContext(function($ctx2) {
  39031. return $recv(closure)._add_($self._visit_(each));
  39032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39033. }));
  39034. return closure;
  39035. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  39036. },
  39037. args: ["aNode"],
  39038. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode dagChildren do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  39039. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39040. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  39041. }),
  39042. $globals.IRASTTranslator);
  39043. $core.addMethod(
  39044. $core.method({
  39045. selector: "visitBlockSequenceNode:",
  39046. protocol: "visiting",
  39047. fn: function (aNode){
  39048. var self=this,$self=this;
  39049. return $core.withContext(function($ctx1) {
  39050. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  39051. $1=$recv($globals.IRBlockSequence)._new();
  39052. $ctx1.sendIdx["new"]=1;
  39053. return $self._withSequence_do_($1,(function(){
  39054. return $core.withContext(function($ctx2) {
  39055. $2=$recv(aNode)._dagChildren();
  39056. $ctx2.sendIdx["dagChildren"]=1;
  39057. return $recv($2)._ifNotEmpty_((function(){
  39058. return $core.withContext(function($ctx3) {
  39059. $4=$recv(aNode)._dagChildren();
  39060. $ctx3.sendIdx["dagChildren"]=2;
  39061. $3=$recv($4)._allButLast();
  39062. $recv($3)._do_((function(each){
  39063. return $core.withContext(function($ctx4) {
  39064. $5=$self._visitOrAlias_(each);
  39065. $ctx4.sendIdx["visitOrAlias:"]=1;
  39066. return $self._addToSequence_($5);
  39067. $ctx4.sendIdx["addToSequence:"]=1;
  39068. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39069. }));
  39070. $8=$recv(aNode)._dagChildren();
  39071. $ctx3.sendIdx["dagChildren"]=3;
  39072. $7=$recv($8)._last();
  39073. $ctx3.sendIdx["last"]=1;
  39074. $6=$recv($7)._isReturnNode();
  39075. if($core.assert($6)){
  39076. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  39077. } else {
  39078. $10=$recv($globals.IRBlockReturn)._new();
  39079. $13=$recv(aNode)._dagChildren();
  39080. $ctx3.sendIdx["dagChildren"]=4;
  39081. $12=$recv($13)._last();
  39082. $ctx3.sendIdx["last"]=2;
  39083. $11=$self._visitOrAlias_($12);
  39084. $ctx3.sendIdx["visitOrAlias:"]=2;
  39085. $recv($10)._add_($11);
  39086. $9=$recv($10)._yourself();
  39087. return $self._addToSequence_($9);
  39088. $ctx3.sendIdx["addToSequence:"]=2;
  39089. }
  39090. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39091. }));
  39092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39093. }));
  39094. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39095. },
  39096. args: ["aNode"],
  39097. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren ifNotEmpty: [\x0a\x09\x09\x09\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self addToSequence: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self addToSequence: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self addToSequence: (self visitOrAlias: aNode dagChildren last) ] ]]",
  39098. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39099. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39100. }),
  39101. $globals.IRASTTranslator);
  39102. $core.addMethod(
  39103. $core.method({
  39104. selector: "visitCascadeNode:",
  39105. protocol: "visiting",
  39106. fn: function (aNode){
  39107. var self=this,$self=this;
  39108. var receiver;
  39109. return $core.withContext(function($ctx1) {
  39110. var $1,$2,$4,$3;
  39111. receiver=$recv(aNode)._receiver();
  39112. $1=$recv(receiver)._isImmutable();
  39113. if(!$core.assert($1)){
  39114. var alias;
  39115. alias=$self._alias_(receiver);
  39116. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39117. receiver;
  39118. }
  39119. $2=$recv(aNode)._dagChildren();
  39120. $ctx1.sendIdx["dagChildren"]=1;
  39121. $recv($2)._do_((function(each){
  39122. return $core.withContext(function($ctx2) {
  39123. return $recv(each)._receiver_(receiver);
  39124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39125. }));
  39126. $ctx1.sendIdx["do:"]=1;
  39127. $4=$recv(aNode)._dagChildren();
  39128. $ctx1.sendIdx["dagChildren"]=2;
  39129. $3=$recv($4)._allButLast();
  39130. $recv($3)._do_((function(each){
  39131. return $core.withContext(function($ctx2) {
  39132. return $self._addToSequence_($self._visit_(each));
  39133. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39134. }));
  39135. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  39136. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  39137. },
  39138. args: ["aNode"],
  39139. source: "visitCascadeNode: aNode\x0a\x09| receiver |\x0a\x09receiver := aNode receiver.\x0a\x09receiver isImmutable ifFalse: [\x0a\x09\x09| alias |\x0a\x09\x09alias := self alias: receiver.\x0a\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09aNode dagChildren do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode dagChildren allButLast do: [ :each |\x0a\x09\x09self addToSequence: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  39140. referencedClasses: ["VariableNode"],
  39141. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  39142. }),
  39143. $globals.IRASTTranslator);
  39144. $core.addMethod(
  39145. $core.method({
  39146. selector: "visitDynamicArrayNode:",
  39147. protocol: "visiting",
  39148. fn: function (aNode){
  39149. var self=this,$self=this;
  39150. var array;
  39151. return $core.withContext(function($ctx1) {
  39152. array=$recv($globals.IRDynamicArray)._new();
  39153. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39154. return $core.withContext(function($ctx2) {
  39155. return $recv(array)._add_(each);
  39156. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39157. }));
  39158. return array;
  39159. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  39160. },
  39161. args: ["aNode"],
  39162. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39163. referencedClasses: ["IRDynamicArray"],
  39164. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39165. }),
  39166. $globals.IRASTTranslator);
  39167. $core.addMethod(
  39168. $core.method({
  39169. selector: "visitDynamicDictionaryNode:",
  39170. protocol: "visiting",
  39171. fn: function (aNode){
  39172. var self=this,$self=this;
  39173. var dictionary;
  39174. return $core.withContext(function($ctx1) {
  39175. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39176. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39177. return $core.withContext(function($ctx2) {
  39178. return $recv(dictionary)._add_(each);
  39179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39180. }));
  39181. return dictionary;
  39182. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  39183. },
  39184. args: ["aNode"],
  39185. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39186. referencedClasses: ["IRDynamicDictionary"],
  39187. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39188. }),
  39189. $globals.IRASTTranslator);
  39190. $core.addMethod(
  39191. $core.method({
  39192. selector: "visitJSStatementNode:",
  39193. protocol: "visiting",
  39194. fn: function (aNode){
  39195. var self=this,$self=this;
  39196. return $core.withContext(function($ctx1) {
  39197. var $1;
  39198. $1=$recv($globals.IRVerbatim)._new();
  39199. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39200. return $recv($1)._yourself();
  39201. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39202. },
  39203. args: ["aNode"],
  39204. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39205. referencedClasses: ["IRVerbatim"],
  39206. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39207. }),
  39208. $globals.IRASTTranslator);
  39209. $core.addMethod(
  39210. $core.method({
  39211. selector: "visitMethodNode:",
  39212. protocol: "visiting",
  39213. fn: function (aNode){
  39214. var self=this,$self=this;
  39215. return $core.withContext(function($ctx1) {
  39216. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  39217. $2=$recv($globals.IRMethod)._new();
  39218. $ctx1.sendIdx["new"]=1;
  39219. $recv($2)._source_($recv($self._source())._crlfSanitized());
  39220. $ctx1.sendIdx["source:"]=1;
  39221. $recv($2)._theClass_($self._theClass());
  39222. $recv($2)._arguments_($recv(aNode)._arguments());
  39223. $recv($2)._selector_($recv(aNode)._selector());
  39224. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  39225. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39226. $recv($2)._classReferences_($recv(aNode)._classReferences());
  39227. $3=$recv(aNode)._scope();
  39228. $ctx1.sendIdx["scope"]=1;
  39229. $recv($2)._scope_($3);
  39230. $ctx1.sendIdx["scope:"]=1;
  39231. $4=$recv($2)._yourself();
  39232. $ctx1.sendIdx["yourself"]=1;
  39233. $1=$4;
  39234. $self._method_($1);
  39235. $6=$recv(aNode)._scope();
  39236. $ctx1.sendIdx["scope"]=2;
  39237. $5=$recv($6)._temps();
  39238. $recv($5)._do_((function(each){
  39239. return $core.withContext(function($ctx2) {
  39240. $7=$self._method();
  39241. $ctx2.sendIdx["method"]=1;
  39242. $9=$recv($globals.IRTempDeclaration)._new();
  39243. $ctx2.sendIdx["new"]=2;
  39244. $recv($9)._name_($recv(each)._name());
  39245. $10=$recv(aNode)._scope();
  39246. $ctx2.sendIdx["scope"]=3;
  39247. $recv($9)._scope_($10);
  39248. $11=$recv($9)._yourself();
  39249. $ctx2.sendIdx["yourself"]=2;
  39250. $8=$11;
  39251. return $recv($7)._add_($8);
  39252. $ctx2.sendIdx["add:"]=1;
  39253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39254. }));
  39255. $ctx1.sendIdx["do:"]=1;
  39256. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39257. return $core.withContext(function($ctx2) {
  39258. $12=$self._method();
  39259. $ctx2.sendIdx["method"]=2;
  39260. return $recv($12)._add_($self._visit_(each));
  39261. $ctx2.sendIdx["add:"]=2;
  39262. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39263. }));
  39264. $14=$recv(aNode)._scope();
  39265. $ctx1.sendIdx["scope"]=4;
  39266. $13=$recv($14)._hasLocalReturn();
  39267. if(!$core.assert($13)){
  39268. $15=$self._method();
  39269. $ctx1.sendIdx["method"]=3;
  39270. $17=$recv($globals.IRReturn)._new();
  39271. $ctx1.sendIdx["new"]=3;
  39272. $19=$recv($globals.IRVariable)._new();
  39273. $ctx1.sendIdx["new"]=4;
  39274. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39275. $20=$recv($19)._yourself();
  39276. $ctx1.sendIdx["yourself"]=3;
  39277. $18=$20;
  39278. $recv($17)._add_($18);
  39279. $ctx1.sendIdx["add:"]=4;
  39280. $21=$recv($17)._yourself();
  39281. $ctx1.sendIdx["yourself"]=4;
  39282. $16=$21;
  39283. $recv($15)._add_($16);
  39284. $ctx1.sendIdx["add:"]=3;
  39285. $23=$recv($globals.IRVerbatim)._new();
  39286. $recv($23)._source_(";".__comma($recv($globals.String)._lf()));
  39287. $22=$recv($23)._yourself();
  39288. $recv($15)._add_($22);
  39289. }
  39290. return $self._method();
  39291. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39292. },
  39293. args: ["aNode"],
  39294. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
  39295. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  39296. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
  39297. }),
  39298. $globals.IRASTTranslator);
  39299. $core.addMethod(
  39300. $core.method({
  39301. selector: "visitOrAlias:",
  39302. protocol: "visiting",
  39303. fn: function (aNode){
  39304. var self=this,$self=this;
  39305. return $core.withContext(function($ctx1) {
  39306. var $1;
  39307. $1=$recv(aNode)._shouldBeAliased();
  39308. if($core.assert($1)){
  39309. return $self._alias_(aNode);
  39310. } else {
  39311. return $self._visit_(aNode);
  39312. }
  39313. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  39314. },
  39315. args: ["aNode"],
  39316. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  39317. referencedClasses: [],
  39318. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  39319. }),
  39320. $globals.IRASTTranslator);
  39321. $core.addMethod(
  39322. $core.method({
  39323. selector: "visitReturnNode:",
  39324. protocol: "visiting",
  39325. fn: function (aNode){
  39326. var self=this,$self=this;
  39327. var return_;
  39328. return $core.withContext(function($ctx1) {
  39329. var $1;
  39330. $1=$recv(aNode)._nonLocalReturn();
  39331. if($core.assert($1)){
  39332. return_=$recv($globals.IRNonLocalReturn)._new();
  39333. $ctx1.sendIdx["new"]=1;
  39334. } else {
  39335. return_=$recv($globals.IRReturn)._new();
  39336. }
  39337. $recv(return_)._scope_($recv(aNode)._scope());
  39338. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39339. return $core.withContext(function($ctx2) {
  39340. return $recv(return_)._add_($self._visitOrAlias_(each));
  39341. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39342. }));
  39343. return return_;
  39344. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39345. },
  39346. args: ["aNode"],
  39347. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode dagChildren do: [ :each |\x0a\x09\x09return add: (self visitOrAlias: each) ].\x0a\x09^ return",
  39348. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39349. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39350. }),
  39351. $globals.IRASTTranslator);
  39352. $core.addMethod(
  39353. $core.method({
  39354. selector: "visitSendNode:",
  39355. protocol: "visiting",
  39356. fn: function (aNode){
  39357. var self=this,$self=this;
  39358. var send;
  39359. return $core.withContext(function($ctx1) {
  39360. var $1;
  39361. send=$recv($globals.IRSend)._new();
  39362. $1=send;
  39363. $recv($1)._selector_($recv(aNode)._selector());
  39364. $recv($1)._index_($recv(aNode)._index());
  39365. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39366. return $core.withContext(function($ctx2) {
  39367. return $recv(send)._add_(each);
  39368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39369. }));
  39370. return send;
  39371. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39372. },
  39373. args: ["aNode"],
  39374. source: "visitSendNode: aNode\x0a\x09| send |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  39375. referencedClasses: ["IRSend"],
  39376. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39377. }),
  39378. $globals.IRASTTranslator);
  39379. $core.addMethod(
  39380. $core.method({
  39381. selector: "visitSequenceNode:",
  39382. protocol: "visiting",
  39383. fn: function (aNode){
  39384. var self=this,$self=this;
  39385. return $core.withContext(function($ctx1) {
  39386. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39387. return $core.withContext(function($ctx2) {
  39388. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39389. return $core.withContext(function($ctx3) {
  39390. return $self._addToSequence_($self._visitOrAlias_(each));
  39391. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39392. }));
  39393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39394. }));
  39395. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39396. },
  39397. args: ["aNode"],
  39398. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [ aNode dagChildren do: [ :each |\x0a\x09\x09\x09self addToSequence: (self visitOrAlias: each) ] ]",
  39399. referencedClasses: ["IRSequence"],
  39400. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  39401. }),
  39402. $globals.IRASTTranslator);
  39403. $core.addMethod(
  39404. $core.method({
  39405. selector: "visitValueNode:",
  39406. protocol: "visiting",
  39407. fn: function (aNode){
  39408. var self=this,$self=this;
  39409. return $core.withContext(function($ctx1) {
  39410. var $1;
  39411. $1=$recv($globals.IRValue)._new();
  39412. $recv($1)._value_($recv(aNode)._value());
  39413. return $recv($1)._yourself();
  39414. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39415. },
  39416. args: ["aNode"],
  39417. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39418. referencedClasses: ["IRValue"],
  39419. messageSends: ["value:", "new", "value", "yourself"]
  39420. }),
  39421. $globals.IRASTTranslator);
  39422. $core.addMethod(
  39423. $core.method({
  39424. selector: "visitVariableNode:",
  39425. protocol: "visiting",
  39426. fn: function (aNode){
  39427. var self=this,$self=this;
  39428. return $core.withContext(function($ctx1) {
  39429. var $1;
  39430. $1=$recv($globals.IRVariable)._new();
  39431. $recv($1)._variable_($recv(aNode)._binding());
  39432. return $recv($1)._yourself();
  39433. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39434. },
  39435. args: ["aNode"],
  39436. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39437. referencedClasses: ["IRVariable"],
  39438. messageSends: ["variable:", "new", "binding", "yourself"]
  39439. }),
  39440. $globals.IRASTTranslator);
  39441. $core.addMethod(
  39442. $core.method({
  39443. selector: "withSequence:do:",
  39444. protocol: "accessing",
  39445. fn: function (aSequence,aBlock){
  39446. var self=this,$self=this;
  39447. var outerSequence;
  39448. return $core.withContext(function($ctx1) {
  39449. outerSequence=$self._sequence();
  39450. $self._sequence_(aSequence);
  39451. $ctx1.sendIdx["sequence:"]=1;
  39452. $recv(aBlock)._value();
  39453. $self._sequence_(outerSequence);
  39454. return aSequence;
  39455. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39456. },
  39457. args: ["aSequence", "aBlock"],
  39458. source: "withSequence: aSequence do: aBlock\x0a\x09| outerSequence |\x0a\x09outerSequence := self sequence.\x0a\x09self sequence: aSequence.\x0a\x09aBlock value.\x0a\x09self sequence: outerSequence.\x0a\x09^ aSequence",
  39459. referencedClasses: [],
  39460. messageSends: ["sequence", "sequence:", "value"]
  39461. }),
  39462. $globals.IRASTTranslator);
  39463. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39464. $globals.IRInstruction.comment="I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.\x0aThe IR graph is used to emit JavaScript code using a JSStream.";
  39465. $core.addMethod(
  39466. $core.method({
  39467. selector: "add:",
  39468. protocol: "building",
  39469. fn: function (anObject){
  39470. var self=this,$self=this;
  39471. return $core.withContext(function($ctx1) {
  39472. $recv(anObject)._parent_(self);
  39473. return $recv($self._dagChildren())._add_(anObject);
  39474. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39475. },
  39476. args: ["anObject"],
  39477. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39478. referencedClasses: [],
  39479. messageSends: ["parent:", "add:", "dagChildren"]
  39480. }),
  39481. $globals.IRInstruction);
  39482. $core.addMethod(
  39483. $core.method({
  39484. selector: "isClosure",
  39485. protocol: "testing",
  39486. fn: function (){
  39487. var self=this,$self=this;
  39488. return false;
  39489. },
  39490. args: [],
  39491. source: "isClosure\x0a\x09^ false",
  39492. referencedClasses: [],
  39493. messageSends: []
  39494. }),
  39495. $globals.IRInstruction);
  39496. $core.addMethod(
  39497. $core.method({
  39498. selector: "isInlined",
  39499. protocol: "testing",
  39500. fn: function (){
  39501. var self=this,$self=this;
  39502. return false;
  39503. },
  39504. args: [],
  39505. source: "isInlined\x0a\x09^ false",
  39506. referencedClasses: [],
  39507. messageSends: []
  39508. }),
  39509. $globals.IRInstruction);
  39510. $core.addMethod(
  39511. $core.method({
  39512. selector: "isMethod",
  39513. protocol: "testing",
  39514. fn: function (){
  39515. var self=this,$self=this;
  39516. return false;
  39517. },
  39518. args: [],
  39519. source: "isMethod\x0a\x09^ false",
  39520. referencedClasses: [],
  39521. messageSends: []
  39522. }),
  39523. $globals.IRInstruction);
  39524. $core.addMethod(
  39525. $core.method({
  39526. selector: "isSelf",
  39527. protocol: "testing",
  39528. fn: function (){
  39529. var self=this,$self=this;
  39530. return false;
  39531. },
  39532. args: [],
  39533. source: "isSelf\x0a\x09^ false",
  39534. referencedClasses: [],
  39535. messageSends: []
  39536. }),
  39537. $globals.IRInstruction);
  39538. $core.addMethod(
  39539. $core.method({
  39540. selector: "isSend",
  39541. protocol: "testing",
  39542. fn: function (){
  39543. var self=this,$self=this;
  39544. return false;
  39545. },
  39546. args: [],
  39547. source: "isSend\x0a\x09^ false",
  39548. referencedClasses: [],
  39549. messageSends: []
  39550. }),
  39551. $globals.IRInstruction);
  39552. $core.addMethod(
  39553. $core.method({
  39554. selector: "isSequence",
  39555. protocol: "testing",
  39556. fn: function (){
  39557. var self=this,$self=this;
  39558. return false;
  39559. },
  39560. args: [],
  39561. source: "isSequence\x0a\x09^ false",
  39562. referencedClasses: [],
  39563. messageSends: []
  39564. }),
  39565. $globals.IRInstruction);
  39566. $core.addMethod(
  39567. $core.method({
  39568. selector: "isSuper",
  39569. protocol: "testing",
  39570. fn: function (){
  39571. var self=this,$self=this;
  39572. return false;
  39573. },
  39574. args: [],
  39575. source: "isSuper\x0a\x09^ false",
  39576. referencedClasses: [],
  39577. messageSends: []
  39578. }),
  39579. $globals.IRInstruction);
  39580. $core.addMethod(
  39581. $core.method({
  39582. selector: "isTempDeclaration",
  39583. protocol: "testing",
  39584. fn: function (){
  39585. var self=this,$self=this;
  39586. return false;
  39587. },
  39588. args: [],
  39589. source: "isTempDeclaration\x0a\x09^ false",
  39590. referencedClasses: [],
  39591. messageSends: []
  39592. }),
  39593. $globals.IRInstruction);
  39594. $core.addMethod(
  39595. $core.method({
  39596. selector: "isVariable",
  39597. protocol: "testing",
  39598. fn: function (){
  39599. var self=this,$self=this;
  39600. return false;
  39601. },
  39602. args: [],
  39603. source: "isVariable\x0a\x09^ false",
  39604. referencedClasses: [],
  39605. messageSends: []
  39606. }),
  39607. $globals.IRInstruction);
  39608. $core.addMethod(
  39609. $core.method({
  39610. selector: "method",
  39611. protocol: "accessing",
  39612. fn: function (){
  39613. var self=this,$self=this;
  39614. return $core.withContext(function($ctx1) {
  39615. return $recv($self._parent())._method();
  39616. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39617. },
  39618. args: [],
  39619. source: "method\x0a\x09^ self parent method",
  39620. referencedClasses: [],
  39621. messageSends: ["method", "parent"]
  39622. }),
  39623. $globals.IRInstruction);
  39624. $core.addMethod(
  39625. $core.method({
  39626. selector: "needsBoxingAsReceiver",
  39627. protocol: "testing",
  39628. fn: function (){
  39629. var self=this,$self=this;
  39630. return true;
  39631. },
  39632. args: [],
  39633. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39634. referencedClasses: [],
  39635. messageSends: []
  39636. }),
  39637. $globals.IRInstruction);
  39638. $core.addMethod(
  39639. $core.method({
  39640. selector: "parent",
  39641. protocol: "accessing",
  39642. fn: function (){
  39643. var self=this,$self=this;
  39644. return $self["@parent"];
  39645. },
  39646. args: [],
  39647. source: "parent\x0a\x09^ parent",
  39648. referencedClasses: [],
  39649. messageSends: []
  39650. }),
  39651. $globals.IRInstruction);
  39652. $core.addMethod(
  39653. $core.method({
  39654. selector: "parent:",
  39655. protocol: "accessing",
  39656. fn: function (anIRInstruction){
  39657. var self=this,$self=this;
  39658. $self["@parent"]=anIRInstruction;
  39659. return self;
  39660. },
  39661. args: ["anIRInstruction"],
  39662. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39663. referencedClasses: [],
  39664. messageSends: []
  39665. }),
  39666. $globals.IRInstruction);
  39667. $core.addMethod(
  39668. $core.method({
  39669. selector: "remove:",
  39670. protocol: "building",
  39671. fn: function (anIRInstruction){
  39672. var self=this,$self=this;
  39673. return $core.withContext(function($ctx1) {
  39674. $recv($self._dagChildren())._remove_(anIRInstruction);
  39675. return self;
  39676. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39677. },
  39678. args: ["anIRInstruction"],
  39679. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39680. referencedClasses: [],
  39681. messageSends: ["remove:", "dagChildren"]
  39682. }),
  39683. $globals.IRInstruction);
  39684. $core.addMethod(
  39685. $core.method({
  39686. selector: "replace:with:",
  39687. protocol: "building",
  39688. fn: function (anIRInstruction,anotherIRInstruction){
  39689. var self=this,$self=this;
  39690. return $core.withContext(function($ctx1) {
  39691. var $1;
  39692. $recv(anotherIRInstruction)._parent_(self);
  39693. $1=$self._dagChildren();
  39694. $ctx1.sendIdx["dagChildren"]=1;
  39695. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39696. return self;
  39697. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39698. },
  39699. args: ["anIRInstruction", "anotherIRInstruction"],
  39700. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39701. referencedClasses: [],
  39702. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39703. }),
  39704. $globals.IRInstruction);
  39705. $core.addMethod(
  39706. $core.method({
  39707. selector: "replaceWith:",
  39708. protocol: "building",
  39709. fn: function (anIRInstruction){
  39710. var self=this,$self=this;
  39711. return $core.withContext(function($ctx1) {
  39712. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39713. return self;
  39714. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39715. },
  39716. args: ["anIRInstruction"],
  39717. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39718. referencedClasses: [],
  39719. messageSends: ["replace:with:", "parent"]
  39720. }),
  39721. $globals.IRInstruction);
  39722. $core.addMethod(
  39723. $core.method({
  39724. selector: "scope",
  39725. protocol: "accessing",
  39726. fn: function (){
  39727. var self=this,$self=this;
  39728. return $core.withContext(function($ctx1) {
  39729. var $1,$receiver;
  39730. $1=$self._parent();
  39731. if(($receiver = $1) == null || $receiver.a$nil){
  39732. return $1;
  39733. } else {
  39734. var node;
  39735. node=$receiver;
  39736. return $recv(node)._scope();
  39737. }
  39738. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39739. },
  39740. args: [],
  39741. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39742. referencedClasses: [],
  39743. messageSends: ["ifNotNil:", "parent", "scope"]
  39744. }),
  39745. $globals.IRInstruction);
  39746. $core.addMethod(
  39747. $core.method({
  39748. selector: "yieldsValue",
  39749. protocol: "testing",
  39750. fn: function (){
  39751. var self=this,$self=this;
  39752. return true;
  39753. },
  39754. args: [],
  39755. source: "yieldsValue\x0a\x09^ true",
  39756. referencedClasses: [],
  39757. messageSends: []
  39758. }),
  39759. $globals.IRInstruction);
  39760. $core.addMethod(
  39761. $core.method({
  39762. selector: "on:",
  39763. protocol: "instance creation",
  39764. fn: function (aBuilder){
  39765. var self=this,$self=this;
  39766. return $core.withContext(function($ctx1) {
  39767. var $1;
  39768. $1=$self._new();
  39769. $recv($1)._builder_(aBuilder);
  39770. return $recv($1)._yourself();
  39771. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39772. },
  39773. args: ["aBuilder"],
  39774. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39775. referencedClasses: [],
  39776. messageSends: ["builder:", "new", "yourself"]
  39777. }),
  39778. $globals.IRInstruction.a$cls);
  39779. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39780. $core.addMethod(
  39781. $core.method({
  39782. selector: "acceptDagVisitor:",
  39783. protocol: "visiting",
  39784. fn: function (aVisitor){
  39785. var self=this,$self=this;
  39786. return $core.withContext(function($ctx1) {
  39787. return $recv(aVisitor)._visitIRAssignment_(self);
  39788. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39789. },
  39790. args: ["aVisitor"],
  39791. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39792. referencedClasses: [],
  39793. messageSends: ["visitIRAssignment:"]
  39794. }),
  39795. $globals.IRAssignment);
  39796. $core.addMethod(
  39797. $core.method({
  39798. selector: "left",
  39799. protocol: "accessing",
  39800. fn: function (){
  39801. var self=this,$self=this;
  39802. return $core.withContext(function($ctx1) {
  39803. return $recv($self._dagChildren())._first();
  39804. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39805. },
  39806. args: [],
  39807. source: "left\x0a\x09^ self dagChildren first",
  39808. referencedClasses: [],
  39809. messageSends: ["first", "dagChildren"]
  39810. }),
  39811. $globals.IRAssignment);
  39812. $core.addMethod(
  39813. $core.method({
  39814. selector: "right",
  39815. protocol: "accessing",
  39816. fn: function (){
  39817. var self=this,$self=this;
  39818. return $core.withContext(function($ctx1) {
  39819. return $recv($self._dagChildren())._last();
  39820. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39821. },
  39822. args: [],
  39823. source: "right\x0a\x09^ self dagChildren last",
  39824. referencedClasses: [],
  39825. messageSends: ["last", "dagChildren"]
  39826. }),
  39827. $globals.IRAssignment);
  39828. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39829. $core.addMethod(
  39830. $core.method({
  39831. selector: "acceptDagVisitor:",
  39832. protocol: "visiting",
  39833. fn: function (aVisitor){
  39834. var self=this,$self=this;
  39835. return $core.withContext(function($ctx1) {
  39836. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39837. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39838. },
  39839. args: ["aVisitor"],
  39840. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39841. referencedClasses: [],
  39842. messageSends: ["visitIRDynamicArray:"]
  39843. }),
  39844. $globals.IRDynamicArray);
  39845. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39846. $core.addMethod(
  39847. $core.method({
  39848. selector: "acceptDagVisitor:",
  39849. protocol: "visiting",
  39850. fn: function (aVisitor){
  39851. var self=this,$self=this;
  39852. return $core.withContext(function($ctx1) {
  39853. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39854. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39855. },
  39856. args: ["aVisitor"],
  39857. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39858. referencedClasses: [],
  39859. messageSends: ["visitIRDynamicDictionary:"]
  39860. }),
  39861. $globals.IRDynamicDictionary);
  39862. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39863. $core.addMethod(
  39864. $core.method({
  39865. selector: "scope",
  39866. protocol: "accessing",
  39867. fn: function (){
  39868. var self=this,$self=this;
  39869. return $self["@scope"];
  39870. },
  39871. args: [],
  39872. source: "scope\x0a\x09^ scope",
  39873. referencedClasses: [],
  39874. messageSends: []
  39875. }),
  39876. $globals.IRScopedInstruction);
  39877. $core.addMethod(
  39878. $core.method({
  39879. selector: "scope:",
  39880. protocol: "accessing",
  39881. fn: function (aScope){
  39882. var self=this,$self=this;
  39883. $self["@scope"]=aScope;
  39884. return self;
  39885. },
  39886. args: ["aScope"],
  39887. source: "scope: aScope\x0a\x09scope := aScope",
  39888. referencedClasses: [],
  39889. messageSends: []
  39890. }),
  39891. $globals.IRScopedInstruction);
  39892. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  39893. $core.addMethod(
  39894. $core.method({
  39895. selector: "arguments",
  39896. protocol: "accessing",
  39897. fn: function (){
  39898. var self=this,$self=this;
  39899. return $core.withContext(function($ctx1) {
  39900. var $1,$receiver;
  39901. $1=$self["@arguments"];
  39902. if(($receiver = $1) == null || $receiver.a$nil){
  39903. return [];
  39904. } else {
  39905. return $1;
  39906. }
  39907. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  39908. },
  39909. args: [],
  39910. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  39911. referencedClasses: [],
  39912. messageSends: ["ifNil:"]
  39913. }),
  39914. $globals.IRClosureInstruction);
  39915. $core.addMethod(
  39916. $core.method({
  39917. selector: "arguments:",
  39918. protocol: "accessing",
  39919. fn: function (aCollection){
  39920. var self=this,$self=this;
  39921. $self["@arguments"]=aCollection;
  39922. return self;
  39923. },
  39924. args: ["aCollection"],
  39925. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  39926. referencedClasses: [],
  39927. messageSends: []
  39928. }),
  39929. $globals.IRClosureInstruction);
  39930. $core.addMethod(
  39931. $core.method({
  39932. selector: "locals",
  39933. protocol: "accessing",
  39934. fn: function (){
  39935. var self=this,$self=this;
  39936. return $core.withContext(function($ctx1) {
  39937. var $1;
  39938. $1=$recv($self._arguments())._copy();
  39939. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  39940. return $core.withContext(function($ctx2) {
  39941. return $recv(each)._name();
  39942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39943. })));
  39944. return $recv($1)._yourself();
  39945. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  39946. },
  39947. args: [],
  39948. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  39949. referencedClasses: [],
  39950. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  39951. }),
  39952. $globals.IRClosureInstruction);
  39953. $core.addMethod(
  39954. $core.method({
  39955. selector: "requiresSmalltalkContext",
  39956. protocol: "accessing",
  39957. fn: function (){
  39958. var self=this,$self=this;
  39959. return $core.withContext(function($ctx1) {
  39960. var $1,$receiver;
  39961. $1=$self["@requiresSmalltalkContext"];
  39962. if(($receiver = $1) == null || $receiver.a$nil){
  39963. return false;
  39964. } else {
  39965. return $1;
  39966. }
  39967. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  39968. },
  39969. args: [],
  39970. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  39971. referencedClasses: [],
  39972. messageSends: ["ifNil:"]
  39973. }),
  39974. $globals.IRClosureInstruction);
  39975. $core.addMethod(
  39976. $core.method({
  39977. selector: "requiresSmalltalkContext:",
  39978. protocol: "accessing",
  39979. fn: function (anObject){
  39980. var self=this,$self=this;
  39981. $self["@requiresSmalltalkContext"]=anObject;
  39982. return self;
  39983. },
  39984. args: ["anObject"],
  39985. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  39986. referencedClasses: [],
  39987. messageSends: []
  39988. }),
  39989. $globals.IRClosureInstruction);
  39990. $core.addMethod(
  39991. $core.method({
  39992. selector: "scope:",
  39993. protocol: "accessing",
  39994. fn: function (aScope){
  39995. var self=this,$self=this;
  39996. return $core.withContext(function($ctx1) {
  39997. (
  39998. $ctx1.supercall = true,
  39999. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  40000. $ctx1.supercall = false;
  40001. $recv(aScope)._instruction_(self);
  40002. return self;
  40003. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  40004. },
  40005. args: ["aScope"],
  40006. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40007. referencedClasses: [],
  40008. messageSends: ["scope:", "instruction:"]
  40009. }),
  40010. $globals.IRClosureInstruction);
  40011. $core.addMethod(
  40012. $core.method({
  40013. selector: "tempDeclarations",
  40014. protocol: "accessing",
  40015. fn: function (){
  40016. var self=this,$self=this;
  40017. return $core.withContext(function($ctx1) {
  40018. return $recv($self._dagChildren())._select_((function(each){
  40019. return $core.withContext(function($ctx2) {
  40020. return $recv(each)._isTempDeclaration();
  40021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40022. }));
  40023. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  40024. },
  40025. args: [],
  40026. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40027. referencedClasses: [],
  40028. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40029. }),
  40030. $globals.IRClosureInstruction);
  40031. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40032. $core.addMethod(
  40033. $core.method({
  40034. selector: "acceptDagVisitor:",
  40035. protocol: "visiting",
  40036. fn: function (aVisitor){
  40037. var self=this,$self=this;
  40038. return $core.withContext(function($ctx1) {
  40039. return $recv(aVisitor)._visitIRClosure_(self);
  40040. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  40041. },
  40042. args: ["aVisitor"],
  40043. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40044. referencedClasses: [],
  40045. messageSends: ["visitIRClosure:"]
  40046. }),
  40047. $globals.IRClosure);
  40048. $core.addMethod(
  40049. $core.method({
  40050. selector: "isClosure",
  40051. protocol: "testing",
  40052. fn: function (){
  40053. var self=this,$self=this;
  40054. return true;
  40055. },
  40056. args: [],
  40057. source: "isClosure\x0a\x09^ true",
  40058. referencedClasses: [],
  40059. messageSends: []
  40060. }),
  40061. $globals.IRClosure);
  40062. $core.addMethod(
  40063. $core.method({
  40064. selector: "sequence",
  40065. protocol: "accessing",
  40066. fn: function (){
  40067. var self=this,$self=this;
  40068. return $core.withContext(function($ctx1) {
  40069. return $recv($self._dagChildren())._last();
  40070. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  40071. },
  40072. args: [],
  40073. source: "sequence\x0a\x09^ self dagChildren last",
  40074. referencedClasses: [],
  40075. messageSends: ["last", "dagChildren"]
  40076. }),
  40077. $globals.IRClosure);
  40078. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  40079. $globals.IRMethod.comment="I am a method instruction";
  40080. $core.addMethod(
  40081. $core.method({
  40082. selector: "acceptDagVisitor:",
  40083. protocol: "visiting",
  40084. fn: function (aVisitor){
  40085. var self=this,$self=this;
  40086. return $core.withContext(function($ctx1) {
  40087. return $recv(aVisitor)._visitIRMethod_(self);
  40088. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  40089. },
  40090. args: ["aVisitor"],
  40091. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40092. referencedClasses: [],
  40093. messageSends: ["visitIRMethod:"]
  40094. }),
  40095. $globals.IRMethod);
  40096. $core.addMethod(
  40097. $core.method({
  40098. selector: "classReferences",
  40099. protocol: "accessing",
  40100. fn: function (){
  40101. var self=this,$self=this;
  40102. return $self["@classReferences"];
  40103. },
  40104. args: [],
  40105. source: "classReferences\x0a\x09^ classReferences",
  40106. referencedClasses: [],
  40107. messageSends: []
  40108. }),
  40109. $globals.IRMethod);
  40110. $core.addMethod(
  40111. $core.method({
  40112. selector: "classReferences:",
  40113. protocol: "accessing",
  40114. fn: function (aCollection){
  40115. var self=this,$self=this;
  40116. $self["@classReferences"]=aCollection;
  40117. return self;
  40118. },
  40119. args: ["aCollection"],
  40120. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40121. referencedClasses: [],
  40122. messageSends: []
  40123. }),
  40124. $globals.IRMethod);
  40125. $core.addMethod(
  40126. $core.method({
  40127. selector: "internalVariables",
  40128. protocol: "accessing",
  40129. fn: function (){
  40130. var self=this,$self=this;
  40131. return $core.withContext(function($ctx1) {
  40132. var $1,$receiver;
  40133. $1=$self["@internalVariables"];
  40134. if(($receiver = $1) == null || $receiver.a$nil){
  40135. $self["@internalVariables"]=$recv($globals.Set)._new();
  40136. return $self["@internalVariables"];
  40137. } else {
  40138. return $1;
  40139. }
  40140. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  40141. },
  40142. args: [],
  40143. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40144. referencedClasses: ["Set"],
  40145. messageSends: ["ifNil:", "new"]
  40146. }),
  40147. $globals.IRMethod);
  40148. $core.addMethod(
  40149. $core.method({
  40150. selector: "isMethod",
  40151. protocol: "testing",
  40152. fn: function (){
  40153. var self=this,$self=this;
  40154. return true;
  40155. },
  40156. args: [],
  40157. source: "isMethod\x0a\x09^ true",
  40158. referencedClasses: [],
  40159. messageSends: []
  40160. }),
  40161. $globals.IRMethod);
  40162. $core.addMethod(
  40163. $core.method({
  40164. selector: "messageSends",
  40165. protocol: "accessing",
  40166. fn: function (){
  40167. var self=this,$self=this;
  40168. return $core.withContext(function($ctx1) {
  40169. return $recv($self._sendIndexes())._keys();
  40170. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  40171. },
  40172. args: [],
  40173. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40174. referencedClasses: [],
  40175. messageSends: ["keys", "sendIndexes"]
  40176. }),
  40177. $globals.IRMethod);
  40178. $core.addMethod(
  40179. $core.method({
  40180. selector: "method",
  40181. protocol: "accessing",
  40182. fn: function (){
  40183. var self=this,$self=this;
  40184. return self;
  40185. },
  40186. args: [],
  40187. source: "method\x0a\x09^ self",
  40188. referencedClasses: [],
  40189. messageSends: []
  40190. }),
  40191. $globals.IRMethod);
  40192. $core.addMethod(
  40193. $core.method({
  40194. selector: "selector",
  40195. protocol: "accessing",
  40196. fn: function (){
  40197. var self=this,$self=this;
  40198. return $self["@selector"];
  40199. },
  40200. args: [],
  40201. source: "selector\x0a\x09^ selector",
  40202. referencedClasses: [],
  40203. messageSends: []
  40204. }),
  40205. $globals.IRMethod);
  40206. $core.addMethod(
  40207. $core.method({
  40208. selector: "selector:",
  40209. protocol: "accessing",
  40210. fn: function (aString){
  40211. var self=this,$self=this;
  40212. $self["@selector"]=aString;
  40213. return self;
  40214. },
  40215. args: ["aString"],
  40216. source: "selector: aString\x0a\x09selector := aString",
  40217. referencedClasses: [],
  40218. messageSends: []
  40219. }),
  40220. $globals.IRMethod);
  40221. $core.addMethod(
  40222. $core.method({
  40223. selector: "sendIndexes",
  40224. protocol: "accessing",
  40225. fn: function (){
  40226. var self=this,$self=this;
  40227. return $self["@sendIndexes"];
  40228. },
  40229. args: [],
  40230. source: "sendIndexes\x0a\x09^ sendIndexes",
  40231. referencedClasses: [],
  40232. messageSends: []
  40233. }),
  40234. $globals.IRMethod);
  40235. $core.addMethod(
  40236. $core.method({
  40237. selector: "sendIndexes:",
  40238. protocol: "accessing",
  40239. fn: function (aDictionary){
  40240. var self=this,$self=this;
  40241. $self["@sendIndexes"]=aDictionary;
  40242. return self;
  40243. },
  40244. args: ["aDictionary"],
  40245. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  40246. referencedClasses: [],
  40247. messageSends: []
  40248. }),
  40249. $globals.IRMethod);
  40250. $core.addMethod(
  40251. $core.method({
  40252. selector: "source",
  40253. protocol: "accessing",
  40254. fn: function (){
  40255. var self=this,$self=this;
  40256. return $self["@source"];
  40257. },
  40258. args: [],
  40259. source: "source\x0a\x09^ source",
  40260. referencedClasses: [],
  40261. messageSends: []
  40262. }),
  40263. $globals.IRMethod);
  40264. $core.addMethod(
  40265. $core.method({
  40266. selector: "source:",
  40267. protocol: "accessing",
  40268. fn: function (aString){
  40269. var self=this,$self=this;
  40270. $self["@source"]=aString;
  40271. return self;
  40272. },
  40273. args: ["aString"],
  40274. source: "source: aString\x0a\x09source := aString",
  40275. referencedClasses: [],
  40276. messageSends: []
  40277. }),
  40278. $globals.IRMethod);
  40279. $core.addMethod(
  40280. $core.method({
  40281. selector: "theClass",
  40282. protocol: "accessing",
  40283. fn: function (){
  40284. var self=this,$self=this;
  40285. return $self["@theClass"];
  40286. },
  40287. args: [],
  40288. source: "theClass\x0a\x09^ theClass",
  40289. referencedClasses: [],
  40290. messageSends: []
  40291. }),
  40292. $globals.IRMethod);
  40293. $core.addMethod(
  40294. $core.method({
  40295. selector: "theClass:",
  40296. protocol: "accessing",
  40297. fn: function (aClass){
  40298. var self=this,$self=this;
  40299. $self["@theClass"]=aClass;
  40300. return self;
  40301. },
  40302. args: ["aClass"],
  40303. source: "theClass: aClass\x0a\x09theClass := aClass",
  40304. referencedClasses: [],
  40305. messageSends: []
  40306. }),
  40307. $globals.IRMethod);
  40308. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  40309. $globals.IRReturn.comment="I am a local return instruction.";
  40310. $core.addMethod(
  40311. $core.method({
  40312. selector: "acceptDagVisitor:",
  40313. protocol: "visiting",
  40314. fn: function (aVisitor){
  40315. var self=this,$self=this;
  40316. return $core.withContext(function($ctx1) {
  40317. return $recv(aVisitor)._visitIRReturn_(self);
  40318. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  40319. },
  40320. args: ["aVisitor"],
  40321. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  40322. referencedClasses: [],
  40323. messageSends: ["visitIRReturn:"]
  40324. }),
  40325. $globals.IRReturn);
  40326. $core.addMethod(
  40327. $core.method({
  40328. selector: "expression",
  40329. protocol: "accessing",
  40330. fn: function (){
  40331. var self=this,$self=this;
  40332. return $core.withContext(function($ctx1) {
  40333. return $recv($self._dagChildren())._single();
  40334. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40335. },
  40336. args: [],
  40337. source: "expression\x0a\x09^ self dagChildren single",
  40338. referencedClasses: [],
  40339. messageSends: ["single", "dagChildren"]
  40340. }),
  40341. $globals.IRReturn);
  40342. $core.addMethod(
  40343. $core.method({
  40344. selector: "scope",
  40345. protocol: "accessing",
  40346. fn: function (){
  40347. var self=this,$self=this;
  40348. return $core.withContext(function($ctx1) {
  40349. var $1,$receiver;
  40350. $1=$self["@scope"];
  40351. if(($receiver = $1) == null || $receiver.a$nil){
  40352. return $recv($self._parent())._scope();
  40353. } else {
  40354. return $1;
  40355. }
  40356. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40357. },
  40358. args: [],
  40359. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40360. referencedClasses: [],
  40361. messageSends: ["ifNil:", "scope", "parent"]
  40362. }),
  40363. $globals.IRReturn);
  40364. $core.addMethod(
  40365. $core.method({
  40366. selector: "yieldsValue",
  40367. protocol: "testing",
  40368. fn: function (){
  40369. var self=this,$self=this;
  40370. return false;
  40371. },
  40372. args: [],
  40373. source: "yieldsValue\x0a\x09^ false",
  40374. referencedClasses: [],
  40375. messageSends: []
  40376. }),
  40377. $globals.IRReturn);
  40378. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40379. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40380. $core.addMethod(
  40381. $core.method({
  40382. selector: "acceptDagVisitor:",
  40383. protocol: "visiting",
  40384. fn: function (aVisitor){
  40385. var self=this,$self=this;
  40386. return $core.withContext(function($ctx1) {
  40387. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40388. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40389. },
  40390. args: ["aVisitor"],
  40391. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40392. referencedClasses: [],
  40393. messageSends: ["visitIRBlockReturn:"]
  40394. }),
  40395. $globals.IRBlockReturn);
  40396. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40397. $globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
  40398. $core.addMethod(
  40399. $core.method({
  40400. selector: "acceptDagVisitor:",
  40401. protocol: "visiting",
  40402. fn: function (aVisitor){
  40403. var self=this,$self=this;
  40404. return $core.withContext(function($ctx1) {
  40405. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40406. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40407. },
  40408. args: ["aVisitor"],
  40409. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40410. referencedClasses: [],
  40411. messageSends: ["visitIRNonLocalReturn:"]
  40412. }),
  40413. $globals.IRNonLocalReturn);
  40414. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40415. $core.addMethod(
  40416. $core.method({
  40417. selector: "acceptDagVisitor:",
  40418. protocol: "visiting",
  40419. fn: function (aVisitor){
  40420. var self=this,$self=this;
  40421. return $core.withContext(function($ctx1) {
  40422. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40423. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40424. },
  40425. args: ["aVisitor"],
  40426. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40427. referencedClasses: [],
  40428. messageSends: ["visitIRTempDeclaration:"]
  40429. }),
  40430. $globals.IRTempDeclaration);
  40431. $core.addMethod(
  40432. $core.method({
  40433. selector: "isTempDeclaration",
  40434. protocol: "testing",
  40435. fn: function (){
  40436. var self=this,$self=this;
  40437. return true;
  40438. },
  40439. args: [],
  40440. source: "isTempDeclaration\x0a\x09^ true",
  40441. referencedClasses: [],
  40442. messageSends: []
  40443. }),
  40444. $globals.IRTempDeclaration);
  40445. $core.addMethod(
  40446. $core.method({
  40447. selector: "name",
  40448. protocol: "accessing",
  40449. fn: function (){
  40450. var self=this,$self=this;
  40451. return $self["@name"];
  40452. },
  40453. args: [],
  40454. source: "name\x0a\x09^ name",
  40455. referencedClasses: [],
  40456. messageSends: []
  40457. }),
  40458. $globals.IRTempDeclaration);
  40459. $core.addMethod(
  40460. $core.method({
  40461. selector: "name:",
  40462. protocol: "accessing",
  40463. fn: function (aString){
  40464. var self=this,$self=this;
  40465. $self["@name"]=aString;
  40466. return self;
  40467. },
  40468. args: ["aString"],
  40469. source: "name: aString\x0a\x09name := aString",
  40470. referencedClasses: [],
  40471. messageSends: []
  40472. }),
  40473. $globals.IRTempDeclaration);
  40474. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40475. $globals.IRSend.comment="I am a message send instruction.";
  40476. $core.addMethod(
  40477. $core.method({
  40478. selector: "acceptDagVisitor:",
  40479. protocol: "visiting",
  40480. fn: function (aVisitor){
  40481. var self=this,$self=this;
  40482. return $core.withContext(function($ctx1) {
  40483. return $recv(aVisitor)._visitIRSend_(self);
  40484. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40485. },
  40486. args: ["aVisitor"],
  40487. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40488. referencedClasses: [],
  40489. messageSends: ["visitIRSend:"]
  40490. }),
  40491. $globals.IRSend);
  40492. $core.addMethod(
  40493. $core.method({
  40494. selector: "arguments",
  40495. protocol: "accessing",
  40496. fn: function (){
  40497. var self=this,$self=this;
  40498. return $core.withContext(function($ctx1) {
  40499. return $recv($self._dagChildren())._allButFirst();
  40500. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40501. },
  40502. args: [],
  40503. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40504. referencedClasses: [],
  40505. messageSends: ["allButFirst", "dagChildren"]
  40506. }),
  40507. $globals.IRSend);
  40508. $core.addMethod(
  40509. $core.method({
  40510. selector: "index",
  40511. protocol: "accessing",
  40512. fn: function (){
  40513. var self=this,$self=this;
  40514. return $self["@index"];
  40515. },
  40516. args: [],
  40517. source: "index\x0a\x09^ index",
  40518. referencedClasses: [],
  40519. messageSends: []
  40520. }),
  40521. $globals.IRSend);
  40522. $core.addMethod(
  40523. $core.method({
  40524. selector: "index:",
  40525. protocol: "accessing",
  40526. fn: function (anInteger){
  40527. var self=this,$self=this;
  40528. $self["@index"]=anInteger;
  40529. return self;
  40530. },
  40531. args: ["anInteger"],
  40532. source: "index: anInteger\x0a\x09index := anInteger",
  40533. referencedClasses: [],
  40534. messageSends: []
  40535. }),
  40536. $globals.IRSend);
  40537. $core.addMethod(
  40538. $core.method({
  40539. selector: "isSend",
  40540. protocol: "testing",
  40541. fn: function (){
  40542. var self=this,$self=this;
  40543. return true;
  40544. },
  40545. args: [],
  40546. source: "isSend\x0a\x09^ true",
  40547. referencedClasses: [],
  40548. messageSends: []
  40549. }),
  40550. $globals.IRSend);
  40551. $core.addMethod(
  40552. $core.method({
  40553. selector: "receiver",
  40554. protocol: "accessing",
  40555. fn: function (){
  40556. var self=this,$self=this;
  40557. return $core.withContext(function($ctx1) {
  40558. return $recv($self._dagChildren())._first();
  40559. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40560. },
  40561. args: [],
  40562. source: "receiver\x0a\x09^ self dagChildren first",
  40563. referencedClasses: [],
  40564. messageSends: ["first", "dagChildren"]
  40565. }),
  40566. $globals.IRSend);
  40567. $core.addMethod(
  40568. $core.method({
  40569. selector: "selector",
  40570. protocol: "accessing",
  40571. fn: function (){
  40572. var self=this,$self=this;
  40573. return $self["@selector"];
  40574. },
  40575. args: [],
  40576. source: "selector\x0a\x09^ selector",
  40577. referencedClasses: [],
  40578. messageSends: []
  40579. }),
  40580. $globals.IRSend);
  40581. $core.addMethod(
  40582. $core.method({
  40583. selector: "selector:",
  40584. protocol: "accessing",
  40585. fn: function (aString){
  40586. var self=this,$self=this;
  40587. $self["@selector"]=aString;
  40588. return self;
  40589. },
  40590. args: ["aString"],
  40591. source: "selector: aString\x0a\x09selector := aString",
  40592. referencedClasses: [],
  40593. messageSends: []
  40594. }),
  40595. $globals.IRSend);
  40596. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40597. $core.addMethod(
  40598. $core.method({
  40599. selector: "acceptDagVisitor:",
  40600. protocol: "visiting",
  40601. fn: function (aVisitor){
  40602. var self=this,$self=this;
  40603. return $core.withContext(function($ctx1) {
  40604. return $recv(aVisitor)._visitIRSequence_(self);
  40605. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40606. },
  40607. args: ["aVisitor"],
  40608. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40609. referencedClasses: [],
  40610. messageSends: ["visitIRSequence:"]
  40611. }),
  40612. $globals.IRSequence);
  40613. $core.addMethod(
  40614. $core.method({
  40615. selector: "isSequence",
  40616. protocol: "testing",
  40617. fn: function (){
  40618. var self=this,$self=this;
  40619. return true;
  40620. },
  40621. args: [],
  40622. source: "isSequence\x0a\x09^ true",
  40623. referencedClasses: [],
  40624. messageSends: []
  40625. }),
  40626. $globals.IRSequence);
  40627. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40628. $core.addMethod(
  40629. $core.method({
  40630. selector: "acceptDagVisitor:",
  40631. protocol: "visiting",
  40632. fn: function (aVisitor){
  40633. var self=this,$self=this;
  40634. return $core.withContext(function($ctx1) {
  40635. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40636. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40637. },
  40638. args: ["aVisitor"],
  40639. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40640. referencedClasses: [],
  40641. messageSends: ["visitIRBlockSequence:"]
  40642. }),
  40643. $globals.IRBlockSequence);
  40644. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40645. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40646. $core.addMethod(
  40647. $core.method({
  40648. selector: "acceptDagVisitor:",
  40649. protocol: "visiting",
  40650. fn: function (aVisitor){
  40651. var self=this,$self=this;
  40652. return $core.withContext(function($ctx1) {
  40653. return $recv(aVisitor)._visitIRValue_(self);
  40654. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40655. },
  40656. args: ["aVisitor"],
  40657. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40658. referencedClasses: [],
  40659. messageSends: ["visitIRValue:"]
  40660. }),
  40661. $globals.IRValue);
  40662. $core.addMethod(
  40663. $core.method({
  40664. selector: "needsBoxingAsReceiver",
  40665. protocol: "testing",
  40666. fn: function (){
  40667. var self=this,$self=this;
  40668. return false;
  40669. },
  40670. args: [],
  40671. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40672. referencedClasses: [],
  40673. messageSends: []
  40674. }),
  40675. $globals.IRValue);
  40676. $core.addMethod(
  40677. $core.method({
  40678. selector: "value",
  40679. protocol: "accessing",
  40680. fn: function (){
  40681. var self=this,$self=this;
  40682. return $self["@value"];
  40683. },
  40684. args: [],
  40685. source: "value\x0a\x09^ value",
  40686. referencedClasses: [],
  40687. messageSends: []
  40688. }),
  40689. $globals.IRValue);
  40690. $core.addMethod(
  40691. $core.method({
  40692. selector: "value:",
  40693. protocol: "accessing",
  40694. fn: function (aString){
  40695. var self=this,$self=this;
  40696. $self["@value"]=aString;
  40697. return self;
  40698. },
  40699. args: ["aString"],
  40700. source: "value: aString\x0a\x09value := aString",
  40701. referencedClasses: [],
  40702. messageSends: []
  40703. }),
  40704. $globals.IRValue);
  40705. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40706. $globals.IRVariable.comment="I am a variable instruction.";
  40707. $core.addMethod(
  40708. $core.method({
  40709. selector: "acceptDagVisitor:",
  40710. protocol: "visiting",
  40711. fn: function (aVisitor){
  40712. var self=this,$self=this;
  40713. return $core.withContext(function($ctx1) {
  40714. return $recv(aVisitor)._visitIRVariable_(self);
  40715. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40716. },
  40717. args: ["aVisitor"],
  40718. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40719. referencedClasses: [],
  40720. messageSends: ["visitIRVariable:"]
  40721. }),
  40722. $globals.IRVariable);
  40723. $core.addMethod(
  40724. $core.method({
  40725. selector: "isSelf",
  40726. protocol: "testing",
  40727. fn: function (){
  40728. var self=this,$self=this;
  40729. return $core.withContext(function($ctx1) {
  40730. return $recv($self._variable())._isSelf();
  40731. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40732. },
  40733. args: [],
  40734. source: "isSelf\x0a\x09^ self variable isSelf",
  40735. referencedClasses: [],
  40736. messageSends: ["isSelf", "variable"]
  40737. }),
  40738. $globals.IRVariable);
  40739. $core.addMethod(
  40740. $core.method({
  40741. selector: "isSuper",
  40742. protocol: "testing",
  40743. fn: function (){
  40744. var self=this,$self=this;
  40745. return $core.withContext(function($ctx1) {
  40746. return $recv($self._variable())._isSuper();
  40747. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40748. },
  40749. args: [],
  40750. source: "isSuper\x0a\x09^ self variable isSuper",
  40751. referencedClasses: [],
  40752. messageSends: ["isSuper", "variable"]
  40753. }),
  40754. $globals.IRVariable);
  40755. $core.addMethod(
  40756. $core.method({
  40757. selector: "isVariable",
  40758. protocol: "testing",
  40759. fn: function (){
  40760. var self=this,$self=this;
  40761. return true;
  40762. },
  40763. args: [],
  40764. source: "isVariable\x0a\x09^ true",
  40765. referencedClasses: [],
  40766. messageSends: []
  40767. }),
  40768. $globals.IRVariable);
  40769. $core.addMethod(
  40770. $core.method({
  40771. selector: "needsBoxingAsReceiver",
  40772. protocol: "testing",
  40773. fn: function (){
  40774. var self=this,$self=this;
  40775. return $core.withContext(function($ctx1) {
  40776. return $recv($recv($self._variable())._isPseudoVar())._not();
  40777. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40778. },
  40779. args: [],
  40780. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40781. referencedClasses: [],
  40782. messageSends: ["not", "isPseudoVar", "variable"]
  40783. }),
  40784. $globals.IRVariable);
  40785. $core.addMethod(
  40786. $core.method({
  40787. selector: "variable",
  40788. protocol: "accessing",
  40789. fn: function (){
  40790. var self=this,$self=this;
  40791. return $self["@variable"];
  40792. },
  40793. args: [],
  40794. source: "variable\x0a\x09^ variable",
  40795. referencedClasses: [],
  40796. messageSends: []
  40797. }),
  40798. $globals.IRVariable);
  40799. $core.addMethod(
  40800. $core.method({
  40801. selector: "variable:",
  40802. protocol: "accessing",
  40803. fn: function (aScopeVariable){
  40804. var self=this,$self=this;
  40805. $self["@variable"]=aScopeVariable;
  40806. return self;
  40807. },
  40808. args: ["aScopeVariable"],
  40809. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40810. referencedClasses: [],
  40811. messageSends: []
  40812. }),
  40813. $globals.IRVariable);
  40814. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40815. $core.addMethod(
  40816. $core.method({
  40817. selector: "acceptDagVisitor:",
  40818. protocol: "visiting",
  40819. fn: function (aVisitor){
  40820. var self=this,$self=this;
  40821. return $core.withContext(function($ctx1) {
  40822. return $recv(aVisitor)._visitIRVerbatim_(self);
  40823. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40824. },
  40825. args: ["aVisitor"],
  40826. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40827. referencedClasses: [],
  40828. messageSends: ["visitIRVerbatim:"]
  40829. }),
  40830. $globals.IRVerbatim);
  40831. $core.addMethod(
  40832. $core.method({
  40833. selector: "source",
  40834. protocol: "accessing",
  40835. fn: function (){
  40836. var self=this,$self=this;
  40837. return $self["@source"];
  40838. },
  40839. args: [],
  40840. source: "source\x0a\x09^ source",
  40841. referencedClasses: [],
  40842. messageSends: []
  40843. }),
  40844. $globals.IRVerbatim);
  40845. $core.addMethod(
  40846. $core.method({
  40847. selector: "source:",
  40848. protocol: "accessing",
  40849. fn: function (aString){
  40850. var self=this,$self=this;
  40851. $self["@source"]=aString;
  40852. return self;
  40853. },
  40854. args: ["aString"],
  40855. source: "source: aString\x0a\x09source := aString",
  40856. referencedClasses: [],
  40857. messageSends: []
  40858. }),
  40859. $globals.IRVerbatim);
  40860. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40861. $core.addMethod(
  40862. $core.method({
  40863. selector: "visitDagNode:",
  40864. protocol: "visiting",
  40865. fn: function (aNode){
  40866. var self=this,$self=this;
  40867. return $core.withContext(function($ctx1) {
  40868. return $self._visitDagNodeVariantSimple_(aNode);
  40869. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40870. },
  40871. args: ["aNode"],
  40872. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40873. referencedClasses: [],
  40874. messageSends: ["visitDagNodeVariantSimple:"]
  40875. }),
  40876. $globals.IRVisitor);
  40877. $core.addMethod(
  40878. $core.method({
  40879. selector: "visitIRAssignment:",
  40880. protocol: "visiting",
  40881. fn: function (anIRAssignment){
  40882. var self=this,$self=this;
  40883. return $core.withContext(function($ctx1) {
  40884. return $self._visitDagNode_(anIRAssignment);
  40885. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  40886. },
  40887. args: ["anIRAssignment"],
  40888. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  40889. referencedClasses: [],
  40890. messageSends: ["visitDagNode:"]
  40891. }),
  40892. $globals.IRVisitor);
  40893. $core.addMethod(
  40894. $core.method({
  40895. selector: "visitIRBlockReturn:",
  40896. protocol: "visiting",
  40897. fn: function (anIRBlockReturn){
  40898. var self=this,$self=this;
  40899. return $core.withContext(function($ctx1) {
  40900. return $self._visitIRReturn_(anIRBlockReturn);
  40901. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  40902. },
  40903. args: ["anIRBlockReturn"],
  40904. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  40905. referencedClasses: [],
  40906. messageSends: ["visitIRReturn:"]
  40907. }),
  40908. $globals.IRVisitor);
  40909. $core.addMethod(
  40910. $core.method({
  40911. selector: "visitIRBlockSequence:",
  40912. protocol: "visiting",
  40913. fn: function (anIRBlockSequence){
  40914. var self=this,$self=this;
  40915. return $core.withContext(function($ctx1) {
  40916. return $self._visitIRSequence_(anIRBlockSequence);
  40917. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  40918. },
  40919. args: ["anIRBlockSequence"],
  40920. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  40921. referencedClasses: [],
  40922. messageSends: ["visitIRSequence:"]
  40923. }),
  40924. $globals.IRVisitor);
  40925. $core.addMethod(
  40926. $core.method({
  40927. selector: "visitIRClosure:",
  40928. protocol: "visiting",
  40929. fn: function (anIRClosure){
  40930. var self=this,$self=this;
  40931. return $core.withContext(function($ctx1) {
  40932. return $self._visitDagNode_(anIRClosure);
  40933. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  40934. },
  40935. args: ["anIRClosure"],
  40936. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  40937. referencedClasses: [],
  40938. messageSends: ["visitDagNode:"]
  40939. }),
  40940. $globals.IRVisitor);
  40941. $core.addMethod(
  40942. $core.method({
  40943. selector: "visitIRDynamicArray:",
  40944. protocol: "visiting",
  40945. fn: function (anIRDynamicArray){
  40946. var self=this,$self=this;
  40947. return $core.withContext(function($ctx1) {
  40948. return $self._visitDagNode_(anIRDynamicArray);
  40949. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  40950. },
  40951. args: ["anIRDynamicArray"],
  40952. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  40953. referencedClasses: [],
  40954. messageSends: ["visitDagNode:"]
  40955. }),
  40956. $globals.IRVisitor);
  40957. $core.addMethod(
  40958. $core.method({
  40959. selector: "visitIRDynamicDictionary:",
  40960. protocol: "visiting",
  40961. fn: function (anIRDynamicDictionary){
  40962. var self=this,$self=this;
  40963. return $core.withContext(function($ctx1) {
  40964. return $self._visitDagNode_(anIRDynamicDictionary);
  40965. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  40966. },
  40967. args: ["anIRDynamicDictionary"],
  40968. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  40969. referencedClasses: [],
  40970. messageSends: ["visitDagNode:"]
  40971. }),
  40972. $globals.IRVisitor);
  40973. $core.addMethod(
  40974. $core.method({
  40975. selector: "visitIRInlinedClosure:",
  40976. protocol: "visiting",
  40977. fn: function (anIRInlinedClosure){
  40978. var self=this,$self=this;
  40979. return $core.withContext(function($ctx1) {
  40980. return $self._visitIRClosure_(anIRInlinedClosure);
  40981. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  40982. },
  40983. args: ["anIRInlinedClosure"],
  40984. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  40985. referencedClasses: [],
  40986. messageSends: ["visitIRClosure:"]
  40987. }),
  40988. $globals.IRVisitor);
  40989. $core.addMethod(
  40990. $core.method({
  40991. selector: "visitIRInlinedSequence:",
  40992. protocol: "visiting",
  40993. fn: function (anIRInlinedSequence){
  40994. var self=this,$self=this;
  40995. return $core.withContext(function($ctx1) {
  40996. return $self._visitIRSequence_(anIRInlinedSequence);
  40997. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  40998. },
  40999. args: ["anIRInlinedSequence"],
  41000. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  41001. referencedClasses: [],
  41002. messageSends: ["visitIRSequence:"]
  41003. }),
  41004. $globals.IRVisitor);
  41005. $core.addMethod(
  41006. $core.method({
  41007. selector: "visitIRMethod:",
  41008. protocol: "visiting",
  41009. fn: function (anIRMethod){
  41010. var self=this,$self=this;
  41011. return $core.withContext(function($ctx1) {
  41012. return $self._visitDagNode_(anIRMethod);
  41013. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  41014. },
  41015. args: ["anIRMethod"],
  41016. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41017. referencedClasses: [],
  41018. messageSends: ["visitDagNode:"]
  41019. }),
  41020. $globals.IRVisitor);
  41021. $core.addMethod(
  41022. $core.method({
  41023. selector: "visitIRNonLocalReturn:",
  41024. protocol: "visiting",
  41025. fn: function (anIRNonLocalReturn){
  41026. var self=this,$self=this;
  41027. return $core.withContext(function($ctx1) {
  41028. return $self._visitDagNode_(anIRNonLocalReturn);
  41029. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  41030. },
  41031. args: ["anIRNonLocalReturn"],
  41032. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  41033. referencedClasses: [],
  41034. messageSends: ["visitDagNode:"]
  41035. }),
  41036. $globals.IRVisitor);
  41037. $core.addMethod(
  41038. $core.method({
  41039. selector: "visitIRNonLocalReturnHandling:",
  41040. protocol: "visiting",
  41041. fn: function (anIRNonLocalReturnHandling){
  41042. var self=this,$self=this;
  41043. return $core.withContext(function($ctx1) {
  41044. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  41045. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  41046. },
  41047. args: ["anIRNonLocalReturnHandling"],
  41048. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  41049. referencedClasses: [],
  41050. messageSends: ["visitDagNode:"]
  41051. }),
  41052. $globals.IRVisitor);
  41053. $core.addMethod(
  41054. $core.method({
  41055. selector: "visitIRReturn:",
  41056. protocol: "visiting",
  41057. fn: function (anIRReturn){
  41058. var self=this,$self=this;
  41059. return $core.withContext(function($ctx1) {
  41060. return $self._visitDagNode_(anIRReturn);
  41061. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  41062. },
  41063. args: ["anIRReturn"],
  41064. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  41065. referencedClasses: [],
  41066. messageSends: ["visitDagNode:"]
  41067. }),
  41068. $globals.IRVisitor);
  41069. $core.addMethod(
  41070. $core.method({
  41071. selector: "visitIRSend:",
  41072. protocol: "visiting",
  41073. fn: function (anIRSend){
  41074. var self=this,$self=this;
  41075. return $core.withContext(function($ctx1) {
  41076. return $self._visitDagNode_(anIRSend);
  41077. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  41078. },
  41079. args: ["anIRSend"],
  41080. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  41081. referencedClasses: [],
  41082. messageSends: ["visitDagNode:"]
  41083. }),
  41084. $globals.IRVisitor);
  41085. $core.addMethod(
  41086. $core.method({
  41087. selector: "visitIRSequence:",
  41088. protocol: "visiting",
  41089. fn: function (anIRSequence){
  41090. var self=this,$self=this;
  41091. return $core.withContext(function($ctx1) {
  41092. return $self._visitDagNode_(anIRSequence);
  41093. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  41094. },
  41095. args: ["anIRSequence"],
  41096. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  41097. referencedClasses: [],
  41098. messageSends: ["visitDagNode:"]
  41099. }),
  41100. $globals.IRVisitor);
  41101. $core.addMethod(
  41102. $core.method({
  41103. selector: "visitIRTempDeclaration:",
  41104. protocol: "visiting",
  41105. fn: function (anIRTempDeclaration){
  41106. var self=this,$self=this;
  41107. return $core.withContext(function($ctx1) {
  41108. return $self._visitDagNode_(anIRTempDeclaration);
  41109. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  41110. },
  41111. args: ["anIRTempDeclaration"],
  41112. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  41113. referencedClasses: [],
  41114. messageSends: ["visitDagNode:"]
  41115. }),
  41116. $globals.IRVisitor);
  41117. $core.addMethod(
  41118. $core.method({
  41119. selector: "visitIRValue:",
  41120. protocol: "visiting",
  41121. fn: function (anIRValue){
  41122. var self=this,$self=this;
  41123. return $core.withContext(function($ctx1) {
  41124. return $self._visitDagNode_(anIRValue);
  41125. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  41126. },
  41127. args: ["anIRValue"],
  41128. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  41129. referencedClasses: [],
  41130. messageSends: ["visitDagNode:"]
  41131. }),
  41132. $globals.IRVisitor);
  41133. $core.addMethod(
  41134. $core.method({
  41135. selector: "visitIRVariable:",
  41136. protocol: "visiting",
  41137. fn: function (anIRVariable){
  41138. var self=this,$self=this;
  41139. return $core.withContext(function($ctx1) {
  41140. return $self._visitDagNode_(anIRVariable);
  41141. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  41142. },
  41143. args: ["anIRVariable"],
  41144. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  41145. referencedClasses: [],
  41146. messageSends: ["visitDagNode:"]
  41147. }),
  41148. $globals.IRVisitor);
  41149. $core.addMethod(
  41150. $core.method({
  41151. selector: "visitIRVerbatim:",
  41152. protocol: "visiting",
  41153. fn: function (anIRVerbatim){
  41154. var self=this,$self=this;
  41155. return $core.withContext(function($ctx1) {
  41156. return $self._visitDagNode_(anIRVerbatim);
  41157. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  41158. },
  41159. args: ["anIRVerbatim"],
  41160. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  41161. referencedClasses: [],
  41162. messageSends: ["visitDagNode:"]
  41163. }),
  41164. $globals.IRVisitor);
  41165. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  41166. $core.addMethod(
  41167. $core.method({
  41168. selector: "contents",
  41169. protocol: "accessing",
  41170. fn: function (){
  41171. var self=this,$self=this;
  41172. return $core.withContext(function($ctx1) {
  41173. return $recv($self._stream())._contents();
  41174. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  41175. },
  41176. args: [],
  41177. source: "contents\x0a\x09^ self stream contents",
  41178. referencedClasses: [],
  41179. messageSends: ["contents", "stream"]
  41180. }),
  41181. $globals.IRJSTranslator);
  41182. $core.addMethod(
  41183. $core.method({
  41184. selector: "currentClass",
  41185. protocol: "accessing",
  41186. fn: function (){
  41187. var self=this,$self=this;
  41188. return $self["@currentClass"];
  41189. },
  41190. args: [],
  41191. source: "currentClass\x0a\x09^ currentClass",
  41192. referencedClasses: [],
  41193. messageSends: []
  41194. }),
  41195. $globals.IRJSTranslator);
  41196. $core.addMethod(
  41197. $core.method({
  41198. selector: "currentClass:",
  41199. protocol: "accessing",
  41200. fn: function (aClass){
  41201. var self=this,$self=this;
  41202. $self["@currentClass"]=aClass;
  41203. return self;
  41204. },
  41205. args: ["aClass"],
  41206. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  41207. referencedClasses: [],
  41208. messageSends: []
  41209. }),
  41210. $globals.IRJSTranslator);
  41211. $core.addMethod(
  41212. $core.method({
  41213. selector: "initialize",
  41214. protocol: "initialization",
  41215. fn: function (){
  41216. var self=this,$self=this;
  41217. return $core.withContext(function($ctx1) {
  41218. (
  41219. $ctx1.supercall = true,
  41220. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41221. $ctx1.supercall = false;
  41222. $self["@stream"]=$recv($globals.JSStream)._new();
  41223. return self;
  41224. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  41225. },
  41226. args: [],
  41227. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  41228. referencedClasses: ["JSStream"],
  41229. messageSends: ["initialize", "new"]
  41230. }),
  41231. $globals.IRJSTranslator);
  41232. $core.addMethod(
  41233. $core.method({
  41234. selector: "stream",
  41235. protocol: "accessing",
  41236. fn: function (){
  41237. var self=this,$self=this;
  41238. return $self["@stream"];
  41239. },
  41240. args: [],
  41241. source: "stream\x0a\x09^ stream",
  41242. referencedClasses: [],
  41243. messageSends: []
  41244. }),
  41245. $globals.IRJSTranslator);
  41246. $core.addMethod(
  41247. $core.method({
  41248. selector: "stream:",
  41249. protocol: "accessing",
  41250. fn: function (aStream){
  41251. var self=this,$self=this;
  41252. $self["@stream"]=aStream;
  41253. return self;
  41254. },
  41255. args: ["aStream"],
  41256. source: "stream: aStream\x0a\x09stream := aStream",
  41257. referencedClasses: [],
  41258. messageSends: []
  41259. }),
  41260. $globals.IRJSTranslator);
  41261. $core.addMethod(
  41262. $core.method({
  41263. selector: "visitIRAssignment:",
  41264. protocol: "visiting",
  41265. fn: function (anIRAssignment){
  41266. var self=this,$self=this;
  41267. return $core.withContext(function($ctx1) {
  41268. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  41269. return $core.withContext(function($ctx2) {
  41270. return $self._visit_($recv(anIRAssignment)._left());
  41271. $ctx2.sendIdx["visit:"]=1;
  41272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41273. }),(function(){
  41274. return $core.withContext(function($ctx2) {
  41275. return $self._visit_($recv(anIRAssignment)._right());
  41276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41277. }));
  41278. return self;
  41279. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  41280. },
  41281. args: ["anIRAssignment"],
  41282. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  41283. referencedClasses: [],
  41284. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  41285. }),
  41286. $globals.IRJSTranslator);
  41287. $core.addMethod(
  41288. $core.method({
  41289. selector: "visitIRClosure:",
  41290. protocol: "visiting",
  41291. fn: function (anIRClosure){
  41292. var self=this,$self=this;
  41293. return $core.withContext(function($ctx1) {
  41294. var $1,$2;
  41295. $1=$self._stream();
  41296. $ctx1.sendIdx["stream"]=1;
  41297. $recv($1)._nextPutClosureWith_arguments_((function(){
  41298. return $core.withContext(function($ctx2) {
  41299. $2=$self._stream();
  41300. $ctx2.sendIdx["stream"]=2;
  41301. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  41302. return $core.withContext(function($ctx3) {
  41303. return $recv($recv(each)._name())._asVariableName();
  41304. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41305. })));
  41306. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  41307. return $core.withContext(function($ctx3) {
  41308. return (
  41309. $ctx3.supercall = true,
  41310. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  41311. $ctx3.supercall = false;
  41312. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  41313. }));
  41314. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41315. }),$recv(anIRClosure)._arguments());
  41316. return self;
  41317. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  41318. },
  41319. args: ["anIRClosure"],
  41320. source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments",
  41321. referencedClasses: [],
  41322. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  41323. }),
  41324. $globals.IRJSTranslator);
  41325. $core.addMethod(
  41326. $core.method({
  41327. selector: "visitIRDynamicArray:",
  41328. protocol: "visiting",
  41329. fn: function (anIRDynamicArray){
  41330. var self=this,$self=this;
  41331. return $core.withContext(function($ctx1) {
  41332. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41333. return self;
  41334. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41335. },
  41336. args: ["anIRDynamicArray"],
  41337. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41338. referencedClasses: [],
  41339. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41340. }),
  41341. $globals.IRJSTranslator);
  41342. $core.addMethod(
  41343. $core.method({
  41344. selector: "visitIRDynamicDictionary:",
  41345. protocol: "visiting",
  41346. fn: function (anIRDynamicDictionary){
  41347. var self=this,$self=this;
  41348. return $core.withContext(function($ctx1) {
  41349. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41350. return self;
  41351. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41352. },
  41353. args: ["anIRDynamicDictionary"],
  41354. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41355. referencedClasses: [],
  41356. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41357. }),
  41358. $globals.IRJSTranslator);
  41359. $core.addMethod(
  41360. $core.method({
  41361. selector: "visitIRMethod:",
  41362. protocol: "visiting",
  41363. fn: function (anIRMethod){
  41364. var self=this,$self=this;
  41365. return $core.withContext(function($ctx1) {
  41366. var $1,$2,$3,$4,$5,$6,$7;
  41367. $1=$self._stream();
  41368. $ctx1.sendIdx["stream"]=1;
  41369. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41370. return $core.withContext(function($ctx2) {
  41371. $2=$self._stream();
  41372. $ctx2.sendIdx["stream"]=2;
  41373. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41374. return $core.withContext(function($ctx3) {
  41375. $3=$self._stream();
  41376. $ctx3.sendIdx["stream"]=3;
  41377. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41378. return $core.withContext(function($ctx4) {
  41379. return $recv($recv(each)._name())._asVariableName();
  41380. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41381. }));
  41382. $ctx3.sendIdx["collect:"]=1;
  41383. $recv($3)._nextPutVars_($4);
  41384. $ctx3.sendIdx["nextPutVars:"]=1;
  41385. $5=$self._stream();
  41386. $ctx3.sendIdx["stream"]=4;
  41387. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41388. return $core.withContext(function($ctx4) {
  41389. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41390. return $core.withContext(function($ctx5) {
  41391. $6=$self._stream();
  41392. $ctx5.sendIdx["stream"]=5;
  41393. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41394. return $core.withContext(function($ctx6) {
  41395. return $recv($recv(each)._variable())._alias();
  41396. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41397. })));
  41398. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41399. }));
  41400. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41401. if($core.assert($7)){
  41402. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41403. return $core.withContext(function($ctx5) {
  41404. return (
  41405. $ctx5.supercall = true,
  41406. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41407. $ctx5.supercall = false;
  41408. $ctx5.sendIdx["visitIRMethod:"]=1;
  41409. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41410. }));
  41411. } else {
  41412. return (
  41413. $ctx4.supercall = true,
  41414. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41415. $ctx4.supercall = false;
  41416. }
  41417. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41418. }));
  41419. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41420. }),$recv(anIRMethod)._arguments());
  41421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41422. }));
  41423. return $self._contents();
  41424. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41425. },
  41426. args: ["anIRMethod"],
  41427. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09\x09anIRMethod internalVariables ifNotEmpty: [ :internalVars |\x0a\x09\x09\x09\x09\x09\x09self stream nextPutVars: \x0a\x09\x09\x09\x09\x09\x09\x09(internalVars asSet collect: [ :each | each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ].\x0a\x09^ self contents",
  41428. referencedClasses: [],
  41429. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifNotEmpty:", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments", "contents"]
  41430. }),
  41431. $globals.IRJSTranslator);
  41432. $core.addMethod(
  41433. $core.method({
  41434. selector: "visitIRNonLocalReturn:",
  41435. protocol: "visiting",
  41436. fn: function (anIRNonLocalReturn){
  41437. var self=this,$self=this;
  41438. return $core.withContext(function($ctx1) {
  41439. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41440. return $core.withContext(function($ctx2) {
  41441. return (
  41442. $ctx2.supercall = true,
  41443. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41444. $ctx2.supercall = false;
  41445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41446. }));
  41447. return self;
  41448. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41449. },
  41450. args: ["anIRNonLocalReturn"],
  41451. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41452. referencedClasses: [],
  41453. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41454. }),
  41455. $globals.IRJSTranslator);
  41456. $core.addMethod(
  41457. $core.method({
  41458. selector: "visitIRReturn:",
  41459. protocol: "visiting",
  41460. fn: function (anIRReturn){
  41461. var self=this,$self=this;
  41462. return $core.withContext(function($ctx1) {
  41463. $recv($self._stream())._nextPutReturnWith_((function(){
  41464. return $core.withContext(function($ctx2) {
  41465. return (
  41466. $ctx2.supercall = true,
  41467. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41468. $ctx2.supercall = false;
  41469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41470. }));
  41471. return self;
  41472. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41473. },
  41474. args: ["anIRReturn"],
  41475. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41476. referencedClasses: [],
  41477. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41478. }),
  41479. $globals.IRJSTranslator);
  41480. $core.addMethod(
  41481. $core.method({
  41482. selector: "visitIRSend:",
  41483. protocol: "visiting",
  41484. fn: function (anIRSend){
  41485. var self=this,$self=this;
  41486. var sends,superclass;
  41487. return $core.withContext(function($ctx1) {
  41488. var $1,$2;
  41489. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41490. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41491. if($core.assert($1)){
  41492. $self._visitSuperSend_(anIRSend);
  41493. } else {
  41494. $self._visitSend_(anIRSend);
  41495. }
  41496. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41497. if($core.assert($2)){
  41498. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41499. }
  41500. return self;
  41501. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41502. },
  41503. args: ["anIRSend"],
  41504. source: "visitIRSend: anIRSend\x0a\x09| sends superclass |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend receiver isSuper\x0a\x09\x09ifTrue: [ self visitSuperSend: anIRSend ]\x0a\x09\x09ifFalse: [ self visitSend: anIRSend ].\x0a\x09\x09\x0a\x09anIRSend index < sends\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  41505. referencedClasses: [],
  41506. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41507. }),
  41508. $globals.IRJSTranslator);
  41509. $core.addMethod(
  41510. $core.method({
  41511. selector: "visitIRSequence:",
  41512. protocol: "visiting",
  41513. fn: function (anIRSequence){
  41514. var self=this,$self=this;
  41515. return $core.withContext(function($ctx1) {
  41516. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41517. return $core.withContext(function($ctx2) {
  41518. return $recv($self._stream())._nextPutStatementWith_((function(){
  41519. return $core.withContext(function($ctx3) {
  41520. return $self._visit_(each);
  41521. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41522. }));
  41523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41524. }));
  41525. return self;
  41526. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41527. },
  41528. args: ["anIRSequence"],
  41529. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41530. referencedClasses: [],
  41531. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41532. }),
  41533. $globals.IRJSTranslator);
  41534. $core.addMethod(
  41535. $core.method({
  41536. selector: "visitIRTempDeclaration:",
  41537. protocol: "visiting",
  41538. fn: function (anIRTempDeclaration){
  41539. var self=this,$self=this;
  41540. return self;
  41541. },
  41542. args: ["anIRTempDeclaration"],
  41543. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41544. referencedClasses: [],
  41545. messageSends: []
  41546. }),
  41547. $globals.IRJSTranslator);
  41548. $core.addMethod(
  41549. $core.method({
  41550. selector: "visitIRValue:",
  41551. protocol: "visiting",
  41552. fn: function (anIRValue){
  41553. var self=this,$self=this;
  41554. return $core.withContext(function($ctx1) {
  41555. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41556. return self;
  41557. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41558. },
  41559. args: ["anIRValue"],
  41560. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41561. referencedClasses: [],
  41562. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41563. }),
  41564. $globals.IRJSTranslator);
  41565. $core.addMethod(
  41566. $core.method({
  41567. selector: "visitIRVariable:",
  41568. protocol: "visiting",
  41569. fn: function (anIRVariable){
  41570. var self=this,$self=this;
  41571. return $core.withContext(function($ctx1) {
  41572. var $3,$2,$1,$4;
  41573. $3=$recv(anIRVariable)._variable();
  41574. $ctx1.sendIdx["variable"]=1;
  41575. $2=$recv($3)._name();
  41576. $1=$recv($2).__eq("thisContext");
  41577. if($core.assert($1)){
  41578. $4=$self._stream();
  41579. $ctx1.sendIdx["stream"]=1;
  41580. $recv($4)._nextPutAll_("$core.getThisContext()");
  41581. $ctx1.sendIdx["nextPutAll:"]=1;
  41582. } else {
  41583. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41584. }
  41585. return self;
  41586. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41587. },
  41588. args: ["anIRVariable"],
  41589. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: '$core.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  41590. referencedClasses: [],
  41591. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41592. }),
  41593. $globals.IRJSTranslator);
  41594. $core.addMethod(
  41595. $core.method({
  41596. selector: "visitIRVerbatim:",
  41597. protocol: "visiting",
  41598. fn: function (anIRVerbatim){
  41599. var self=this,$self=this;
  41600. return $core.withContext(function($ctx1) {
  41601. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41602. return self;
  41603. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41604. },
  41605. args: ["anIRVerbatim"],
  41606. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  41607. referencedClasses: [],
  41608. messageSends: ["nextPutAll:", "stream", "source"]
  41609. }),
  41610. $globals.IRJSTranslator);
  41611. $core.addMethod(
  41612. $core.method({
  41613. selector: "visitInstructionList:enclosedBetween:and:",
  41614. protocol: "visiting",
  41615. fn: function (anArray,aString,anotherString){
  41616. var self=this,$self=this;
  41617. return $core.withContext(function($ctx1) {
  41618. var $1;
  41619. $1=$self._stream();
  41620. $ctx1.sendIdx["stream"]=1;
  41621. $recv($1)._nextPutAll_(aString);
  41622. $ctx1.sendIdx["nextPutAll:"]=1;
  41623. $recv(anArray)._do_separatedBy_((function(each){
  41624. return $core.withContext(function($ctx2) {
  41625. return $self._visit_(each);
  41626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41627. }),(function(){
  41628. return $core.withContext(function($ctx2) {
  41629. return $recv($self._stream())._nextPutAll_(",");
  41630. $ctx2.sendIdx["nextPutAll:"]=2;
  41631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41632. }));
  41633. $recv($self["@stream"])._nextPutAll_(anotherString);
  41634. return self;
  41635. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41636. },
  41637. args: ["anArray", "aString", "anotherString"],
  41638. source: "visitInstructionList: anArray enclosedBetween: aString and: anotherString\x0a\x09self stream nextPutAll: aString.\x0a\x09anArray\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: anotherString",
  41639. referencedClasses: [],
  41640. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41641. }),
  41642. $globals.IRJSTranslator);
  41643. $core.addMethod(
  41644. $core.method({
  41645. selector: "visitReceiver:",
  41646. protocol: "visiting",
  41647. fn: function (anIRInstruction){
  41648. var self=this,$self=this;
  41649. var instr;
  41650. return $core.withContext(function($ctx1) {
  41651. var $1,$2,$4,$5,$3,$6,$7,$8;
  41652. $1=$recv(anIRInstruction)._isSelf();
  41653. if($core.assert($1)){
  41654. $2=$recv(anIRInstruction)._copy();
  41655. $ctx1.sendIdx["copy"]=1;
  41656. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41657. $recv($4)._name_("$self");
  41658. $5=$recv($4)._yourself();
  41659. $ctx1.sendIdx["yourself"]=1;
  41660. $3=$5;
  41661. $recv($2)._variable_($3);
  41662. instr=$recv($2)._yourself();
  41663. instr;
  41664. } else {
  41665. instr=anIRInstruction;
  41666. instr;
  41667. }
  41668. $6=$recv(instr)._needsBoxingAsReceiver();
  41669. if(!$core.assert($6)){
  41670. $7=$self._visit_(instr);
  41671. $ctx1.sendIdx["visit:"]=1;
  41672. return $7;
  41673. }
  41674. $8=$self._stream();
  41675. $ctx1.sendIdx["stream"]=1;
  41676. $recv($8)._nextPutAll_("$recv(");
  41677. $ctx1.sendIdx["nextPutAll:"]=1;
  41678. $self._visit_(instr);
  41679. $recv($self._stream())._nextPutAll_(")");
  41680. return self;
  41681. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41682. },
  41683. args: ["anIRInstruction"],
  41684. source: "visitReceiver: anIRInstruction\x0a\x09| instr |\x0a\x0a\x09anIRInstruction isSelf\x0a\x09\x09ifTrue: [ instr := anIRInstruction copy\x0a\x09\x09\x09variable: (anIRInstruction variable copy name: '$self'; yourself);\x0a\x09\x09\x09yourself ]\x0a\x09\x09ifFalse: [ instr := anIRInstruction ].\x0a\x09\x0a\x09instr needsBoxingAsReceiver ifFalse: [ ^ self visit: instr ].\x0a\x09\x0a\x09self stream nextPutAll: '$recv('.\x0a\x09self visit: instr.\x0a\x09self stream nextPutAll: ')'",
  41685. referencedClasses: [],
  41686. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41687. }),
  41688. $globals.IRJSTranslator);
  41689. $core.addMethod(
  41690. $core.method({
  41691. selector: "visitSend:",
  41692. protocol: "visiting",
  41693. fn: function (anIRSend){
  41694. var self=this,$self=this;
  41695. return $core.withContext(function($ctx1) {
  41696. $self._visitReceiver_($recv(anIRSend)._receiver());
  41697. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41698. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41699. return self;
  41700. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41701. },
  41702. args: ["anIRSend"],
  41703. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend receiver.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '(' and: ')'",
  41704. referencedClasses: [],
  41705. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41706. }),
  41707. $globals.IRJSTranslator);
  41708. $core.addMethod(
  41709. $core.method({
  41710. selector: "visitSuperSend:",
  41711. protocol: "visiting",
  41712. fn: function (anIRSend){
  41713. var self=this,$self=this;
  41714. return $core.withContext(function($ctx1) {
  41715. var $1,$4,$3,$2,$5,$6,$7,$8;
  41716. $1=$self._stream();
  41717. $ctx1.sendIdx["stream"]=1;
  41718. $recv($1)._nextPutAll_("(");
  41719. $ctx1.sendIdx["nextPutAll:"]=1;
  41720. $recv($1)._lf();
  41721. $ctx1.sendIdx["lf"]=1;
  41722. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41723. $ctx1.sendIdx["nextPutAll:"]=2;
  41724. $recv($1)._lf();
  41725. $ctx1.sendIdx["lf"]=2;
  41726. $4=$recv(anIRSend)._scope();
  41727. $ctx1.sendIdx["scope"]=1;
  41728. $3=$recv($4)._alias();
  41729. $ctx1.sendIdx["alias"]=1;
  41730. $2=$recv($3).__comma(".supercall = true,");
  41731. $ctx1.sendIdx[","]=1;
  41732. $recv($1)._nextPutAll_($2);
  41733. $ctx1.sendIdx["nextPutAll:"]=3;
  41734. $recv($1)._lf();
  41735. $ctx1.sendIdx["lf"]=3;
  41736. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41737. $ctx1.sendIdx["nextPutAll:"]=4;
  41738. $recv($1)._lf();
  41739. $ctx1.sendIdx["lf"]=4;
  41740. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41741. $ctx1.sendIdx[","]=2;
  41742. $recv($1)._nextPutAll_($5);
  41743. $ctx1.sendIdx["nextPutAll:"]=5;
  41744. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41745. $ctx1.sendIdx["nextPutAll:"]=6;
  41746. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41747. $ctx1.sendIdx[","]=3;
  41748. $recv($1)._nextPutAll_($6);
  41749. $ctx1.sendIdx["nextPutAll:"]=7;
  41750. $7=$recv($1)._nextPutAll_("$self, ");
  41751. $ctx1.sendIdx["nextPutAll:"]=8;
  41752. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41753. $8=$self._stream();
  41754. $recv($8)._nextPutAll_("));");
  41755. $ctx1.sendIdx["nextPutAll:"]=9;
  41756. $recv($8)._lf();
  41757. $ctx1.sendIdx["lf"]=5;
  41758. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41759. $ctx1.sendIdx["nextPutAll:"]=10;
  41760. $recv($8)._lf();
  41761. $ctx1.sendIdx["lf"]=6;
  41762. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41763. $ctx1.sendIdx["nextPutAll:"]=11;
  41764. $recv($8)._lf();
  41765. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41766. return self;
  41767. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41768. },
  41769. args: ["anIRSend"],
  41770. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavaScriptSource;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$self, '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  41771. referencedClasses: [],
  41772. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41773. }),
  41774. $globals.IRJSTranslator);
  41775. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41776. $core.addMethod(
  41777. $core.method({
  41778. selector: "contents",
  41779. protocol: "accessing",
  41780. fn: function (){
  41781. var self=this,$self=this;
  41782. return $core.withContext(function($ctx1) {
  41783. return $recv($self["@stream"])._contents();
  41784. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41785. },
  41786. args: [],
  41787. source: "contents\x0a\x09^ stream contents",
  41788. referencedClasses: [],
  41789. messageSends: ["contents"]
  41790. }),
  41791. $globals.JSStream);
  41792. $core.addMethod(
  41793. $core.method({
  41794. selector: "initialize",
  41795. protocol: "initialization",
  41796. fn: function (){
  41797. var self=this,$self=this;
  41798. return $core.withContext(function($ctx1) {
  41799. (
  41800. $ctx1.supercall = true,
  41801. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41802. $ctx1.supercall = false;
  41803. $self["@stream"]=""._writeStream();
  41804. return self;
  41805. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41806. },
  41807. args: [],
  41808. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41809. referencedClasses: [],
  41810. messageSends: ["initialize", "writeStream"]
  41811. }),
  41812. $globals.JSStream);
  41813. $core.addMethod(
  41814. $core.method({
  41815. selector: "lf",
  41816. protocol: "streaming",
  41817. fn: function (){
  41818. var self=this,$self=this;
  41819. return $core.withContext(function($ctx1) {
  41820. $recv($self["@stream"])._lf();
  41821. return self;
  41822. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41823. },
  41824. args: [],
  41825. source: "lf\x0a\x09stream lf",
  41826. referencedClasses: [],
  41827. messageSends: ["lf"]
  41828. }),
  41829. $globals.JSStream);
  41830. $core.addMethod(
  41831. $core.method({
  41832. selector: "nextPut:",
  41833. protocol: "streaming",
  41834. fn: function (aString){
  41835. var self=this,$self=this;
  41836. return $core.withContext(function($ctx1) {
  41837. $recv($self["@stream"])._nextPut_(aString);
  41838. return self;
  41839. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41840. },
  41841. args: ["aString"],
  41842. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41843. referencedClasses: [],
  41844. messageSends: ["nextPut:"]
  41845. }),
  41846. $globals.JSStream);
  41847. $core.addMethod(
  41848. $core.method({
  41849. selector: "nextPutAll:",
  41850. protocol: "streaming",
  41851. fn: function (aString){
  41852. var self=this,$self=this;
  41853. return $core.withContext(function($ctx1) {
  41854. $recv($self["@stream"])._nextPutAll_(aString);
  41855. return self;
  41856. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41857. },
  41858. args: ["aString"],
  41859. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41860. referencedClasses: [],
  41861. messageSends: ["nextPutAll:"]
  41862. }),
  41863. $globals.JSStream);
  41864. $core.addMethod(
  41865. $core.method({
  41866. selector: "nextPutAssignLhs:rhs:",
  41867. protocol: "streaming",
  41868. fn: function (aBlock,anotherBlock){
  41869. var self=this,$self=this;
  41870. return $core.withContext(function($ctx1) {
  41871. $recv(aBlock)._value();
  41872. $ctx1.sendIdx["value"]=1;
  41873. $recv($self["@stream"])._nextPutAll_("=");
  41874. $recv(anotherBlock)._value();
  41875. return self;
  41876. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41877. },
  41878. args: ["aBlock", "anotherBlock"],
  41879. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41880. referencedClasses: [],
  41881. messageSends: ["value", "nextPutAll:"]
  41882. }),
  41883. $globals.JSStream);
  41884. $core.addMethod(
  41885. $core.method({
  41886. selector: "nextPutBlockContextFor:during:",
  41887. protocol: "streaming",
  41888. fn: function (anIRClosure,aBlock){
  41889. var self=this,$self=this;
  41890. return $core.withContext(function($ctx1) {
  41891. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  41892. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  41893. if(!$core.assert($1)){
  41894. $2=$recv(aBlock)._value();
  41895. $ctx1.sendIdx["value"]=1;
  41896. return $2;
  41897. }
  41898. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41899. $ctx1.sendIdx["nextPutAll:"]=1;
  41900. $self._lf();
  41901. $ctx1.sendIdx["lf"]=1;
  41902. $6=$recv(anIRClosure)._scope();
  41903. $ctx1.sendIdx["scope"]=1;
  41904. $5=$recv($6)._alias();
  41905. $ctx1.sendIdx["alias"]=1;
  41906. $4="return $core.withContext(function(".__comma($5);
  41907. $ctx1.sendIdx[","]=2;
  41908. $3=$recv($4).__comma(") {");
  41909. $ctx1.sendIdx[","]=1;
  41910. $self._nextPutAll_($3);
  41911. $ctx1.sendIdx["nextPutAll:"]=2;
  41912. $self._lf();
  41913. $ctx1.sendIdx["lf"]=2;
  41914. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41915. $ctx1.sendIdx["nextPutAll:"]=3;
  41916. $7=$self._lf();
  41917. $ctx1.sendIdx["lf"]=3;
  41918. $recv(aBlock)._value();
  41919. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41920. $ctx1.sendIdx["nextPutAll:"]=4;
  41921. $self._lf();
  41922. $ctx1.sendIdx["lf"]=4;
  41923. $11=$recv(anIRClosure)._scope();
  41924. $ctx1.sendIdx["scope"]=2;
  41925. $10=$recv($11)._alias();
  41926. $ctx1.sendIdx["alias"]=2;
  41927. $9="}, function(".__comma($10);
  41928. $ctx1.sendIdx[","]=4;
  41929. $8=$recv($9).__comma(") {");
  41930. $ctx1.sendIdx[","]=3;
  41931. $self._nextPutAll_($8);
  41932. $ctx1.sendIdx["nextPutAll:"]=5;
  41933. $15=$recv(anIRClosure)._scope();
  41934. $ctx1.sendIdx["scope"]=3;
  41935. $14=$recv($15)._alias();
  41936. $ctx1.sendIdx["alias"]=3;
  41937. $13=$recv($14).__comma(".fillBlock({");
  41938. $ctx1.sendIdx[","]=5;
  41939. $12=$self._nextPutAll_($13);
  41940. $ctx1.sendIdx["nextPutAll:"]=6;
  41941. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  41942. return $core.withContext(function($ctx2) {
  41943. $16=$recv(each)._asVariableName();
  41944. $ctx2.sendIdx["asVariableName"]=1;
  41945. $self._nextPutAll_($16);
  41946. $ctx2.sendIdx["nextPutAll:"]=7;
  41947. $self._nextPutAll_(":");
  41948. $ctx2.sendIdx["nextPutAll:"]=8;
  41949. $17=$self._nextPutAll_($recv(each)._asVariableName());
  41950. $ctx2.sendIdx["nextPutAll:"]=9;
  41951. return $17;
  41952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41953. }),(function(){
  41954. return $core.withContext(function($ctx2) {
  41955. return $self._nextPutAll_(",");
  41956. $ctx2.sendIdx["nextPutAll:"]=10;
  41957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41958. }));
  41959. $self._nextPutAll_("},");
  41960. $ctx1.sendIdx["nextPutAll:"]=11;
  41961. $23=$recv(anIRClosure)._scope();
  41962. $ctx1.sendIdx["scope"]=4;
  41963. $22=$recv($23)._outerScope();
  41964. $21=$recv($22)._alias();
  41965. $20=$recv($21).__comma(",");
  41966. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  41967. $ctx1.sendIdx[","]=7;
  41968. $18=$recv($19).__comma(")});");
  41969. $ctx1.sendIdx[","]=6;
  41970. $self._nextPutAll_($18);
  41971. $ctx1.sendIdx["nextPutAll:"]=12;
  41972. $self._lf();
  41973. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41974. return self;
  41975. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  41976. },
  41977. args: ["anIRClosure", "aBlock"],
  41978. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', anIRClosure scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  41979. referencedClasses: [],
  41980. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  41981. }),
  41982. $globals.JSStream);
  41983. $core.addMethod(
  41984. $core.method({
  41985. selector: "nextPutClosureWith:arguments:",
  41986. protocol: "streaming",
  41987. fn: function (aBlock,anArray){
  41988. var self=this,$self=this;
  41989. return $core.withContext(function($ctx1) {
  41990. var $1,$2,$3;
  41991. $recv($self["@stream"])._nextPutAll_("(function(");
  41992. $ctx1.sendIdx["nextPutAll:"]=1;
  41993. $recv(anArray)._do_separatedBy_((function(each){
  41994. return $core.withContext(function($ctx2) {
  41995. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41996. $ctx2.sendIdx["nextPutAll:"]=2;
  41997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41998. }),(function(){
  41999. return $core.withContext(function($ctx2) {
  42000. return $recv($self["@stream"])._nextPut_(",");
  42001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42002. }));
  42003. $1=$self["@stream"];
  42004. $recv($1)._nextPutAll_("){");
  42005. $ctx1.sendIdx["nextPutAll:"]=3;
  42006. $2=$recv($1)._lf();
  42007. $ctx1.sendIdx["lf"]=1;
  42008. $recv(aBlock)._value();
  42009. $3=$self["@stream"];
  42010. $recv($3)._lf();
  42011. $recv($3)._nextPutAll_("})");
  42012. return self;
  42013. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42014. },
  42015. args: ["aBlock", "anArray"],
  42016. source: "nextPutClosureWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '})'",
  42017. referencedClasses: [],
  42018. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42019. }),
  42020. $globals.JSStream);
  42021. $core.addMethod(
  42022. $core.method({
  42023. selector: "nextPutContextFor:during:",
  42024. protocol: "streaming",
  42025. fn: function (aMethod,aBlock){
  42026. var self=this,$self=this;
  42027. return $core.withContext(function($ctx1) {
  42028. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  42029. $1=$recv(aMethod)._requiresSmalltalkContext();
  42030. if(!$core.assert($1)){
  42031. $2=$recv(aBlock)._value();
  42032. $ctx1.sendIdx["value"]=1;
  42033. return $2;
  42034. }
  42035. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42036. $ctx1.sendIdx["nextPutAll:"]=1;
  42037. $self._lf();
  42038. $ctx1.sendIdx["lf"]=1;
  42039. $6=$recv(aMethod)._scope();
  42040. $ctx1.sendIdx["scope"]=1;
  42041. $5=$recv($6)._alias();
  42042. $ctx1.sendIdx["alias"]=1;
  42043. $4="return $core.withContext(function(".__comma($5);
  42044. $ctx1.sendIdx[","]=2;
  42045. $3=$recv($4).__comma(") {");
  42046. $ctx1.sendIdx[","]=1;
  42047. $self._nextPutAll_($3);
  42048. $ctx1.sendIdx["nextPutAll:"]=2;
  42049. $self._lf();
  42050. $ctx1.sendIdx["lf"]=2;
  42051. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42052. $ctx1.sendIdx["nextPutAll:"]=3;
  42053. $7=$self._lf();
  42054. $ctx1.sendIdx["lf"]=3;
  42055. $recv(aBlock)._value();
  42056. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42057. $ctx1.sendIdx["nextPutAll:"]=4;
  42058. $self._lf();
  42059. $ctx1.sendIdx["lf"]=4;
  42060. $12=$recv(aMethod)._scope();
  42061. $ctx1.sendIdx["scope"]=2;
  42062. $11=$recv($12)._alias();
  42063. $ctx1.sendIdx["alias"]=2;
  42064. $10="}, function(".__comma($11);
  42065. $ctx1.sendIdx[","]=5;
  42066. $9=$recv($10).__comma(") {");
  42067. $ctx1.sendIdx[","]=4;
  42068. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  42069. $ctx1.sendIdx[","]=3;
  42070. $self._nextPutAll_($8);
  42071. $ctx1.sendIdx["nextPutAll:"]=5;
  42072. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42073. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42074. $15=".fill(self,".__comma($16);
  42075. $14=$recv($15).__comma(",{");
  42076. $ctx1.sendIdx[","]=6;
  42077. $13=$self._nextPutAll_($14);
  42078. $ctx1.sendIdx["nextPutAll:"]=6;
  42079. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  42080. return $core.withContext(function($ctx2) {
  42081. $17=$recv(each)._asVariableName();
  42082. $ctx2.sendIdx["asVariableName"]=1;
  42083. $self._nextPutAll_($17);
  42084. $ctx2.sendIdx["nextPutAll:"]=7;
  42085. $self._nextPutAll_(":");
  42086. $ctx2.sendIdx["nextPutAll:"]=8;
  42087. $18=$self._nextPutAll_($recv(each)._asVariableName());
  42088. $ctx2.sendIdx["nextPutAll:"]=9;
  42089. return $18;
  42090. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42091. }),(function(){
  42092. return $core.withContext(function($ctx2) {
  42093. return $self._nextPutAll_(",");
  42094. $ctx2.sendIdx["nextPutAll:"]=10;
  42095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42096. }));
  42097. $self._nextPutAll_("},");
  42098. $ctx1.sendIdx["nextPutAll:"]=11;
  42099. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  42100. $ctx1.sendIdx["nextPutAll:"]=12;
  42101. $self._nextPutAll_(")});");
  42102. $ctx1.sendIdx["nextPutAll:"]=13;
  42103. $self._lf();
  42104. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42105. return self;
  42106. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42107. },
  42108. args: ["aMethod", "aBlock"],
  42109. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return $core.withContext(function(', aMethod scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavaScriptSource, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavaScriptSource;\x0a\x09\x09nextPutAll: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  42110. referencedClasses: [],
  42111. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  42112. }),
  42113. $globals.JSStream);
  42114. $core.addMethod(
  42115. $core.method({
  42116. selector: "nextPutFunctionWith:arguments:",
  42117. protocol: "streaming",
  42118. fn: function (aBlock,anArray){
  42119. var self=this,$self=this;
  42120. return $core.withContext(function($ctx1) {
  42121. var $1,$2,$3,$4,$5;
  42122. $recv($self["@stream"])._nextPutAll_("fn: function (");
  42123. $ctx1.sendIdx["nextPutAll:"]=1;
  42124. $recv(anArray)._do_separatedBy_((function(each){
  42125. return $core.withContext(function($ctx2) {
  42126. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42127. $ctx2.sendIdx["nextPutAll:"]=2;
  42128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42129. }),(function(){
  42130. return $core.withContext(function($ctx2) {
  42131. return $recv($self["@stream"])._nextPut_(",");
  42132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42133. }));
  42134. $1=$self["@stream"];
  42135. $recv($1)._nextPutAll_("){");
  42136. $ctx1.sendIdx["nextPutAll:"]=3;
  42137. $2=$recv($1)._lf();
  42138. $ctx1.sendIdx["lf"]=1;
  42139. $3=$self["@stream"];
  42140. $recv($3)._nextPutAll_("var self=this,$self=this;");
  42141. $ctx1.sendIdx["nextPutAll:"]=4;
  42142. $4=$recv($3)._lf();
  42143. $ctx1.sendIdx["lf"]=2;
  42144. $recv(aBlock)._value();
  42145. $5=$self["@stream"];
  42146. $recv($5)._lf();
  42147. $recv($5)._nextPutAll_("}");
  42148. return self;
  42149. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42150. },
  42151. args: ["aBlock", "anArray"],
  42152. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function ('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this,$self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
  42153. referencedClasses: [],
  42154. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42155. }),
  42156. $globals.JSStream);
  42157. $core.addMethod(
  42158. $core.method({
  42159. selector: "nextPutIf:then:",
  42160. protocol: "streaming",
  42161. fn: function (aBlock,anotherBlock){
  42162. var self=this,$self=this;
  42163. return $core.withContext(function($ctx1) {
  42164. var $1;
  42165. $recv($self["@stream"])._nextPutAll_("if(");
  42166. $ctx1.sendIdx["nextPutAll:"]=1;
  42167. $recv(aBlock)._value();
  42168. $ctx1.sendIdx["value"]=1;
  42169. $1=$self["@stream"];
  42170. $recv($1)._nextPutAll_("){");
  42171. $ctx1.sendIdx["nextPutAll:"]=2;
  42172. $recv($1)._lf();
  42173. $recv(anotherBlock)._value();
  42174. $recv($self["@stream"])._nextPutAll_("}");
  42175. $self._omitSemicolon_(true);
  42176. return self;
  42177. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42178. },
  42179. args: ["aBlock", "anotherBlock"],
  42180. source: "nextPutIf: aBlock then: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'.\x0a\x09self omitSemicolon: true",
  42181. referencedClasses: [],
  42182. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42183. }),
  42184. $globals.JSStream);
  42185. $core.addMethod(
  42186. $core.method({
  42187. selector: "nextPutIf:then:else:",
  42188. protocol: "streaming",
  42189. fn: function (aBlock,ifBlock,elseBlock){
  42190. var self=this,$self=this;
  42191. return $core.withContext(function($ctx1) {
  42192. var $1,$2,$3;
  42193. $recv($self["@stream"])._nextPutAll_("if(");
  42194. $ctx1.sendIdx["nextPutAll:"]=1;
  42195. $recv(aBlock)._value();
  42196. $ctx1.sendIdx["value"]=1;
  42197. $1=$self["@stream"];
  42198. $recv($1)._nextPutAll_("){");
  42199. $ctx1.sendIdx["nextPutAll:"]=2;
  42200. $2=$recv($1)._lf();
  42201. $ctx1.sendIdx["lf"]=1;
  42202. $recv(ifBlock)._value();
  42203. $ctx1.sendIdx["value"]=2;
  42204. $3=$self["@stream"];
  42205. $recv($3)._nextPutAll_("} else {");
  42206. $ctx1.sendIdx["nextPutAll:"]=3;
  42207. $recv($3)._lf();
  42208. $recv(elseBlock)._value();
  42209. $recv($self["@stream"])._nextPutAll_("}");
  42210. $self._omitSemicolon_(true);
  42211. return self;
  42212. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  42213. },
  42214. args: ["aBlock", "ifBlock", "elseBlock"],
  42215. source: "nextPutIf: aBlock then: ifBlock else: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'.\x0a\x09self omitSemicolon: true",
  42216. referencedClasses: [],
  42217. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42218. }),
  42219. $globals.JSStream);
  42220. $core.addMethod(
  42221. $core.method({
  42222. selector: "nextPutMethodDeclaration:with:",
  42223. protocol: "streaming",
  42224. fn: function (aMethod,aBlock){
  42225. var self=this,$self=this;
  42226. return $core.withContext(function($ctx1) {
  42227. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  42228. $1=$self["@stream"];
  42229. $recv($1)._nextPutAll_("$core.method({");
  42230. $ctx1.sendIdx["nextPutAll:"]=1;
  42231. $recv($1)._lf();
  42232. $ctx1.sendIdx["lf"]=1;
  42233. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42234. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42235. $3="selector: ".__comma($4);
  42236. $ctx1.sendIdx[","]=2;
  42237. $2=$recv($3).__comma(",");
  42238. $ctx1.sendIdx[","]=1;
  42239. $recv($1)._nextPutAll_($2);
  42240. $ctx1.sendIdx["nextPutAll:"]=2;
  42241. $recv($1)._lf();
  42242. $ctx1.sendIdx["lf"]=2;
  42243. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  42244. $ctx1.sendIdx["asJavaScriptSource"]=2;
  42245. $6="source: ".__comma($7);
  42246. $ctx1.sendIdx[","]=4;
  42247. $5=$recv($6).__comma(",");
  42248. $ctx1.sendIdx[","]=3;
  42249. $recv($1)._nextPutAll_($5);
  42250. $ctx1.sendIdx["nextPutAll:"]=3;
  42251. $8=$recv($1)._lf();
  42252. $ctx1.sendIdx["lf"]=3;
  42253. $recv(aBlock)._value();
  42254. $ctx1.sendIdx["value"]=1;
  42255. $9=$self["@stream"];
  42256. $12=$recv($globals.String)._lf();
  42257. $ctx1.sendIdx["lf"]=4;
  42258. $11=",".__comma($12);
  42259. $ctx1.sendIdx[","]=6;
  42260. $10=$recv($11).__comma("messageSends: ");
  42261. $ctx1.sendIdx[","]=5;
  42262. $recv($9)._nextPutAll_($10);
  42263. $ctx1.sendIdx["nextPutAll:"]=4;
  42264. $15=$recv($recv(aMethod)._messageSends())._asArray();
  42265. $ctx1.sendIdx["asArray"]=1;
  42266. $14=$recv($15)._asJavaScriptSource();
  42267. $ctx1.sendIdx["asJavaScriptSource"]=3;
  42268. $13=$recv($14).__comma(",");
  42269. $ctx1.sendIdx[","]=7;
  42270. $recv($9)._nextPutAll_($13);
  42271. $ctx1.sendIdx["nextPutAll:"]=5;
  42272. $recv($9)._lf();
  42273. $ctx1.sendIdx["lf"]=5;
  42274. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  42275. return $core.withContext(function($ctx2) {
  42276. return $recv(each)._value();
  42277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42278. })))._asArray())._asJavaScriptSource();
  42279. $ctx1.sendIdx["asJavaScriptSource"]=4;
  42280. $17="args: ".__comma($18);
  42281. $16=$recv($17).__comma(",");
  42282. $ctx1.sendIdx[","]=8;
  42283. $recv($9)._nextPutAll_($16);
  42284. $ctx1.sendIdx["nextPutAll:"]=6;
  42285. $recv($9)._lf();
  42286. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  42287. $ctx1.sendIdx["nextPutAll:"]=7;
  42288. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  42289. return $core.withContext(function($ctx2) {
  42290. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  42291. $ctx2.sendIdx["nextPutAll:"]=8;
  42292. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42293. }),(function(){
  42294. return $core.withContext(function($ctx2) {
  42295. return $recv($self["@stream"])._nextPutAll_(",");
  42296. $ctx2.sendIdx["nextPutAll:"]=9;
  42297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42298. }));
  42299. $20=$self["@stream"];
  42300. $recv($20)._nextPutAll_("]");
  42301. $ctx1.sendIdx["nextPutAll:"]=10;
  42302. $recv($20)._nextPutAll_("})");
  42303. return self;
  42304. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42305. },
  42306. args: ["aMethod", "aBlock"],
  42307. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: '$core.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavaScriptSource, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavaScriptSource, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavaScriptSource ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  42308. referencedClasses: ["String"],
  42309. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  42310. }),
  42311. $globals.JSStream);
  42312. $core.addMethod(
  42313. $core.method({
  42314. selector: "nextPutNonLocalReturnHandlingWith:",
  42315. protocol: "streaming",
  42316. fn: function (aBlock){
  42317. var self=this,$self=this;
  42318. return $core.withContext(function($ctx1) {
  42319. var $1,$2,$3;
  42320. $1=$self["@stream"];
  42321. $recv($1)._nextPutAll_("var $early={};");
  42322. $ctx1.sendIdx["nextPutAll:"]=1;
  42323. $recv($1)._lf();
  42324. $ctx1.sendIdx["lf"]=1;
  42325. $recv($1)._nextPutAll_("try {");
  42326. $ctx1.sendIdx["nextPutAll:"]=2;
  42327. $2=$recv($1)._lf();
  42328. $ctx1.sendIdx["lf"]=2;
  42329. $recv(aBlock)._value();
  42330. $3=$self["@stream"];
  42331. $recv($3)._nextPutAll_("}");
  42332. $ctx1.sendIdx["nextPutAll:"]=3;
  42333. $recv($3)._lf();
  42334. $ctx1.sendIdx["lf"]=3;
  42335. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42336. $recv($3)._lf();
  42337. return self;
  42338. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42339. },
  42340. args: ["aBlock"],
  42341. source: "nextPutNonLocalReturnHandlingWith: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'var $early={};'; lf;\x0a\x09\x09nextPutAll: 'try {'; lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: '}'; lf;\x0a\x09\x09nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf",
  42342. referencedClasses: [],
  42343. messageSends: ["nextPutAll:", "lf", "value"]
  42344. }),
  42345. $globals.JSStream);
  42346. $core.addMethod(
  42347. $core.method({
  42348. selector: "nextPutNonLocalReturnWith:",
  42349. protocol: "streaming",
  42350. fn: function (aBlock){
  42351. var self=this,$self=this;
  42352. return $core.withContext(function($ctx1) {
  42353. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  42354. $ctx1.sendIdx["nextPutAll:"]=1;
  42355. $recv(aBlock)._value();
  42356. $recv($self["@stream"])._nextPutAll_("]");
  42357. return self;
  42358. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42359. },
  42360. args: ["aBlock"],
  42361. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42362. referencedClasses: [],
  42363. messageSends: ["nextPutAll:", "value"]
  42364. }),
  42365. $globals.JSStream);
  42366. $core.addMethod(
  42367. $core.method({
  42368. selector: "nextPutReturnWith:",
  42369. protocol: "streaming",
  42370. fn: function (aBlock){
  42371. var self=this,$self=this;
  42372. return $core.withContext(function($ctx1) {
  42373. $recv($self["@stream"])._nextPutAll_("return ");
  42374. $recv(aBlock)._value();
  42375. return self;
  42376. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42377. },
  42378. args: ["aBlock"],
  42379. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42380. referencedClasses: [],
  42381. messageSends: ["nextPutAll:", "value"]
  42382. }),
  42383. $globals.JSStream);
  42384. $core.addMethod(
  42385. $core.method({
  42386. selector: "nextPutSendIndexFor:",
  42387. protocol: "streaming",
  42388. fn: function (anIRSend){
  42389. var self=this,$self=this;
  42390. return $core.withContext(function($ctx1) {
  42391. $self._nextPutAll_(";");
  42392. $ctx1.sendIdx["nextPutAll:"]=1;
  42393. $self._lf();
  42394. $ctx1.sendIdx["lf"]=1;
  42395. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42396. $ctx1.sendIdx["nextPutAll:"]=2;
  42397. $self._lf();
  42398. $ctx1.sendIdx["lf"]=2;
  42399. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42400. $ctx1.sendIdx["nextPutAll:"]=3;
  42401. $self._nextPutAll_(".sendIdx[");
  42402. $ctx1.sendIdx["nextPutAll:"]=4;
  42403. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42404. $ctx1.sendIdx["nextPutAll:"]=5;
  42405. $self._nextPutAll_("]=");
  42406. $ctx1.sendIdx["nextPutAll:"]=6;
  42407. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42408. $ctx1.sendIdx["nextPutAll:"]=7;
  42409. $self._nextPutAll_(";");
  42410. $ctx1.sendIdx["nextPutAll:"]=8;
  42411. $self._lf();
  42412. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42413. return self;
  42414. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42415. },
  42416. args: ["anIRSend"],
  42417. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptSource;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  42418. referencedClasses: [],
  42419. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42420. }),
  42421. $globals.JSStream);
  42422. $core.addMethod(
  42423. $core.method({
  42424. selector: "nextPutStatementWith:",
  42425. protocol: "streaming",
  42426. fn: function (aBlock){
  42427. var self=this,$self=this;
  42428. return $core.withContext(function($ctx1) {
  42429. var $1;
  42430. $self._omitSemicolon_(false);
  42431. $ctx1.sendIdx["omitSemicolon:"]=1;
  42432. $recv(aBlock)._value();
  42433. $1=$self._omitSemicolon();
  42434. if(!$core.assert($1)){
  42435. $recv($self["@stream"])._nextPutAll_(";");
  42436. }
  42437. $self._omitSemicolon_(false);
  42438. $recv($self["@stream"])._lf();
  42439. return self;
  42440. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42441. },
  42442. args: ["aBlock"],
  42443. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42444. referencedClasses: [],
  42445. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42446. }),
  42447. $globals.JSStream);
  42448. $core.addMethod(
  42449. $core.method({
  42450. selector: "nextPutVars:",
  42451. protocol: "streaming",
  42452. fn: function (aCollection){
  42453. var self=this,$self=this;
  42454. return $core.withContext(function($ctx1) {
  42455. var $1;
  42456. $recv(aCollection)._ifNotEmpty_((function(){
  42457. return $core.withContext(function($ctx2) {
  42458. $recv($self["@stream"])._nextPutAll_("var ");
  42459. $ctx2.sendIdx["nextPutAll:"]=1;
  42460. $recv(aCollection)._do_separatedBy_((function(each){
  42461. return $core.withContext(function($ctx3) {
  42462. return $recv($self["@stream"])._nextPutAll_(each);
  42463. $ctx3.sendIdx["nextPutAll:"]=2;
  42464. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42465. }),(function(){
  42466. return $core.withContext(function($ctx3) {
  42467. return $recv($self["@stream"])._nextPutAll_(",");
  42468. $ctx3.sendIdx["nextPutAll:"]=3;
  42469. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42470. }));
  42471. $1=$self["@stream"];
  42472. $recv($1)._nextPutAll_(";");
  42473. return $recv($1)._lf();
  42474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42475. }));
  42476. return self;
  42477. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42478. },
  42479. args: ["aCollection"],
  42480. source: "nextPutVars: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09stream nextPutAll: 'var '.\x0a\x09\x09aCollection\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09\x09stream nextPutAll: ';'; lf ]",
  42481. referencedClasses: [],
  42482. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42483. }),
  42484. $globals.JSStream);
  42485. $core.addMethod(
  42486. $core.method({
  42487. selector: "omitSemicolon",
  42488. protocol: "accessing",
  42489. fn: function (){
  42490. var self=this,$self=this;
  42491. return $self["@omitSemicolon"];
  42492. },
  42493. args: [],
  42494. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42495. referencedClasses: [],
  42496. messageSends: []
  42497. }),
  42498. $globals.JSStream);
  42499. $core.addMethod(
  42500. $core.method({
  42501. selector: "omitSemicolon:",
  42502. protocol: "accessing",
  42503. fn: function (aBoolean){
  42504. var self=this,$self=this;
  42505. $self["@omitSemicolon"]=aBoolean;
  42506. return self;
  42507. },
  42508. args: ["aBoolean"],
  42509. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42510. referencedClasses: [],
  42511. messageSends: []
  42512. }),
  42513. $globals.JSStream);
  42514. $core.addMethod(
  42515. $core.method({
  42516. selector: "isReferenced",
  42517. protocol: "*Compiler-IR",
  42518. fn: function (){
  42519. var self=this,$self=this;
  42520. return $core.withContext(function($ctx1) {
  42521. var $3,$2,$1;
  42522. $3=$self._parent();
  42523. $ctx1.sendIdx["parent"]=1;
  42524. $2=$recv($3)._isSequenceNode();
  42525. $1=$recv($2)._or_((function(){
  42526. return $core.withContext(function($ctx2) {
  42527. return $recv($self._parent())._isAssignmentNode();
  42528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42529. }));
  42530. return $recv($1)._not();
  42531. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42532. },
  42533. args: [],
  42534. source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not",
  42535. referencedClasses: [],
  42536. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42537. }),
  42538. $globals.ASTNode);
  42539. $core.addMethod(
  42540. $core.method({
  42541. selector: "subtreeNeedsAliasing",
  42542. protocol: "*Compiler-IR",
  42543. fn: function (){
  42544. var self=this,$self=this;
  42545. return $core.withContext(function($ctx1) {
  42546. return $recv($self._shouldBeAliased())._or_((function(){
  42547. return $core.withContext(function($ctx2) {
  42548. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42549. return $core.withContext(function($ctx3) {
  42550. return $recv(each)._subtreeNeedsAliasing();
  42551. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42552. }));
  42553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42554. }));
  42555. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42556. },
  42557. args: [],
  42558. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42559. referencedClasses: [],
  42560. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42561. }),
  42562. $globals.ASTNode);
  42563. $core.addMethod(
  42564. $core.method({
  42565. selector: "shouldBeAliased",
  42566. protocol: "*Compiler-IR",
  42567. fn: function (){
  42568. var self=this,$self=this;
  42569. return $core.withContext(function($ctx1) {
  42570. var $1;
  42571. $1=(
  42572. $ctx1.supercall = true,
  42573. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42574. $ctx1.supercall = false;
  42575. return $recv($1)._or_((function(){
  42576. return $core.withContext(function($ctx2) {
  42577. return $self._isReferenced();
  42578. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42579. }));
  42580. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42581. },
  42582. args: [],
  42583. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42584. referencedClasses: [],
  42585. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42586. }),
  42587. $globals.AssignmentNode);
  42588. $core.addMethod(
  42589. $core.method({
  42590. selector: "appendToInstruction:",
  42591. protocol: "*Compiler-IR",
  42592. fn: function (anIRInstruction){
  42593. var self=this,$self=this;
  42594. return $core.withContext(function($ctx1) {
  42595. $recv(anIRInstruction)._appendBlock_(self);
  42596. return self;
  42597. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42598. },
  42599. args: ["anIRInstruction"],
  42600. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42601. referencedClasses: [],
  42602. messageSends: ["appendBlock:"]
  42603. }),
  42604. $globals.BlockClosure);
  42605. $core.addMethod(
  42606. $core.method({
  42607. selector: "subtreeNeedsAliasing",
  42608. protocol: "*Compiler-IR",
  42609. fn: function (){
  42610. var self=this,$self=this;
  42611. return $core.withContext(function($ctx1) {
  42612. return $self._shouldBeAliased();
  42613. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42614. },
  42615. args: [],
  42616. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42617. referencedClasses: [],
  42618. messageSends: ["shouldBeAliased"]
  42619. }),
  42620. $globals.BlockNode);
  42621. $core.addMethod(
  42622. $core.method({
  42623. selector: "subtreeNeedsAliasing",
  42624. protocol: "*Compiler-IR",
  42625. fn: function (){
  42626. var self=this,$self=this;
  42627. return $core.withContext(function($ctx1) {
  42628. return $recv($recv($self._parent())._isSequenceNode())._not();
  42629. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42630. },
  42631. args: [],
  42632. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42633. referencedClasses: [],
  42634. messageSends: ["not", "isSequenceNode", "parent"]
  42635. }),
  42636. $globals.CascadeNode);
  42637. $core.addMethod(
  42638. $core.method({
  42639. selector: "shouldBeAliased",
  42640. protocol: "*Compiler-IR",
  42641. fn: function (){
  42642. var self=this,$self=this;
  42643. var sends;
  42644. return $core.withContext(function($ctx1) {
  42645. var $2,$1;
  42646. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42647. $2=(
  42648. $ctx1.supercall = true,
  42649. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42650. $ctx1.supercall = false;
  42651. $1=$recv($2)._or_((function(){
  42652. return $core.withContext(function($ctx2) {
  42653. return $recv($self._isReferenced())._and_((function(){
  42654. return $core.withContext(function($ctx3) {
  42655. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42656. return $core.withContext(function($ctx4) {
  42657. return $self._superSend();
  42658. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42659. }));
  42660. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42661. }));
  42662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42663. }));
  42664. $ctx1.sendIdx["or:"]=1;
  42665. return $1;
  42666. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42667. },
  42668. args: [],
  42669. source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09self index < sends or: [\x0a\x09\x09\x09\x09self superSend ] ] ])",
  42670. referencedClasses: [],
  42671. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42672. }),
  42673. $globals.SendNode);
  42674. $core.addMethod(
  42675. $core.method({
  42676. selector: "subtreeNeedsAliasing",
  42677. protocol: "*Compiler-IR",
  42678. fn: function (){
  42679. var self=this,$self=this;
  42680. return $core.withContext(function($ctx1) {
  42681. return $recv($self._shouldBeInlined())._or_((function(){
  42682. return $core.withContext(function($ctx2) {
  42683. return (
  42684. $ctx2.supercall = true,
  42685. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42686. $ctx2.supercall = false;
  42687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42688. }));
  42689. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42690. },
  42691. args: [],
  42692. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42693. referencedClasses: [],
  42694. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42695. }),
  42696. $globals.SendNode);
  42697. });
  42698. define('amber_core/Compiler-Inlining',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Compiler-IR", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects"], function($boot){"use strict";
  42699. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42700. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42701. $core.addPackage("Compiler-Inlining");
  42702. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  42703. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42704. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42705. $core.addMethod(
  42706. $core.method({
  42707. selector: "visitSendNode:",
  42708. protocol: "visiting",
  42709. fn: function (aNode){
  42710. var self=this,$self=this;
  42711. return $core.withContext(function($ctx1) {
  42712. var $1,$2,$3,$4,$receiver;
  42713. $1=$recv(aNode)._superSend();
  42714. if(!$core.assert($1)){
  42715. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42716. if($core.assert($2)){
  42717. $recv(aNode)._shouldBeInlined_(true);
  42718. $3=$recv(aNode)._receiver();
  42719. if(($receiver = $3) == null || $receiver.a$nil){
  42720. $3;
  42721. } else {
  42722. var receiver;
  42723. receiver=$receiver;
  42724. $recv(receiver)._shouldBeAliased_(true);
  42725. }
  42726. }
  42727. }
  42728. $4=(
  42729. $ctx1.supercall = true,
  42730. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42731. $ctx1.supercall = false;
  42732. return $4;
  42733. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42734. },
  42735. args: ["aNode"],
  42736. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09^ super visitSendNode: aNode",
  42737. referencedClasses: ["IRSendInliner"],
  42738. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42739. }),
  42740. $globals.ASTPreInliner);
  42741. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42742. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42743. $core.addMethod(
  42744. $core.method({
  42745. selector: "acceptDagVisitor:",
  42746. protocol: "visiting",
  42747. fn: function (aVisitor){
  42748. var self=this,$self=this;
  42749. return $core.withContext(function($ctx1) {
  42750. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42751. return self;
  42752. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42753. },
  42754. args: ["aVisitor"],
  42755. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42756. referencedClasses: [],
  42757. messageSends: ["visitIRInlinedClosure:"]
  42758. }),
  42759. $globals.IRInlinedClosure);
  42760. $core.addMethod(
  42761. $core.method({
  42762. selector: "isInlined",
  42763. protocol: "testing",
  42764. fn: function (){
  42765. var self=this,$self=this;
  42766. return true;
  42767. },
  42768. args: [],
  42769. source: "isInlined\x0a\x09^ true",
  42770. referencedClasses: [],
  42771. messageSends: []
  42772. }),
  42773. $globals.IRInlinedClosure);
  42774. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42775. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42776. $core.addMethod(
  42777. $core.method({
  42778. selector: "acceptDagVisitor:",
  42779. protocol: "visiting",
  42780. fn: function (aVisitor){
  42781. var self=this,$self=this;
  42782. return $core.withContext(function($ctx1) {
  42783. $recv(aVisitor)._visitInlinedSend_(self);
  42784. return self;
  42785. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42786. },
  42787. args: ["aVisitor"],
  42788. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42789. referencedClasses: [],
  42790. messageSends: ["visitInlinedSend:"]
  42791. }),
  42792. $globals.IRInlinedSend);
  42793. $core.addMethod(
  42794. $core.method({
  42795. selector: "internalVariables",
  42796. protocol: "accessing",
  42797. fn: function (){
  42798. var self=this,$self=this;
  42799. return [];
  42800. },
  42801. args: [],
  42802. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42803. referencedClasses: [],
  42804. messageSends: []
  42805. }),
  42806. $globals.IRInlinedSend);
  42807. $core.addMethod(
  42808. $core.method({
  42809. selector: "isInlined",
  42810. protocol: "testing",
  42811. fn: function (){
  42812. var self=this,$self=this;
  42813. return true;
  42814. },
  42815. args: [],
  42816. source: "isInlined\x0a\x09^ true",
  42817. referencedClasses: [],
  42818. messageSends: []
  42819. }),
  42820. $globals.IRInlinedSend);
  42821. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42822. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42823. $core.addMethod(
  42824. $core.method({
  42825. selector: "acceptDagVisitor:",
  42826. protocol: "visiting",
  42827. fn: function (aVisitor){
  42828. var self=this,$self=this;
  42829. return $core.withContext(function($ctx1) {
  42830. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42831. return self;
  42832. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42833. },
  42834. args: ["aVisitor"],
  42835. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42836. referencedClasses: [],
  42837. messageSends: ["visitIRInlinedIfFalse:"]
  42838. }),
  42839. $globals.IRInlinedIfFalse);
  42840. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42841. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42842. $core.addMethod(
  42843. $core.method({
  42844. selector: "acceptDagVisitor:",
  42845. protocol: "visiting",
  42846. fn: function (aVisitor){
  42847. var self=this,$self=this;
  42848. return $core.withContext(function($ctx1) {
  42849. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42850. return self;
  42851. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42852. },
  42853. args: ["aVisitor"],
  42854. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42855. referencedClasses: [],
  42856. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42857. }),
  42858. $globals.IRInlinedIfNilIfNotNil);
  42859. $core.addMethod(
  42860. $core.method({
  42861. selector: "internalVariables",
  42862. protocol: "accessing",
  42863. fn: function (){
  42864. var self=this,$self=this;
  42865. return $core.withContext(function($ctx1) {
  42866. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42867. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42868. },
  42869. args: [],
  42870. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42871. referencedClasses: ["Array"],
  42872. messageSends: ["with:", "receiverInternalVariable"]
  42873. }),
  42874. $globals.IRInlinedIfNilIfNotNil);
  42875. $core.addMethod(
  42876. $core.method({
  42877. selector: "receiverInternalVariable",
  42878. protocol: "accessing",
  42879. fn: function (){
  42880. var self=this,$self=this;
  42881. return $core.withContext(function($ctx1) {
  42882. var $1;
  42883. $1=$recv($globals.IRVariable)._new();
  42884. $ctx1.sendIdx["new"]=1;
  42885. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  42886. return $recv($1)._yourself();
  42887. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  42888. },
  42889. args: [],
  42890. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  42891. referencedClasses: ["IRVariable", "AliasVar"],
  42892. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  42893. }),
  42894. $globals.IRInlinedIfNilIfNotNil);
  42895. $core.addMethod(
  42896. $core.method({
  42897. selector: "receiverInternalVariableName",
  42898. protocol: "accessing",
  42899. fn: function (){
  42900. var self=this,$self=this;
  42901. return "$receiver";
  42902. },
  42903. args: [],
  42904. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  42905. referencedClasses: [],
  42906. messageSends: []
  42907. }),
  42908. $globals.IRInlinedIfNilIfNotNil);
  42909. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42910. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  42911. $core.addMethod(
  42912. $core.method({
  42913. selector: "acceptDagVisitor:",
  42914. protocol: "visiting",
  42915. fn: function (aVisitor){
  42916. var self=this,$self=this;
  42917. return $core.withContext(function($ctx1) {
  42918. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  42919. return self;
  42920. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  42921. },
  42922. args: ["aVisitor"],
  42923. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  42924. referencedClasses: [],
  42925. messageSends: ["visitIRInlinedIfTrue:"]
  42926. }),
  42927. $globals.IRInlinedIfTrue);
  42928. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42929. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  42930. $core.addMethod(
  42931. $core.method({
  42932. selector: "acceptDagVisitor:",
  42933. protocol: "visiting",
  42934. fn: function (aVisitor){
  42935. var self=this,$self=this;
  42936. return $core.withContext(function($ctx1) {
  42937. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  42938. return self;
  42939. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  42940. },
  42941. args: ["aVisitor"],
  42942. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  42943. referencedClasses: [],
  42944. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  42945. }),
  42946. $globals.IRInlinedIfTrueIfFalse);
  42947. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  42948. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  42949. $core.addMethod(
  42950. $core.method({
  42951. selector: "acceptDagVisitor:",
  42952. protocol: "visiting",
  42953. fn: function (aVisitor){
  42954. var self=this,$self=this;
  42955. return $core.withContext(function($ctx1) {
  42956. $recv(aVisitor)._visitIRInlinedSequence_(self);
  42957. return self;
  42958. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  42959. },
  42960. args: ["aVisitor"],
  42961. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  42962. referencedClasses: [],
  42963. messageSends: ["visitIRInlinedSequence:"]
  42964. }),
  42965. $globals.IRInlinedSequence);
  42966. $core.addMethod(
  42967. $core.method({
  42968. selector: "isInlined",
  42969. protocol: "testing",
  42970. fn: function (){
  42971. var self=this,$self=this;
  42972. return true;
  42973. },
  42974. args: [],
  42975. source: "isInlined\x0a\x09^ true",
  42976. referencedClasses: [],
  42977. messageSends: []
  42978. }),
  42979. $globals.IRInlinedSequence);
  42980. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  42981. $globals.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`";
  42982. $core.addMethod(
  42983. $core.method({
  42984. selector: "assignmentInliner",
  42985. protocol: "factory",
  42986. fn: function (){
  42987. var self=this,$self=this;
  42988. return $core.withContext(function($ctx1) {
  42989. var $1;
  42990. $1=$recv($globals.IRAssignmentInliner)._new();
  42991. $recv($1)._translator_(self);
  42992. return $recv($1)._yourself();
  42993. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  42994. },
  42995. args: [],
  42996. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42997. referencedClasses: ["IRAssignmentInliner"],
  42998. messageSends: ["translator:", "new", "yourself"]
  42999. }),
  43000. $globals.IRInliner);
  43001. $core.addMethod(
  43002. $core.method({
  43003. selector: "returnInliner",
  43004. protocol: "factory",
  43005. fn: function (){
  43006. var self=this,$self=this;
  43007. return $core.withContext(function($ctx1) {
  43008. var $1;
  43009. $1=$recv($globals.IRReturnInliner)._new();
  43010. $recv($1)._translator_(self);
  43011. return $recv($1)._yourself();
  43012. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  43013. },
  43014. args: [],
  43015. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43016. referencedClasses: ["IRReturnInliner"],
  43017. messageSends: ["translator:", "new", "yourself"]
  43018. }),
  43019. $globals.IRInliner);
  43020. $core.addMethod(
  43021. $core.method({
  43022. selector: "sendInliner",
  43023. protocol: "factory",
  43024. fn: function (){
  43025. var self=this,$self=this;
  43026. return $core.withContext(function($ctx1) {
  43027. var $1;
  43028. $1=$recv($globals.IRSendInliner)._new();
  43029. $recv($1)._translator_(self);
  43030. return $recv($1)._yourself();
  43031. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  43032. },
  43033. args: [],
  43034. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43035. referencedClasses: ["IRSendInliner"],
  43036. messageSends: ["translator:", "new", "yourself"]
  43037. }),
  43038. $globals.IRInliner);
  43039. $core.addMethod(
  43040. $core.method({
  43041. selector: "shouldInlineAssignment:",
  43042. protocol: "testing",
  43043. fn: function (anIRAssignment){
  43044. var self=this,$self=this;
  43045. return $core.withContext(function($ctx1) {
  43046. var $3,$2,$1;
  43047. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  43048. return $core.withContext(function($ctx2) {
  43049. $3=$recv(anIRAssignment)._right();
  43050. $ctx2.sendIdx["right"]=1;
  43051. $2=$recv($3)._isSend();
  43052. return $recv($2)._and_((function(){
  43053. return $core.withContext(function($ctx3) {
  43054. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  43055. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43056. }));
  43057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43058. }));
  43059. $ctx1.sendIdx["and:"]=1;
  43060. return $1;
  43061. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43062. },
  43063. args: ["anIRAssignment"],
  43064. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  43065. referencedClasses: [],
  43066. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  43067. }),
  43068. $globals.IRInliner);
  43069. $core.addMethod(
  43070. $core.method({
  43071. selector: "shouldInlineReturn:",
  43072. protocol: "testing",
  43073. fn: function (anIRReturn){
  43074. var self=this,$self=this;
  43075. return $core.withContext(function($ctx1) {
  43076. var $3,$2,$1;
  43077. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  43078. return $core.withContext(function($ctx2) {
  43079. $3=$recv(anIRReturn)._expression();
  43080. $ctx2.sendIdx["expression"]=1;
  43081. $2=$recv($3)._isSend();
  43082. return $recv($2)._and_((function(){
  43083. return $core.withContext(function($ctx3) {
  43084. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  43085. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43086. }));
  43087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43088. }));
  43089. $ctx1.sendIdx["and:"]=1;
  43090. return $1;
  43091. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43092. },
  43093. args: ["anIRReturn"],
  43094. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  43095. referencedClasses: [],
  43096. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  43097. }),
  43098. $globals.IRInliner);
  43099. $core.addMethod(
  43100. $core.method({
  43101. selector: "shouldInlineSend:",
  43102. protocol: "testing",
  43103. fn: function (anIRSend){
  43104. var self=this,$self=this;
  43105. return $core.withContext(function($ctx1) {
  43106. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  43107. return $core.withContext(function($ctx2) {
  43108. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  43109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43110. }));
  43111. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43112. },
  43113. args: ["anIRSend"],
  43114. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  43115. referencedClasses: ["IRSendInliner"],
  43116. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  43117. }),
  43118. $globals.IRInliner);
  43119. $core.addMethod(
  43120. $core.method({
  43121. selector: "visitIRAssignment:",
  43122. protocol: "visiting",
  43123. fn: function (anIRAssignment){
  43124. var self=this,$self=this;
  43125. return $core.withContext(function($ctx1) {
  43126. var $1;
  43127. $1=$self._shouldInlineAssignment_(anIRAssignment);
  43128. if($core.assert($1)){
  43129. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  43130. } else {
  43131. return (
  43132. $ctx1.supercall = true,
  43133. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  43134. $ctx1.supercall = false;
  43135. }
  43136. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43137. },
  43138. args: ["anIRAssignment"],
  43139. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  43140. referencedClasses: [],
  43141. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  43142. }),
  43143. $globals.IRInliner);
  43144. $core.addMethod(
  43145. $core.method({
  43146. selector: "visitIRNonLocalReturn:",
  43147. protocol: "visiting",
  43148. fn: function (anIRNonLocalReturn){
  43149. var self=this,$self=this;
  43150. var localReturn;
  43151. return $core.withContext(function($ctx1) {
  43152. var $2,$1,$4,$3,$5,$6,$7;
  43153. $2=$recv(anIRNonLocalReturn)._scope();
  43154. $ctx1.sendIdx["scope"]=1;
  43155. $1=$recv($2)._canInlineNonLocalReturns();
  43156. if($core.assert($1)){
  43157. $4=$recv(anIRNonLocalReturn)._scope();
  43158. $ctx1.sendIdx["scope"]=2;
  43159. $3=$recv($4)._methodScope();
  43160. $5=$recv(anIRNonLocalReturn)._scope();
  43161. $ctx1.sendIdx["scope"]=3;
  43162. $recv($3)._removeNonLocalReturn_($5);
  43163. $6=$recv($globals.IRReturn)._new();
  43164. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  43165. localReturn=$recv($6)._yourself();
  43166. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43167. return $core.withContext(function($ctx2) {
  43168. return $recv(localReturn)._add_(each);
  43169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43170. }));
  43171. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  43172. return $self._visitIRReturn_(localReturn);
  43173. }
  43174. $7=(
  43175. $ctx1.supercall = true,
  43176. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43177. $ctx1.supercall = false;
  43178. return $7;
  43179. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  43180. },
  43181. args: ["anIRNonLocalReturn"],
  43182. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn dagChildren do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ self visitIRReturn: localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  43183. referencedClasses: ["IRReturn"],
  43184. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  43185. }),
  43186. $globals.IRInliner);
  43187. $core.addMethod(
  43188. $core.method({
  43189. selector: "visitIRReturn:",
  43190. protocol: "visiting",
  43191. fn: function (anIRReturn){
  43192. var self=this,$self=this;
  43193. return $core.withContext(function($ctx1) {
  43194. var $1;
  43195. $1=$self._shouldInlineReturn_(anIRReturn);
  43196. if($core.assert($1)){
  43197. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  43198. } else {
  43199. return (
  43200. $ctx1.supercall = true,
  43201. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43202. $ctx1.supercall = false;
  43203. }
  43204. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43205. },
  43206. args: ["anIRReturn"],
  43207. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  43208. referencedClasses: [],
  43209. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  43210. }),
  43211. $globals.IRInliner);
  43212. $core.addMethod(
  43213. $core.method({
  43214. selector: "visitIRSend:",
  43215. protocol: "visiting",
  43216. fn: function (anIRSend){
  43217. var self=this,$self=this;
  43218. return $core.withContext(function($ctx1) {
  43219. var $1;
  43220. $1=$self._shouldInlineSend_(anIRSend);
  43221. if($core.assert($1)){
  43222. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  43223. } else {
  43224. return (
  43225. $ctx1.supercall = true,
  43226. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  43227. $ctx1.supercall = false;
  43228. }
  43229. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43230. },
  43231. args: ["anIRSend"],
  43232. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  43233. referencedClasses: [],
  43234. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  43235. }),
  43236. $globals.IRInliner);
  43237. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  43238. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  43239. $core.addMethod(
  43240. $core.method({
  43241. selector: "visitIRInlinedClosure:",
  43242. protocol: "visiting",
  43243. fn: function (anIRInlinedClosure){
  43244. var self=this,$self=this;
  43245. return $core.withContext(function($ctx1) {
  43246. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  43247. return $core.withContext(function($ctx2) {
  43248. return $recv($recv(each)._name())._asVariableName();
  43249. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43250. })));
  43251. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  43252. return self;
  43253. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  43254. },
  43255. args: ["anIRInlinedClosure"],
  43256. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  43257. referencedClasses: [],
  43258. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  43259. }),
  43260. $globals.IRInliningJSTranslator);
  43261. $core.addMethod(
  43262. $core.method({
  43263. selector: "visitIRInlinedIfFalse:",
  43264. protocol: "visiting",
  43265. fn: function (anIRInlinedIfFalse){
  43266. var self=this,$self=this;
  43267. return $core.withContext(function($ctx1) {
  43268. var $1,$2,$4,$3;
  43269. $1=$self._stream();
  43270. $ctx1.sendIdx["stream"]=1;
  43271. $recv($1)._nextPutIf_then_((function(){
  43272. return $core.withContext(function($ctx2) {
  43273. $2=$self._stream();
  43274. $ctx2.sendIdx["stream"]=2;
  43275. $recv($2)._nextPutAll_("!$core.assert(");
  43276. $ctx2.sendIdx["nextPutAll:"]=1;
  43277. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  43278. $ctx2.sendIdx["dagChildren"]=1;
  43279. $3=$recv($4)._first();
  43280. $self._visit_($3);
  43281. $ctx2.sendIdx["visit:"]=1;
  43282. return $recv($self._stream())._nextPutAll_(")");
  43283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43284. }),(function(){
  43285. return $core.withContext(function($ctx2) {
  43286. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  43287. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43288. }));
  43289. return self;
  43290. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  43291. },
  43292. args: ["anIRInlinedIfFalse"],
  43293. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfFalse dagChildren last ]",
  43294. referencedClasses: [],
  43295. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43296. }),
  43297. $globals.IRInliningJSTranslator);
  43298. $core.addMethod(
  43299. $core.method({
  43300. selector: "visitIRInlinedIfNilIfNotNil:",
  43301. protocol: "visiting",
  43302. fn: function (anIRInlinedIfNilIfNotNil){
  43303. var self=this,$self=this;
  43304. return $core.withContext(function($ctx1) {
  43305. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  43306. $1=$self._stream();
  43307. $ctx1.sendIdx["stream"]=1;
  43308. $recv($1)._nextPutIf_then_else_((function(){
  43309. var recvVarName;
  43310. return $core.withContext(function($ctx2) {
  43311. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  43312. $2=$self._stream();
  43313. $ctx2.sendIdx["stream"]=2;
  43314. $4="(".__comma(recvVarName);
  43315. $ctx2.sendIdx[","]=2;
  43316. $3=$recv($4).__comma(" = ");
  43317. $ctx2.sendIdx[","]=1;
  43318. $recv($2)._nextPutAll_($3);
  43319. $ctx2.sendIdx["nextPutAll:"]=1;
  43320. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43321. $ctx2.sendIdx["dagChildren"]=1;
  43322. $5=$recv($6)._first();
  43323. $self._visit_($5);
  43324. $ctx2.sendIdx["visit:"]=1;
  43325. $7=$self._stream();
  43326. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43327. $ctx2.sendIdx[","]=3;
  43328. return $recv($7)._nextPutAll_($8);
  43329. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43330. }),(function(){
  43331. return $core.withContext(function($ctx2) {
  43332. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43333. $ctx2.sendIdx["dagChildren"]=2;
  43334. $9=$recv($10)._second();
  43335. return $self._visit_($9);
  43336. $ctx2.sendIdx["visit:"]=2;
  43337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43338. }),(function(){
  43339. return $core.withContext(function($ctx2) {
  43340. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43342. }));
  43343. return self;
  43344. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43345. },
  43346. args: ["anIRInlinedIfNilIfNotNil"],
  43347. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09| recvVarName |\x0a\x09\x09\x09recvVarName := anIRInlinedIfNilIfNotNil receiverInternalVariableName.\x0a\x09\x09\x09self stream nextPutAll: '(', recvVarName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || ', recvVarName, '.a$nil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]",
  43348. referencedClasses: [],
  43349. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43350. }),
  43351. $globals.IRInliningJSTranslator);
  43352. $core.addMethod(
  43353. $core.method({
  43354. selector: "visitIRInlinedIfTrue:",
  43355. protocol: "visiting",
  43356. fn: function (anIRInlinedIfTrue){
  43357. var self=this,$self=this;
  43358. return $core.withContext(function($ctx1) {
  43359. var $1,$2,$4,$3;
  43360. $1=$self._stream();
  43361. $ctx1.sendIdx["stream"]=1;
  43362. $recv($1)._nextPutIf_then_((function(){
  43363. return $core.withContext(function($ctx2) {
  43364. $2=$self._stream();
  43365. $ctx2.sendIdx["stream"]=2;
  43366. $recv($2)._nextPutAll_("$core.assert(");
  43367. $ctx2.sendIdx["nextPutAll:"]=1;
  43368. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43369. $ctx2.sendIdx["dagChildren"]=1;
  43370. $3=$recv($4)._first();
  43371. $self._visit_($3);
  43372. $ctx2.sendIdx["visit:"]=1;
  43373. return $recv($self._stream())._nextPutAll_(")");
  43374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43375. }),(function(){
  43376. return $core.withContext(function($ctx2) {
  43377. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43378. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43379. }));
  43380. return self;
  43381. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43382. },
  43383. args: ["anIRInlinedIfTrue"],
  43384. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrue dagChildren last ]",
  43385. referencedClasses: [],
  43386. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43387. }),
  43388. $globals.IRInliningJSTranslator);
  43389. $core.addMethod(
  43390. $core.method({
  43391. selector: "visitIRInlinedIfTrueIfFalse:",
  43392. protocol: "visiting",
  43393. fn: function (anIRInlinedIfTrueIfFalse){
  43394. var self=this,$self=this;
  43395. return $core.withContext(function($ctx1) {
  43396. var $1,$2,$4,$3,$6,$5;
  43397. $1=$self._stream();
  43398. $ctx1.sendIdx["stream"]=1;
  43399. $recv($1)._nextPutIf_then_else_((function(){
  43400. return $core.withContext(function($ctx2) {
  43401. $2=$self._stream();
  43402. $ctx2.sendIdx["stream"]=2;
  43403. $recv($2)._nextPutAll_("$core.assert(");
  43404. $ctx2.sendIdx["nextPutAll:"]=1;
  43405. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43406. $ctx2.sendIdx["dagChildren"]=1;
  43407. $3=$recv($4)._first();
  43408. $self._visit_($3);
  43409. $ctx2.sendIdx["visit:"]=1;
  43410. return $recv($self._stream())._nextPutAll_(")");
  43411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43412. }),(function(){
  43413. return $core.withContext(function($ctx2) {
  43414. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43415. $ctx2.sendIdx["dagChildren"]=2;
  43416. $5=$recv($6)._second();
  43417. return $self._visit_($5);
  43418. $ctx2.sendIdx["visit:"]=2;
  43419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43420. }),(function(){
  43421. return $core.withContext(function($ctx2) {
  43422. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43424. }));
  43425. return self;
  43426. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43427. },
  43428. args: ["anIRInlinedIfTrueIfFalse"],
  43429. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrueIfFalse dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfTrueIfFalse dagChildren third ]",
  43430. referencedClasses: [],
  43431. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43432. }),
  43433. $globals.IRInliningJSTranslator);
  43434. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43435. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43436. $core.addMethod(
  43437. $core.method({
  43438. selector: "ifFalse:",
  43439. protocol: "inlining",
  43440. fn: function (anIRInstruction){
  43441. var self=this,$self=this;
  43442. return $core.withContext(function($ctx1) {
  43443. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43444. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43445. },
  43446. args: ["anIRInstruction"],
  43447. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43448. referencedClasses: ["IRInlinedIfFalse"],
  43449. messageSends: ["inlinedSend:withBlock:", "new"]
  43450. }),
  43451. $globals.IRSendInliner);
  43452. $core.addMethod(
  43453. $core.method({
  43454. selector: "ifFalse:ifTrue:",
  43455. protocol: "inlining",
  43456. fn: function (anIRInstruction,anotherIRInstruction){
  43457. var self=this,$self=this;
  43458. return $core.withContext(function($ctx1) {
  43459. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43460. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43461. },
  43462. args: ["anIRInstruction", "anotherIRInstruction"],
  43463. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43464. referencedClasses: [],
  43465. messageSends: ["perform:withArguments:"]
  43466. }),
  43467. $globals.IRSendInliner);
  43468. $core.addMethod(
  43469. $core.method({
  43470. selector: "ifNil:",
  43471. protocol: "inlining",
  43472. fn: function (anIRInstruction){
  43473. var self=this,$self=this;
  43474. return $core.withContext(function($ctx1) {
  43475. var $1,$3,$5,$6,$4,$2;
  43476. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43477. $ctx1.sendIdx["new"]=1;
  43478. $3=$recv($globals.IRClosure)._new();
  43479. $ctx1.sendIdx["new"]=2;
  43480. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43481. $5=$recv($globals.IRBlockSequence)._new();
  43482. $recv($5)._add_($recv($self._send())._receiver());
  43483. $6=$recv($5)._yourself();
  43484. $ctx1.sendIdx["yourself"]=1;
  43485. $4=$6;
  43486. $recv($3)._add_($4);
  43487. $ctx1.sendIdx["add:"]=1;
  43488. $2=$recv($3)._yourself();
  43489. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43490. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43491. },
  43492. args: ["anIRInstruction"],
  43493. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: anIRInstruction\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  43494. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43495. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43496. }),
  43497. $globals.IRSendInliner);
  43498. $core.addMethod(
  43499. $core.method({
  43500. selector: "ifNil:ifNotNil:",
  43501. protocol: "inlining",
  43502. fn: function (anIRInstruction,anotherIRInstruction){
  43503. var self=this,$self=this;
  43504. return $core.withContext(function($ctx1) {
  43505. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43506. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43507. },
  43508. args: ["anIRInstruction", "anotherIRInstruction"],
  43509. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43510. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43511. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43512. }),
  43513. $globals.IRSendInliner);
  43514. $core.addMethod(
  43515. $core.method({
  43516. selector: "ifNotNil:",
  43517. protocol: "inlining",
  43518. fn: function (anIRInstruction){
  43519. var self=this,$self=this;
  43520. return $core.withContext(function($ctx1) {
  43521. var $1,$3,$5,$6,$4,$2;
  43522. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43523. $ctx1.sendIdx["new"]=1;
  43524. $3=$recv($globals.IRClosure)._new();
  43525. $ctx1.sendIdx["new"]=2;
  43526. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43527. $5=$recv($globals.IRBlockSequence)._new();
  43528. $recv($5)._add_($recv($self._send())._receiver());
  43529. $6=$recv($5)._yourself();
  43530. $ctx1.sendIdx["yourself"]=1;
  43531. $4=$6;
  43532. $recv($3)._add_($4);
  43533. $ctx1.sendIdx["add:"]=1;
  43534. $2=$recv($3)._yourself();
  43535. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43536. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43537. },
  43538. args: ["anIRInstruction"],
  43539. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
  43540. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43541. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43542. }),
  43543. $globals.IRSendInliner);
  43544. $core.addMethod(
  43545. $core.method({
  43546. selector: "ifNotNil:ifNil:",
  43547. protocol: "inlining",
  43548. fn: function (anIRInstruction,anotherIRInstruction){
  43549. var self=this,$self=this;
  43550. return $core.withContext(function($ctx1) {
  43551. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43552. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43553. },
  43554. args: ["anIRInstruction", "anotherIRInstruction"],
  43555. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43556. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43557. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43558. }),
  43559. $globals.IRSendInliner);
  43560. $core.addMethod(
  43561. $core.method({
  43562. selector: "ifTrue:",
  43563. protocol: "inlining",
  43564. fn: function (anIRInstruction){
  43565. var self=this,$self=this;
  43566. return $core.withContext(function($ctx1) {
  43567. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43568. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43569. },
  43570. args: ["anIRInstruction"],
  43571. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43572. referencedClasses: ["IRInlinedIfTrue"],
  43573. messageSends: ["inlinedSend:withBlock:", "new"]
  43574. }),
  43575. $globals.IRSendInliner);
  43576. $core.addMethod(
  43577. $core.method({
  43578. selector: "ifTrue:ifFalse:",
  43579. protocol: "inlining",
  43580. fn: function (anIRInstruction,anotherIRInstruction){
  43581. var self=this,$self=this;
  43582. return $core.withContext(function($ctx1) {
  43583. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43584. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43585. },
  43586. args: ["anIRInstruction", "anotherIRInstruction"],
  43587. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43588. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43589. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43590. }),
  43591. $globals.IRSendInliner);
  43592. $core.addMethod(
  43593. $core.method({
  43594. selector: "inlineClosure:",
  43595. protocol: "inlining",
  43596. fn: function (anIRClosure){
  43597. var self=this,$self=this;
  43598. var inlinedClosure,sequence,statements;
  43599. return $core.withContext(function($ctx1) {
  43600. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43601. inlinedClosure=$self._inlinedClosure();
  43602. $1=inlinedClosure;
  43603. $2=$recv(anIRClosure)._scope();
  43604. $ctx1.sendIdx["scope"]=1;
  43605. $recv($1)._scope_($2);
  43606. $ctx1.sendIdx["scope:"]=1;
  43607. $recv($1)._parent_($recv(anIRClosure)._parent());
  43608. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43609. return $core.withContext(function($ctx2) {
  43610. return $recv(inlinedClosure)._add_(each);
  43611. $ctx2.sendIdx["add:"]=1;
  43612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43613. }));
  43614. $ctx1.sendIdx["do:"]=1;
  43615. sequence=$self._inlinedSequence();
  43616. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43617. return $core.withContext(function($ctx2) {
  43618. $3=inlinedClosure;
  43619. $5=$recv($globals.IRTempDeclaration)._new();
  43620. $ctx2.sendIdx["new"]=1;
  43621. $recv($5)._name_(each);
  43622. $ctx2.sendIdx["name:"]=1;
  43623. $6=$recv($5)._yourself();
  43624. $ctx2.sendIdx["yourself"]=1;
  43625. $4=$6;
  43626. $recv($3)._add_($4);
  43627. $ctx2.sendIdx["add:"]=2;
  43628. $7=sequence;
  43629. $9=$recv($globals.IRAssignment)._new();
  43630. $ctx2.sendIdx["new"]=2;
  43631. $11=$recv($globals.IRVariable)._new();
  43632. $ctx2.sendIdx["new"]=3;
  43633. $13=$recv($globals.AliasVar)._new();
  43634. $ctx2.sendIdx["new"]=4;
  43635. $14=$recv(inlinedClosure)._scope();
  43636. $ctx2.sendIdx["scope"]=2;
  43637. $recv($13)._scope_($14);
  43638. $ctx2.sendIdx["scope:"]=2;
  43639. $recv($13)._name_(each);
  43640. $ctx2.sendIdx["name:"]=2;
  43641. $15=$recv($13)._yourself();
  43642. $ctx2.sendIdx["yourself"]=2;
  43643. $12=$15;
  43644. $10=$recv($11)._variable_($12);
  43645. $ctx2.sendIdx["variable:"]=1;
  43646. $recv($9)._add_($10);
  43647. $ctx2.sendIdx["add:"]=4;
  43648. $17=$recv($globals.IRVariable)._new();
  43649. $ctx2.sendIdx["new"]=5;
  43650. $19=$recv($globals.AliasVar)._new();
  43651. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43652. $recv($19)._name_("$receiver");
  43653. $20=$recv($19)._yourself();
  43654. $ctx2.sendIdx["yourself"]=3;
  43655. $18=$20;
  43656. $16=$recv($17)._variable_($18);
  43657. $recv($9)._add_($16);
  43658. $ctx2.sendIdx["add:"]=5;
  43659. $8=$recv($9)._yourself();
  43660. return $recv($7)._add_($8);
  43661. $ctx2.sendIdx["add:"]=3;
  43662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43663. }));
  43664. $ctx1.sendIdx["do:"]=2;
  43665. $recv(inlinedClosure)._add_(sequence);
  43666. $ctx1.sendIdx["add:"]=6;
  43667. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43668. $recv(statements)._ifNotEmpty_((function(){
  43669. return $core.withContext(function($ctx2) {
  43670. $recv($recv(statements)._allButLast())._do_((function(each){
  43671. return $core.withContext(function($ctx3) {
  43672. return $recv(sequence)._add_(each);
  43673. $ctx3.sendIdx["add:"]=7;
  43674. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43675. }));
  43676. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43678. }));
  43679. return inlinedClosure;
  43680. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43681. },
  43682. args: ["anIRClosure"],
  43683. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures change local returns into result value itself\x22\x0a\x09\x09sequence add: statements last asInlinedBlockResult ].\x0a\x0a\x09^ inlinedClosure",
  43684. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43685. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43686. }),
  43687. $globals.IRSendInliner);
  43688. $core.addMethod(
  43689. $core.method({
  43690. selector: "inlineSend:",
  43691. protocol: "inlining",
  43692. fn: function (anIRSend){
  43693. var self=this,$self=this;
  43694. return $core.withContext(function($ctx1) {
  43695. var $2,$1;
  43696. $self._send_(anIRSend);
  43697. $2=$self._send();
  43698. $ctx1.sendIdx["send"]=1;
  43699. $1=$recv($2)._selector();
  43700. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43701. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43702. },
  43703. args: ["anIRSend"],
  43704. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43705. referencedClasses: [],
  43706. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43707. }),
  43708. $globals.IRSendInliner);
  43709. $core.addMethod(
  43710. $core.method({
  43711. selector: "inlineSend:andReplace:",
  43712. protocol: "private",
  43713. fn: function (anIRSend,anIRInstruction){
  43714. var self=this,$self=this;
  43715. return $core.withContext(function($ctx1) {
  43716. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43717. return $self._inlineSend_(anIRSend);
  43718. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43719. },
  43720. args: ["anIRSend", "anIRInstruction"],
  43721. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43722. referencedClasses: [],
  43723. messageSends: ["replaceWith:", "inlineSend:"]
  43724. }),
  43725. $globals.IRSendInliner);
  43726. $core.addMethod(
  43727. $core.method({
  43728. selector: "inlinedClosure",
  43729. protocol: "factory",
  43730. fn: function (){
  43731. var self=this,$self=this;
  43732. return $core.withContext(function($ctx1) {
  43733. return $recv($globals.IRInlinedClosure)._new();
  43734. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43735. },
  43736. args: [],
  43737. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43738. referencedClasses: ["IRInlinedClosure"],
  43739. messageSends: ["new"]
  43740. }),
  43741. $globals.IRSendInliner);
  43742. $core.addMethod(
  43743. $core.method({
  43744. selector: "inlinedSend:withBlock:",
  43745. protocol: "private",
  43746. fn: function (inlinedSend,anIRInstruction){
  43747. var self=this,$self=this;
  43748. var inlinedClosure;
  43749. return $core.withContext(function($ctx1) {
  43750. var $1,$2,$4,$3,$5;
  43751. $1=$recv(anIRInstruction)._isClosure();
  43752. if(!$core.assert($1)){
  43753. $self._inliningError_("Message argument should be a block");
  43754. $ctx1.sendIdx["inliningError:"]=1;
  43755. }
  43756. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43757. if(!$core.assert($2)){
  43758. $self._inliningError_("Inlined block should have zero argument");
  43759. }
  43760. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43761. $4=$self._send();
  43762. $ctx1.sendIdx["send"]=1;
  43763. $3=$recv($4)._receiver();
  43764. $recv(inlinedSend)._add_($3);
  43765. $ctx1.sendIdx["add:"]=1;
  43766. $recv(inlinedSend)._add_(inlinedClosure);
  43767. $recv($self._send())._replaceWith_(inlinedSend);
  43768. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43769. $ctx1.sendIdx["internalVariables"]=1;
  43770. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43771. return inlinedSend;
  43772. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43773. },
  43774. args: ["inlinedSend", "anIRInstruction"],
  43775. source: "inlinedSend: inlinedSend withBlock: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send receiver;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  43776. referencedClasses: [],
  43777. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43778. }),
  43779. $globals.IRSendInliner);
  43780. $core.addMethod(
  43781. $core.method({
  43782. selector: "inlinedSend:withBlock:withBlock:",
  43783. protocol: "private",
  43784. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43785. var self=this,$self=this;
  43786. var inlinedClosure1,inlinedClosure2;
  43787. return $core.withContext(function($ctx1) {
  43788. var $1,$2,$3,$4,$6,$5,$7;
  43789. $1=$recv(anIRInstruction)._isClosure();
  43790. $ctx1.sendIdx["isClosure"]=1;
  43791. if(!$core.assert($1)){
  43792. $self._inliningError_("Message argument should be a block");
  43793. $ctx1.sendIdx["inliningError:"]=1;
  43794. }
  43795. $2=$recv(anotherIRInstruction)._isClosure();
  43796. if(!$core.assert($2)){
  43797. $self._inliningError_("Message argument should be a block");
  43798. }
  43799. $3=$self._translator();
  43800. $ctx1.sendIdx["translator"]=1;
  43801. $4=$self._inlineClosure_(anIRInstruction);
  43802. $ctx1.sendIdx["inlineClosure:"]=1;
  43803. inlinedClosure1=$recv($3)._visit_($4);
  43804. $ctx1.sendIdx["visit:"]=1;
  43805. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43806. $6=$self._send();
  43807. $ctx1.sendIdx["send"]=1;
  43808. $5=$recv($6)._receiver();
  43809. $recv(inlinedSend)._add_($5);
  43810. $ctx1.sendIdx["add:"]=1;
  43811. $recv(inlinedSend)._add_(inlinedClosure1);
  43812. $ctx1.sendIdx["add:"]=2;
  43813. $recv(inlinedSend)._add_(inlinedClosure2);
  43814. $recv($self._send())._replaceWith_(inlinedSend);
  43815. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43816. $ctx1.sendIdx["internalVariables"]=1;
  43817. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43818. return inlinedSend;
  43819. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43820. },
  43821. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43822. source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send receiver;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  43823. referencedClasses: [],
  43824. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43825. }),
  43826. $globals.IRSendInliner);
  43827. $core.addMethod(
  43828. $core.method({
  43829. selector: "inlinedSequence",
  43830. protocol: "factory",
  43831. fn: function (){
  43832. var self=this,$self=this;
  43833. return $core.withContext(function($ctx1) {
  43834. return $recv($globals.IRInlinedSequence)._new();
  43835. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43836. },
  43837. args: [],
  43838. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43839. referencedClasses: ["IRInlinedSequence"],
  43840. messageSends: ["new"]
  43841. }),
  43842. $globals.IRSendInliner);
  43843. $core.addMethod(
  43844. $core.method({
  43845. selector: "inliningError:",
  43846. protocol: "error handling",
  43847. fn: function (aString){
  43848. var self=this,$self=this;
  43849. return $core.withContext(function($ctx1) {
  43850. $recv($globals.InliningError)._signal_(aString);
  43851. return self;
  43852. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43853. },
  43854. args: ["aString"],
  43855. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43856. referencedClasses: ["InliningError"],
  43857. messageSends: ["signal:"]
  43858. }),
  43859. $globals.IRSendInliner);
  43860. $core.addMethod(
  43861. $core.method({
  43862. selector: "send",
  43863. protocol: "accessing",
  43864. fn: function (){
  43865. var self=this,$self=this;
  43866. return $self["@send"];
  43867. },
  43868. args: [],
  43869. source: "send\x0a\x09^ send",
  43870. referencedClasses: [],
  43871. messageSends: []
  43872. }),
  43873. $globals.IRSendInliner);
  43874. $core.addMethod(
  43875. $core.method({
  43876. selector: "send:",
  43877. protocol: "accessing",
  43878. fn: function (anIRSend){
  43879. var self=this,$self=this;
  43880. $self["@send"]=anIRSend;
  43881. return self;
  43882. },
  43883. args: ["anIRSend"],
  43884. source: "send: anIRSend\x0a\x09send := anIRSend",
  43885. referencedClasses: [],
  43886. messageSends: []
  43887. }),
  43888. $globals.IRSendInliner);
  43889. $core.addMethod(
  43890. $core.method({
  43891. selector: "translator",
  43892. protocol: "accessing",
  43893. fn: function (){
  43894. var self=this,$self=this;
  43895. return $self["@translator"];
  43896. },
  43897. args: [],
  43898. source: "translator\x0a\x09^ translator",
  43899. referencedClasses: [],
  43900. messageSends: []
  43901. }),
  43902. $globals.IRSendInliner);
  43903. $core.addMethod(
  43904. $core.method({
  43905. selector: "translator:",
  43906. protocol: "accessing",
  43907. fn: function (anASTTranslator){
  43908. var self=this,$self=this;
  43909. $self["@translator"]=anASTTranslator;
  43910. return self;
  43911. },
  43912. args: ["anASTTranslator"],
  43913. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  43914. referencedClasses: [],
  43915. messageSends: []
  43916. }),
  43917. $globals.IRSendInliner);
  43918. $core.addMethod(
  43919. $core.method({
  43920. selector: "inlinedSelectors",
  43921. protocol: "accessing",
  43922. fn: function (){
  43923. var self=this,$self=this;
  43924. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  43925. },
  43926. args: [],
  43927. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  43928. referencedClasses: [],
  43929. messageSends: []
  43930. }),
  43931. $globals.IRSendInliner.a$cls);
  43932. $core.addMethod(
  43933. $core.method({
  43934. selector: "shouldInline:",
  43935. protocol: "accessing",
  43936. fn: function (anIRSend){
  43937. var self=this,$self=this;
  43938. return $core.withContext(function($ctx1) {
  43939. var $1;
  43940. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  43941. if(!$core.assert($1)){
  43942. return false;
  43943. }
  43944. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  43945. return $core.withContext(function($ctx2) {
  43946. return $recv(each)._isClosure();
  43947. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43948. }));
  43949. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  43950. },
  43951. args: ["anIRSend"],
  43952. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  43953. referencedClasses: [],
  43954. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  43955. }),
  43956. $globals.IRSendInliner.a$cls);
  43957. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  43958. $globals.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions.\x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if($core.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
  43959. $core.addMethod(
  43960. $core.method({
  43961. selector: "inlineAssignment:",
  43962. protocol: "inlining",
  43963. fn: function (anIRAssignment){
  43964. var self=this,$self=this;
  43965. return $core.withContext(function($ctx1) {
  43966. $self._target_($recv(anIRAssignment)._left());
  43967. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  43968. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  43969. },
  43970. args: ["anIRAssignment"],
  43971. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  43972. referencedClasses: [],
  43973. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  43974. }),
  43975. $globals.IRAssignmentInliner);
  43976. $core.addMethod(
  43977. $core.method({
  43978. selector: "inlineClosure:",
  43979. protocol: "inlining",
  43980. fn: function (anIRClosure){
  43981. var self=this,$self=this;
  43982. var closure,sequence,statements;
  43983. return $core.withContext(function($ctx1) {
  43984. var $1,$2,$3,$5,$4;
  43985. closure=(
  43986. $ctx1.supercall = true,
  43987. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43988. $ctx1.supercall = false;
  43989. sequence=$recv(closure)._sequence();
  43990. statements=$recv(sequence)._dagChildren();
  43991. $recv(statements)._ifNotEmpty_((function(){
  43992. var final;
  43993. return $core.withContext(function($ctx2) {
  43994. final=$recv(statements)._last();
  43995. $1=$recv(final)._yieldsValue();
  43996. if($core.assert($1)){
  43997. $2=sequence;
  43998. $3=final;
  43999. $5=$recv($globals.IRAssignment)._new();
  44000. $recv($5)._add_($self._target());
  44001. $ctx2.sendIdx["add:"]=1;
  44002. $recv($5)._add_($recv(final)._copy());
  44003. $4=$recv($5)._yourself();
  44004. return $recv($2)._replace_with_($3,$4);
  44005. }
  44006. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44007. }));
  44008. return closure;
  44009. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  44010. },
  44011. args: ["anIRClosure"],
  44012. source: "inlineClosure: anIRClosure\x0a\x09| closure sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRAssignment new\x0a\x09\x09\x09\x09add: self target;\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
  44013. referencedClasses: ["IRAssignment"],
  44014. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  44015. }),
  44016. $globals.IRAssignmentInliner);
  44017. $core.addMethod(
  44018. $core.method({
  44019. selector: "target",
  44020. protocol: "accessing",
  44021. fn: function (){
  44022. var self=this,$self=this;
  44023. return $self["@target"];
  44024. },
  44025. args: [],
  44026. source: "target\x0a\x09^ target",
  44027. referencedClasses: [],
  44028. messageSends: []
  44029. }),
  44030. $globals.IRAssignmentInliner);
  44031. $core.addMethod(
  44032. $core.method({
  44033. selector: "target:",
  44034. protocol: "accessing",
  44035. fn: function (anObject){
  44036. var self=this,$self=this;
  44037. $self["@target"]=anObject;
  44038. return self;
  44039. },
  44040. args: ["anObject"],
  44041. source: "target: anObject\x0a\x09target := anObject",
  44042. referencedClasses: [],
  44043. messageSends: []
  44044. }),
  44045. $globals.IRAssignmentInliner);
  44046. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  44047. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  44048. $core.addMethod(
  44049. $core.method({
  44050. selector: "inlineClosure:",
  44051. protocol: "inlining",
  44052. fn: function (anIRClosure){
  44053. var self=this,$self=this;
  44054. var closure,sequence,statements;
  44055. return $core.withContext(function($ctx1) {
  44056. var $1,$2,$3,$5,$4;
  44057. closure=(
  44058. $ctx1.supercall = true,
  44059. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44060. $ctx1.supercall = false;
  44061. sequence=$recv(closure)._sequence();
  44062. statements=$recv(sequence)._dagChildren();
  44063. $recv(statements)._ifNotEmpty_((function(){
  44064. var final;
  44065. return $core.withContext(function($ctx2) {
  44066. final=$recv(statements)._last();
  44067. $1=$recv(final)._yieldsValue();
  44068. if($core.assert($1)){
  44069. $2=sequence;
  44070. $3=final;
  44071. $5=$recv($globals.IRReturn)._new();
  44072. $recv($5)._add_($recv(final)._copy());
  44073. $4=$recv($5)._yourself();
  44074. return $recv($2)._replace_with_($3,$4);
  44075. }
  44076. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44077. }));
  44078. return closure;
  44079. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  44080. },
  44081. args: ["anIRClosure"],
  44082. source: "inlineClosure: anIRClosure\x0a\x09| closure sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRReturn new\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
  44083. referencedClasses: ["IRReturn"],
  44084. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  44085. }),
  44086. $globals.IRReturnInliner);
  44087. $core.addMethod(
  44088. $core.method({
  44089. selector: "inlineReturn:",
  44090. protocol: "inlining",
  44091. fn: function (anIRReturn){
  44092. var self=this,$self=this;
  44093. return $core.withContext(function($ctx1) {
  44094. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  44095. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  44096. },
  44097. args: ["anIRReturn"],
  44098. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  44099. referencedClasses: [],
  44100. messageSends: ["inlineSend:andReplace:", "expression"]
  44101. }),
  44102. $globals.IRReturnInliner);
  44103. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  44104. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  44105. $core.addMethod(
  44106. $core.method({
  44107. selector: "inliner",
  44108. protocol: "compiling",
  44109. fn: function (){
  44110. var self=this,$self=this;
  44111. return $core.withContext(function($ctx1) {
  44112. return $recv($globals.IRInliner)._new();
  44113. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  44114. },
  44115. args: [],
  44116. source: "inliner\x0a\x09^ IRInliner new",
  44117. referencedClasses: ["IRInliner"],
  44118. messageSends: ["new"]
  44119. }),
  44120. $globals.InliningCodeGenerator);
  44121. $core.addMethod(
  44122. $core.method({
  44123. selector: "irTranslatorClass",
  44124. protocol: "compiling",
  44125. fn: function (){
  44126. var self=this,$self=this;
  44127. return $globals.IRInliningJSTranslator;
  44128. },
  44129. args: [],
  44130. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  44131. referencedClasses: ["IRInliningJSTranslator"],
  44132. messageSends: []
  44133. }),
  44134. $globals.InliningCodeGenerator);
  44135. $core.addMethod(
  44136. $core.method({
  44137. selector: "preInliner",
  44138. protocol: "compiling",
  44139. fn: function (){
  44140. var self=this,$self=this;
  44141. return $core.withContext(function($ctx1) {
  44142. return $recv($globals.ASTPreInliner)._new();
  44143. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  44144. },
  44145. args: [],
  44146. source: "preInliner\x0a\x09^ ASTPreInliner new",
  44147. referencedClasses: ["ASTPreInliner"],
  44148. messageSends: ["new"]
  44149. }),
  44150. $globals.InliningCodeGenerator);
  44151. $core.addMethod(
  44152. $core.method({
  44153. selector: "transformersDictionary",
  44154. protocol: "compiling",
  44155. fn: function (){
  44156. var self=this,$self=this;
  44157. return $core.withContext(function($ctx1) {
  44158. var $1,$2,$receiver;
  44159. $1=$self["@transformersDictionary"];
  44160. if(($receiver = $1) == null || $receiver.a$nil){
  44161. $2=(
  44162. $ctx1.supercall = true,
  44163. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  44164. $ctx1.supercall = false;
  44165. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  44166. $ctx1.sendIdx["at:put:"]=1;
  44167. $recv($2)._at_put_("6000-inliner",$self._inliner());
  44168. $ctx1.sendIdx["at:put:"]=2;
  44169. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  44170. $self["@transformersDictionary"]=$recv($2)._yourself();
  44171. return $self["@transformersDictionary"];
  44172. } else {
  44173. return $1;
  44174. }
  44175. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  44176. },
  44177. args: [],
  44178. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := super transformersDictionary\x0a\x09\x09at: '3000-inlinerTagging' put: self preInliner;\x0a\x09\x09at: '6000-inliner' put: self inliner;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  44179. referencedClasses: [],
  44180. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  44181. }),
  44182. $globals.InliningCodeGenerator);
  44183. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  44184. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  44185. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  44186. $core.addMethod(
  44187. $core.method({
  44188. selector: "visitSendNode:",
  44189. protocol: "visiting",
  44190. fn: function (aNode){
  44191. var self=this,$self=this;
  44192. return $core.withContext(function($ctx1) {
  44193. var $1,$2,$3,$receiver;
  44194. $1=$recv(aNode)._superSend();
  44195. if(!$core.assert($1)){
  44196. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44197. if($core.assert($2)){
  44198. $recv(aNode)._shouldBeInlined_(true);
  44199. $3=$recv(aNode)._receiver();
  44200. if(($receiver = $3) == null || $receiver.a$nil){
  44201. $3;
  44202. } else {
  44203. var receiver;
  44204. receiver=$receiver;
  44205. $recv(receiver)._shouldBeAliased_(true);
  44206. }
  44207. }
  44208. }
  44209. (
  44210. $ctx1.supercall = true,
  44211. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44212. $ctx1.supercall = false;
  44213. return self;
  44214. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  44215. },
  44216. args: ["aNode"],
  44217. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09super visitSendNode: aNode",
  44218. referencedClasses: ["IRSendInliner"],
  44219. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44220. }),
  44221. $globals.InliningSemanticAnalyzer);
  44222. $core.addMethod(
  44223. $core.method({
  44224. selector: "asInlinedBlockResult",
  44225. protocol: "*Compiler-Inlining",
  44226. fn: function (){
  44227. var self=this,$self=this;
  44228. return $core.withContext(function($ctx1) {
  44229. return $self._expression();
  44230. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  44231. },
  44232. args: [],
  44233. source: "asInlinedBlockResult\x0a\x09^ self expression",
  44234. referencedClasses: [],
  44235. messageSends: ["expression"]
  44236. }),
  44237. $globals.IRBlockReturn);
  44238. $core.addMethod(
  44239. $core.method({
  44240. selector: "asInlinedBlockResult",
  44241. protocol: "*Compiler-Inlining",
  44242. fn: function (){
  44243. var self=this,$self=this;
  44244. return self;
  44245. },
  44246. args: [],
  44247. source: "asInlinedBlockResult\x0a\x09^ self",
  44248. referencedClasses: [],
  44249. messageSends: []
  44250. }),
  44251. $globals.IRInstruction);
  44252. });
  44253. define('amber_core/Compiler-Interpreter',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Semantic", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  44254. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  44255. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44256. $core.addPackage("Compiler-Interpreter");
  44257. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  44258. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44259. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  44260. $globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
  44261. $core.addMethod(
  44262. $core.method({
  44263. selector: "applyTo:arguments:",
  44264. protocol: "evaluating",
  44265. fn: function (anObject,aCollection){
  44266. var self=this,$self=this;
  44267. return $core.withContext(function($ctx1) {
  44268. $self._interpreterError();
  44269. return self;
  44270. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  44271. },
  44272. args: ["anObject", "aCollection"],
  44273. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  44274. referencedClasses: [],
  44275. messageSends: ["interpreterError"]
  44276. }),
  44277. $globals.AIBlockClosure);
  44278. $core.addMethod(
  44279. $core.method({
  44280. selector: "compiledSource",
  44281. protocol: "accessing",
  44282. fn: function (){
  44283. var self=this,$self=this;
  44284. return "[ AST Block closure ]";
  44285. },
  44286. args: [],
  44287. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44288. referencedClasses: [],
  44289. messageSends: []
  44290. }),
  44291. $globals.AIBlockClosure);
  44292. $core.addMethod(
  44293. $core.method({
  44294. selector: "currySelf",
  44295. protocol: "converting",
  44296. fn: function (){
  44297. var self=this,$self=this;
  44298. return $core.withContext(function($ctx1) {
  44299. $self._interpreterError();
  44300. return self;
  44301. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  44302. },
  44303. args: [],
  44304. source: "currySelf\x0a\x09self interpreterError",
  44305. referencedClasses: [],
  44306. messageSends: ["interpreterError"]
  44307. }),
  44308. $globals.AIBlockClosure);
  44309. $core.addMethod(
  44310. $core.method({
  44311. selector: "initializeWithContext:node:",
  44312. protocol: "initialization",
  44313. fn: function (aContext,aNode){
  44314. var self=this,$self=this;
  44315. $self["@node"]=aNode;
  44316. $self["@outerContext"]=aContext;
  44317. return self;
  44318. },
  44319. args: ["aContext", "aNode"],
  44320. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44321. referencedClasses: [],
  44322. messageSends: []
  44323. }),
  44324. $globals.AIBlockClosure);
  44325. $core.addMethod(
  44326. $core.method({
  44327. selector: "interpreterError",
  44328. protocol: "error handling",
  44329. fn: function (){
  44330. var self=this,$self=this;
  44331. return $core.withContext(function($ctx1) {
  44332. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44333. return self;
  44334. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44335. },
  44336. args: [],
  44337. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44338. referencedClasses: ["ASTInterpreterError"],
  44339. messageSends: ["signal:"]
  44340. }),
  44341. $globals.AIBlockClosure);
  44342. $core.addMethod(
  44343. $core.method({
  44344. selector: "numArgs",
  44345. protocol: "accessing",
  44346. fn: function (){
  44347. var self=this,$self=this;
  44348. return $core.withContext(function($ctx1) {
  44349. return $recv($recv($self["@node"])._temps())._size();
  44350. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44351. },
  44352. args: [],
  44353. source: "numArgs\x0a\x09^ node temps size",
  44354. referencedClasses: [],
  44355. messageSends: ["size", "temps"]
  44356. }),
  44357. $globals.AIBlockClosure);
  44358. $core.addMethod(
  44359. $core.method({
  44360. selector: "value",
  44361. protocol: "evaluating",
  44362. fn: function (){
  44363. var self=this,$self=this;
  44364. return $core.withContext(function($ctx1) {
  44365. return $self._valueWithPossibleArguments_([]);
  44366. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44367. },
  44368. args: [],
  44369. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44370. referencedClasses: [],
  44371. messageSends: ["valueWithPossibleArguments:"]
  44372. }),
  44373. $globals.AIBlockClosure);
  44374. $core.addMethod(
  44375. $core.method({
  44376. selector: "value:",
  44377. protocol: "evaluating",
  44378. fn: function (anArgument){
  44379. var self=this,$self=this;
  44380. return $core.withContext(function($ctx1) {
  44381. return $self._valueWithPossibleArguments_([anArgument]);
  44382. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44383. },
  44384. args: ["anArgument"],
  44385. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44386. referencedClasses: [],
  44387. messageSends: ["valueWithPossibleArguments:"]
  44388. }),
  44389. $globals.AIBlockClosure);
  44390. $core.addMethod(
  44391. $core.method({
  44392. selector: "value:value:",
  44393. protocol: "evaluating",
  44394. fn: function (firstArgument,secondArgument){
  44395. var self=this,$self=this;
  44396. return $core.withContext(function($ctx1) {
  44397. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44398. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44399. },
  44400. args: ["firstArgument", "secondArgument"],
  44401. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44402. referencedClasses: [],
  44403. messageSends: ["valueWithPossibleArguments:"]
  44404. }),
  44405. $globals.AIBlockClosure);
  44406. $core.addMethod(
  44407. $core.method({
  44408. selector: "value:value:value:",
  44409. protocol: "evaluating",
  44410. fn: function (firstArgument,secondArgument,thirdArgument){
  44411. var self=this,$self=this;
  44412. return $core.withContext(function($ctx1) {
  44413. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44414. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44415. },
  44416. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44417. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44418. referencedClasses: [],
  44419. messageSends: ["valueWithPossibleArguments:"]
  44420. }),
  44421. $globals.AIBlockClosure);
  44422. $core.addMethod(
  44423. $core.method({
  44424. selector: "valueWithPossibleArguments:",
  44425. protocol: "evaluating",
  44426. fn: function (aCollection){
  44427. var self=this,$self=this;
  44428. var context,sequenceNode;
  44429. return $core.withContext(function($ctx1) {
  44430. var $1,$2,$3;
  44431. context=$recv($self["@outerContext"])._newInnerContext();
  44432. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44433. $recv($1)._parent_(nil);
  44434. sequenceNode=$recv($1)._yourself();
  44435. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44436. return $core.withContext(function($ctx2) {
  44437. return $recv(context)._defineLocal_(each);
  44438. $ctx2.sendIdx["defineLocal:"]=1;
  44439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44440. }));
  44441. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44442. return $core.withContext(function($ctx2) {
  44443. $recv(context)._defineLocal_(each);
  44444. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44445. return nil;
  44446. })));
  44447. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44448. }));
  44449. $2=$recv(context)._interpreter();
  44450. $ctx1.sendIdx["interpreter"]=1;
  44451. $recv($2)._node_(sequenceNode);
  44452. $recv($2)._enterNode();
  44453. $recv($2)._proceed();
  44454. $3=$recv($self["@outerContext"])._interpreter();
  44455. $ctx1.sendIdx["interpreter"]=2;
  44456. $recv($3)._setNonLocalReturnFromContext_(context);
  44457. return $recv($recv(context)._interpreter())._pop();
  44458. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44459. },
  44460. args: ["aCollection"],
  44461. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node dagChildren first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  44462. referencedClasses: [],
  44463. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44464. }),
  44465. $globals.AIBlockClosure);
  44466. $core.addMethod(
  44467. $core.method({
  44468. selector: "forContext:node:",
  44469. protocol: "instance creation",
  44470. fn: function (aContext,aNode){
  44471. var self=this,$self=this;
  44472. return $core.withContext(function($ctx1) {
  44473. var $1;
  44474. $1=$self._new();
  44475. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44476. return $recv($1)._yourself();
  44477. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44478. },
  44479. args: ["aContext", "aNode"],
  44480. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44481. referencedClasses: [],
  44482. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44483. }),
  44484. $globals.AIBlockClosure.a$cls);
  44485. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44486. $globals.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
  44487. $core.addMethod(
  44488. $core.method({
  44489. selector: "arguments",
  44490. protocol: "interpreting",
  44491. fn: function (){
  44492. var self=this,$self=this;
  44493. return $core.withContext(function($ctx1) {
  44494. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44495. return $core.withContext(function($ctx2) {
  44496. return $self._localAt_ifAbsent_(each,(function(){
  44497. return $core.withContext(function($ctx3) {
  44498. return $self._error_("Argument not in context");
  44499. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44500. }));
  44501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44502. }));
  44503. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44504. },
  44505. args: [],
  44506. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44507. referencedClasses: [],
  44508. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44509. }),
  44510. $globals.AIContext);
  44511. $core.addMethod(
  44512. $core.method({
  44513. selector: "ast",
  44514. protocol: "interpreting",
  44515. fn: function (){
  44516. var self=this,$self=this;
  44517. return $core.withContext(function($ctx1) {
  44518. var $1,$2,$3,$receiver;
  44519. $1=$self._isBlockContext();
  44520. if($core.assert($1)){
  44521. $2=$self._outerContext();
  44522. if(($receiver = $2) == null || $receiver.a$nil){
  44523. return $2;
  44524. } else {
  44525. var context;
  44526. context=$receiver;
  44527. return $recv(context)._ast();
  44528. }
  44529. }
  44530. $3=$self["@ast"];
  44531. if(($receiver = $3) == null || $receiver.a$nil){
  44532. $self._initializeAST();
  44533. } else {
  44534. $3;
  44535. }
  44536. return $self["@ast"];
  44537. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44538. },
  44539. args: [],
  44540. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44541. referencedClasses: [],
  44542. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44543. }),
  44544. $globals.AIContext);
  44545. $core.addMethod(
  44546. $core.method({
  44547. selector: "basicLocalAt:",
  44548. protocol: "private",
  44549. fn: function (aString){
  44550. var self=this,$self=this;
  44551. return $core.withContext(function($ctx1) {
  44552. return $recv($self._locals())._at_(aString);
  44553. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44554. },
  44555. args: ["aString"],
  44556. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44557. referencedClasses: [],
  44558. messageSends: ["at:", "locals"]
  44559. }),
  44560. $globals.AIContext);
  44561. $core.addMethod(
  44562. $core.method({
  44563. selector: "basicLocalAt:put:",
  44564. protocol: "private",
  44565. fn: function (aString,anObject){
  44566. var self=this,$self=this;
  44567. return $core.withContext(function($ctx1) {
  44568. $recv($self._locals())._at_put_(aString,anObject);
  44569. return self;
  44570. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44571. },
  44572. args: ["aString", "anObject"],
  44573. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44574. referencedClasses: [],
  44575. messageSends: ["at:put:", "locals"]
  44576. }),
  44577. $globals.AIContext);
  44578. $core.addMethod(
  44579. $core.method({
  44580. selector: "basicReceiver",
  44581. protocol: "interpreting",
  44582. fn: function (){
  44583. var self=this,$self=this;
  44584. return $core.withContext(function($ctx1) {
  44585. return $self._localAt_("self");
  44586. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44587. },
  44588. args: [],
  44589. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44590. referencedClasses: [],
  44591. messageSends: ["localAt:"]
  44592. }),
  44593. $globals.AIContext);
  44594. $core.addMethod(
  44595. $core.method({
  44596. selector: "defineLocal:",
  44597. protocol: "accessing",
  44598. fn: function (aString){
  44599. var self=this,$self=this;
  44600. return $core.withContext(function($ctx1) {
  44601. $recv($self._locals())._at_put_(aString,nil);
  44602. return self;
  44603. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44604. },
  44605. args: ["aString"],
  44606. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44607. referencedClasses: [],
  44608. messageSends: ["at:put:", "locals"]
  44609. }),
  44610. $globals.AIContext);
  44611. $core.addMethod(
  44612. $core.method({
  44613. selector: "evaluate:on:",
  44614. protocol: "evaluating",
  44615. fn: function (aString,anEvaluator){
  44616. var self=this,$self=this;
  44617. return $core.withContext(function($ctx1) {
  44618. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44619. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44620. },
  44621. args: ["aString", "anEvaluator"],
  44622. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44623. referencedClasses: [],
  44624. messageSends: ["evaluate:context:"]
  44625. }),
  44626. $globals.AIContext);
  44627. $core.addMethod(
  44628. $core.method({
  44629. selector: "evaluateNode:",
  44630. protocol: "evaluating",
  44631. fn: function (aNode){
  44632. var self=this,$self=this;
  44633. return $core.withContext(function($ctx1) {
  44634. var $1;
  44635. $1=$recv($globals.ASTInterpreter)._new();
  44636. $recv($1)._context_(self);
  44637. $recv($1)._node_(aNode);
  44638. $recv($1)._enterNode();
  44639. $recv($1)._proceed();
  44640. return $recv($1)._result();
  44641. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44642. },
  44643. args: ["aNode"],
  44644. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44645. referencedClasses: ["ASTInterpreter"],
  44646. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44647. }),
  44648. $globals.AIContext);
  44649. $core.addMethod(
  44650. $core.method({
  44651. selector: "evaluatedSelector",
  44652. protocol: "accessing",
  44653. fn: function (){
  44654. var self=this,$self=this;
  44655. return $self["@evaluatedSelector"];
  44656. },
  44657. args: [],
  44658. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44659. referencedClasses: [],
  44660. messageSends: []
  44661. }),
  44662. $globals.AIContext);
  44663. $core.addMethod(
  44664. $core.method({
  44665. selector: "evaluatedSelector:",
  44666. protocol: "accessing",
  44667. fn: function (aString){
  44668. var self=this,$self=this;
  44669. $self["@evaluatedSelector"]=aString;
  44670. return self;
  44671. },
  44672. args: ["aString"],
  44673. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44674. referencedClasses: [],
  44675. messageSends: []
  44676. }),
  44677. $globals.AIContext);
  44678. $core.addMethod(
  44679. $core.method({
  44680. selector: "index",
  44681. protocol: "accessing",
  44682. fn: function (){
  44683. var self=this,$self=this;
  44684. return $core.withContext(function($ctx1) {
  44685. var $1,$receiver;
  44686. $1=$self["@index"];
  44687. if(($receiver = $1) == null || $receiver.a$nil){
  44688. return (0);
  44689. } else {
  44690. return $1;
  44691. }
  44692. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44693. },
  44694. args: [],
  44695. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44696. referencedClasses: [],
  44697. messageSends: ["ifNil:"]
  44698. }),
  44699. $globals.AIContext);
  44700. $core.addMethod(
  44701. $core.method({
  44702. selector: "index:",
  44703. protocol: "accessing",
  44704. fn: function (anInteger){
  44705. var self=this,$self=this;
  44706. $self["@index"]=anInteger;
  44707. return self;
  44708. },
  44709. args: ["anInteger"],
  44710. source: "index: anInteger\x0a\x09index := anInteger",
  44711. referencedClasses: [],
  44712. messageSends: []
  44713. }),
  44714. $globals.AIContext);
  44715. $core.addMethod(
  44716. $core.method({
  44717. selector: "initializeAST",
  44718. protocol: "initialization",
  44719. fn: function (){
  44720. var self=this,$self=this;
  44721. return $core.withContext(function($ctx1) {
  44722. var $1;
  44723. $1=$self._method();
  44724. $ctx1.sendIdx["method"]=1;
  44725. $self["@ast"]=$recv($1)._ast();
  44726. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44727. return self;
  44728. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44729. },
  44730. args: [],
  44731. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44732. referencedClasses: ["SemanticAnalyzer"],
  44733. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44734. }),
  44735. $globals.AIContext);
  44736. $core.addMethod(
  44737. $core.method({
  44738. selector: "initializeFromMethodContext:",
  44739. protocol: "initialization",
  44740. fn: function (aMethodContext){
  44741. var self=this,$self=this;
  44742. return $core.withContext(function($ctx1) {
  44743. var $1,$2,$3,$receiver;
  44744. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44745. $self._index_($recv(aMethodContext)._index());
  44746. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44747. $self._receiver_($recv(aMethodContext)._receiver());
  44748. $self._supercall_($recv(aMethodContext)._supercall());
  44749. $self._selector_($recv(aMethodContext)._selector());
  44750. $1=$recv(aMethodContext)._outerContext();
  44751. $ctx1.sendIdx["outerContext"]=1;
  44752. if(($receiver = $1) == null || $receiver.a$nil){
  44753. $1;
  44754. } else {
  44755. var outer;
  44756. outer=$receiver;
  44757. $2=$recv(outer)._methodContext();
  44758. if(($receiver = $2) == null || $receiver.a$nil){
  44759. $2;
  44760. } else {
  44761. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44762. }
  44763. $3=$recv(aMethodContext)._locals();
  44764. $ctx1.sendIdx["locals"]=1;
  44765. $recv($3)._keysAndValuesDo_((function(key,value){
  44766. return $core.withContext(function($ctx2) {
  44767. return $recv($self._locals())._at_put_(key,value);
  44768. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44769. }));
  44770. }
  44771. return self;
  44772. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44773. },
  44774. args: ["aMethodContext"],
  44775. source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
  44776. referencedClasses: [],
  44777. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44778. }),
  44779. $globals.AIContext);
  44780. $core.addMethod(
  44781. $core.method({
  44782. selector: "initializeInterpreter",
  44783. protocol: "initialization",
  44784. fn: function (){
  44785. var self=this,$self=this;
  44786. return $core.withContext(function($ctx1) {
  44787. var $1,$2,$receiver;
  44788. $1=$recv($globals.ASTInterpreter)._new();
  44789. $recv($1)._context_(self);
  44790. $self["@interpreter"]=$recv($1)._yourself();
  44791. $2=$self._innerContext();
  44792. if(($receiver = $2) == null || $receiver.a$nil){
  44793. $2;
  44794. } else {
  44795. $self._setupInterpreter_($self["@interpreter"]);
  44796. }
  44797. return self;
  44798. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44799. },
  44800. args: [],
  44801. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44802. referencedClasses: ["ASTInterpreter"],
  44803. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44804. }),
  44805. $globals.AIContext);
  44806. $core.addMethod(
  44807. $core.method({
  44808. selector: "initializeLocals",
  44809. protocol: "initialization",
  44810. fn: function (){
  44811. var self=this,$self=this;
  44812. return $core.withContext(function($ctx1) {
  44813. $self["@locals"]=$recv($globals.Dictionary)._new();
  44814. $recv($self["@locals"])._at_put_("thisContext",self);
  44815. return self;
  44816. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44817. },
  44818. args: [],
  44819. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44820. referencedClasses: ["Dictionary"],
  44821. messageSends: ["new", "at:put:"]
  44822. }),
  44823. $globals.AIContext);
  44824. $core.addMethod(
  44825. $core.method({
  44826. selector: "innerContext",
  44827. protocol: "accessing",
  44828. fn: function (){
  44829. var self=this,$self=this;
  44830. return $self["@innerContext"];
  44831. },
  44832. args: [],
  44833. source: "innerContext\x0a\x09^ innerContext",
  44834. referencedClasses: [],
  44835. messageSends: []
  44836. }),
  44837. $globals.AIContext);
  44838. $core.addMethod(
  44839. $core.method({
  44840. selector: "innerContext:",
  44841. protocol: "accessing",
  44842. fn: function (anAIContext){
  44843. var self=this,$self=this;
  44844. $self["@innerContext"]=anAIContext;
  44845. return self;
  44846. },
  44847. args: ["anAIContext"],
  44848. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44849. referencedClasses: [],
  44850. messageSends: []
  44851. }),
  44852. $globals.AIContext);
  44853. $core.addMethod(
  44854. $core.method({
  44855. selector: "interpreter",
  44856. protocol: "interpreting",
  44857. fn: function (){
  44858. var self=this,$self=this;
  44859. return $core.withContext(function($ctx1) {
  44860. var $1,$receiver;
  44861. $1=$self["@interpreter"];
  44862. if(($receiver = $1) == null || $receiver.a$nil){
  44863. $self._initializeInterpreter();
  44864. } else {
  44865. $1;
  44866. }
  44867. return $self["@interpreter"];
  44868. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44869. },
  44870. args: [],
  44871. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44872. referencedClasses: [],
  44873. messageSends: ["ifNil:", "initializeInterpreter"]
  44874. }),
  44875. $globals.AIContext);
  44876. $core.addMethod(
  44877. $core.method({
  44878. selector: "interpreter:",
  44879. protocol: "interpreting",
  44880. fn: function (anInterpreter){
  44881. var self=this,$self=this;
  44882. $self["@interpreter"]=anInterpreter;
  44883. return self;
  44884. },
  44885. args: ["anInterpreter"],
  44886. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  44887. referencedClasses: [],
  44888. messageSends: []
  44889. }),
  44890. $globals.AIContext);
  44891. $core.addMethod(
  44892. $core.method({
  44893. selector: "isTopContext",
  44894. protocol: "testing",
  44895. fn: function (){
  44896. var self=this,$self=this;
  44897. return $core.withContext(function($ctx1) {
  44898. return $recv($self._innerContext())._isNil();
  44899. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  44900. },
  44901. args: [],
  44902. source: "isTopContext\x0a\x09^ self innerContext isNil",
  44903. referencedClasses: [],
  44904. messageSends: ["isNil", "innerContext"]
  44905. }),
  44906. $globals.AIContext);
  44907. $core.addMethod(
  44908. $core.method({
  44909. selector: "localAt:",
  44910. protocol: "accessing",
  44911. fn: function (aString){
  44912. var self=this,$self=this;
  44913. var context;
  44914. return $core.withContext(function($ctx1) {
  44915. context=$self._lookupContextForLocal_(aString);
  44916. return $recv(context)._basicLocalAt_(aString);
  44917. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  44918. },
  44919. args: ["aString"],
  44920. source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09^ context basicLocalAt: aString",
  44921. referencedClasses: [],
  44922. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  44923. }),
  44924. $globals.AIContext);
  44925. $core.addMethod(
  44926. $core.method({
  44927. selector: "localAt:ifAbsent:",
  44928. protocol: "accessing",
  44929. fn: function (aString,aBlock){
  44930. var self=this,$self=this;
  44931. var context;
  44932. return $core.withContext(function($ctx1) {
  44933. var $early={};
  44934. try {
  44935. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  44936. return $core.withContext(function($ctx2) {
  44937. throw $early=[$recv(aBlock)._value()];
  44938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44939. }));
  44940. return $recv(context)._basicLocalAt_(aString);
  44941. }
  44942. catch(e) {if(e===$early)return e[0]; throw e}
  44943. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  44944. },
  44945. args: ["aString", "aBlock"],
  44946. source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self \x09\x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ ^ aBlock value ].\x0a\x09\x0a\x09^ context basicLocalAt: aString",
  44947. referencedClasses: [],
  44948. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  44949. }),
  44950. $globals.AIContext);
  44951. $core.addMethod(
  44952. $core.method({
  44953. selector: "localAt:put:",
  44954. protocol: "accessing",
  44955. fn: function (aString,anObject){
  44956. var self=this,$self=this;
  44957. var context;
  44958. return $core.withContext(function($ctx1) {
  44959. context=$self._lookupContextForLocal_(aString);
  44960. $recv(context)._basicLocalAt_put_(aString,anObject);
  44961. return self;
  44962. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  44963. },
  44964. args: ["aString", "anObject"],
  44965. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  44966. referencedClasses: [],
  44967. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  44968. }),
  44969. $globals.AIContext);
  44970. $core.addMethod(
  44971. $core.method({
  44972. selector: "locals",
  44973. protocol: "accessing",
  44974. fn: function (){
  44975. var self=this,$self=this;
  44976. return $core.withContext(function($ctx1) {
  44977. var $1,$receiver;
  44978. $1=$self["@locals"];
  44979. if(($receiver = $1) == null || $receiver.a$nil){
  44980. $self._initializeLocals();
  44981. } else {
  44982. $1;
  44983. }
  44984. return $self["@locals"];
  44985. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  44986. },
  44987. args: [],
  44988. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  44989. referencedClasses: [],
  44990. messageSends: ["ifNil:", "initializeLocals"]
  44991. }),
  44992. $globals.AIContext);
  44993. $core.addMethod(
  44994. $core.method({
  44995. selector: "lookupContextForLocal:",
  44996. protocol: "private",
  44997. fn: function (aString){
  44998. var self=this,$self=this;
  44999. return $core.withContext(function($ctx1) {
  45000. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  45001. return $core.withContext(function($ctx2) {
  45002. return $self._variableNotFound();
  45003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45004. }));
  45005. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  45006. },
  45007. args: ["aString"],
  45008. source: "lookupContextForLocal: aString\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self \x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ self variableNotFound ]",
  45009. referencedClasses: [],
  45010. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  45011. }),
  45012. $globals.AIContext);
  45013. $core.addMethod(
  45014. $core.method({
  45015. selector: "lookupContextForLocal:ifNone:",
  45016. protocol: "private",
  45017. fn: function (aString,aBlock){
  45018. var self=this,$self=this;
  45019. return $core.withContext(function($ctx1) {
  45020. var $1;
  45021. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  45022. return self;
  45023. }),(function(){
  45024. return $core.withContext(function($ctx2) {
  45025. $1=$self._outerContext();
  45026. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  45027. return $core.withContext(function($ctx3) {
  45028. return $recv(context)._lookupContextForLocal_(aString);
  45029. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  45030. }));
  45031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45032. }));
  45033. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  45034. },
  45035. args: ["aString", "aBlock"],
  45036. source: "lookupContextForLocal: aString ifNone: aBlock\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self locals \x0a\x09\x09at: aString\x0a\x09\x09ifPresent: [ self ]\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09self outerContext \x0a\x09\x09\x09\x09ifNil: aBlock\x0a\x09\x09\x09\x09ifNotNil: [ :context | \x0a\x09\x09\x09\x09\x09context lookupContextForLocal: aString ] ]",
  45037. referencedClasses: [],
  45038. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  45039. }),
  45040. $globals.AIContext);
  45041. $core.addMethod(
  45042. $core.method({
  45043. selector: "newInnerContext",
  45044. protocol: "factory",
  45045. fn: function (){
  45046. var self=this,$self=this;
  45047. return $core.withContext(function($ctx1) {
  45048. var $1;
  45049. $1=$recv($self._class())._new();
  45050. $recv($1)._outerContext_(self);
  45051. return $recv($1)._yourself();
  45052. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  45053. },
  45054. args: [],
  45055. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  45056. referencedClasses: [],
  45057. messageSends: ["outerContext:", "new", "class", "yourself"]
  45058. }),
  45059. $globals.AIContext);
  45060. $core.addMethod(
  45061. $core.method({
  45062. selector: "outerContext",
  45063. protocol: "accessing",
  45064. fn: function (){
  45065. var self=this,$self=this;
  45066. return $self["@outerContext"];
  45067. },
  45068. args: [],
  45069. source: "outerContext\x0a\x09^ outerContext",
  45070. referencedClasses: [],
  45071. messageSends: []
  45072. }),
  45073. $globals.AIContext);
  45074. $core.addMethod(
  45075. $core.method({
  45076. selector: "outerContext:",
  45077. protocol: "accessing",
  45078. fn: function (anAIContext){
  45079. var self=this,$self=this;
  45080. return $core.withContext(function($ctx1) {
  45081. var $1,$receiver;
  45082. $self["@outerContext"]=anAIContext;
  45083. $1=$self["@outerContext"];
  45084. if(($receiver = $1) == null || $receiver.a$nil){
  45085. $1;
  45086. } else {
  45087. var context;
  45088. context=$receiver;
  45089. $recv(context)._innerContext_(self);
  45090. }
  45091. return self;
  45092. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  45093. },
  45094. args: ["anAIContext"],
  45095. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  45096. referencedClasses: [],
  45097. messageSends: ["ifNotNil:", "innerContext:"]
  45098. }),
  45099. $globals.AIContext);
  45100. $core.addMethod(
  45101. $core.method({
  45102. selector: "receiver:",
  45103. protocol: "interpreting",
  45104. fn: function (anObject){
  45105. var self=this,$self=this;
  45106. return $core.withContext(function($ctx1) {
  45107. $recv($self._locals())._at_put_("self",anObject);
  45108. return self;
  45109. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  45110. },
  45111. args: ["anObject"],
  45112. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  45113. referencedClasses: [],
  45114. messageSends: ["at:put:", "locals"]
  45115. }),
  45116. $globals.AIContext);
  45117. $core.addMethod(
  45118. $core.method({
  45119. selector: "selector",
  45120. protocol: "accessing",
  45121. fn: function (){
  45122. var self=this,$self=this;
  45123. return $self["@selector"];
  45124. },
  45125. args: [],
  45126. source: "selector\x0a\x09^ selector",
  45127. referencedClasses: [],
  45128. messageSends: []
  45129. }),
  45130. $globals.AIContext);
  45131. $core.addMethod(
  45132. $core.method({
  45133. selector: "selector:",
  45134. protocol: "accessing",
  45135. fn: function (aString){
  45136. var self=this,$self=this;
  45137. $self["@selector"]=aString;
  45138. return self;
  45139. },
  45140. args: ["aString"],
  45141. source: "selector: aString\x0a\x09selector := aString",
  45142. referencedClasses: [],
  45143. messageSends: []
  45144. }),
  45145. $globals.AIContext);
  45146. $core.addMethod(
  45147. $core.method({
  45148. selector: "sendIndexAt:",
  45149. protocol: "accessing",
  45150. fn: function (aString){
  45151. var self=this,$self=this;
  45152. return $core.withContext(function($ctx1) {
  45153. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  45154. return (0);
  45155. }));
  45156. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  45157. },
  45158. args: ["aString"],
  45159. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  45160. referencedClasses: [],
  45161. messageSends: ["at:ifAbsent:", "sendIndexes"]
  45162. }),
  45163. $globals.AIContext);
  45164. $core.addMethod(
  45165. $core.method({
  45166. selector: "sendIndexes",
  45167. protocol: "accessing",
  45168. fn: function (){
  45169. var self=this,$self=this;
  45170. return $core.withContext(function($ctx1) {
  45171. var $1,$receiver;
  45172. $1=$self["@sendIndexes"];
  45173. if(($receiver = $1) == null || $receiver.a$nil){
  45174. return $recv($globals.Dictionary)._new();
  45175. } else {
  45176. return $1;
  45177. }
  45178. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  45179. },
  45180. args: [],
  45181. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  45182. referencedClasses: ["Dictionary"],
  45183. messageSends: ["ifNil:", "new"]
  45184. }),
  45185. $globals.AIContext);
  45186. $core.addMethod(
  45187. $core.method({
  45188. selector: "sendIndexes:",
  45189. protocol: "accessing",
  45190. fn: function (aDictionary){
  45191. var self=this,$self=this;
  45192. $self["@sendIndexes"]=aDictionary;
  45193. return self;
  45194. },
  45195. args: ["aDictionary"],
  45196. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  45197. referencedClasses: [],
  45198. messageSends: []
  45199. }),
  45200. $globals.AIContext);
  45201. $core.addMethod(
  45202. $core.method({
  45203. selector: "setupInterpreter:",
  45204. protocol: "interpreting",
  45205. fn: function (anInterpreter){
  45206. var self=this,$self=this;
  45207. var currentNode;
  45208. return $core.withContext(function($ctx1) {
  45209. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  45210. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45211. $2=$self._evaluatedSelector();
  45212. $ctx1.sendIdx["evaluatedSelector"]=1;
  45213. $recv($1)._selector_($2);
  45214. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  45215. $3=$self._ast();
  45216. $ctx1.sendIdx["ast"]=1;
  45217. $recv($1)._visit_($3);
  45218. currentNode=$recv($1)._currentNode();
  45219. $4=$recv($self._ast())._sequenceNode();
  45220. if(($receiver = $4) == null || $receiver.a$nil){
  45221. $4;
  45222. } else {
  45223. var sequence;
  45224. sequence=$receiver;
  45225. $recv($recv(sequence)._temps())._do_((function(each){
  45226. return $core.withContext(function($ctx2) {
  45227. return $self._defineLocal_(each);
  45228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45229. }));
  45230. $ctx1.sendIdx["do:"]=1;
  45231. }
  45232. $recv(anInterpreter)._node_(currentNode);
  45233. $7=$self._innerContext();
  45234. $ctx1.sendIdx["innerContext"]=1;
  45235. $6=$recv($7)._arguments();
  45236. $5=$recv($6)._reversed();
  45237. $recv($5)._do_((function(each){
  45238. return $core.withContext(function($ctx2) {
  45239. return $recv(anInterpreter)._push_(each);
  45240. $ctx2.sendIdx["push:"]=1;
  45241. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45242. }));
  45243. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  45244. return self;
  45245. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  45246. },
  45247. args: ["anInterpreter"],
  45248. source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09index: (self sendIndexAt: self evaluatedSelector);\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  45249. referencedClasses: ["ASTPCNodeVisitor"],
  45250. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  45251. }),
  45252. $globals.AIContext);
  45253. $core.addMethod(
  45254. $core.method({
  45255. selector: "supercall",
  45256. protocol: "interpreting",
  45257. fn: function (){
  45258. var self=this,$self=this;
  45259. return $core.withContext(function($ctx1) {
  45260. var $1,$receiver;
  45261. $1=$self["@supercall"];
  45262. if(($receiver = $1) == null || $receiver.a$nil){
  45263. return false;
  45264. } else {
  45265. return $1;
  45266. }
  45267. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  45268. },
  45269. args: [],
  45270. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  45271. referencedClasses: [],
  45272. messageSends: ["ifNil:"]
  45273. }),
  45274. $globals.AIContext);
  45275. $core.addMethod(
  45276. $core.method({
  45277. selector: "supercall:",
  45278. protocol: "interpreting",
  45279. fn: function (aBoolean){
  45280. var self=this,$self=this;
  45281. $self["@supercall"]=aBoolean;
  45282. return self;
  45283. },
  45284. args: ["aBoolean"],
  45285. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  45286. referencedClasses: [],
  45287. messageSends: []
  45288. }),
  45289. $globals.AIContext);
  45290. $core.addMethod(
  45291. $core.method({
  45292. selector: "variableNotFound",
  45293. protocol: "error handling",
  45294. fn: function (){
  45295. var self=this,$self=this;
  45296. return $core.withContext(function($ctx1) {
  45297. $self._error_("Variable missing");
  45298. return self;
  45299. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  45300. },
  45301. args: [],
  45302. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  45303. referencedClasses: [],
  45304. messageSends: ["error:"]
  45305. }),
  45306. $globals.AIContext);
  45307. $core.addMethod(
  45308. $core.method({
  45309. selector: "fromMethodContext:",
  45310. protocol: "instance creation",
  45311. fn: function (aMethodContext){
  45312. var self=this,$self=this;
  45313. return $core.withContext(function($ctx1) {
  45314. var $1;
  45315. $1=$self._new();
  45316. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45317. return $recv($1)._yourself();
  45318. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45319. },
  45320. args: ["aMethodContext"],
  45321. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45322. referencedClasses: [],
  45323. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45324. }),
  45325. $globals.AIContext.a$cls);
  45326. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45327. $globals.AISemanticAnalyzer.comment="I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables.";
  45328. $core.addMethod(
  45329. $core.method({
  45330. selector: "context",
  45331. protocol: "accessing",
  45332. fn: function (){
  45333. var self=this,$self=this;
  45334. return $self["@context"];
  45335. },
  45336. args: [],
  45337. source: "context\x0a\x09^ context",
  45338. referencedClasses: [],
  45339. messageSends: []
  45340. }),
  45341. $globals.AISemanticAnalyzer);
  45342. $core.addMethod(
  45343. $core.method({
  45344. selector: "context:",
  45345. protocol: "accessing",
  45346. fn: function (anAIContext){
  45347. var self=this,$self=this;
  45348. $self["@context"]=anAIContext;
  45349. return self;
  45350. },
  45351. args: ["anAIContext"],
  45352. source: "context: anAIContext\x0a\x09context := anAIContext",
  45353. referencedClasses: [],
  45354. messageSends: []
  45355. }),
  45356. $globals.AISemanticAnalyzer);
  45357. $core.addMethod(
  45358. $core.method({
  45359. selector: "visitVariableNode:",
  45360. protocol: "visiting",
  45361. fn: function (aNode){
  45362. var self=this,$self=this;
  45363. return $core.withContext(function($ctx1) {
  45364. var $1;
  45365. var $early={};
  45366. try {
  45367. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45368. return $core.withContext(function($ctx2) {
  45369. $1=(
  45370. $ctx2.supercall = true,
  45371. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45372. $ctx2.supercall = false;
  45373. throw $early=[$1];
  45374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45375. }));
  45376. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45377. return self;
  45378. }
  45379. catch(e) {if(e===$early)return e[0]; throw e}
  45380. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45381. },
  45382. args: ["aNode"],
  45383. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45384. referencedClasses: ["ASTContextVar"],
  45385. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45386. }),
  45387. $globals.AISemanticAnalyzer);
  45388. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45389. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45390. $core.addMethod(
  45391. $core.method({
  45392. selector: "context",
  45393. protocol: "accessing",
  45394. fn: function (){
  45395. var self=this,$self=this;
  45396. return $self["@context"];
  45397. },
  45398. args: [],
  45399. source: "context\x0a\x09^ context",
  45400. referencedClasses: [],
  45401. messageSends: []
  45402. }),
  45403. $globals.ASTContextVar);
  45404. $core.addMethod(
  45405. $core.method({
  45406. selector: "context:",
  45407. protocol: "accessing",
  45408. fn: function (anObject){
  45409. var self=this,$self=this;
  45410. $self["@context"]=anObject;
  45411. return self;
  45412. },
  45413. args: ["anObject"],
  45414. source: "context: anObject\x0a\x09context := anObject",
  45415. referencedClasses: [],
  45416. messageSends: []
  45417. }),
  45418. $globals.ASTContextVar);
  45419. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45420. $globals.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping.";
  45421. $core.addMethod(
  45422. $core.method({
  45423. selector: "atEnd",
  45424. protocol: "testing",
  45425. fn: function (){
  45426. var self=this,$self=this;
  45427. return $core.withContext(function($ctx1) {
  45428. var $1,$receiver;
  45429. $1=$self._context();
  45430. $ctx1.sendIdx["context"]=1;
  45431. if(($receiver = $1) == null || $receiver.a$nil){
  45432. return true;
  45433. } else {
  45434. $1;
  45435. }
  45436. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45437. return $core.withContext(function($ctx2) {
  45438. return $recv($self._context())._isTopContext();
  45439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45440. }));
  45441. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45442. },
  45443. args: [],
  45444. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45445. referencedClasses: [],
  45446. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45447. }),
  45448. $globals.ASTDebugger);
  45449. $core.addMethod(
  45450. $core.method({
  45451. selector: "context",
  45452. protocol: "accessing",
  45453. fn: function (){
  45454. var self=this,$self=this;
  45455. return $self["@context"];
  45456. },
  45457. args: [],
  45458. source: "context\x0a\x09^ context",
  45459. referencedClasses: [],
  45460. messageSends: []
  45461. }),
  45462. $globals.ASTDebugger);
  45463. $core.addMethod(
  45464. $core.method({
  45465. selector: "context:",
  45466. protocol: "accessing",
  45467. fn: function (aContext){
  45468. var self=this,$self=this;
  45469. $self["@context"]=aContext;
  45470. return self;
  45471. },
  45472. args: ["aContext"],
  45473. source: "context: aContext\x0a\x09context := aContext",
  45474. referencedClasses: [],
  45475. messageSends: []
  45476. }),
  45477. $globals.ASTDebugger);
  45478. $core.addMethod(
  45479. $core.method({
  45480. selector: "flushInnerContexts",
  45481. protocol: "actions",
  45482. fn: function (){
  45483. var self=this,$self=this;
  45484. return $core.withContext(function($ctx1) {
  45485. var $1,$receiver;
  45486. $1=$self._context();
  45487. if(($receiver = $1) == null || $receiver.a$nil){
  45488. $1;
  45489. } else {
  45490. var cxt;
  45491. cxt=$receiver;
  45492. $recv(cxt)._innerContext_(nil);
  45493. }
  45494. return self;
  45495. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45496. },
  45497. args: [],
  45498. source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self context ifNotNil: [ :cxt | \x0a\x09\x09cxt innerContext: nil ]",
  45499. referencedClasses: [],
  45500. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45501. }),
  45502. $globals.ASTDebugger);
  45503. $core.addMethod(
  45504. $core.method({
  45505. selector: "interpreter",
  45506. protocol: "accessing",
  45507. fn: function (){
  45508. var self=this,$self=this;
  45509. return $core.withContext(function($ctx1) {
  45510. var $1,$receiver;
  45511. $1=$self._context();
  45512. if(($receiver = $1) == null || $receiver.a$nil){
  45513. return $1;
  45514. } else {
  45515. var ctx;
  45516. ctx=$receiver;
  45517. return $recv(ctx)._interpreter();
  45518. }
  45519. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45520. },
  45521. args: [],
  45522. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45523. referencedClasses: [],
  45524. messageSends: ["ifNotNil:", "context", "interpreter"]
  45525. }),
  45526. $globals.ASTDebugger);
  45527. $core.addMethod(
  45528. $core.method({
  45529. selector: "method",
  45530. protocol: "accessing",
  45531. fn: function (){
  45532. var self=this,$self=this;
  45533. return $core.withContext(function($ctx1) {
  45534. return $recv($self._context())._method();
  45535. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45536. },
  45537. args: [],
  45538. source: "method\x0a\x09^ self context method",
  45539. referencedClasses: [],
  45540. messageSends: ["method", "context"]
  45541. }),
  45542. $globals.ASTDebugger);
  45543. $core.addMethod(
  45544. $core.method({
  45545. selector: "node",
  45546. protocol: "accessing",
  45547. fn: function (){
  45548. var self=this,$self=this;
  45549. return $core.withContext(function($ctx1) {
  45550. var $1,$receiver;
  45551. $1=$self._interpreter();
  45552. $ctx1.sendIdx["interpreter"]=1;
  45553. if(($receiver = $1) == null || $receiver.a$nil){
  45554. return $1;
  45555. } else {
  45556. return $recv($self._interpreter())._node();
  45557. }
  45558. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45559. },
  45560. args: [],
  45561. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45562. referencedClasses: [],
  45563. messageSends: ["ifNotNil:", "interpreter", "node"]
  45564. }),
  45565. $globals.ASTDebugger);
  45566. $core.addMethod(
  45567. $core.method({
  45568. selector: "onStep",
  45569. protocol: "private",
  45570. fn: function (){
  45571. var self=this,$self=this;
  45572. return $core.withContext(function($ctx1) {
  45573. var $1,$3,$2,$4,$6,$5,$receiver;
  45574. $1=$self._interpreter();
  45575. $ctx1.sendIdx["interpreter"]=1;
  45576. $self["@result"]=$recv($1)._result();
  45577. $3=$self._interpreter();
  45578. $ctx1.sendIdx["interpreter"]=2;
  45579. $2=$recv($3)._atEnd();
  45580. $ctx1.sendIdx["atEnd"]=1;
  45581. if($core.assert($2)){
  45582. $4=$recv($self._context())._outerContext();
  45583. if(($receiver = $4) == null || $receiver.a$nil){
  45584. $4;
  45585. } else {
  45586. var outerContext;
  45587. outerContext=$receiver;
  45588. $self._context_(outerContext);
  45589. }
  45590. $6=$self._interpreter();
  45591. $ctx1.sendIdx["interpreter"]=3;
  45592. $5=$recv($6)._atEnd();
  45593. if(!$core.assert($5)){
  45594. $recv($self._interpreter())._skip();
  45595. }
  45596. }
  45597. $self._flushInnerContexts();
  45598. return self;
  45599. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45600. },
  45601. args: [],
  45602. source: "onStep\x0a\x09\x22After each step, check if the interpreter is at the end,\x0a\x09and if it is move to its outer context if any, skipping its \x0a\x09current node (which was just evaluated by the current \x0a\x09interpreter).\x0a\x09\x0a\x09After each step we also flush inner contexts.\x22\x0a\x09\x0a\x09result := self interpreter result.\x0a\x09\x0a\x09self interpreter atEnd ifTrue: [\x0a\x09\x09self context outerContext ifNotNil: [ :outerContext | \x0a\x09\x09\x09self context: outerContext ].\x0a\x09\x09self interpreter atEnd ifFalse: [ self interpreter skip ] ].\x0a\x09\x09\x0a\x09self flushInnerContexts",
  45603. referencedClasses: [],
  45604. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45605. }),
  45606. $globals.ASTDebugger);
  45607. $core.addMethod(
  45608. $core.method({
  45609. selector: "proceed",
  45610. protocol: "stepping",
  45611. fn: function (){
  45612. var self=this,$self=this;
  45613. return $core.withContext(function($ctx1) {
  45614. $recv((function(){
  45615. return $core.withContext(function($ctx2) {
  45616. return $self._atEnd();
  45617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45618. }))._whileFalse_((function(){
  45619. return $core.withContext(function($ctx2) {
  45620. return $self._stepOver();
  45621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45622. }));
  45623. return self;
  45624. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45625. },
  45626. args: [],
  45627. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45628. referencedClasses: [],
  45629. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45630. }),
  45631. $globals.ASTDebugger);
  45632. $core.addMethod(
  45633. $core.method({
  45634. selector: "restart",
  45635. protocol: "stepping",
  45636. fn: function (){
  45637. var self=this,$self=this;
  45638. return $core.withContext(function($ctx1) {
  45639. $recv($self._interpreter())._restart();
  45640. $self._flushInnerContexts();
  45641. return self;
  45642. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45643. },
  45644. args: [],
  45645. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45646. referencedClasses: [],
  45647. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45648. }),
  45649. $globals.ASTDebugger);
  45650. $core.addMethod(
  45651. $core.method({
  45652. selector: "result",
  45653. protocol: "accessing",
  45654. fn: function (){
  45655. var self=this,$self=this;
  45656. return $self["@result"];
  45657. },
  45658. args: [],
  45659. source: "result\x0a\x09^ result",
  45660. referencedClasses: [],
  45661. messageSends: []
  45662. }),
  45663. $globals.ASTDebugger);
  45664. $core.addMethod(
  45665. $core.method({
  45666. selector: "stepInto",
  45667. protocol: "stepping",
  45668. fn: function (){
  45669. var self=this,$self=this;
  45670. return $core.withContext(function($ctx1) {
  45671. $self._shouldBeImplemented();
  45672. return self;
  45673. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45674. },
  45675. args: [],
  45676. source: "stepInto\x0a\x09self shouldBeImplemented",
  45677. referencedClasses: [],
  45678. messageSends: ["shouldBeImplemented"]
  45679. }),
  45680. $globals.ASTDebugger);
  45681. $core.addMethod(
  45682. $core.method({
  45683. selector: "stepOver",
  45684. protocol: "stepping",
  45685. fn: function (){
  45686. var self=this,$self=this;
  45687. return $core.withContext(function($ctx1) {
  45688. var $1,$2;
  45689. $1=$recv($self._context())._isTopContext();
  45690. if($core.assert($1)){
  45691. $recv($self._interpreter())._stepOver();
  45692. } else {
  45693. $2=$self._interpreter();
  45694. $ctx1.sendIdx["interpreter"]=1;
  45695. $recv($2)._skip();
  45696. }
  45697. $self._onStep();
  45698. return self;
  45699. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45700. },
  45701. args: [],
  45702. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45703. referencedClasses: [],
  45704. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45705. }),
  45706. $globals.ASTDebugger);
  45707. $core.addMethod(
  45708. $core.method({
  45709. selector: "context:",
  45710. protocol: "instance creation",
  45711. fn: function (aContext){
  45712. var self=this,$self=this;
  45713. return $core.withContext(function($ctx1) {
  45714. var $1;
  45715. $1=$self._new();
  45716. $recv($1)._context_(aContext);
  45717. return $recv($1)._yourself();
  45718. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45719. },
  45720. args: ["aContext"],
  45721. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45722. referencedClasses: [],
  45723. messageSends: ["context:", "new", "yourself"]
  45724. }),
  45725. $globals.ASTDebugger.a$cls);
  45726. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45727. $core.addMethod(
  45728. $core.method({
  45729. selector: "interpreter",
  45730. protocol: "accessing",
  45731. fn: function (){
  45732. var self=this,$self=this;
  45733. return $self["@interpreter"];
  45734. },
  45735. args: [],
  45736. source: "interpreter\x0a\x09^ interpreter",
  45737. referencedClasses: [],
  45738. messageSends: []
  45739. }),
  45740. $globals.ASTEnterNode);
  45741. $core.addMethod(
  45742. $core.method({
  45743. selector: "interpreter:",
  45744. protocol: "accessing",
  45745. fn: function (anObject){
  45746. var self=this,$self=this;
  45747. $self["@interpreter"]=anObject;
  45748. return self;
  45749. },
  45750. args: ["anObject"],
  45751. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45752. referencedClasses: [],
  45753. messageSends: []
  45754. }),
  45755. $globals.ASTEnterNode);
  45756. $core.addMethod(
  45757. $core.method({
  45758. selector: "visitBlockNode:",
  45759. protocol: "visiting",
  45760. fn: function (aNode){
  45761. var self=this,$self=this;
  45762. return aNode;
  45763. },
  45764. args: ["aNode"],
  45765. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45766. referencedClasses: [],
  45767. messageSends: []
  45768. }),
  45769. $globals.ASTEnterNode);
  45770. $core.addMethod(
  45771. $core.method({
  45772. selector: "visitDagNode:",
  45773. protocol: "visiting",
  45774. fn: function (aNode){
  45775. var self=this,$self=this;
  45776. return $core.withContext(function($ctx1) {
  45777. var $early={};
  45778. try {
  45779. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45780. throw $early=[aNode];
  45781. }),(function(nodes){
  45782. return $core.withContext(function($ctx2) {
  45783. throw $early=[$self._visit_($recv(nodes)._first())];
  45784. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45785. }));
  45786. return self;
  45787. }
  45788. catch(e) {if(e===$early)return e[0]; throw e}
  45789. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45790. },
  45791. args: ["aNode"],
  45792. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45793. referencedClasses: [],
  45794. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45795. }),
  45796. $globals.ASTEnterNode);
  45797. $core.addMethod(
  45798. $core.method({
  45799. selector: "visitSequenceNode:",
  45800. protocol: "visiting",
  45801. fn: function (aNode){
  45802. var self=this,$self=this;
  45803. return $core.withContext(function($ctx1) {
  45804. var $1;
  45805. $recv($recv(aNode)._temps())._do_((function(each){
  45806. return $core.withContext(function($ctx2) {
  45807. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45809. }));
  45810. $1=(
  45811. $ctx1.supercall = true,
  45812. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45813. $ctx1.supercall = false;
  45814. return $1;
  45815. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45816. },
  45817. args: ["aNode"],
  45818. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45819. referencedClasses: [],
  45820. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45821. }),
  45822. $globals.ASTEnterNode);
  45823. $core.addMethod(
  45824. $core.method({
  45825. selector: "on:",
  45826. protocol: "instance creation",
  45827. fn: function (anInterpreter){
  45828. var self=this,$self=this;
  45829. return $core.withContext(function($ctx1) {
  45830. var $1;
  45831. $1=$self._new();
  45832. $recv($1)._interpreter_(anInterpreter);
  45833. return $recv($1)._yourself();
  45834. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45835. },
  45836. args: ["anInterpreter"],
  45837. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45838. referencedClasses: [],
  45839. messageSends: ["interpreter:", "new", "yourself"]
  45840. }),
  45841. $globals.ASTEnterNode.a$cls);
  45842. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45843. $globals.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
  45844. $core.addMethod(
  45845. $core.method({
  45846. selector: "assign:to:",
  45847. protocol: "private",
  45848. fn: function (aNode,anObject){
  45849. var self=this,$self=this;
  45850. return $core.withContext(function($ctx1) {
  45851. var $1,$3,$2,$4;
  45852. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45853. if($core.assert($1)){
  45854. $3=$self._context();
  45855. $ctx1.sendIdx["context"]=1;
  45856. $2=$recv($3)._receiver();
  45857. $4=$recv(aNode)._value();
  45858. $ctx1.sendIdx["value"]=1;
  45859. $recv($2)._instVarAt_put_($4,anObject);
  45860. } else {
  45861. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45862. }
  45863. return self;
  45864. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45865. },
  45866. args: ["aNode", "anObject"],
  45867. source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  45868. referencedClasses: [],
  45869. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45870. }),
  45871. $globals.ASTInterpreter);
  45872. $core.addMethod(
  45873. $core.method({
  45874. selector: "atEnd",
  45875. protocol: "testing",
  45876. fn: function (){
  45877. var self=this,$self=this;
  45878. return $core.withContext(function($ctx1) {
  45879. var $1;
  45880. $1=$self["@forceAtEnd"];
  45881. if($core.assert($1)){
  45882. return true;
  45883. }
  45884. return $recv($self._hasReturned())._or_((function(){
  45885. return $core.withContext(function($ctx2) {
  45886. return $recv($self._node())._isNil();
  45887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45888. }));
  45889. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  45890. },
  45891. args: [],
  45892. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  45893. referencedClasses: [],
  45894. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  45895. }),
  45896. $globals.ASTInterpreter);
  45897. $core.addMethod(
  45898. $core.method({
  45899. selector: "context",
  45900. protocol: "accessing",
  45901. fn: function (){
  45902. var self=this,$self=this;
  45903. return $self["@context"];
  45904. },
  45905. args: [],
  45906. source: "context\x0a\x09^ context",
  45907. referencedClasses: [],
  45908. messageSends: []
  45909. }),
  45910. $globals.ASTInterpreter);
  45911. $core.addMethod(
  45912. $core.method({
  45913. selector: "context:",
  45914. protocol: "accessing",
  45915. fn: function (aContext){
  45916. var self=this,$self=this;
  45917. $self["@context"]=aContext;
  45918. return self;
  45919. },
  45920. args: ["aContext"],
  45921. source: "context: aContext\x0a\x09context := aContext",
  45922. referencedClasses: [],
  45923. messageSends: []
  45924. }),
  45925. $globals.ASTInterpreter);
  45926. $core.addMethod(
  45927. $core.method({
  45928. selector: "enterNode",
  45929. protocol: "interpreting",
  45930. fn: function (){
  45931. var self=this,$self=this;
  45932. return $core.withContext(function($ctx1) {
  45933. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  45934. return self;
  45935. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  45936. },
  45937. args: [],
  45938. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  45939. referencedClasses: ["ASTEnterNode"],
  45940. messageSends: ["node:", "visit:", "on:", "node"]
  45941. }),
  45942. $globals.ASTInterpreter);
  45943. $core.addMethod(
  45944. $core.method({
  45945. selector: "eval:",
  45946. protocol: "private",
  45947. fn: function (aString){
  45948. var self=this,$self=this;
  45949. var source,function_;
  45950. return $core.withContext(function($ctx1) {
  45951. var $3,$2,$1;
  45952. source=$recv($globals.String)._streamContents_((function(str){
  45953. return $core.withContext(function($ctx2) {
  45954. $recv(str)._nextPutAll_("0,(function(");
  45955. $ctx2.sendIdx["nextPutAll:"]=1;
  45956. $3=$self._context();
  45957. $ctx2.sendIdx["context"]=1;
  45958. $2=$recv($3)._locals();
  45959. $ctx2.sendIdx["locals"]=1;
  45960. $1=$recv($2)._keys();
  45961. $recv($1)._do_separatedBy_((function(each){
  45962. return $core.withContext(function($ctx3) {
  45963. return $recv(str)._nextPutAll_(each);
  45964. $ctx3.sendIdx["nextPutAll:"]=2;
  45965. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  45966. }),(function(){
  45967. return $core.withContext(function($ctx3) {
  45968. return $recv(str)._nextPutAll_(",");
  45969. $ctx3.sendIdx["nextPutAll:"]=3;
  45970. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45971. }));
  45972. $recv(str)._nextPutAll_("){ return (function() {");
  45973. $ctx2.sendIdx["nextPutAll:"]=4;
  45974. $recv(str)._nextPutAll_(aString);
  45975. $ctx2.sendIdx["nextPutAll:"]=5;
  45976. return $recv(str)._nextPutAll_("})()})");
  45977. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  45978. }));
  45979. function_=$recv($globals.Compiler)._eval_(source);
  45980. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  45981. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  45982. },
  45983. args: ["aString"],
  45984. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  45985. referencedClasses: ["String", "Compiler"],
  45986. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  45987. }),
  45988. $globals.ASTInterpreter);
  45989. $core.addMethod(
  45990. $core.method({
  45991. selector: "hasReturned",
  45992. protocol: "testing",
  45993. fn: function (){
  45994. var self=this,$self=this;
  45995. return $core.withContext(function($ctx1) {
  45996. var $1,$receiver;
  45997. $1=$self["@returned"];
  45998. if(($receiver = $1) == null || $receiver.a$nil){
  45999. return false;
  46000. } else {
  46001. return $1;
  46002. }
  46003. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  46004. },
  46005. args: [],
  46006. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  46007. referencedClasses: [],
  46008. messageSends: ["ifNil:"]
  46009. }),
  46010. $globals.ASTInterpreter);
  46011. $core.addMethod(
  46012. $core.method({
  46013. selector: "initialize",
  46014. protocol: "initialization",
  46015. fn: function (){
  46016. var self=this,$self=this;
  46017. return $core.withContext(function($ctx1) {
  46018. (
  46019. $ctx1.supercall = true,
  46020. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46021. $ctx1.supercall = false;
  46022. $self["@forceAtEnd"]=false;
  46023. return self;
  46024. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  46025. },
  46026. args: [],
  46027. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  46028. referencedClasses: [],
  46029. messageSends: ["initialize"]
  46030. }),
  46031. $globals.ASTInterpreter);
  46032. $core.addMethod(
  46033. $core.method({
  46034. selector: "interpret",
  46035. protocol: "interpreting",
  46036. fn: function (){
  46037. var self=this,$self=this;
  46038. return $core.withContext(function($ctx1) {
  46039. $self._visit_($self._node());
  46040. return self;
  46041. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  46042. },
  46043. args: [],
  46044. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  46045. referencedClasses: [],
  46046. messageSends: ["visit:", "node"]
  46047. }),
  46048. $globals.ASTInterpreter);
  46049. $core.addMethod(
  46050. $core.method({
  46051. selector: "messageFromSendNode:arguments:",
  46052. protocol: "private",
  46053. fn: function (aSendNode,aCollection){
  46054. var self=this,$self=this;
  46055. return $core.withContext(function($ctx1) {
  46056. var $1;
  46057. $1=$recv($globals.Message)._new();
  46058. $recv($1)._selector_($recv(aSendNode)._selector());
  46059. $recv($1)._arguments_(aCollection);
  46060. return $recv($1)._yourself();
  46061. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  46062. },
  46063. args: ["aSendNode", "aCollection"],
  46064. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  46065. referencedClasses: ["Message"],
  46066. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  46067. }),
  46068. $globals.ASTInterpreter);
  46069. $core.addMethod(
  46070. $core.method({
  46071. selector: "messageNotUnderstood:receiver:",
  46072. protocol: "private",
  46073. fn: function (aMessage,anObject){
  46074. var self=this,$self=this;
  46075. return $core.withContext(function($ctx1) {
  46076. var $1;
  46077. $1=$recv($globals.MessageNotUnderstood)._new();
  46078. $recv($1)._message_(aMessage);
  46079. $recv($1)._receiver_(anObject);
  46080. $recv($1)._signal();
  46081. return self;
  46082. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  46083. },
  46084. args: ["aMessage", "anObject"],
  46085. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  46086. referencedClasses: ["MessageNotUnderstood"],
  46087. messageSends: ["message:", "new", "receiver:", "signal"]
  46088. }),
  46089. $globals.ASTInterpreter);
  46090. $core.addMethod(
  46091. $core.method({
  46092. selector: "next",
  46093. protocol: "interpreting",
  46094. fn: function (){
  46095. var self=this,$self=this;
  46096. var nd,nextNode;
  46097. return $core.withContext(function($ctx1) {
  46098. var $1,$2,$receiver;
  46099. nd=$self._node();
  46100. $1=$recv(nd)._parent();
  46101. if(($receiver = $1) == null || $receiver.a$nil){
  46102. nextNode=$1;
  46103. } else {
  46104. var parent;
  46105. parent=$receiver;
  46106. $2=$recv(parent)._nextSiblingNode_(nd);
  46107. if(($receiver = $2) == null || $receiver.a$nil){
  46108. nextNode=parent;
  46109. } else {
  46110. var sibling;
  46111. sibling=$receiver;
  46112. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  46113. }
  46114. }
  46115. $self._node_(nextNode);
  46116. return self;
  46117. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  46118. },
  46119. args: [],
  46120. source: "next\x0a\x09| nd nextNode |\x0a\x09nd := self node.\x0a\x09nextNode := nd parent ifNotNil: [ :parent |\x0a\x09\x09(parent nextSiblingNode: nd)\x0a\x09\x09\x09ifNil: [ parent ]\x0a\x09\x09\x09ifNotNil: [ :sibling | (ASTEnterNode on: self) visit: sibling ] ].\x0a\x09self node: nextNode",
  46121. referencedClasses: ["ASTEnterNode"],
  46122. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  46123. }),
  46124. $globals.ASTInterpreter);
  46125. $core.addMethod(
  46126. $core.method({
  46127. selector: "node",
  46128. protocol: "accessing",
  46129. fn: function (){
  46130. var self=this,$self=this;
  46131. return $self["@node"];
  46132. },
  46133. args: [],
  46134. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  46135. referencedClasses: [],
  46136. messageSends: []
  46137. }),
  46138. $globals.ASTInterpreter);
  46139. $core.addMethod(
  46140. $core.method({
  46141. selector: "node:",
  46142. protocol: "accessing",
  46143. fn: function (aNode){
  46144. var self=this,$self=this;
  46145. $self["@node"]=aNode;
  46146. return self;
  46147. },
  46148. args: ["aNode"],
  46149. source: "node: aNode\x0a\x09node := aNode",
  46150. referencedClasses: [],
  46151. messageSends: []
  46152. }),
  46153. $globals.ASTInterpreter);
  46154. $core.addMethod(
  46155. $core.method({
  46156. selector: "peek",
  46157. protocol: "stack",
  46158. fn: function (){
  46159. var self=this,$self=this;
  46160. return $core.withContext(function($ctx1) {
  46161. var $1;
  46162. var $early={};
  46163. try {
  46164. $1=$self._stack();
  46165. $ctx1.sendIdx["stack"]=1;
  46166. $recv($1)._ifEmpty_((function(){
  46167. throw $early=[nil];
  46168. }));
  46169. return $recv($self._stack())._last();
  46170. }
  46171. catch(e) {if(e===$early)return e[0]; throw e}
  46172. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  46173. },
  46174. args: [],
  46175. source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last",
  46176. referencedClasses: [],
  46177. messageSends: ["ifEmpty:", "stack", "last"]
  46178. }),
  46179. $globals.ASTInterpreter);
  46180. $core.addMethod(
  46181. $core.method({
  46182. selector: "pop",
  46183. protocol: "stack",
  46184. fn: function (){
  46185. var self=this,$self=this;
  46186. var peekedValue;
  46187. return $core.withContext(function($ctx1) {
  46188. peekedValue=$self._peek();
  46189. $recv($self._stack())._removeLast();
  46190. return peekedValue;
  46191. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  46192. },
  46193. args: [],
  46194. source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue",
  46195. referencedClasses: [],
  46196. messageSends: ["peek", "removeLast", "stack"]
  46197. }),
  46198. $globals.ASTInterpreter);
  46199. $core.addMethod(
  46200. $core.method({
  46201. selector: "proceed",
  46202. protocol: "interpreting",
  46203. fn: function (){
  46204. var self=this,$self=this;
  46205. return $core.withContext(function($ctx1) {
  46206. $recv((function(){
  46207. return $core.withContext(function($ctx2) {
  46208. return $self._atEnd();
  46209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46210. }))._whileFalse_((function(){
  46211. return $core.withContext(function($ctx2) {
  46212. return $self._step();
  46213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46214. }));
  46215. return self;
  46216. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  46217. },
  46218. args: [],
  46219. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  46220. referencedClasses: [],
  46221. messageSends: ["whileFalse:", "atEnd", "step"]
  46222. }),
  46223. $globals.ASTInterpreter);
  46224. $core.addMethod(
  46225. $core.method({
  46226. selector: "push:",
  46227. protocol: "stack",
  46228. fn: function (anObject){
  46229. var self=this,$self=this;
  46230. return $core.withContext(function($ctx1) {
  46231. return $recv($self._stack())._add_(anObject);
  46232. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  46233. },
  46234. args: ["anObject"],
  46235. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  46236. referencedClasses: [],
  46237. messageSends: ["add:", "stack"]
  46238. }),
  46239. $globals.ASTInterpreter);
  46240. $core.addMethod(
  46241. $core.method({
  46242. selector: "restart",
  46243. protocol: "interpreting",
  46244. fn: function (){
  46245. var self=this,$self=this;
  46246. return $core.withContext(function($ctx1) {
  46247. $self._node_($recv($self._context())._ast());
  46248. $self._enterNode();
  46249. return self;
  46250. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  46251. },
  46252. args: [],
  46253. source: "restart\x0a\x09self node: self context ast; enterNode",
  46254. referencedClasses: [],
  46255. messageSends: ["node:", "ast", "context", "enterNode"]
  46256. }),
  46257. $globals.ASTInterpreter);
  46258. $core.addMethod(
  46259. $core.method({
  46260. selector: "result",
  46261. protocol: "accessing",
  46262. fn: function (){
  46263. var self=this,$self=this;
  46264. return $core.withContext(function($ctx1) {
  46265. var $1;
  46266. $1=$self._hasReturned();
  46267. if($core.assert($1)){
  46268. return $self._returnValue();
  46269. } else {
  46270. return $recv($self._context())._receiver();
  46271. }
  46272. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  46273. },
  46274. args: [],
  46275. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  46276. referencedClasses: [],
  46277. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  46278. }),
  46279. $globals.ASTInterpreter);
  46280. $core.addMethod(
  46281. $core.method({
  46282. selector: "returnValue",
  46283. protocol: "accessing",
  46284. fn: function (){
  46285. var self=this,$self=this;
  46286. return $self["@returnValue"];
  46287. },
  46288. args: [],
  46289. source: "returnValue\x0a\x09^ returnValue",
  46290. referencedClasses: [],
  46291. messageSends: []
  46292. }),
  46293. $globals.ASTInterpreter);
  46294. $core.addMethod(
  46295. $core.method({
  46296. selector: "returnValue:",
  46297. protocol: "accessing",
  46298. fn: function (anObject){
  46299. var self=this,$self=this;
  46300. $self["@returnValue"]=anObject;
  46301. return self;
  46302. },
  46303. args: ["anObject"],
  46304. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  46305. referencedClasses: [],
  46306. messageSends: []
  46307. }),
  46308. $globals.ASTInterpreter);
  46309. $core.addMethod(
  46310. $core.method({
  46311. selector: "sendMessage:to:superSend:",
  46312. protocol: "private",
  46313. fn: function (aMessage,anObject,aBoolean){
  46314. var self=this,$self=this;
  46315. var method;
  46316. return $core.withContext(function($ctx1) {
  46317. var $2,$1,$3,$receiver;
  46318. var $early={};
  46319. try {
  46320. if(!$core.assert(aBoolean)){
  46321. return $recv(aMessage)._sendTo_(anObject);
  46322. }
  46323. $2=$recv(anObject)._class();
  46324. $ctx1.sendIdx["class"]=1;
  46325. $1=$recv($2)._superclass();
  46326. $ctx1.sendIdx["superclass"]=1;
  46327. if(($receiver = $1) == null || $receiver.a$nil){
  46328. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46329. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46330. return $3;
  46331. } else {
  46332. $1;
  46333. }
  46334. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46335. return $core.withContext(function($ctx2) {
  46336. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46338. }));
  46339. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46340. }
  46341. catch(e) {if(e===$early)return e[0]; throw e}
  46342. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46343. },
  46344. args: ["aMessage", "anObject", "aBoolean"],
  46345. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  46346. referencedClasses: [],
  46347. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46348. }),
  46349. $globals.ASTInterpreter);
  46350. $core.addMethod(
  46351. $core.method({
  46352. selector: "setNonLocalReturnFromContext:",
  46353. protocol: "interpreting",
  46354. fn: function (aContext){
  46355. var self=this,$self=this;
  46356. return $core.withContext(function($ctx1) {
  46357. var $2,$1;
  46358. $2=$recv(aContext)._interpreter();
  46359. $ctx1.sendIdx["interpreter"]=1;
  46360. $1=$recv($2)._hasReturned();
  46361. if($core.assert($1)){
  46362. $self["@returned"]=true;
  46363. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46364. }
  46365. return self;
  46366. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46367. },
  46368. args: ["aContext"],
  46369. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46370. referencedClasses: [],
  46371. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46372. }),
  46373. $globals.ASTInterpreter);
  46374. $core.addMethod(
  46375. $core.method({
  46376. selector: "skip",
  46377. protocol: "interpreting",
  46378. fn: function (){
  46379. var self=this,$self=this;
  46380. return $core.withContext(function($ctx1) {
  46381. $self._next();
  46382. return self;
  46383. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46384. },
  46385. args: [],
  46386. source: "skip\x0a\x09self next",
  46387. referencedClasses: [],
  46388. messageSends: ["next"]
  46389. }),
  46390. $globals.ASTInterpreter);
  46391. $core.addMethod(
  46392. $core.method({
  46393. selector: "stack",
  46394. protocol: "accessing",
  46395. fn: function (){
  46396. var self=this,$self=this;
  46397. return $core.withContext(function($ctx1) {
  46398. var $1,$receiver;
  46399. $1=$self["@stack"];
  46400. if(($receiver = $1) == null || $receiver.a$nil){
  46401. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46402. return $self["@stack"];
  46403. } else {
  46404. return $1;
  46405. }
  46406. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46407. },
  46408. args: [],
  46409. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46410. referencedClasses: ["OrderedCollection"],
  46411. messageSends: ["ifNil:", "new"]
  46412. }),
  46413. $globals.ASTInterpreter);
  46414. $core.addMethod(
  46415. $core.method({
  46416. selector: "step",
  46417. protocol: "interpreting",
  46418. fn: function (){
  46419. var self=this,$self=this;
  46420. return $core.withContext(function($ctx1) {
  46421. $self._interpret();
  46422. $self._next();
  46423. return self;
  46424. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46425. },
  46426. args: [],
  46427. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46428. referencedClasses: [],
  46429. messageSends: ["interpret", "next"]
  46430. }),
  46431. $globals.ASTInterpreter);
  46432. $core.addMethod(
  46433. $core.method({
  46434. selector: "stepOver",
  46435. protocol: "interpreting",
  46436. fn: function (){
  46437. var self=this,$self=this;
  46438. return $core.withContext(function($ctx1) {
  46439. var $2,$1;
  46440. $self._step();
  46441. $ctx1.sendIdx["step"]=1;
  46442. $recv((function(){
  46443. return $core.withContext(function($ctx2) {
  46444. $2=$self._node();
  46445. $ctx2.sendIdx["node"]=1;
  46446. $1=$recv($2)._isNil();
  46447. return $recv($1)._or_((function(){
  46448. return $core.withContext(function($ctx3) {
  46449. return $recv($self._node())._isSteppingNode();
  46450. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46451. }));
  46452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46453. }))._whileFalse_((function(){
  46454. return $core.withContext(function($ctx2) {
  46455. return $self._step();
  46456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46457. }));
  46458. return self;
  46459. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46460. },
  46461. args: [],
  46462. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46463. referencedClasses: [],
  46464. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46465. }),
  46466. $globals.ASTInterpreter);
  46467. $core.addMethod(
  46468. $core.method({
  46469. selector: "visit:",
  46470. protocol: "visiting",
  46471. fn: function (aNode){
  46472. var self=this,$self=this;
  46473. return $core.withContext(function($ctx1) {
  46474. var $1;
  46475. $1=$self._hasReturned();
  46476. if(!$core.assert($1)){
  46477. (
  46478. $ctx1.supercall = true,
  46479. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46480. $ctx1.supercall = false;
  46481. }
  46482. return self;
  46483. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46484. },
  46485. args: ["aNode"],
  46486. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46487. referencedClasses: [],
  46488. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46489. }),
  46490. $globals.ASTInterpreter);
  46491. $core.addMethod(
  46492. $core.method({
  46493. selector: "visitAssignmentNode:",
  46494. protocol: "visiting",
  46495. fn: function (aNode){
  46496. var self=this,$self=this;
  46497. var poppedValue;
  46498. return $core.withContext(function($ctx1) {
  46499. poppedValue=$self._pop();
  46500. $ctx1.sendIdx["pop"]=1;
  46501. $self._pop();
  46502. $self._push_(poppedValue);
  46503. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46504. return self;
  46505. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46506. },
  46507. args: ["aNode"],
  46508. source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue",
  46509. referencedClasses: [],
  46510. messageSends: ["pop", "push:", "assign:to:", "left"]
  46511. }),
  46512. $globals.ASTInterpreter);
  46513. $core.addMethod(
  46514. $core.method({
  46515. selector: "visitBlockNode:",
  46516. protocol: "visiting",
  46517. fn: function (aNode){
  46518. var self=this,$self=this;
  46519. var block;
  46520. return $core.withContext(function($ctx1) {
  46521. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46522. $self._push_(block);
  46523. return self;
  46524. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46525. },
  46526. args: ["aNode"],
  46527. source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block",
  46528. referencedClasses: ["AIBlockClosure"],
  46529. messageSends: ["forContext:node:", "context", "push:"]
  46530. }),
  46531. $globals.ASTInterpreter);
  46532. $core.addMethod(
  46533. $core.method({
  46534. selector: "visitBlockSequenceNode:",
  46535. protocol: "visiting",
  46536. fn: function (aNode){
  46537. var self=this,$self=this;
  46538. return $core.withContext(function($ctx1) {
  46539. (
  46540. $ctx1.supercall = true,
  46541. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46542. $ctx1.supercall = false;
  46543. $self["@forceAtEnd"]=true;
  46544. return self;
  46545. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46546. },
  46547. args: ["aNode"],
  46548. source: "visitBlockSequenceNode: aNode\x0a\x09\x22If the receiver is actually visiting a BlockSequenceNode,\x0a\x09it means the the context is a block context. Evaluation should \x0a\x09stop right after evaluating the block sequence and the outer\x0a\x09context's interpreter should take over. \x0a\x09Therefore we force #atEnd.\x22\x0a\x09\x0a\x09super visitBlockSequenceNode: aNode.\x0a\x09forceAtEnd := true",
  46549. referencedClasses: [],
  46550. messageSends: ["visitBlockSequenceNode:"]
  46551. }),
  46552. $globals.ASTInterpreter);
  46553. $core.addMethod(
  46554. $core.method({
  46555. selector: "visitDagNode:",
  46556. protocol: "visiting",
  46557. fn: function (aNode){
  46558. var self=this,$self=this;
  46559. return self;
  46560. },
  46561. args: ["aNode"],
  46562. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46563. referencedClasses: [],
  46564. messageSends: []
  46565. }),
  46566. $globals.ASTInterpreter);
  46567. $core.addMethod(
  46568. $core.method({
  46569. selector: "visitDynamicArrayNode:",
  46570. protocol: "visiting",
  46571. fn: function (aNode){
  46572. var self=this,$self=this;
  46573. var array;
  46574. return $core.withContext(function($ctx1) {
  46575. array=[];
  46576. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46577. return $core.withContext(function($ctx2) {
  46578. return $recv(array)._addFirst_($self._pop());
  46579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46580. }));
  46581. $self._push_(array);
  46582. return self;
  46583. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46584. },
  46585. args: ["aNode"],
  46586. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode dagChildren do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  46587. referencedClasses: [],
  46588. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46589. }),
  46590. $globals.ASTInterpreter);
  46591. $core.addMethod(
  46592. $core.method({
  46593. selector: "visitDynamicDictionaryNode:",
  46594. protocol: "visiting",
  46595. fn: function (aNode){
  46596. var self=this,$self=this;
  46597. var keyValueList;
  46598. return $core.withContext(function($ctx1) {
  46599. keyValueList=$recv($globals.OrderedCollection)._new();
  46600. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46601. return $core.withContext(function($ctx2) {
  46602. return $recv(keyValueList)._add_($self._pop());
  46603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46604. }));
  46605. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46606. return self;
  46607. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46608. },
  46609. args: ["aNode"],
  46610. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode dagChildren do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  46611. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46612. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46613. }),
  46614. $globals.ASTInterpreter);
  46615. $core.addMethod(
  46616. $core.method({
  46617. selector: "visitJSStatementNode:",
  46618. protocol: "visiting",
  46619. fn: function (aNode){
  46620. var self=this,$self=this;
  46621. return $core.withContext(function($ctx1) {
  46622. $self["@returned"]=true;
  46623. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46624. return self;
  46625. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46626. },
  46627. args: ["aNode"],
  46628. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46629. referencedClasses: [],
  46630. messageSends: ["returnValue:", "eval:", "source"]
  46631. }),
  46632. $globals.ASTInterpreter);
  46633. $core.addMethod(
  46634. $core.method({
  46635. selector: "visitReturnNode:",
  46636. protocol: "visiting",
  46637. fn: function (aNode){
  46638. var self=this,$self=this;
  46639. return $core.withContext(function($ctx1) {
  46640. $self["@returned"]=true;
  46641. $self._returnValue_($self._pop());
  46642. return self;
  46643. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46644. },
  46645. args: ["aNode"],
  46646. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46647. referencedClasses: [],
  46648. messageSends: ["returnValue:", "pop"]
  46649. }),
  46650. $globals.ASTInterpreter);
  46651. $core.addMethod(
  46652. $core.method({
  46653. selector: "visitSendNode:",
  46654. protocol: "visiting",
  46655. fn: function (aNode){
  46656. var self=this,$self=this;
  46657. var receiver,args,message,result;
  46658. return $core.withContext(function($ctx1) {
  46659. var $1;
  46660. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46661. return $core.withContext(function($ctx2) {
  46662. return $self._pop();
  46663. $ctx2.sendIdx["pop"]=1;
  46664. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46665. }));
  46666. receiver=$self._peek();
  46667. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46668. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46669. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46670. return $core.withContext(function($ctx2) {
  46671. return $recv($recv(aNode)._isLastChild())._not();
  46672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46673. }));
  46674. if(!$core.assert($1)){
  46675. $self._pop();
  46676. $self._push_(result);
  46677. }
  46678. return self;
  46679. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46680. },
  46681. args: ["aNode"],
  46682. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self peek.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifFalse: [ self pop; push: result ]",
  46683. referencedClasses: [],
  46684. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46685. }),
  46686. $globals.ASTInterpreter);
  46687. $core.addMethod(
  46688. $core.method({
  46689. selector: "visitValueNode:",
  46690. protocol: "visiting",
  46691. fn: function (aNode){
  46692. var self=this,$self=this;
  46693. return $core.withContext(function($ctx1) {
  46694. $self._push_($recv(aNode)._value());
  46695. return self;
  46696. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46697. },
  46698. args: ["aNode"],
  46699. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46700. referencedClasses: [],
  46701. messageSends: ["push:", "value"]
  46702. }),
  46703. $globals.ASTInterpreter);
  46704. $core.addMethod(
  46705. $core.method({
  46706. selector: "visitVariableNode:",
  46707. protocol: "visiting",
  46708. fn: function (aNode){
  46709. var self=this,$self=this;
  46710. return $core.withContext(function($ctx1) {
  46711. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46712. $2=$recv(aNode)._binding();
  46713. $ctx1.sendIdx["binding"]=1;
  46714. $1=$recv($2)._isUnknownVar();
  46715. if($core.assert($1)){
  46716. $5=$recv($globals.Platform)._globals();
  46717. $ctx1.sendIdx["globals"]=1;
  46718. $6=$recv(aNode)._value();
  46719. $ctx1.sendIdx["value"]=1;
  46720. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46721. return $core.withContext(function($ctx2) {
  46722. return $self._error_("Unknown variable");
  46723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46724. }));
  46725. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46726. $3=$self._push_($4);
  46727. $ctx1.sendIdx["push:"]=1;
  46728. return $3;
  46729. }
  46730. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46731. if($core.assert($8)){
  46732. $10=$self._context();
  46733. $ctx1.sendIdx["context"]=1;
  46734. $9=$recv($10)._receiver();
  46735. $11=$recv(aNode)._value();
  46736. $ctx1.sendIdx["value"]=2;
  46737. $7=$recv($9)._instVarAt_($11);
  46738. } else {
  46739. $12=$self._context();
  46740. $13=$recv(aNode)._value();
  46741. $ctx1.sendIdx["value"]=3;
  46742. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46743. return $core.withContext(function($ctx2) {
  46744. $15=$recv(aNode)._value();
  46745. $ctx2.sendIdx["value"]=4;
  46746. $14=$recv($15)._isCapitalized();
  46747. if($core.assert($14)){
  46748. $16=$recv($globals.Smalltalk)._globals();
  46749. $ctx2.sendIdx["globals"]=2;
  46750. $17=$recv(aNode)._value();
  46751. $ctx2.sendIdx["value"]=5;
  46752. return $recv($16)._at_ifAbsent_($17,(function(){
  46753. return $core.withContext(function($ctx3) {
  46754. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46755. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46756. }));
  46757. }
  46758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46759. }));
  46760. }
  46761. $self._push_($7);
  46762. return self;
  46763. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46764. },
  46765. args: ["aNode"],
  46766. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (Platform globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ Platform globals at: aNode value ] ] ] ])",
  46767. referencedClasses: ["Platform", "Smalltalk"],
  46768. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46769. }),
  46770. $globals.ASTInterpreter);
  46771. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46772. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46773. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46774. $globals.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node is answered by `#currentNode`";
  46775. $core.addMethod(
  46776. $core.method({
  46777. selector: "currentNode",
  46778. protocol: "accessing",
  46779. fn: function (){
  46780. var self=this,$self=this;
  46781. return $self["@currentNode"];
  46782. },
  46783. args: [],
  46784. source: "currentNode\x0a\x09^ currentNode",
  46785. referencedClasses: [],
  46786. messageSends: []
  46787. }),
  46788. $globals.ASTPCNodeVisitor);
  46789. $core.addMethod(
  46790. $core.method({
  46791. selector: "increaseTrackedIndex",
  46792. protocol: "accessing",
  46793. fn: function (){
  46794. var self=this,$self=this;
  46795. return $core.withContext(function($ctx1) {
  46796. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46797. return self;
  46798. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46799. },
  46800. args: [],
  46801. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46802. referencedClasses: [],
  46803. messageSends: ["+", "trackedIndex"]
  46804. }),
  46805. $globals.ASTPCNodeVisitor);
  46806. $core.addMethod(
  46807. $core.method({
  46808. selector: "index",
  46809. protocol: "accessing",
  46810. fn: function (){
  46811. var self=this,$self=this;
  46812. return $self["@index"];
  46813. },
  46814. args: [],
  46815. source: "index\x0a\x09^ index",
  46816. referencedClasses: [],
  46817. messageSends: []
  46818. }),
  46819. $globals.ASTPCNodeVisitor);
  46820. $core.addMethod(
  46821. $core.method({
  46822. selector: "index:",
  46823. protocol: "accessing",
  46824. fn: function (aNumber){
  46825. var self=this,$self=this;
  46826. $self["@index"]=aNumber;
  46827. return self;
  46828. },
  46829. args: ["aNumber"],
  46830. source: "index: aNumber\x0a\x09index := aNumber",
  46831. referencedClasses: [],
  46832. messageSends: []
  46833. }),
  46834. $globals.ASTPCNodeVisitor);
  46835. $core.addMethod(
  46836. $core.method({
  46837. selector: "selector",
  46838. protocol: "accessing",
  46839. fn: function (){
  46840. var self=this,$self=this;
  46841. return $self["@selector"];
  46842. },
  46843. args: [],
  46844. source: "selector\x0a\x09^ selector",
  46845. referencedClasses: [],
  46846. messageSends: []
  46847. }),
  46848. $globals.ASTPCNodeVisitor);
  46849. $core.addMethod(
  46850. $core.method({
  46851. selector: "selector:",
  46852. protocol: "accessing",
  46853. fn: function (aString){
  46854. var self=this,$self=this;
  46855. $self["@selector"]=aString;
  46856. return self;
  46857. },
  46858. args: ["aString"],
  46859. source: "selector: aString\x0a\x09selector := aString",
  46860. referencedClasses: [],
  46861. messageSends: []
  46862. }),
  46863. $globals.ASTPCNodeVisitor);
  46864. $core.addMethod(
  46865. $core.method({
  46866. selector: "trackedIndex",
  46867. protocol: "accessing",
  46868. fn: function (){
  46869. var self=this,$self=this;
  46870. return $core.withContext(function($ctx1) {
  46871. var $1,$receiver;
  46872. $1=$self["@trackedIndex"];
  46873. if(($receiver = $1) == null || $receiver.a$nil){
  46874. $self["@trackedIndex"]=(0);
  46875. return $self["@trackedIndex"];
  46876. } else {
  46877. return $1;
  46878. }
  46879. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46880. },
  46881. args: [],
  46882. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46883. referencedClasses: [],
  46884. messageSends: ["ifNil:"]
  46885. }),
  46886. $globals.ASTPCNodeVisitor);
  46887. $core.addMethod(
  46888. $core.method({
  46889. selector: "visitJSStatementNode:",
  46890. protocol: "visiting",
  46891. fn: function (aNode){
  46892. var self=this,$self=this;
  46893. $self["@currentNode"]=aNode;
  46894. return self;
  46895. },
  46896. args: ["aNode"],
  46897. source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode",
  46898. referencedClasses: [],
  46899. messageSends: []
  46900. }),
  46901. $globals.ASTPCNodeVisitor);
  46902. $core.addMethod(
  46903. $core.method({
  46904. selector: "visitSendNode:",
  46905. protocol: "visiting",
  46906. fn: function (aNode){
  46907. var self=this,$self=this;
  46908. return $core.withContext(function($ctx1) {
  46909. var $2,$1,$3;
  46910. (
  46911. $ctx1.supercall = true,
  46912. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  46913. $ctx1.supercall = false;
  46914. $2=$self._selector();
  46915. $ctx1.sendIdx["selector"]=1;
  46916. $1=$recv($2).__eq($recv(aNode)._selector());
  46917. $ctx1.sendIdx["="]=1;
  46918. if($core.assert($1)){
  46919. $3=$recv($self._trackedIndex()).__eq($self._index());
  46920. if($core.assert($3)){
  46921. $self["@currentNode"]=aNode;
  46922. $self["@currentNode"];
  46923. }
  46924. $self._increaseTrackedIndex();
  46925. }
  46926. return self;
  46927. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  46928. },
  46929. args: ["aNode"],
  46930. source: "visitSendNode: aNode\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self trackedIndex = self index ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseTrackedIndex ]",
  46931. referencedClasses: [],
  46932. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  46933. }),
  46934. $globals.ASTPCNodeVisitor);
  46935. $core.addMethod(
  46936. $core.method({
  46937. selector: "isLastChild",
  46938. protocol: "*Compiler-Interpreter",
  46939. fn: function (){
  46940. var self=this,$self=this;
  46941. return $core.withContext(function($ctx1) {
  46942. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  46943. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  46944. },
  46945. args: [],
  46946. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  46947. referencedClasses: [],
  46948. messageSends: ["=", "last", "dagChildren", "parent"]
  46949. }),
  46950. $globals.ASTNode);
  46951. $core.addMethod(
  46952. $core.method({
  46953. selector: "isSteppingNode",
  46954. protocol: "*Compiler-Interpreter",
  46955. fn: function (){
  46956. var self=this,$self=this;
  46957. return false;
  46958. },
  46959. args: [],
  46960. source: "isSteppingNode\x0a\x09^ false",
  46961. referencedClasses: [],
  46962. messageSends: []
  46963. }),
  46964. $globals.ASTNode);
  46965. $core.addMethod(
  46966. $core.method({
  46967. selector: "nextSiblingNode:",
  46968. protocol: "*Compiler-Interpreter",
  46969. fn: function (aNode){
  46970. var self=this,$self=this;
  46971. return $core.withContext(function($ctx1) {
  46972. var $1;
  46973. var $early={};
  46974. try {
  46975. $1=$self._dagChildren();
  46976. $ctx1.sendIdx["dagChildren"]=1;
  46977. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  46978. throw $early=[nil];
  46979. }));
  46980. }
  46981. catch(e) {if(e===$early)return e[0]; throw e}
  46982. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  46983. },
  46984. args: ["aNode"],
  46985. source: "nextSiblingNode: aNode\x0a\x09\x22Answer the next node after aNode or nil\x22\x0a\x09\x0a\x09^ self dagChildren \x0a\x09\x09at: (self dagChildren indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ nil ]",
  46986. referencedClasses: [],
  46987. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  46988. }),
  46989. $globals.ASTNode);
  46990. $core.addMethod(
  46991. $core.method({
  46992. selector: "isSteppingNode",
  46993. protocol: "*Compiler-Interpreter",
  46994. fn: function (){
  46995. var self=this,$self=this;
  46996. return true;
  46997. },
  46998. args: [],
  46999. source: "isSteppingNode\x0a\x09^ true",
  47000. referencedClasses: [],
  47001. messageSends: []
  47002. }),
  47003. $globals.AssignmentNode);
  47004. $core.addMethod(
  47005. $core.method({
  47006. selector: "isSteppingNode",
  47007. protocol: "*Compiler-Interpreter",
  47008. fn: function (){
  47009. var self=this,$self=this;
  47010. return true;
  47011. },
  47012. args: [],
  47013. source: "isSteppingNode\x0a\x09^ true",
  47014. referencedClasses: [],
  47015. messageSends: []
  47016. }),
  47017. $globals.BlockNode);
  47018. $core.addMethod(
  47019. $core.method({
  47020. selector: "nextSiblingNode:",
  47021. protocol: "*Compiler-Interpreter",
  47022. fn: function (aNode){
  47023. var self=this,$self=this;
  47024. return nil;
  47025. },
  47026. args: ["aNode"],
  47027. source: "nextSiblingNode: aNode\x0a\x09\x22Answer nil as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09\x22In fact, this should not have been called, ever. IMO. -- herby\x22\x0a\x09\x0a\x09^ nil",
  47028. referencedClasses: [],
  47029. messageSends: []
  47030. }),
  47031. $globals.BlockNode);
  47032. $core.addMethod(
  47033. $core.method({
  47034. selector: "isSteppingNode",
  47035. protocol: "*Compiler-Interpreter",
  47036. fn: function (){
  47037. var self=this,$self=this;
  47038. return true;
  47039. },
  47040. args: [],
  47041. source: "isSteppingNode\x0a\x09^ true",
  47042. referencedClasses: [],
  47043. messageSends: []
  47044. }),
  47045. $globals.DynamicArrayNode);
  47046. $core.addMethod(
  47047. $core.method({
  47048. selector: "isSteppingNode",
  47049. protocol: "*Compiler-Interpreter",
  47050. fn: function (){
  47051. var self=this,$self=this;
  47052. return true;
  47053. },
  47054. args: [],
  47055. source: "isSteppingNode\x0a\x09^ true",
  47056. referencedClasses: [],
  47057. messageSends: []
  47058. }),
  47059. $globals.DynamicDictionaryNode);
  47060. $core.addMethod(
  47061. $core.method({
  47062. selector: "isSteppingNode",
  47063. protocol: "*Compiler-Interpreter",
  47064. fn: function (){
  47065. var self=this,$self=this;
  47066. return true;
  47067. },
  47068. args: [],
  47069. source: "isSteppingNode\x0a\x09^ true",
  47070. referencedClasses: [],
  47071. messageSends: []
  47072. }),
  47073. $globals.JSStatementNode);
  47074. $core.addMethod(
  47075. $core.method({
  47076. selector: "isCascadeSendNode",
  47077. protocol: "*Compiler-Interpreter",
  47078. fn: function (){
  47079. var self=this,$self=this;
  47080. return $core.withContext(function($ctx1) {
  47081. return $recv($self._parent())._isCascadeNode();
  47082. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  47083. },
  47084. args: [],
  47085. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  47086. referencedClasses: [],
  47087. messageSends: ["isCascadeNode", "parent"]
  47088. }),
  47089. $globals.SendNode);
  47090. $core.addMethod(
  47091. $core.method({
  47092. selector: "isSteppingNode",
  47093. protocol: "*Compiler-Interpreter",
  47094. fn: function (){
  47095. var self=this,$self=this;
  47096. return true;
  47097. },
  47098. args: [],
  47099. source: "isSteppingNode\x0a\x09^ true",
  47100. referencedClasses: [],
  47101. messageSends: []
  47102. }),
  47103. $globals.SendNode);
  47104. });
  47105. define('amber/lang',[
  47106. './deploy',
  47107. './boot', // pre-fetch, dep of ./helpers
  47108. './helpers', // pre-fetch, dep of ./deploy
  47109. './parser',
  47110. // --- packages for the Amber reflection begin here ---
  47111. 'amber_core/Platform-ImportExport',
  47112. 'amber_core/Compiler-Core',
  47113. 'amber_core/Compiler-AST',
  47114. 'amber_core/Compiler-Semantic',
  47115. 'amber_core/Compiler-IR',
  47116. 'amber_core/Compiler-Inlining',
  47117. 'amber_core/Compiler-Interpreter'
  47118. // --- packages for the Amber reflection end here ---
  47119. ], function (amber) {
  47120. return amber;
  47121. });
  47122. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47123. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47124. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47125. $core.addPackage("Platform-DOM");
  47126. ($core.packageDescriptors||$core.packages)["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  47127. ($core.packageDescriptors||$core.packages)["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47128. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  47129. $core.addMethod(
  47130. $core.method({
  47131. selector: "isDomNode:",
  47132. protocol: "testing",
  47133. fn: function (anObject){
  47134. var self=this,$self=this;
  47135. return $core.withContext(function($ctx1) {
  47136. return anObject.nodeType > 0 &&
  47137. Object.prototype.toString.call(anObject) !== "[object Object]";
  47138. return self;
  47139. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  47140. },
  47141. args: ["anObject"],
  47142. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  47143. referencedClasses: [],
  47144. messageSends: []
  47145. }),
  47146. $globals.PlatformDom.a$cls);
  47147. $core.addMethod(
  47148. $core.method({
  47149. selector: "isFeasible",
  47150. protocol: "testing",
  47151. fn: function (){
  47152. var self=this,$self=this;
  47153. return $core.withContext(function($ctx1) {
  47154. if (typeof document === "undefined") return false;
  47155. try {
  47156. var d = document.createElement("div"),
  47157. f = document.createDocumentFragment(),
  47158. t = document.createTextNode("Hello, Amber!");
  47159. f.appendChild(t);
  47160. d.insertBefore(f, null);
  47161. return d.innerHTML === "Hello, Amber!";
  47162. } catch (e) {
  47163. return false;
  47164. };
  47165. return self;
  47166. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  47167. },
  47168. args: [],
  47169. source: "isFeasible\x0a<inlineJS: '\x0a if (typeof document === \x22undefined\x22) return false;\x0a try {\x0a var d = document.createElement(\x22div\x22),\x0a\x09 f = document.createDocumentFragment(),\x0a\x09 t = document.createTextNode(\x22Hello, Amber!\x22);\x0a\x09f.appendChild(t);\x0a\x09d.insertBefore(f, null);\x0a\x09return d.innerHTML === \x22Hello, Amber!\x22;\x0a } catch (e) {\x0a return false;\x0a }\x0a'>",
  47170. referencedClasses: [],
  47171. messageSends: []
  47172. }),
  47173. $globals.PlatformDom.a$cls);
  47174. $core.addMethod(
  47175. $core.method({
  47176. selector: "newCustomEvent:detail:",
  47177. protocol: "creation",
  47178. fn: function (aString,anObject){
  47179. var self=this,$self=this;
  47180. return $core.withContext(function($ctx1) {
  47181. return new CustomEvent(aString, {detail: anObject});
  47182. return self;
  47183. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  47184. },
  47185. args: ["aString", "anObject"],
  47186. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  47187. referencedClasses: [],
  47188. messageSends: []
  47189. }),
  47190. $globals.PlatformDom.a$cls);
  47191. $core.addMethod(
  47192. $core.method({
  47193. selector: "toArray:",
  47194. protocol: "converting",
  47195. fn: function (aDomList){
  47196. var self=this,$self=this;
  47197. return $core.withContext(function($ctx1) {
  47198. return Array.prototype.slice.call(aDomList);
  47199. return self;
  47200. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  47201. },
  47202. args: ["aDomList"],
  47203. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  47204. referencedClasses: [],
  47205. messageSends: []
  47206. }),
  47207. $globals.PlatformDom.a$cls);
  47208. $core.addMethod(
  47209. $core.method({
  47210. selector: "asDomNode",
  47211. protocol: "*Platform-DOM",
  47212. fn: function (){
  47213. var self=this,$self=this;
  47214. return $core.withContext(function($ctx1) {
  47215. return $recv(document)._createTextNode_($self._asString());
  47216. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  47217. },
  47218. args: [],
  47219. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  47220. referencedClasses: [],
  47221. messageSends: ["createTextNode:", "asString"]
  47222. }),
  47223. $globals.CharacterArray);
  47224. $core.addMethod(
  47225. $core.method({
  47226. selector: "asDomNode",
  47227. protocol: "*Platform-DOM",
  47228. fn: function (){
  47229. var self=this,$self=this;
  47230. var fragment;
  47231. return $core.withContext(function($ctx1) {
  47232. fragment=$recv(document)._createDocumentFragment();
  47233. $self._do_((function(each){
  47234. return $core.withContext(function($ctx2) {
  47235. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  47236. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47237. }));
  47238. return fragment;
  47239. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  47240. },
  47241. args: [],
  47242. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  47243. referencedClasses: [],
  47244. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  47245. }),
  47246. $globals.Collection);
  47247. $core.addMethod(
  47248. $core.method({
  47249. selector: "asDomNode",
  47250. protocol: "*Platform-DOM",
  47251. fn: function (){
  47252. var self=this,$self=this;
  47253. return $core.withContext(function($ctx1) {
  47254. var $1,$2;
  47255. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  47256. if($core.assert($1)){
  47257. return $self["@jsObject"];
  47258. } else {
  47259. $2=(
  47260. $ctx1.supercall = true,
  47261. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  47262. $ctx1.supercall = false;
  47263. return $2;
  47264. }
  47265. return self;
  47266. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  47267. },
  47268. args: [],
  47269. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  47270. referencedClasses: ["PlatformDom"],
  47271. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  47272. }),
  47273. $globals.JSObjectProxy);
  47274. $core.addMethod(
  47275. $core.method({
  47276. selector: "htmlTextContent",
  47277. protocol: "*Platform-DOM",
  47278. fn: function (){
  47279. var self=this,$self=this;
  47280. return $core.withContext(function($ctx1) {
  47281. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  47282. return self;
  47283. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  47284. },
  47285. args: [],
  47286. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  47287. referencedClasses: [],
  47288. messageSends: []
  47289. }),
  47290. $globals.String);
  47291. });
  47292. define('amber_core/SUnit',["amber/boot", "amber_core/Kernel-Classes", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47293. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47294. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47295. $core.addPackage("SUnit");
  47296. ($core.packageDescriptors||$core.packages)["SUnit"].innerEval = function (expr) { return eval(expr); };
  47297. ($core.packageDescriptors||$core.packages)["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47298. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  47299. $globals.ResultAnnouncement.comment="I get signaled when a `TestCase` has been run.\x0a\x0aMy instances hold the result (instance of `TestResult`) of the test run.";
  47300. $core.addMethod(
  47301. $core.method({
  47302. selector: "result",
  47303. protocol: "accessing",
  47304. fn: function (){
  47305. var self=this,$self=this;
  47306. return $self["@result"];
  47307. },
  47308. args: [],
  47309. source: "result\x0a\x09^ result",
  47310. referencedClasses: [],
  47311. messageSends: []
  47312. }),
  47313. $globals.ResultAnnouncement);
  47314. $core.addMethod(
  47315. $core.method({
  47316. selector: "result:",
  47317. protocol: "accessing",
  47318. fn: function (aTestResult){
  47319. var self=this,$self=this;
  47320. $self["@result"]=aTestResult;
  47321. return self;
  47322. },
  47323. args: ["aTestResult"],
  47324. source: "result: aTestResult\x0a\x09result := aTestResult",
  47325. referencedClasses: [],
  47326. messageSends: []
  47327. }),
  47328. $globals.ResultAnnouncement);
  47329. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47330. $globals.TestCase.comment="I am an implementation of the command pattern to run a test.\x0a\x0a## API\x0a\x0aMy instances are created with the class method `#selector:`,\x0apassing the symbol that names the method to be executed when the test case runs.\x0a\x0aWhen you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.\x0aAs that method develops and more `#test...` methods are added, you will find yourself refactoring temps\x0ainto instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.\x0aAs required, override `#tearDown` to nil references, release objects and deallocate.";
  47331. $core.addMethod(
  47332. $core.method({
  47333. selector: "assert:",
  47334. protocol: "testing",
  47335. fn: function (aBoolean){
  47336. var self=this,$self=this;
  47337. return $core.withContext(function($ctx1) {
  47338. $self._assert_description_(aBoolean,"Assertion failed");
  47339. return self;
  47340. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47341. },
  47342. args: ["aBoolean"],
  47343. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47344. referencedClasses: [],
  47345. messageSends: ["assert:description:"]
  47346. }),
  47347. $globals.TestCase);
  47348. $core.addMethod(
  47349. $core.method({
  47350. selector: "assert:description:",
  47351. protocol: "testing",
  47352. fn: function (aBoolean,aString){
  47353. var self=this,$self=this;
  47354. return $core.withContext(function($ctx1) {
  47355. if(!$core.assert(aBoolean)){
  47356. $self._signalFailure_(aString);
  47357. }
  47358. return self;
  47359. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47360. },
  47361. args: ["aBoolean", "aString"],
  47362. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47363. referencedClasses: [],
  47364. messageSends: ["ifFalse:", "signalFailure:"]
  47365. }),
  47366. $globals.TestCase);
  47367. $core.addMethod(
  47368. $core.method({
  47369. selector: "assert:equals:",
  47370. protocol: "testing",
  47371. fn: function (actual,expected){
  47372. var self=this,$self=this;
  47373. return $core.withContext(function($ctx1) {
  47374. var $1,$5,$4,$3,$2;
  47375. $1=$recv(actual).__eq(expected);
  47376. $5=$recv(expected)._printString();
  47377. $ctx1.sendIdx["printString"]=1;
  47378. $4="Expected: ".__comma($5);
  47379. $3=$recv($4).__comma(" but was: ");
  47380. $ctx1.sendIdx[","]=2;
  47381. $2=$recv($3).__comma($recv(actual)._printString());
  47382. $ctx1.sendIdx[","]=1;
  47383. return $self._assert_description_($1,$2);
  47384. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47385. },
  47386. args: ["actual", "expected"],
  47387. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47388. referencedClasses: [],
  47389. messageSends: ["assert:description:", "=", ",", "printString"]
  47390. }),
  47391. $globals.TestCase);
  47392. $core.addMethod(
  47393. $core.method({
  47394. selector: "async:",
  47395. protocol: "async",
  47396. fn: function (aBlock){
  47397. var self=this,$self=this;
  47398. var c;
  47399. return $core.withContext(function($ctx1) {
  47400. var $1;
  47401. $self._errorIfNotAsync_("#async");
  47402. c=$self["@context"];
  47403. return (function(){
  47404. return $core.withContext(function($ctx2) {
  47405. $1=$self._isAsync();
  47406. if($core.assert($1)){
  47407. return $recv(c)._execute_(aBlock);
  47408. }
  47409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47410. });
  47411. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47412. },
  47413. args: ["aBlock"],
  47414. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47415. referencedClasses: [],
  47416. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47417. }),
  47418. $globals.TestCase);
  47419. $core.addMethod(
  47420. $core.method({
  47421. selector: "context:",
  47422. protocol: "accessing",
  47423. fn: function (aRunningTestContext){
  47424. var self=this,$self=this;
  47425. $self["@context"]=aRunningTestContext;
  47426. return self;
  47427. },
  47428. args: ["aRunningTestContext"],
  47429. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47430. referencedClasses: [],
  47431. messageSends: []
  47432. }),
  47433. $globals.TestCase);
  47434. $core.addMethod(
  47435. $core.method({
  47436. selector: "deny:",
  47437. protocol: "testing",
  47438. fn: function (aBoolean){
  47439. var self=this,$self=this;
  47440. return $core.withContext(function($ctx1) {
  47441. $self._assert_($recv(aBoolean)._not());
  47442. return self;
  47443. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47444. },
  47445. args: ["aBoolean"],
  47446. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47447. referencedClasses: [],
  47448. messageSends: ["assert:", "not"]
  47449. }),
  47450. $globals.TestCase);
  47451. $core.addMethod(
  47452. $core.method({
  47453. selector: "errorIfNotAsync:",
  47454. protocol: "error handling",
  47455. fn: function (aString){
  47456. var self=this,$self=this;
  47457. return $core.withContext(function($ctx1) {
  47458. var $1;
  47459. $1=$self._isAsync();
  47460. if(!$core.assert($1)){
  47461. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47462. }
  47463. return self;
  47464. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47465. },
  47466. args: ["aString"],
  47467. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47468. referencedClasses: [],
  47469. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47470. }),
  47471. $globals.TestCase);
  47472. $core.addMethod(
  47473. $core.method({
  47474. selector: "finished",
  47475. protocol: "async",
  47476. fn: function (){
  47477. var self=this,$self=this;
  47478. return $core.withContext(function($ctx1) {
  47479. $self._errorIfNotAsync_("#finished");
  47480. $self["@asyncTimeout"]=nil;
  47481. return self;
  47482. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47483. },
  47484. args: [],
  47485. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47486. referencedClasses: [],
  47487. messageSends: ["errorIfNotAsync:"]
  47488. }),
  47489. $globals.TestCase);
  47490. $core.addMethod(
  47491. $core.method({
  47492. selector: "isAsync",
  47493. protocol: "testing",
  47494. fn: function (){
  47495. var self=this,$self=this;
  47496. return $core.withContext(function($ctx1) {
  47497. return $recv($self["@asyncTimeout"])._notNil();
  47498. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47499. },
  47500. args: [],
  47501. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47502. referencedClasses: [],
  47503. messageSends: ["notNil"]
  47504. }),
  47505. $globals.TestCase);
  47506. $core.addMethod(
  47507. $core.method({
  47508. selector: "performTest",
  47509. protocol: "running",
  47510. fn: function (){
  47511. var self=this,$self=this;
  47512. return $core.withContext(function($ctx1) {
  47513. $self["@asyncTimeout"]=nil;
  47514. $self._perform_($self._selector());
  47515. return self;
  47516. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47517. },
  47518. args: [],
  47519. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47520. referencedClasses: [],
  47521. messageSends: ["perform:", "selector"]
  47522. }),
  47523. $globals.TestCase);
  47524. $core.addMethod(
  47525. $core.method({
  47526. selector: "runCase",
  47527. protocol: "running",
  47528. fn: function (){
  47529. var self=this,$self=this;
  47530. return $core.withContext(function($ctx1) {
  47531. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47532. return self;
  47533. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47534. },
  47535. args: [],
  47536. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47537. referencedClasses: ["TestContext"],
  47538. messageSends: ["start", "testCase:"]
  47539. }),
  47540. $globals.TestCase);
  47541. $core.addMethod(
  47542. $core.method({
  47543. selector: "selector",
  47544. protocol: "accessing",
  47545. fn: function (){
  47546. var self=this,$self=this;
  47547. return $self["@testSelector"];
  47548. },
  47549. args: [],
  47550. source: "selector\x0a\x09^ testSelector",
  47551. referencedClasses: [],
  47552. messageSends: []
  47553. }),
  47554. $globals.TestCase);
  47555. $core.addMethod(
  47556. $core.method({
  47557. selector: "setTestSelector:",
  47558. protocol: "accessing",
  47559. fn: function (aSelector){
  47560. var self=this,$self=this;
  47561. $self["@testSelector"]=aSelector;
  47562. return self;
  47563. },
  47564. args: ["aSelector"],
  47565. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47566. referencedClasses: [],
  47567. messageSends: []
  47568. }),
  47569. $globals.TestCase);
  47570. $core.addMethod(
  47571. $core.method({
  47572. selector: "setUp",
  47573. protocol: "running",
  47574. fn: function (){
  47575. var self=this,$self=this;
  47576. return self;
  47577. },
  47578. args: [],
  47579. source: "setUp",
  47580. referencedClasses: [],
  47581. messageSends: []
  47582. }),
  47583. $globals.TestCase);
  47584. $core.addMethod(
  47585. $core.method({
  47586. selector: "should:",
  47587. protocol: "testing",
  47588. fn: function (aBlock){
  47589. var self=this,$self=this;
  47590. return $core.withContext(function($ctx1) {
  47591. $self._assert_($recv(aBlock)._value());
  47592. return self;
  47593. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47594. },
  47595. args: ["aBlock"],
  47596. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47597. referencedClasses: [],
  47598. messageSends: ["assert:", "value"]
  47599. }),
  47600. $globals.TestCase);
  47601. $core.addMethod(
  47602. $core.method({
  47603. selector: "should:raise:",
  47604. protocol: "testing",
  47605. fn: function (aBlock,anExceptionClass){
  47606. var self=this,$self=this;
  47607. return $core.withContext(function($ctx1) {
  47608. $self._assert_($recv((function(){
  47609. return $core.withContext(function($ctx2) {
  47610. $recv(aBlock)._value();
  47611. return false;
  47612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47613. }))._on_do_(anExceptionClass,(function(ex){
  47614. return true;
  47615. })));
  47616. return self;
  47617. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47618. },
  47619. args: ["aBlock", "anExceptionClass"],
  47620. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47621. referencedClasses: [],
  47622. messageSends: ["assert:", "on:do:", "value"]
  47623. }),
  47624. $globals.TestCase);
  47625. $core.addMethod(
  47626. $core.method({
  47627. selector: "shouldnt:raise:",
  47628. protocol: "testing",
  47629. fn: function (aBlock,anExceptionClass){
  47630. var self=this,$self=this;
  47631. return $core.withContext(function($ctx1) {
  47632. $self._assert_($recv((function(){
  47633. return $core.withContext(function($ctx2) {
  47634. $recv(aBlock)._value();
  47635. return true;
  47636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47637. }))._on_do_(anExceptionClass,(function(ex){
  47638. return false;
  47639. })));
  47640. return self;
  47641. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47642. },
  47643. args: ["aBlock", "anExceptionClass"],
  47644. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47645. referencedClasses: [],
  47646. messageSends: ["assert:", "on:do:", "value"]
  47647. }),
  47648. $globals.TestCase);
  47649. $core.addMethod(
  47650. $core.method({
  47651. selector: "signalFailure:",
  47652. protocol: "private",
  47653. fn: function (aString){
  47654. var self=this,$self=this;
  47655. return $core.withContext(function($ctx1) {
  47656. var $1;
  47657. $1=$recv($globals.TestFailure)._new();
  47658. $recv($1)._messageText_(aString);
  47659. $recv($1)._signal();
  47660. return self;
  47661. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47662. },
  47663. args: ["aString"],
  47664. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47665. referencedClasses: ["TestFailure"],
  47666. messageSends: ["messageText:", "new", "signal"]
  47667. }),
  47668. $globals.TestCase);
  47669. $core.addMethod(
  47670. $core.method({
  47671. selector: "tearDown",
  47672. protocol: "running",
  47673. fn: function (){
  47674. var self=this,$self=this;
  47675. return self;
  47676. },
  47677. args: [],
  47678. source: "tearDown",
  47679. referencedClasses: [],
  47680. messageSends: []
  47681. }),
  47682. $globals.TestCase);
  47683. $core.addMethod(
  47684. $core.method({
  47685. selector: "timeout:",
  47686. protocol: "async",
  47687. fn: function (aNumber){
  47688. var self=this,$self=this;
  47689. return $core.withContext(function($ctx1) {
  47690. var $1,$receiver;
  47691. $1=$self["@asyncTimeout"];
  47692. if(($receiver = $1) == null || $receiver.a$nil){
  47693. $1;
  47694. } else {
  47695. $recv($self["@asyncTimeout"])._clearTimeout();
  47696. }
  47697. $self["@asyncTimeout"]=(0);
  47698. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47699. return $core.withContext(function($ctx2) {
  47700. return $self._assert_description_(false,"SUnit grace time exhausted");
  47701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47702. })))._valueWithTimeout_(aNumber);
  47703. return self;
  47704. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47705. },
  47706. args: ["aNumber"],
  47707. source: "timeout: aNumber\x0a\x09\x22Set a grace time timeout in milliseconds to run the test asynchronously\x22\x0a\x09\x0a\x09asyncTimeout ifNotNil: [ asyncTimeout clearTimeout ].\x0a\x09\x0a\x09\x22to allow #async: message send without throwing an error\x22\x0a\x09asyncTimeout := 0.\x0a\x09\x0a\x09asyncTimeout := (self async: [\x0a\x09\x09self assert: false description: 'SUnit grace time exhausted' ])\x0a\x09\x09\x09valueWithTimeout: aNumber",
  47708. referencedClasses: [],
  47709. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47710. }),
  47711. $globals.TestCase);
  47712. $core.addMethod(
  47713. $core.method({
  47714. selector: "allTestSelectors",
  47715. protocol: "accessing",
  47716. fn: function (){
  47717. var self=this,$self=this;
  47718. var selectors;
  47719. return $core.withContext(function($ctx1) {
  47720. var $1;
  47721. selectors=$self._testSelectors();
  47722. $1=$self._shouldInheritSelectors();
  47723. if($core.assert($1)){
  47724. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47725. }
  47726. return selectors;
  47727. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47728. },
  47729. args: [],
  47730. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47731. referencedClasses: [],
  47732. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47733. }),
  47734. $globals.TestCase.a$cls);
  47735. $core.addMethod(
  47736. $core.method({
  47737. selector: "buildSuite",
  47738. protocol: "accessing",
  47739. fn: function (){
  47740. var self=this,$self=this;
  47741. return $core.withContext(function($ctx1) {
  47742. return $recv($self._allTestSelectors())._collect_((function(each){
  47743. return $core.withContext(function($ctx2) {
  47744. return $self._selector_(each);
  47745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47746. }));
  47747. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47748. },
  47749. args: [],
  47750. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47751. referencedClasses: [],
  47752. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47753. }),
  47754. $globals.TestCase.a$cls);
  47755. $core.addMethod(
  47756. $core.method({
  47757. selector: "classTag",
  47758. protocol: "accessing",
  47759. fn: function (){
  47760. var self=this,$self=this;
  47761. return "test";
  47762. },
  47763. args: [],
  47764. 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^ 'test'",
  47765. referencedClasses: [],
  47766. messageSends: []
  47767. }),
  47768. $globals.TestCase.a$cls);
  47769. $core.addMethod(
  47770. $core.method({
  47771. selector: "isAbstract",
  47772. protocol: "testing",
  47773. fn: function (){
  47774. var self=this,$self=this;
  47775. return $core.withContext(function($ctx1) {
  47776. return $recv($self._name()).__eq("TestCase");
  47777. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47778. },
  47779. args: [],
  47780. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47781. referencedClasses: [],
  47782. messageSends: ["=", "name"]
  47783. }),
  47784. $globals.TestCase.a$cls);
  47785. $core.addMethod(
  47786. $core.method({
  47787. selector: "isTestClass",
  47788. protocol: "testing",
  47789. fn: function (){
  47790. var self=this,$self=this;
  47791. return $core.withContext(function($ctx1) {
  47792. return $recv($self._isAbstract())._not();
  47793. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47794. },
  47795. args: [],
  47796. source: "isTestClass\x0a\x09^ self isAbstract not",
  47797. referencedClasses: [],
  47798. messageSends: ["not", "isAbstract"]
  47799. }),
  47800. $globals.TestCase.a$cls);
  47801. $core.addMethod(
  47802. $core.method({
  47803. selector: "lookupHierarchyRoot",
  47804. protocol: "accessing",
  47805. fn: function (){
  47806. var self=this,$self=this;
  47807. return $globals.TestCase;
  47808. },
  47809. args: [],
  47810. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47811. referencedClasses: ["TestCase"],
  47812. messageSends: []
  47813. }),
  47814. $globals.TestCase.a$cls);
  47815. $core.addMethod(
  47816. $core.method({
  47817. selector: "selector:",
  47818. protocol: "accessing",
  47819. fn: function (aSelector){
  47820. var self=this,$self=this;
  47821. return $core.withContext(function($ctx1) {
  47822. var $1;
  47823. $1=$self._new();
  47824. $recv($1)._setTestSelector_(aSelector);
  47825. return $recv($1)._yourself();
  47826. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47827. },
  47828. args: ["aSelector"],
  47829. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47830. referencedClasses: [],
  47831. messageSends: ["setTestSelector:", "new", "yourself"]
  47832. }),
  47833. $globals.TestCase.a$cls);
  47834. $core.addMethod(
  47835. $core.method({
  47836. selector: "shouldInheritSelectors",
  47837. protocol: "testing",
  47838. fn: function (){
  47839. var self=this,$self=this;
  47840. return $core.withContext(function($ctx1) {
  47841. return $self.__tild_eq($self._lookupHierarchyRoot());
  47842. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47843. },
  47844. args: [],
  47845. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47846. referencedClasses: [],
  47847. messageSends: ["~=", "lookupHierarchyRoot"]
  47848. }),
  47849. $globals.TestCase.a$cls);
  47850. $core.addMethod(
  47851. $core.method({
  47852. selector: "testSelectors",
  47853. protocol: "accessing",
  47854. fn: function (){
  47855. var self=this,$self=this;
  47856. return $core.withContext(function($ctx1) {
  47857. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47858. return $core.withContext(function($ctx2) {
  47859. return $recv(each)._match_("^test");
  47860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47861. }));
  47862. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47863. },
  47864. args: [],
  47865. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47866. referencedClasses: [],
  47867. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47868. }),
  47869. $globals.TestCase.a$cls);
  47870. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47871. $globals.TestContext.comment="I govern running a particular test case.\x0a\x0aMy main added value is `#execute:` method which runs a block as a part of test case (restores context, nilling it afterwards, cleaning/calling `#tearDown` as appropriate for sync/async scenario).";
  47872. $core.addMethod(
  47873. $core.method({
  47874. selector: "execute:",
  47875. protocol: "running",
  47876. fn: function (aBlock){
  47877. var self=this,$self=this;
  47878. var failed;
  47879. return $core.withContext(function($ctx1) {
  47880. var $1,$2;
  47881. $recv($self["@testCase"])._context_(self);
  47882. $ctx1.sendIdx["context:"]=1;
  47883. $recv((function(){
  47884. return $core.withContext(function($ctx2) {
  47885. failed=true;
  47886. $recv(aBlock)._value();
  47887. failed=false;
  47888. return failed;
  47889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47890. }))._ensure_((function(){
  47891. return $core.withContext(function($ctx2) {
  47892. $recv($self["@testCase"])._context_(nil);
  47893. $1=$recv(failed)._and_((function(){
  47894. return $core.withContext(function($ctx3) {
  47895. return $recv($self["@testCase"])._isAsync();
  47896. $ctx3.sendIdx["isAsync"]=1;
  47897. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47898. }));
  47899. if($core.assert($1)){
  47900. $recv($self["@testCase"])._finished();
  47901. }
  47902. $2=$recv($self["@testCase"])._isAsync();
  47903. if(!$core.assert($2)){
  47904. return $recv($self["@testCase"])._tearDown();
  47905. }
  47906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47907. }));
  47908. return self;
  47909. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  47910. },
  47911. args: ["aBlock"],
  47912. source: "execute: aBlock\x0a\x09| failed |\x0a\x09\x0a\x09testCase context: self.\x0a\x09[\x0a\x09\x09failed := true.\x0a\x09\x09aBlock value.\x0a\x09\x09failed := false\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase context: nil.\x0a\x09\x09\x09\x0a\x09\x09\x09(failed and: [ testCase isAsync ]) ifTrue: [\x0a\x09\x09\x09\x09testCase finished ].\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09testCase tearDown ] ]",
  47913. referencedClasses: [],
  47914. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  47915. }),
  47916. $globals.TestContext);
  47917. $core.addMethod(
  47918. $core.method({
  47919. selector: "start",
  47920. protocol: "running",
  47921. fn: function (){
  47922. var self=this,$self=this;
  47923. return $core.withContext(function($ctx1) {
  47924. $self._execute_((function(){
  47925. return $core.withContext(function($ctx2) {
  47926. $recv($self["@testCase"])._setUp();
  47927. return $recv($self["@testCase"])._performTest();
  47928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47929. }));
  47930. return self;
  47931. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  47932. },
  47933. args: [],
  47934. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  47935. referencedClasses: [],
  47936. messageSends: ["execute:", "setUp", "performTest"]
  47937. }),
  47938. $globals.TestContext);
  47939. $core.addMethod(
  47940. $core.method({
  47941. selector: "testCase:",
  47942. protocol: "accessing",
  47943. fn: function (aTestCase){
  47944. var self=this,$self=this;
  47945. $self["@testCase"]=aTestCase;
  47946. return self;
  47947. },
  47948. args: ["aTestCase"],
  47949. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  47950. referencedClasses: [],
  47951. messageSends: []
  47952. }),
  47953. $globals.TestContext);
  47954. $core.addMethod(
  47955. $core.method({
  47956. selector: "testCase:",
  47957. protocol: "instance creation",
  47958. fn: function (aTestCase){
  47959. var self=this,$self=this;
  47960. return $core.withContext(function($ctx1) {
  47961. var $1;
  47962. $1=$self._new();
  47963. $recv($1)._testCase_(aTestCase);
  47964. return $recv($1)._yourself();
  47965. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  47966. },
  47967. args: ["aTestCase"],
  47968. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  47969. referencedClasses: [],
  47970. messageSends: ["testCase:", "new", "yourself"]
  47971. }),
  47972. $globals.TestContext.a$cls);
  47973. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  47974. $globals.ReportingTestContext.comment="I add `TestResult` reporting to `TestContext`.\x0a\x0aErrors are caught and save into a `TestResult`,\x0aWhen test case is finished (which can be later for async tests), a callback block is executed; this is used by a `TestSuiteRunner`.";
  47975. $core.addMethod(
  47976. $core.method({
  47977. selector: "execute:",
  47978. protocol: "running",
  47979. fn: function (aBlock){
  47980. var self=this,$self=this;
  47981. return $core.withContext(function($ctx1) {
  47982. var $1;
  47983. $recv((function(){
  47984. return $core.withContext(function($ctx2) {
  47985. return $self._withErrorReporting_((function(){
  47986. return $core.withContext(function($ctx3) {
  47987. return (
  47988. $ctx3.supercall = true,
  47989. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  47990. $ctx3.supercall = false;
  47991. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47992. }));
  47993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47994. }))._ensure_((function(){
  47995. return $core.withContext(function($ctx2) {
  47996. $1=$recv($self["@testCase"])._isAsync();
  47997. if(!$core.assert($1)){
  47998. $recv($self["@result"])._increaseRuns();
  47999. return $recv($self["@finished"])._value();
  48000. }
  48001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48002. }));
  48003. return self;
  48004. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48005. },
  48006. args: ["aBlock"],
  48007. source: "execute: aBlock\x0a\x09[\x0a\x09\x09self withErrorReporting: [ super execute: aBlock ]\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09result increaseRuns. finished value ] ]",
  48008. referencedClasses: [],
  48009. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  48010. }),
  48011. $globals.ReportingTestContext);
  48012. $core.addMethod(
  48013. $core.method({
  48014. selector: "finished:",
  48015. protocol: "accessing",
  48016. fn: function (aBlock){
  48017. var self=this,$self=this;
  48018. $self["@finished"]=aBlock;
  48019. return self;
  48020. },
  48021. args: ["aBlock"],
  48022. source: "finished: aBlock\x0a\x09finished := aBlock",
  48023. referencedClasses: [],
  48024. messageSends: []
  48025. }),
  48026. $globals.ReportingTestContext);
  48027. $core.addMethod(
  48028. $core.method({
  48029. selector: "result:",
  48030. protocol: "accessing",
  48031. fn: function (aTestResult){
  48032. var self=this,$self=this;
  48033. $self["@result"]=aTestResult;
  48034. return self;
  48035. },
  48036. args: ["aTestResult"],
  48037. source: "result: aTestResult\x0a\x09result := aTestResult",
  48038. referencedClasses: [],
  48039. messageSends: []
  48040. }),
  48041. $globals.ReportingTestContext);
  48042. $core.addMethod(
  48043. $core.method({
  48044. selector: "withErrorReporting:",
  48045. protocol: "private",
  48046. fn: function (aBlock){
  48047. var self=this,$self=this;
  48048. return $core.withContext(function($ctx1) {
  48049. $recv((function(){
  48050. return $core.withContext(function($ctx2) {
  48051. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  48052. return $core.withContext(function($ctx3) {
  48053. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  48054. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  48055. }));
  48056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48057. }))._on_do_($globals.Error,(function(ex){
  48058. return $core.withContext(function($ctx2) {
  48059. return $recv($self["@result"])._addError_($self["@testCase"]);
  48060. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  48061. }));
  48062. $ctx1.sendIdx["on:do:"]=1;
  48063. return self;
  48064. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48065. },
  48066. args: ["aBlock"],
  48067. source: "withErrorReporting: aBlock\x0a\x09[ aBlock\x0a\x09\x09on: TestFailure\x0a\x09\x09do: [ :ex | result addFailure: testCase ]\x0a\x09]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | result addError: testCase ]",
  48068. referencedClasses: ["TestFailure", "Error"],
  48069. messageSends: ["on:do:", "addFailure:", "addError:"]
  48070. }),
  48071. $globals.ReportingTestContext);
  48072. $core.addMethod(
  48073. $core.method({
  48074. selector: "testCase:result:finished:",
  48075. protocol: "instance creation",
  48076. fn: function (aTestCase,aTestResult,aBlock){
  48077. var self=this,$self=this;
  48078. return $core.withContext(function($ctx1) {
  48079. var $1;
  48080. $1=(
  48081. $ctx1.supercall = true,
  48082. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  48083. $ctx1.supercall = false;
  48084. $recv($1)._result_(aTestResult);
  48085. $recv($1)._finished_(aBlock);
  48086. return $recv($1)._yourself();
  48087. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  48088. },
  48089. args: ["aTestCase", "aTestResult", "aBlock"],
  48090. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  48091. referencedClasses: [],
  48092. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  48093. }),
  48094. $globals.ReportingTestContext.a$cls);
  48095. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  48096. $globals.TestFailure.comment="I am raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.\x0a\x0aThe test framework distinguishes between failures and errors.\x0aA failure is an event whose possibiity is explicitly anticipated and checked for in an assertion,\x0awhereas an error is an unanticipated problem like a division by 0 or an index out of bounds.";
  48097. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  48098. $globals.TestResult.comment="I implement the collecting parameter pattern for running a bunch of tests.\x0a\x0aMy instances hold tests that have run, sorted into the result categories of passed, failures and errors.\x0a\x0a`TestResult` is an interesting object to subclass or substitute. `#runCase:` is the external protocol you need to reproduce";
  48099. $core.addMethod(
  48100. $core.method({
  48101. selector: "addError:",
  48102. protocol: "accessing",
  48103. fn: function (anError){
  48104. var self=this,$self=this;
  48105. return $core.withContext(function($ctx1) {
  48106. $recv($self._errors())._add_(anError);
  48107. return self;
  48108. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  48109. },
  48110. args: ["anError"],
  48111. source: "addError: anError\x0a\x09self errors add: anError",
  48112. referencedClasses: [],
  48113. messageSends: ["add:", "errors"]
  48114. }),
  48115. $globals.TestResult);
  48116. $core.addMethod(
  48117. $core.method({
  48118. selector: "addFailure:",
  48119. protocol: "accessing",
  48120. fn: function (aFailure){
  48121. var self=this,$self=this;
  48122. return $core.withContext(function($ctx1) {
  48123. $recv($self._failures())._add_(aFailure);
  48124. return self;
  48125. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  48126. },
  48127. args: ["aFailure"],
  48128. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  48129. referencedClasses: [],
  48130. messageSends: ["add:", "failures"]
  48131. }),
  48132. $globals.TestResult);
  48133. $core.addMethod(
  48134. $core.method({
  48135. selector: "errors",
  48136. protocol: "accessing",
  48137. fn: function (){
  48138. var self=this,$self=this;
  48139. return $self["@errors"];
  48140. },
  48141. args: [],
  48142. source: "errors\x0a\x09^ errors",
  48143. referencedClasses: [],
  48144. messageSends: []
  48145. }),
  48146. $globals.TestResult);
  48147. $core.addMethod(
  48148. $core.method({
  48149. selector: "failures",
  48150. protocol: "accessing",
  48151. fn: function (){
  48152. var self=this,$self=this;
  48153. return $self["@failures"];
  48154. },
  48155. args: [],
  48156. source: "failures\x0a\x09^ failures",
  48157. referencedClasses: [],
  48158. messageSends: []
  48159. }),
  48160. $globals.TestResult);
  48161. $core.addMethod(
  48162. $core.method({
  48163. selector: "increaseRuns",
  48164. protocol: "accessing",
  48165. fn: function (){
  48166. var self=this,$self=this;
  48167. return $core.withContext(function($ctx1) {
  48168. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  48169. return self;
  48170. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  48171. },
  48172. args: [],
  48173. source: "increaseRuns\x0a\x09runs := runs + 1",
  48174. referencedClasses: [],
  48175. messageSends: ["+"]
  48176. }),
  48177. $globals.TestResult);
  48178. $core.addMethod(
  48179. $core.method({
  48180. selector: "initialize",
  48181. protocol: "initialization",
  48182. fn: function (){
  48183. var self=this,$self=this;
  48184. return $core.withContext(function($ctx1) {
  48185. (
  48186. $ctx1.supercall = true,
  48187. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48188. $ctx1.supercall = false;
  48189. $self["@timestamp"]=$recv($globals.Date)._now();
  48190. $self["@runs"]=(0);
  48191. $self["@errors"]=$recv($globals.Array)._new();
  48192. $ctx1.sendIdx["new"]=1;
  48193. $self["@failures"]=$recv($globals.Array)._new();
  48194. $self["@total"]=(0);
  48195. return self;
  48196. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  48197. },
  48198. args: [],
  48199. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  48200. referencedClasses: ["Date", "Array"],
  48201. messageSends: ["initialize", "now", "new"]
  48202. }),
  48203. $globals.TestResult);
  48204. $core.addMethod(
  48205. $core.method({
  48206. selector: "nextRunDo:",
  48207. protocol: "running",
  48208. fn: function (aBlock){
  48209. var self=this,$self=this;
  48210. return $core.withContext(function($ctx1) {
  48211. var $2,$1;
  48212. $2=$self._runs();
  48213. $ctx1.sendIdx["runs"]=1;
  48214. $1=$recv($2).__eq_eq($self._total());
  48215. if(!$core.assert($1)){
  48216. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  48217. }
  48218. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  48219. },
  48220. args: ["aBlock"],
  48221. source: "nextRunDo: aBlock\x0a\x09\x22Runs aBlock with index of next run or does nothing if no more runs\x22\x0a\x09^ self runs == self total\x0a\x09\x09ifFalse: [ aBlock value: self runs + 1 ]",
  48222. referencedClasses: [],
  48223. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  48224. }),
  48225. $globals.TestResult);
  48226. $core.addMethod(
  48227. $core.method({
  48228. selector: "runCase:",
  48229. protocol: "running",
  48230. fn: function (aTestCase){
  48231. var self=this,$self=this;
  48232. return $core.withContext(function($ctx1) {
  48233. $recv((function(){
  48234. return $core.withContext(function($ctx2) {
  48235. return $recv((function(){
  48236. return $core.withContext(function($ctx3) {
  48237. $self._increaseRuns();
  48238. return $recv(aTestCase)._runCase();
  48239. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48240. }))._on_do_($globals.TestFailure,(function(ex){
  48241. return $core.withContext(function($ctx3) {
  48242. return $self._addFailure_(aTestCase);
  48243. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48244. }));
  48245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48246. }))._on_do_($globals.Error,(function(ex){
  48247. return $core.withContext(function($ctx2) {
  48248. return $self._addError_(aTestCase);
  48249. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  48250. }));
  48251. $ctx1.sendIdx["on:do:"]=1;
  48252. return self;
  48253. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  48254. },
  48255. args: ["aTestCase"],
  48256. source: "runCase: aTestCase\x0a\x09[ [ self increaseRuns.\x0a\x09\x09aTestCase runCase ]\x0a\x09on: TestFailure do: [ :ex | self addFailure: aTestCase ]]\x0a\x09on: Error do: [ :ex | self addError: aTestCase ]",
  48257. referencedClasses: ["TestFailure", "Error"],
  48258. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  48259. }),
  48260. $globals.TestResult);
  48261. $core.addMethod(
  48262. $core.method({
  48263. selector: "runs",
  48264. protocol: "accessing",
  48265. fn: function (){
  48266. var self=this,$self=this;
  48267. return $self["@runs"];
  48268. },
  48269. args: [],
  48270. source: "runs\x0a\x09^ runs",
  48271. referencedClasses: [],
  48272. messageSends: []
  48273. }),
  48274. $globals.TestResult);
  48275. $core.addMethod(
  48276. $core.method({
  48277. selector: "status",
  48278. protocol: "accessing",
  48279. fn: function (){
  48280. var self=this,$self=this;
  48281. return $core.withContext(function($ctx1) {
  48282. var $1;
  48283. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  48284. return "error";
  48285. }),(function(){
  48286. return $core.withContext(function($ctx2) {
  48287. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  48288. return "failure";
  48289. }),(function(){
  48290. return "success";
  48291. }));
  48292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48293. }));
  48294. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  48295. return $1;
  48296. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  48297. },
  48298. args: [],
  48299. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  48300. referencedClasses: [],
  48301. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  48302. }),
  48303. $globals.TestResult);
  48304. $core.addMethod(
  48305. $core.method({
  48306. selector: "timestamp",
  48307. protocol: "accessing",
  48308. fn: function (){
  48309. var self=this,$self=this;
  48310. return $self["@timestamp"];
  48311. },
  48312. args: [],
  48313. source: "timestamp\x0a\x09^ timestamp",
  48314. referencedClasses: [],
  48315. messageSends: []
  48316. }),
  48317. $globals.TestResult);
  48318. $core.addMethod(
  48319. $core.method({
  48320. selector: "total",
  48321. protocol: "accessing",
  48322. fn: function (){
  48323. var self=this,$self=this;
  48324. return $self["@total"];
  48325. },
  48326. args: [],
  48327. source: "total\x0a\x09^ total",
  48328. referencedClasses: [],
  48329. messageSends: []
  48330. }),
  48331. $globals.TestResult);
  48332. $core.addMethod(
  48333. $core.method({
  48334. selector: "total:",
  48335. protocol: "accessing",
  48336. fn: function (aNumber){
  48337. var self=this,$self=this;
  48338. $self["@total"]=aNumber;
  48339. return self;
  48340. },
  48341. args: ["aNumber"],
  48342. source: "total: aNumber\x0a\x09total := aNumber",
  48343. referencedClasses: [],
  48344. messageSends: []
  48345. }),
  48346. $globals.TestResult);
  48347. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48348. $globals.TestSuiteRunner.comment="I am responsible for running a collection (`suite`) of tests.\x0a\x0a## API\x0a\x0aInstances should be created using the class-side `#on:` method, taking a collection of tests to run as parameter.\x0aTo run the test suite, use `#run`.";
  48349. $core.addMethod(
  48350. $core.method({
  48351. selector: "announcer",
  48352. protocol: "accessing",
  48353. fn: function (){
  48354. var self=this,$self=this;
  48355. return $self["@announcer"];
  48356. },
  48357. args: [],
  48358. source: "announcer\x0a\x09^ announcer",
  48359. referencedClasses: [],
  48360. messageSends: []
  48361. }),
  48362. $globals.TestSuiteRunner);
  48363. $core.addMethod(
  48364. $core.method({
  48365. selector: "contextOf:",
  48366. protocol: "private",
  48367. fn: function (anInteger){
  48368. var self=this,$self=this;
  48369. return $core.withContext(function($ctx1) {
  48370. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48371. return $core.withContext(function($ctx2) {
  48372. return $self._resume();
  48373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48374. }));
  48375. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48376. },
  48377. args: ["anInteger"],
  48378. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48379. referencedClasses: ["ReportingTestContext"],
  48380. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48381. }),
  48382. $globals.TestSuiteRunner);
  48383. $core.addMethod(
  48384. $core.method({
  48385. selector: "initialize",
  48386. protocol: "initialization",
  48387. fn: function (){
  48388. var self=this,$self=this;
  48389. return $core.withContext(function($ctx1) {
  48390. var $1;
  48391. (
  48392. $ctx1.supercall = true,
  48393. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48394. $ctx1.supercall = false;
  48395. $self["@announcer"]=$recv($globals.Announcer)._new();
  48396. $ctx1.sendIdx["new"]=1;
  48397. $self["@result"]=$recv($globals.TestResult)._new();
  48398. $self["@runNextTest"]=(function(){
  48399. var runs;
  48400. return $core.withContext(function($ctx2) {
  48401. runs=$recv($self["@result"])._runs();
  48402. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48403. if($core.assert($1)){
  48404. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48405. }
  48406. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48407. });
  48408. return self;
  48409. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48410. },
  48411. args: [],
  48412. source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new.\x0a\x09result := TestResult new.\x0a\x09runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ] ].",
  48413. referencedClasses: ["Announcer", "TestResult"],
  48414. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48415. }),
  48416. $globals.TestSuiteRunner);
  48417. $core.addMethod(
  48418. $core.method({
  48419. selector: "result",
  48420. protocol: "accessing",
  48421. fn: function (){
  48422. var self=this,$self=this;
  48423. return $self["@result"];
  48424. },
  48425. args: [],
  48426. source: "result\x0a\x09^ result",
  48427. referencedClasses: [],
  48428. messageSends: []
  48429. }),
  48430. $globals.TestSuiteRunner);
  48431. $core.addMethod(
  48432. $core.method({
  48433. selector: "resume",
  48434. protocol: "actions",
  48435. fn: function (){
  48436. var self=this,$self=this;
  48437. return $core.withContext(function($ctx1) {
  48438. $recv($self["@runNextTest"])._fork();
  48439. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48440. return self;
  48441. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48442. },
  48443. args: [],
  48444. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48445. referencedClasses: ["ResultAnnouncement"],
  48446. messageSends: ["fork", "announce:", "result:", "new"]
  48447. }),
  48448. $globals.TestSuiteRunner);
  48449. $core.addMethod(
  48450. $core.method({
  48451. selector: "run",
  48452. protocol: "actions",
  48453. fn: function (){
  48454. var self=this,$self=this;
  48455. return $core.withContext(function($ctx1) {
  48456. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48457. $self._resume();
  48458. return self;
  48459. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48460. },
  48461. args: [],
  48462. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48463. referencedClasses: [],
  48464. messageSends: ["total:", "size", "resume"]
  48465. }),
  48466. $globals.TestSuiteRunner);
  48467. $core.addMethod(
  48468. $core.method({
  48469. selector: "suite:",
  48470. protocol: "accessing",
  48471. fn: function (aCollection){
  48472. var self=this,$self=this;
  48473. $self["@suite"]=aCollection;
  48474. return self;
  48475. },
  48476. args: ["aCollection"],
  48477. source: "suite: aCollection\x0a\x09suite := aCollection",
  48478. referencedClasses: [],
  48479. messageSends: []
  48480. }),
  48481. $globals.TestSuiteRunner);
  48482. $core.addMethod(
  48483. $core.method({
  48484. selector: "new",
  48485. protocol: "instance creation",
  48486. fn: function (){
  48487. var self=this,$self=this;
  48488. return $core.withContext(function($ctx1) {
  48489. $self._shouldNotImplement();
  48490. return self;
  48491. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48492. },
  48493. args: [],
  48494. source: "new\x0a\x09self shouldNotImplement",
  48495. referencedClasses: [],
  48496. messageSends: ["shouldNotImplement"]
  48497. }),
  48498. $globals.TestSuiteRunner.a$cls);
  48499. $core.addMethod(
  48500. $core.method({
  48501. selector: "on:",
  48502. protocol: "instance creation",
  48503. fn: function (aCollection){
  48504. var self=this,$self=this;
  48505. return $core.withContext(function($ctx1) {
  48506. var $1;
  48507. $1=(
  48508. $ctx1.supercall = true,
  48509. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48510. $ctx1.supercall = false;
  48511. return $recv($1)._suite_(aCollection);
  48512. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48513. },
  48514. args: ["aCollection"],
  48515. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48516. referencedClasses: [],
  48517. messageSends: ["suite:", "new"]
  48518. }),
  48519. $globals.TestSuiteRunner.a$cls);
  48520. $core.addMethod(
  48521. $core.method({
  48522. selector: "isTestPackage",
  48523. protocol: "*SUnit",
  48524. fn: function (){
  48525. var self=this,$self=this;
  48526. return $core.withContext(function($ctx1) {
  48527. return $recv($self._classes())._anySatisfy_((function(each){
  48528. return $core.withContext(function($ctx2) {
  48529. return $recv(each)._isTestClass();
  48530. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48531. }));
  48532. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48533. },
  48534. args: [],
  48535. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48536. referencedClasses: [],
  48537. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48538. }),
  48539. $globals.Package);
  48540. $core.addMethod(
  48541. $core.method({
  48542. selector: "isTestClass",
  48543. protocol: "*SUnit",
  48544. fn: function (){
  48545. var self=this,$self=this;
  48546. return false;
  48547. },
  48548. args: [],
  48549. source: "isTestClass\x0a\x09^ false",
  48550. referencedClasses: [],
  48551. messageSends: []
  48552. }),
  48553. $globals.TBehaviorDefaults);
  48554. });
  48555. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48556. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48557. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48558. $core.addPackage("Compiler-Tests");
  48559. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  48560. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48561. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48562. $core.addMethod(
  48563. $core.method({
  48564. selector: "parse:forClass:",
  48565. protocol: "parsing",
  48566. fn: function (aString,aClass){
  48567. var self=this,$self=this;
  48568. return $core.withContext(function($ctx1) {
  48569. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  48570. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48571. },
  48572. args: ["aString", "aClass"],
  48573. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  48574. referencedClasses: ["Compiler"],
  48575. messageSends: ["ast:forClass:protocol:", "new"]
  48576. }),
  48577. $globals.ASTParsingTest);
  48578. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48579. $core.addMethod(
  48580. $core.method({
  48581. selector: "astPCNodeVisitor",
  48582. protocol: "factory",
  48583. fn: function (){
  48584. var self=this,$self=this;
  48585. return $core.withContext(function($ctx1) {
  48586. var $1;
  48587. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48588. $recv($1)._index_((0));
  48589. return $recv($1)._yourself();
  48590. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48591. },
  48592. args: [],
  48593. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48594. referencedClasses: ["ASTPCNodeVisitor"],
  48595. messageSends: ["index:", "new", "yourself"]
  48596. }),
  48597. $globals.ASTPCNodeVisitorTest);
  48598. $core.addMethod(
  48599. $core.method({
  48600. selector: "astPCNodeVisitorForSelector:",
  48601. protocol: "factory",
  48602. fn: function (aString){
  48603. var self=this,$self=this;
  48604. return $core.withContext(function($ctx1) {
  48605. var $1;
  48606. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48607. $recv($1)._selector_(aString);
  48608. $recv($1)._index_((0));
  48609. return $recv($1)._yourself();
  48610. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48611. },
  48612. args: ["aString"],
  48613. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48614. referencedClasses: ["ASTPCNodeVisitor"],
  48615. messageSends: ["selector:", "new", "index:", "yourself"]
  48616. }),
  48617. $globals.ASTPCNodeVisitorTest);
  48618. $core.addMethod(
  48619. $core.method({
  48620. selector: "testJSStatementNode",
  48621. protocol: "tests",
  48622. fn: function (){
  48623. var self=this,$self=this;
  48624. var ast,visitor;
  48625. return $core.withContext(function($ctx1) {
  48626. var $3,$2,$1;
  48627. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48628. $3=$self._astPCNodeVisitor();
  48629. $recv($3)._visit_(ast);
  48630. $2=$recv($3)._currentNode();
  48631. $1=$recv($2)._isJSStatementNode();
  48632. $self._assert_($1);
  48633. return self;
  48634. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48635. },
  48636. args: [],
  48637. source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <inlineJS: ''consolee.log(1)''>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  48638. referencedClasses: ["Object"],
  48639. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48640. }),
  48641. $globals.ASTPCNodeVisitorTest);
  48642. $core.addMethod(
  48643. $core.method({
  48644. selector: "testMessageSend",
  48645. protocol: "tests",
  48646. fn: function (){
  48647. var self=this,$self=this;
  48648. var ast;
  48649. return $core.withContext(function($ctx1) {
  48650. var $3,$2,$1;
  48651. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48652. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48653. $recv($3)._visit_(ast);
  48654. $2=$recv($3)._currentNode();
  48655. $1=$recv($2)._selector();
  48656. $self._assert_equals_($1,"yourself");
  48657. return self;
  48658. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48659. },
  48660. args: [],
  48661. source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  48662. referencedClasses: ["Object"],
  48663. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48664. }),
  48665. $globals.ASTPCNodeVisitorTest);
  48666. $core.addMethod(
  48667. $core.method({
  48668. selector: "testMessageSendWithBlocks",
  48669. protocol: "tests",
  48670. fn: function (){
  48671. var self=this,$self=this;
  48672. var ast;
  48673. return $core.withContext(function($ctx1) {
  48674. var $3,$2,$1;
  48675. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48676. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48677. $recv($3)._visit_(ast);
  48678. $2=$recv($3)._currentNode();
  48679. $1=$recv($2)._selector();
  48680. $self._assert_equals_($1,"yourself");
  48681. return self;
  48682. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48683. },
  48684. args: [],
  48685. source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  48686. referencedClasses: ["Object"],
  48687. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48688. }),
  48689. $globals.ASTPCNodeVisitorTest);
  48690. $core.addMethod(
  48691. $core.method({
  48692. selector: "testMessageSendWithInlining",
  48693. protocol: "tests",
  48694. fn: function (){
  48695. var self=this,$self=this;
  48696. var ast;
  48697. return $core.withContext(function($ctx1) {
  48698. var $3,$4,$2,$1,$7,$6,$5;
  48699. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48700. $ctx1.sendIdx["parse:forClass:"]=1;
  48701. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48702. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48703. $recv($3)._visit_(ast);
  48704. $ctx1.sendIdx["visit:"]=1;
  48705. $4=$recv($3)._currentNode();
  48706. $ctx1.sendIdx["currentNode"]=1;
  48707. $2=$4;
  48708. $1=$recv($2)._selector();
  48709. $ctx1.sendIdx["selector"]=1;
  48710. $self._assert_equals_($1,"yourself");
  48711. $ctx1.sendIdx["assert:equals:"]=1;
  48712. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48713. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48714. $recv($7)._visit_(ast);
  48715. $6=$recv($7)._currentNode();
  48716. $5=$recv($6)._selector();
  48717. $self._assert_equals_($5,"asBoolean");
  48718. return self;
  48719. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48720. },
  48721. args: [],
  48722. source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
  48723. referencedClasses: ["Object"],
  48724. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48725. }),
  48726. $globals.ASTPCNodeVisitorTest);
  48727. $core.addMethod(
  48728. $core.method({
  48729. selector: "testNoMessageSend",
  48730. protocol: "tests",
  48731. fn: function (){
  48732. var self=this,$self=this;
  48733. var ast;
  48734. return $core.withContext(function($ctx1) {
  48735. var $3,$2,$1;
  48736. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48737. $3=$self._astPCNodeVisitor();
  48738. $recv($3)._visit_(ast);
  48739. $2=$recv($3)._currentNode();
  48740. $1=$recv($2)._isNil();
  48741. $self._assert_($1);
  48742. return self;
  48743. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48744. },
  48745. args: [],
  48746. source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil",
  48747. referencedClasses: ["Object"],
  48748. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48749. }),
  48750. $globals.ASTPCNodeVisitorTest);
  48751. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48752. $core.addMethod(
  48753. $core.method({
  48754. selector: "testNodeAtPosition",
  48755. protocol: "tests",
  48756. fn: function (){
  48757. var self=this,$self=this;
  48758. var node;
  48759. return $core.withContext(function($ctx1) {
  48760. var $3,$4,$2,$1,$7,$8,$6,$5;
  48761. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  48762. $ctx1.sendIdx["parse:forClass:"]=1;
  48763. $3=node;
  48764. $4=(2).__at((4));
  48765. $ctx1.sendIdx["@"]=1;
  48766. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48767. return nil;
  48768. }));
  48769. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48770. $1=$recv($2)._source();
  48771. $self._assert_equals_($1,"self");
  48772. $ctx1.sendIdx["assert:equals:"]=1;
  48773. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  48774. $ctx1.sendIdx["parse:forClass:"]=2;
  48775. $7=node;
  48776. $8=(2).__at((7));
  48777. $ctx1.sendIdx["@"]=2;
  48778. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48779. return nil;
  48780. }));
  48781. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48782. $5=$recv($6)._selector();
  48783. $ctx1.sendIdx["selector"]=1;
  48784. $self._assert_equals_($5,"ifTrue:");
  48785. $ctx1.sendIdx["assert:equals:"]=2;
  48786. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  48787. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48788. return nil;
  48789. })))._selector(),"foo");
  48790. return self;
  48791. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48792. },
  48793. args: [],
  48794. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48795. referencedClasses: ["Object"],
  48796. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48797. }),
  48798. $globals.ASTPositionTest);
  48799. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48800. $core.addMethod(
  48801. $core.method({
  48802. selector: "codeGeneratorClass",
  48803. protocol: "accessing",
  48804. fn: function (){
  48805. var self=this,$self=this;
  48806. return $globals.CodeGenerator;
  48807. },
  48808. args: [],
  48809. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48810. referencedClasses: ["CodeGenerator"],
  48811. messageSends: []
  48812. }),
  48813. $globals.CodeGeneratorTest);
  48814. $core.addMethod(
  48815. $core.method({
  48816. selector: "compiler",
  48817. protocol: "factory",
  48818. fn: function (){
  48819. var self=this,$self=this;
  48820. return $core.withContext(function($ctx1) {
  48821. var $1;
  48822. $1=$recv($globals.Compiler)._new();
  48823. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48824. return $recv($1)._yourself();
  48825. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48826. },
  48827. args: [],
  48828. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48829. referencedClasses: ["Compiler"],
  48830. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48831. }),
  48832. $globals.CodeGeneratorTest);
  48833. $core.addMethod(
  48834. $core.method({
  48835. selector: "setUp",
  48836. protocol: "initialization",
  48837. fn: function (){
  48838. var self=this,$self=this;
  48839. return $core.withContext(function($ctx1) {
  48840. $self["@receiver"]=$recv($globals.DoIt)._new();
  48841. return self;
  48842. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48843. },
  48844. args: [],
  48845. source: "setUp\x0a\x09receiver := DoIt new",
  48846. referencedClasses: ["DoIt"],
  48847. messageSends: ["new"]
  48848. }),
  48849. $globals.CodeGeneratorTest);
  48850. $core.addMethod(
  48851. $core.method({
  48852. selector: "should:receiver:raise:",
  48853. protocol: "testing",
  48854. fn: function (aString,anObject,anErrorClass){
  48855. var self=this,$self=this;
  48856. var method,result;
  48857. return $core.withContext(function($ctx1) {
  48858. var $1,$2,$3,$receiver;
  48859. $self["@receiver"]=anObject;
  48860. $recv((function(){
  48861. return $core.withContext(function($ctx2) {
  48862. return $self._should_raise_((function(){
  48863. return $core.withContext(function($ctx3) {
  48864. $1=$self._compiler();
  48865. $2=$recv(anObject)._class();
  48866. $ctx3.sendIdx["class"]=1;
  48867. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48868. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48869. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48870. }),anErrorClass);
  48871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48872. }))._ensure_((function(){
  48873. return $core.withContext(function($ctx2) {
  48874. $3=method;
  48875. if(($receiver = $3) == null || $receiver.a$nil){
  48876. return $3;
  48877. } else {
  48878. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48879. }
  48880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48881. }));
  48882. return self;
  48883. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48884. },
  48885. args: ["aString", "anObject", "anErrorClass"],
  48886. source: "should: aString receiver: anObject raise: anErrorClass\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09[ self should: [\x0a\x09\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09\x09receiver perform: method selector ] raise: anErrorClass ]\x0a\x09ensure: [ method ifNotNil: [ anObject class removeCompiledMethod: method ] ]",
  48887. referencedClasses: [],
  48888. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  48889. }),
  48890. $globals.CodeGeneratorTest);
  48891. $core.addMethod(
  48892. $core.method({
  48893. selector: "should:receiver:return:",
  48894. protocol: "testing",
  48895. fn: function (aString,anObject,aResult){
  48896. var self=this,$self=this;
  48897. var method,result;
  48898. return $core.withContext(function($ctx1) {
  48899. var $1,$2;
  48900. $self["@receiver"]=anObject;
  48901. $1=$self._compiler();
  48902. $2=$recv(anObject)._class();
  48903. $ctx1.sendIdx["class"]=1;
  48904. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48905. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  48906. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48907. $self._assert_equals_(aResult,result);
  48908. return self;
  48909. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  48910. },
  48911. args: ["aString", "anObject", "aResult"],
  48912. source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  48913. referencedClasses: [],
  48914. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  48915. }),
  48916. $globals.CodeGeneratorTest);
  48917. $core.addMethod(
  48918. $core.method({
  48919. selector: "should:return:",
  48920. protocol: "testing",
  48921. fn: function (aString,anObject){
  48922. var self=this,$self=this;
  48923. return $core.withContext(function($ctx1) {
  48924. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  48925. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  48926. },
  48927. args: ["aString", "anObject"],
  48928. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  48929. referencedClasses: [],
  48930. messageSends: ["should:receiver:return:"]
  48931. }),
  48932. $globals.CodeGeneratorTest);
  48933. $core.addMethod(
  48934. $core.method({
  48935. selector: "tearDown",
  48936. protocol: "initialization",
  48937. fn: function (){
  48938. var self=this,$self=this;
  48939. return self;
  48940. },
  48941. args: [],
  48942. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  48943. referencedClasses: [],
  48944. messageSends: []
  48945. }),
  48946. $globals.CodeGeneratorTest);
  48947. $core.addMethod(
  48948. $core.method({
  48949. selector: "testAssignment",
  48950. protocol: "tests",
  48951. fn: function (){
  48952. var self=this,$self=this;
  48953. return $core.withContext(function($ctx1) {
  48954. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  48955. $ctx1.sendIdx["should:return:"]=1;
  48956. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  48957. $ctx1.sendIdx["should:return:"]=2;
  48958. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  48959. return self;
  48960. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  48961. },
  48962. args: [],
  48963. source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1",
  48964. referencedClasses: [],
  48965. messageSends: ["should:return:"]
  48966. }),
  48967. $globals.CodeGeneratorTest);
  48968. $core.addMethod(
  48969. $core.method({
  48970. selector: "testBackslashSelectors",
  48971. protocol: "tests",
  48972. fn: function (){
  48973. var self=this,$self=this;
  48974. return $core.withContext(function($ctx1) {
  48975. $self._should_return_("\x5c arg ^ 4",(4));
  48976. $ctx1.sendIdx["should:return:"]=1;
  48977. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  48978. return self;
  48979. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  48980. },
  48981. args: [],
  48982. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  48983. referencedClasses: [],
  48984. messageSends: ["should:return:"]
  48985. }),
  48986. $globals.CodeGeneratorTest);
  48987. $core.addMethod(
  48988. $core.method({
  48989. selector: "testBlockReturn",
  48990. protocol: "tests",
  48991. fn: function (){
  48992. var self=this,$self=this;
  48993. return $core.withContext(function($ctx1) {
  48994. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  48995. $ctx1.sendIdx["should:return:"]=1;
  48996. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  48997. $ctx1.sendIdx["should:return:"]=2;
  48998. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  48999. return self;
  49000. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  49001. },
  49002. args: [],
  49003. source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
  49004. referencedClasses: [],
  49005. messageSends: ["should:return:"]
  49006. }),
  49007. $globals.CodeGeneratorTest);
  49008. $core.addMethod(
  49009. $core.method({
  49010. selector: "testCascades",
  49011. protocol: "tests",
  49012. fn: function (){
  49013. var self=this,$self=this;
  49014. return $core.withContext(function($ctx1) {
  49015. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  49016. return self;
  49017. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  49018. },
  49019. args: [],
  49020. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  49021. referencedClasses: [],
  49022. messageSends: ["should:return:"]
  49023. }),
  49024. $globals.CodeGeneratorTest);
  49025. $core.addMethod(
  49026. $core.method({
  49027. selector: "testCascadesInDynamicArray",
  49028. protocol: "tests",
  49029. fn: function (){
  49030. var self=this,$self=this;
  49031. return $core.withContext(function($ctx1) {
  49032. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  49033. return self;
  49034. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  49035. },
  49036. args: [],
  49037. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  49038. referencedClasses: [],
  49039. messageSends: ["should:return:"]
  49040. }),
  49041. $globals.CodeGeneratorTest);
  49042. $core.addMethod(
  49043. $core.method({
  49044. selector: "testCascadesInDynamicDictioary",
  49045. protocol: "tests",
  49046. fn: function (){
  49047. var self=this,$self=this;
  49048. return $core.withContext(function($ctx1) {
  49049. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  49050. return self;
  49051. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  49052. },
  49053. args: [],
  49054. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  49055. referencedClasses: [],
  49056. messageSends: ["should:return:"]
  49057. }),
  49058. $globals.CodeGeneratorTest);
  49059. $core.addMethod(
  49060. $core.method({
  49061. selector: "testCascadesInSend",
  49062. protocol: "tests",
  49063. fn: function (){
  49064. var self=this,$self=this;
  49065. return $core.withContext(function($ctx1) {
  49066. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  49067. return self;
  49068. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  49069. },
  49070. args: [],
  49071. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  49072. referencedClasses: [],
  49073. messageSends: ["should:return:"]
  49074. }),
  49075. $globals.CodeGeneratorTest);
  49076. $core.addMethod(
  49077. $core.method({
  49078. selector: "testCascadesWithInlining",
  49079. protocol: "tests",
  49080. fn: function (){
  49081. var self=this,$self=this;
  49082. return $core.withContext(function($ctx1) {
  49083. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  49084. $ctx1.sendIdx["should:return:"]=1;
  49085. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  49086. return self;
  49087. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  49088. },
  49089. args: [],
  49090. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  49091. referencedClasses: [],
  49092. messageSends: ["should:return:"]
  49093. }),
  49094. $globals.CodeGeneratorTest);
  49095. $core.addMethod(
  49096. $core.method({
  49097. selector: "testDynamicArrayElementsOrdered",
  49098. protocol: "tests",
  49099. fn: function (){
  49100. var self=this,$self=this;
  49101. return $core.withContext(function($ctx1) {
  49102. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  49103. $ctx1.sendIdx["should:return:"]=1;
  49104. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  49105. return self;
  49106. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  49107. },
  49108. args: [],
  49109. source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).",
  49110. referencedClasses: [],
  49111. messageSends: ["should:return:"]
  49112. }),
  49113. $globals.CodeGeneratorTest);
  49114. $core.addMethod(
  49115. $core.method({
  49116. selector: "testDynamicDictionaryElementsOrdered",
  49117. protocol: "tests",
  49118. fn: function (){
  49119. var self=this,$self=this;
  49120. return $core.withContext(function($ctx1) {
  49121. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  49122. return self;
  49123. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  49124. },
  49125. args: [],
  49126. source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  49127. referencedClasses: [],
  49128. messageSends: ["should:return:"]
  49129. }),
  49130. $globals.CodeGeneratorTest);
  49131. $core.addMethod(
  49132. $core.method({
  49133. selector: "testDynamicDictionaryWithMoreArrows",
  49134. protocol: "tests",
  49135. fn: function (){
  49136. var self=this,$self=this;
  49137. return $core.withContext(function($ctx1) {
  49138. var $2,$1;
  49139. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  49140. $ctx1.sendIdx["->"]=1;
  49141. $1=$recv($globals.HashedCollection)._with_($2);
  49142. $self._should_return_("foo ^ #{1->2->3}",$1);
  49143. return self;
  49144. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  49145. },
  49146. args: [],
  49147. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  49148. referencedClasses: ["HashedCollection"],
  49149. messageSends: ["should:return:", "with:", "->"]
  49150. }),
  49151. $globals.CodeGeneratorTest);
  49152. $core.addMethod(
  49153. $core.method({
  49154. selector: "testGlobalVar",
  49155. protocol: "tests",
  49156. fn: function (){
  49157. var self=this,$self=this;
  49158. return $core.withContext(function($ctx1) {
  49159. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  49160. $ctx1.sendIdx["should:return:"]=1;
  49161. $self._should_return_("foo ^ Math cos: 0",(1));
  49162. $ctx1.sendIdx["should:return:"]=2;
  49163. $self._should_return_("foo ^ NonExistingVar",nil);
  49164. return self;
  49165. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  49166. },
  49167. args: [],
  49168. source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil",
  49169. referencedClasses: ["BlockClosure"],
  49170. messageSends: ["should:return:"]
  49171. }),
  49172. $globals.CodeGeneratorTest);
  49173. $core.addMethod(
  49174. $core.method({
  49175. selector: "testInnerTemporalDependentElementsOrdered",
  49176. protocol: "tests",
  49177. fn: function (){
  49178. var self=this,$self=this;
  49179. return $core.withContext(function($ctx1) {
  49180. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  49181. $2="foo".__minus_gt($globals.Array);
  49182. $ctx1.sendIdx["->"]=1;
  49183. $3="bar".__minus_gt((2));
  49184. $ctx1.sendIdx["->"]=2;
  49185. $1=[$2,$3];
  49186. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  49187. $ctx1.sendIdx["should:return:"]=1;
  49188. $5="foo".__minus_gt($globals.Array);
  49189. $ctx1.sendIdx["->"]=3;
  49190. $6="bar".__minus_gt((2));
  49191. $ctx1.sendIdx["->"]=4;
  49192. $4=[$5,$6];
  49193. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  49194. $ctx1.sendIdx["should:return:"]=2;
  49195. $8="foo".__minus_gt((1));
  49196. $ctx1.sendIdx["->"]=5;
  49197. $9="bar".__minus_gt((2));
  49198. $ctx1.sendIdx["->"]=6;
  49199. $7=[$8,$9];
  49200. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  49201. $ctx1.sendIdx["should:return:"]=3;
  49202. $11="foo".__minus_gt((1));
  49203. $ctx1.sendIdx["->"]=7;
  49204. $10=[$11,"bar".__minus_gt((2))];
  49205. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  49206. $ctx1.sendIdx["should:return:"]=4;
  49207. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  49208. return self;
  49209. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  49210. },
  49211. args: [],
  49212. source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  49213. referencedClasses: ["Array"],
  49214. messageSends: ["should:return:", "->"]
  49215. }),
  49216. $globals.CodeGeneratorTest);
  49217. $core.addMethod(
  49218. $core.method({
  49219. selector: "testLexicalScope",
  49220. protocol: "tests",
  49221. fn: function (){
  49222. var self=this,$self=this;
  49223. return $core.withContext(function($ctx1) {
  49224. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  49225. return self;
  49226. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  49227. },
  49228. args: [],
  49229. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  49230. referencedClasses: [],
  49231. messageSends: ["should:return:"]
  49232. }),
  49233. $globals.CodeGeneratorTest);
  49234. $core.addMethod(
  49235. $core.method({
  49236. selector: "testLiterals",
  49237. protocol: "tests",
  49238. fn: function (){
  49239. var self=this,$self=this;
  49240. return $core.withContext(function($ctx1) {
  49241. $self._should_return_("foo ^ 1",(1));
  49242. $ctx1.sendIdx["should:return:"]=1;
  49243. $self._should_return_("foo ^ 'hello'","hello");
  49244. $ctx1.sendIdx["should:return:"]=2;
  49245. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49246. $ctx1.sendIdx["should:return:"]=3;
  49247. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49248. $ctx1.sendIdx["should:return:"]=4;
  49249. $self._should_return_("foo ^ true",true);
  49250. $ctx1.sendIdx["should:return:"]=5;
  49251. $self._should_return_("foo ^ false",false);
  49252. $ctx1.sendIdx["should:return:"]=6;
  49253. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49254. $ctx1.sendIdx["should:return:"]=7;
  49255. $self._should_return_("foo ^ #hello","hello");
  49256. $ctx1.sendIdx["should:return:"]=8;
  49257. $self._should_return_("foo ^ $h","h");
  49258. $ctx1.sendIdx["should:return:"]=9;
  49259. $self._should_return_("foo ^ -123.456",(-123.456));
  49260. $ctx1.sendIdx["should:return:"]=10;
  49261. $self._should_return_("foo ^ -2.5e4",(-25000));
  49262. return self;
  49263. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49264. },
  49265. args: [],
  49266. source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ $h' return: 'h'.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.",
  49267. referencedClasses: [],
  49268. messageSends: ["should:return:"]
  49269. }),
  49270. $globals.CodeGeneratorTest);
  49271. $core.addMethod(
  49272. $core.method({
  49273. selector: "testLocalReturn",
  49274. protocol: "tests",
  49275. fn: function (){
  49276. var self=this,$self=this;
  49277. return $core.withContext(function($ctx1) {
  49278. $self._should_return_("foo ^ 1",(1));
  49279. $ctx1.sendIdx["should:return:"]=1;
  49280. $self._should_return_("foo ^ 1 + 1",(2));
  49281. $ctx1.sendIdx["should:return:"]=2;
  49282. $self._should_return_("foo ",$self["@receiver"]);
  49283. $ctx1.sendIdx["should:return:"]=3;
  49284. $self._should_return_("foo self asString",$self["@receiver"]);
  49285. $ctx1.sendIdx["should:return:"]=4;
  49286. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49287. return self;
  49288. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49289. },
  49290. args: [],
  49291. source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
  49292. referencedClasses: [],
  49293. messageSends: ["should:return:"]
  49294. }),
  49295. $globals.CodeGeneratorTest);
  49296. $core.addMethod(
  49297. $core.method({
  49298. selector: "testMessageSends",
  49299. protocol: "tests",
  49300. fn: function (){
  49301. var self=this,$self=this;
  49302. return $core.withContext(function($ctx1) {
  49303. $self._should_return_("foo ^ 1 asString","1");
  49304. $ctx1.sendIdx["should:return:"]=1;
  49305. $self._should_return_("foo ^ 1 + 1",(2));
  49306. $ctx1.sendIdx["should:return:"]=2;
  49307. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49308. $ctx1.sendIdx["should:return:"]=3;
  49309. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49310. $ctx1.sendIdx["should:return:"]=4;
  49311. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49312. return self;
  49313. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49314. },
  49315. args: [],
  49316. source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
  49317. referencedClasses: [],
  49318. messageSends: ["should:return:"]
  49319. }),
  49320. $globals.CodeGeneratorTest);
  49321. $core.addMethod(
  49322. $core.method({
  49323. selector: "testMistypedPragmaJSStatement",
  49324. protocol: "tests",
  49325. fn: function (){
  49326. var self=this,$self=this;
  49327. return $core.withContext(function($ctx1) {
  49328. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49329. return self;
  49330. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49331. },
  49332. args: [],
  49333. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49334. referencedClasses: ["ParseError"],
  49335. messageSends: ["should:receiver:raise:"]
  49336. }),
  49337. $globals.CodeGeneratorTest);
  49338. $core.addMethod(
  49339. $core.method({
  49340. selector: "testMultipleSequences",
  49341. protocol: "tests",
  49342. fn: function (){
  49343. var self=this,$self=this;
  49344. return $core.withContext(function($ctx1) {
  49345. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49346. return self;
  49347. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49348. },
  49349. args: [],
  49350. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49351. referencedClasses: [],
  49352. messageSends: ["should:return:"]
  49353. }),
  49354. $globals.CodeGeneratorTest);
  49355. $core.addMethod(
  49356. $core.method({
  49357. selector: "testMutableLiterals",
  49358. protocol: "tests",
  49359. fn: function (){
  49360. var self=this,$self=this;
  49361. return $core.withContext(function($ctx1) {
  49362. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49363. return self;
  49364. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49365. },
  49366. args: [],
  49367. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://lolg.it/amber/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  49368. referencedClasses: [],
  49369. messageSends: ["should:return:"]
  49370. }),
  49371. $globals.CodeGeneratorTest);
  49372. $core.addMethod(
  49373. $core.method({
  49374. selector: "testNestedIfTrue",
  49375. protocol: "tests",
  49376. fn: function (){
  49377. var self=this,$self=this;
  49378. return $core.withContext(function($ctx1) {
  49379. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49380. $ctx1.sendIdx["should:return:"]=1;
  49381. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49382. $ctx1.sendIdx["should:return:"]=2;
  49383. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49384. $ctx1.sendIdx["should:return:"]=3;
  49385. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49386. return self;
  49387. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49388. },
  49389. args: [],
  49390. source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
  49391. referencedClasses: [],
  49392. messageSends: ["should:return:"]
  49393. }),
  49394. $globals.CodeGeneratorTest);
  49395. $core.addMethod(
  49396. $core.method({
  49397. selector: "testNestedSends",
  49398. protocol: "tests",
  49399. fn: function (){
  49400. var self=this,$self=this;
  49401. return $core.withContext(function($ctx1) {
  49402. $self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",$recv($recv($globals.Point)._x_y_((2).__at((3)),(4)))._asString());
  49403. return self;
  49404. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49405. },
  49406. args: [],
  49407. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49408. referencedClasses: ["Point"],
  49409. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49410. }),
  49411. $globals.CodeGeneratorTest);
  49412. $core.addMethod(
  49413. $core.method({
  49414. selector: "testNonLocalReturn",
  49415. protocol: "tests",
  49416. fn: function (){
  49417. var self=this,$self=this;
  49418. return $core.withContext(function($ctx1) {
  49419. $self._should_return_("foo [ ^ 1 ] value",(1));
  49420. $ctx1.sendIdx["should:return:"]=1;
  49421. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49422. $ctx1.sendIdx["should:return:"]=2;
  49423. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49424. $ctx1.sendIdx["should:return:"]=3;
  49425. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49426. return self;
  49427. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49428. },
  49429. args: [],
  49430. source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
  49431. referencedClasses: [],
  49432. messageSends: ["should:return:"]
  49433. }),
  49434. $globals.CodeGeneratorTest);
  49435. $core.addMethod(
  49436. $core.method({
  49437. selector: "testPascalCaseGlobal",
  49438. protocol: "tests",
  49439. fn: function (){
  49440. var self=this,$self=this;
  49441. return $core.withContext(function($ctx1) {
  49442. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49443. $ctx1.sendIdx["should:return:"]=1;
  49444. $self._should_return_("foo ^NonExistent",nil);
  49445. return self;
  49446. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49447. },
  49448. args: [],
  49449. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49450. referencedClasses: ["Smalltalk"],
  49451. messageSends: ["should:return:", "at:", "globals"]
  49452. }),
  49453. $globals.CodeGeneratorTest);
  49454. $core.addMethod(
  49455. $core.method({
  49456. selector: "testPragmaJSStatement",
  49457. protocol: "tests",
  49458. fn: function (){
  49459. var self=this,$self=this;
  49460. return $core.withContext(function($ctx1) {
  49461. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49462. return self;
  49463. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49464. },
  49465. args: [],
  49466. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49467. referencedClasses: [],
  49468. messageSends: ["should:return:"]
  49469. }),
  49470. $globals.CodeGeneratorTest);
  49471. $core.addMethod(
  49472. $core.method({
  49473. selector: "testRootSuperSend",
  49474. protocol: "tests",
  49475. fn: function (){
  49476. var self=this,$self=this;
  49477. return $core.withContext(function($ctx1) {
  49478. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49479. return self;
  49480. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49481. },
  49482. args: [],
  49483. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49484. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49485. messageSends: ["should:receiver:raise:", "new"]
  49486. }),
  49487. $globals.CodeGeneratorTest);
  49488. $core.addMethod(
  49489. $core.method({
  49490. selector: "testSendReceiverAndArgumentsOrdered",
  49491. protocol: "tests",
  49492. fn: function (){
  49493. var self=this,$self=this;
  49494. return $core.withContext(function($ctx1) {
  49495. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49496. $ctx1.sendIdx["should:return:"]=1;
  49497. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49498. return self;
  49499. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49500. },
  49501. args: [],
  49502. source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.",
  49503. referencedClasses: ["Array"],
  49504. messageSends: ["should:return:"]
  49505. }),
  49506. $globals.CodeGeneratorTest);
  49507. $core.addMethod(
  49508. $core.method({
  49509. selector: "testSuperSend",
  49510. protocol: "tests",
  49511. fn: function (){
  49512. var self=this,$self=this;
  49513. return $core.withContext(function($ctx1) {
  49514. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49515. return self;
  49516. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49517. },
  49518. args: [],
  49519. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49520. referencedClasses: [],
  49521. messageSends: ["should:receiver:return:"]
  49522. }),
  49523. $globals.CodeGeneratorTest);
  49524. $core.addMethod(
  49525. $core.method({
  49526. selector: "testTempVariables",
  49527. protocol: "tests",
  49528. fn: function (){
  49529. var self=this,$self=this;
  49530. return $core.withContext(function($ctx1) {
  49531. $self._should_return_("foo | a | ^ a",nil);
  49532. $ctx1.sendIdx["should:return:"]=1;
  49533. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49534. $ctx1.sendIdx["should:return:"]=2;
  49535. $self._should_return_("foo | a b c | ^ c",nil);
  49536. $ctx1.sendIdx["should:return:"]=3;
  49537. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49538. $ctx1.sendIdx["should:return:"]=4;
  49539. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49540. $ctx1.sendIdx["should:return:"]=5;
  49541. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49542. return self;
  49543. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49544. },
  49545. args: [],
  49546. source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.",
  49547. referencedClasses: [],
  49548. messageSends: ["should:return:"]
  49549. }),
  49550. $globals.CodeGeneratorTest);
  49551. $core.addMethod(
  49552. $core.method({
  49553. selector: "testThisContext",
  49554. protocol: "tests",
  49555. fn: function (){
  49556. var self=this,$self=this;
  49557. return $core.withContext(function($ctx1) {
  49558. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49559. return self;
  49560. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49561. },
  49562. args: [],
  49563. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49564. referencedClasses: [],
  49565. messageSends: ["should:return:"]
  49566. }),
  49567. $globals.CodeGeneratorTest);
  49568. $core.addMethod(
  49569. $core.method({
  49570. selector: "testUnknownPragma",
  49571. protocol: "tests",
  49572. fn: function (){
  49573. var self=this,$self=this;
  49574. return $core.withContext(function($ctx1) {
  49575. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  49576. $ctx1.sendIdx["should:return:"]=1;
  49577. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  49578. return self;
  49579. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
  49580. },
  49581. args: [],
  49582. source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
  49583. referencedClasses: [],
  49584. messageSends: ["should:return:"]
  49585. }),
  49586. $globals.CodeGeneratorTest);
  49587. $core.addMethod(
  49588. $core.method({
  49589. selector: "testifFalse",
  49590. protocol: "tests",
  49591. fn: function (){
  49592. var self=this,$self=this;
  49593. return $core.withContext(function($ctx1) {
  49594. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49595. $ctx1.sendIdx["should:return:"]=1;
  49596. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49597. $ctx1.sendIdx["should:return:"]=2;
  49598. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49599. $ctx1.sendIdx["should:return:"]=3;
  49600. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49601. return self;
  49602. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49603. },
  49604. args: [],
  49605. source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
  49606. referencedClasses: [],
  49607. messageSends: ["should:return:"]
  49608. }),
  49609. $globals.CodeGeneratorTest);
  49610. $core.addMethod(
  49611. $core.method({
  49612. selector: "testifFalseIfTrue",
  49613. protocol: "tests",
  49614. fn: function (){
  49615. var self=this,$self=this;
  49616. return $core.withContext(function($ctx1) {
  49617. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49618. $ctx1.sendIdx["should:return:"]=1;
  49619. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49620. $ctx1.sendIdx["should:return:"]=2;
  49621. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49622. $ctx1.sendIdx["should:return:"]=3;
  49623. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49624. return self;
  49625. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49626. },
  49627. args: [],
  49628. source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
  49629. referencedClasses: [],
  49630. messageSends: ["should:return:"]
  49631. }),
  49632. $globals.CodeGeneratorTest);
  49633. $core.addMethod(
  49634. $core.method({
  49635. selector: "testifNil",
  49636. protocol: "tests",
  49637. fn: function (){
  49638. var self=this,$self=this;
  49639. return $core.withContext(function($ctx1) {
  49640. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49641. $ctx1.sendIdx["should:return:"]=1;
  49642. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49643. $ctx1.sendIdx["should:return:"]=2;
  49644. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49645. $ctx1.sendIdx["should:return:"]=3;
  49646. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49647. return self;
  49648. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49649. },
  49650. args: [],
  49651. source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
  49652. referencedClasses: [],
  49653. messageSends: ["should:return:"]
  49654. }),
  49655. $globals.CodeGeneratorTest);
  49656. $core.addMethod(
  49657. $core.method({
  49658. selector: "testifNilIfNotNil",
  49659. protocol: "tests",
  49660. fn: function (){
  49661. var self=this,$self=this;
  49662. return $core.withContext(function($ctx1) {
  49663. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49664. $ctx1.sendIdx["should:return:"]=1;
  49665. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49666. $ctx1.sendIdx["should:return:"]=2;
  49667. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49668. $ctx1.sendIdx["should:return:"]=3;
  49669. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49670. return self;
  49671. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49672. },
  49673. args: [],
  49674. source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
  49675. referencedClasses: [],
  49676. messageSends: ["should:return:"]
  49677. }),
  49678. $globals.CodeGeneratorTest);
  49679. $core.addMethod(
  49680. $core.method({
  49681. selector: "testifNotNil",
  49682. protocol: "tests",
  49683. fn: function (){
  49684. var self=this,$self=this;
  49685. return $core.withContext(function($ctx1) {
  49686. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49687. $ctx1.sendIdx["should:return:"]=1;
  49688. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49689. $ctx1.sendIdx["should:return:"]=2;
  49690. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49691. $ctx1.sendIdx["should:return:"]=3;
  49692. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49693. return self;
  49694. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49695. },
  49696. args: [],
  49697. source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
  49698. referencedClasses: [],
  49699. messageSends: ["should:return:"]
  49700. }),
  49701. $globals.CodeGeneratorTest);
  49702. $core.addMethod(
  49703. $core.method({
  49704. selector: "testifNotNilWithArgument",
  49705. protocol: "tests",
  49706. fn: function (){
  49707. var self=this,$self=this;
  49708. return $core.withContext(function($ctx1) {
  49709. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49710. $ctx1.sendIdx["should:return:"]=1;
  49711. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49712. $ctx1.sendIdx["should:return:"]=2;
  49713. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49714. $ctx1.sendIdx["should:return:"]=3;
  49715. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49716. $ctx1.sendIdx["should:return:"]=4;
  49717. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49718. $ctx1.sendIdx["should:return:"]=5;
  49719. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49720. return self;
  49721. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49722. },
  49723. args: [],
  49724. source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5",
  49725. referencedClasses: [],
  49726. messageSends: ["should:return:"]
  49727. }),
  49728. $globals.CodeGeneratorTest);
  49729. $core.addMethod(
  49730. $core.method({
  49731. selector: "testifTrue",
  49732. protocol: "tests",
  49733. fn: function (){
  49734. var self=this,$self=this;
  49735. return $core.withContext(function($ctx1) {
  49736. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49737. $ctx1.sendIdx["should:return:"]=1;
  49738. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49739. $ctx1.sendIdx["should:return:"]=2;
  49740. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49741. $ctx1.sendIdx["should:return:"]=3;
  49742. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49743. return self;
  49744. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49745. },
  49746. args: [],
  49747. source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
  49748. referencedClasses: [],
  49749. messageSends: ["should:return:"]
  49750. }),
  49751. $globals.CodeGeneratorTest);
  49752. $core.addMethod(
  49753. $core.method({
  49754. selector: "testifTrueIfFalse",
  49755. protocol: "tests",
  49756. fn: function (){
  49757. var self=this,$self=this;
  49758. return $core.withContext(function($ctx1) {
  49759. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49760. $ctx1.sendIdx["should:return:"]=1;
  49761. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49762. $ctx1.sendIdx["should:return:"]=2;
  49763. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49764. $ctx1.sendIdx["should:return:"]=3;
  49765. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49766. return self;
  49767. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49768. },
  49769. args: [],
  49770. source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
  49771. referencedClasses: [],
  49772. messageSends: ["should:return:"]
  49773. }),
  49774. $globals.CodeGeneratorTest);
  49775. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49776. $core.addMethod(
  49777. $core.method({
  49778. selector: "interpret:receiver:withArguments:",
  49779. protocol: "private",
  49780. fn: function (aString,anObject,aDictionary){
  49781. var self=this,$self=this;
  49782. var ctx,ast,interpreter;
  49783. return $core.withContext(function($ctx1) {
  49784. var $1,$2,$3,$receiver;
  49785. interpreter=$recv($globals.ASTInterpreter)._new();
  49786. $ctx1.sendIdx["new"]=1;
  49787. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49788. $1=$recv($globals.AIContext)._new();
  49789. $recv($1)._receiver_(anObject);
  49790. $recv($1)._interpreter_(interpreter);
  49791. ctx=$recv($1)._yourself();
  49792. $2=$recv(ast)._sequenceNode();
  49793. if(($receiver = $2) == null || $receiver.a$nil){
  49794. $2;
  49795. } else {
  49796. var sequence;
  49797. sequence=$receiver;
  49798. $recv($recv(sequence)._temps())._do_((function(each){
  49799. return $core.withContext(function($ctx2) {
  49800. return $recv(ctx)._defineLocal_(each);
  49801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49802. }));
  49803. }
  49804. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49805. return $core.withContext(function($ctx2) {
  49806. return $recv(ctx)._localAt_put_(key,value);
  49807. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49808. }));
  49809. $3=interpreter;
  49810. $recv($3)._context_(ctx);
  49811. $recv($3)._node_(ast);
  49812. $recv($3)._enterNode();
  49813. $recv($3)._proceed();
  49814. return $recv($3)._result();
  49815. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49816. },
  49817. args: ["aString", "anObject", "aDictionary"],
  49818. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  49819. referencedClasses: ["ASTInterpreter", "AIContext"],
  49820. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49821. }),
  49822. $globals.ASTInterpreterTest);
  49823. $core.addMethod(
  49824. $core.method({
  49825. selector: "should:receiver:return:",
  49826. protocol: "testing",
  49827. fn: function (aString,anObject,aResult){
  49828. var self=this,$self=this;
  49829. return $core.withContext(function($ctx1) {
  49830. $self["@receiver"]=anObject;
  49831. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49832. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49833. },
  49834. args: ["aString", "anObject", "aResult"],
  49835. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult",
  49836. referencedClasses: [],
  49837. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49838. }),
  49839. $globals.ASTInterpreterTest);
  49840. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49841. $core.addMethod(
  49842. $core.method({
  49843. selector: "interpret:receiver:withArguments:",
  49844. protocol: "private",
  49845. fn: function (aString,anObject,aDictionary){
  49846. var self=this,$self=this;
  49847. var ctx,ast,debugger_;
  49848. return $core.withContext(function($ctx1) {
  49849. var $1,$2,$3,$4,$5,$receiver;
  49850. $1=$recv($globals.AIContext)._new();
  49851. $ctx1.sendIdx["new"]=1;
  49852. $recv($1)._receiver_(anObject);
  49853. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49854. ctx=$recv($1)._yourself();
  49855. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49856. $2=$recv(ast)._sequenceNode();
  49857. if(($receiver = $2) == null || $receiver.a$nil){
  49858. $2;
  49859. } else {
  49860. var sequence;
  49861. sequence=$receiver;
  49862. $recv($recv(sequence)._temps())._do_((function(each){
  49863. return $core.withContext(function($ctx2) {
  49864. return $recv(ctx)._defineLocal_(each);
  49865. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49866. }));
  49867. }
  49868. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49869. return $core.withContext(function($ctx2) {
  49870. return $recv(ctx)._localAt_put_(key,value);
  49871. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49872. }));
  49873. $3=$recv(ctx)._interpreter();
  49874. $ctx1.sendIdx["interpreter"]=1;
  49875. $recv($3)._context_(ctx);
  49876. $ctx1.sendIdx["context:"]=1;
  49877. $4=$recv(ctx)._interpreter();
  49878. $recv($4)._node_(ast);
  49879. $recv($4)._enterNode();
  49880. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  49881. $5=debugger_;
  49882. $recv($5)._proceed();
  49883. return $recv($5)._result();
  49884. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  49885. },
  49886. args: ["aString", "anObject", "aDictionary"],
  49887. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast; enterNode.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  49888. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  49889. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  49890. }),
  49891. $globals.ASTDebuggerTest);
  49892. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49893. $core.addMethod(
  49894. $core.method({
  49895. selector: "codeGeneratorClass",
  49896. protocol: "accessing",
  49897. fn: function (){
  49898. var self=this,$self=this;
  49899. return $globals.InliningCodeGenerator;
  49900. },
  49901. args: [],
  49902. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  49903. referencedClasses: ["InliningCodeGenerator"],
  49904. messageSends: []
  49905. }),
  49906. $globals.InliningCodeGeneratorTest);
  49907. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  49908. $core.addMethod(
  49909. $core.method({
  49910. selector: "testClassRefVar",
  49911. protocol: "tests",
  49912. fn: function (){
  49913. var self=this,$self=this;
  49914. var node;
  49915. return $core.withContext(function($ctx1) {
  49916. var $1,$2;
  49917. $1=$recv($globals.VariableNode)._new();
  49918. $ctx1.sendIdx["new"]=1;
  49919. $recv($1)._value_("Object");
  49920. node=$recv($1)._yourself();
  49921. $2=$recv($globals.SemanticAnalyzer)._new();
  49922. $ctx1.sendIdx["new"]=2;
  49923. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  49924. $recv($2)._visit_(node);
  49925. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  49926. return self;
  49927. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  49928. },
  49929. args: [],
  49930. source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar",
  49931. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  49932. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  49933. }),
  49934. $globals.ScopeVarTest);
  49935. $core.addMethod(
  49936. $core.method({
  49937. selector: "testInstanceVar",
  49938. protocol: "tests",
  49939. fn: function (){
  49940. var self=this,$self=this;
  49941. var node,scope;
  49942. return $core.withContext(function($ctx1) {
  49943. var $1;
  49944. $1=$recv($globals.VariableNode)._new();
  49945. $ctx1.sendIdx["new"]=1;
  49946. $recv($1)._value_("bzzz");
  49947. node=$recv($1)._yourself();
  49948. scope=$recv($globals.MethodLexicalScope)._new();
  49949. $recv(scope)._addIVar_("bzzz");
  49950. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  49951. return self;
  49952. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49953. },
  49954. args: [],
  49955. source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
  49956. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49957. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  49958. }),
  49959. $globals.ScopeVarTest);
  49960. $core.addMethod(
  49961. $core.method({
  49962. selector: "testPseudoVar",
  49963. protocol: "tests",
  49964. fn: function (){
  49965. var self=this,$self=this;
  49966. var node,pseudoVars;
  49967. return $core.withContext(function($ctx1) {
  49968. var $1;
  49969. pseudoVars=["self", "super", "true", "false", "nil"];
  49970. $recv(pseudoVars)._do_((function(each){
  49971. return $core.withContext(function($ctx2) {
  49972. $1=$recv($globals.VariableNode)._new();
  49973. $ctx2.sendIdx["new"]=1;
  49974. $recv($1)._value_(each);
  49975. node=$recv($1)._yourself();
  49976. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  49977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49978. }));
  49979. return self;
  49980. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  49981. },
  49982. args: [],
  49983. source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar]",
  49984. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49985. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  49986. }),
  49987. $globals.ScopeVarTest);
  49988. $core.addMethod(
  49989. $core.method({
  49990. selector: "testTempVar",
  49991. protocol: "tests",
  49992. fn: function (){
  49993. var self=this,$self=this;
  49994. var node,scope;
  49995. return $core.withContext(function($ctx1) {
  49996. var $1;
  49997. $1=$recv($globals.VariableNode)._new();
  49998. $ctx1.sendIdx["new"]=1;
  49999. $recv($1)._value_("bzzz");
  50000. node=$recv($1)._yourself();
  50001. scope=$recv($globals.MethodLexicalScope)._new();
  50002. $recv(scope)._addTemp_("bzzz");
  50003. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  50004. return self;
  50005. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50006. },
  50007. args: [],
  50008. source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
  50009. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50010. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  50011. }),
  50012. $globals.ScopeVarTest);
  50013. $core.addMethod(
  50014. $core.method({
  50015. selector: "testUnknownVar",
  50016. protocol: "tests",
  50017. fn: function (){
  50018. var self=this,$self=this;
  50019. var node;
  50020. return $core.withContext(function($ctx1) {
  50021. var $1;
  50022. $1=$recv($globals.VariableNode)._new();
  50023. $ctx1.sendIdx["new"]=1;
  50024. $recv($1)._value_("bzzz");
  50025. node=$recv($1)._yourself();
  50026. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  50027. return self;
  50028. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  50029. },
  50030. args: [],
  50031. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  50032. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50033. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  50034. }),
  50035. $globals.ScopeVarTest);
  50036. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  50037. $core.addMethod(
  50038. $core.method({
  50039. selector: "setUp",
  50040. protocol: "running",
  50041. fn: function (){
  50042. var self=this,$self=this;
  50043. return $core.withContext(function($ctx1) {
  50044. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  50045. return self;
  50046. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  50047. },
  50048. args: [],
  50049. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  50050. referencedClasses: ["SemanticAnalyzer", "Object"],
  50051. messageSends: ["on:"]
  50052. }),
  50053. $globals.SemanticAnalyzerTest);
  50054. $core.addMethod(
  50055. $core.method({
  50056. selector: "testAssignment",
  50057. protocol: "tests",
  50058. fn: function (){
  50059. var self=this,$self=this;
  50060. var src,ast;
  50061. return $core.withContext(function($ctx1) {
  50062. src="foo self := 1";
  50063. ast=$recv($globals.Smalltalk)._parse_(src);
  50064. $self._should_raise_((function(){
  50065. return $core.withContext(function($ctx2) {
  50066. return $recv($self["@analyzer"])._visit_(ast);
  50067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50068. }),$globals.InvalidAssignmentError);
  50069. return self;
  50070. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50071. },
  50072. args: [],
  50073. source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
  50074. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  50075. messageSends: ["parse:", "should:raise:", "visit:"]
  50076. }),
  50077. $globals.SemanticAnalyzerTest);
  50078. $core.addMethod(
  50079. $core.method({
  50080. selector: "testNonLocalReturn",
  50081. protocol: "tests",
  50082. fn: function (){
  50083. var self=this,$self=this;
  50084. var src,ast;
  50085. return $core.withContext(function($ctx1) {
  50086. src="foo | a | a + 1. ^ a";
  50087. ast=$recv($globals.Smalltalk)._parse_(src);
  50088. $recv($self["@analyzer"])._visit_(ast);
  50089. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50090. return self;
  50091. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50092. },
  50093. args: [],
  50094. source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
  50095. referencedClasses: ["Smalltalk"],
  50096. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  50097. }),
  50098. $globals.SemanticAnalyzerTest);
  50099. $core.addMethod(
  50100. $core.method({
  50101. selector: "testNonLocalReturn2",
  50102. protocol: "tests",
  50103. fn: function (){
  50104. var self=this,$self=this;
  50105. var src,ast;
  50106. return $core.withContext(function($ctx1) {
  50107. src="foo | a | a + 1. [ [ ^ a] ]";
  50108. ast=$recv($globals.Smalltalk)._parse_(src);
  50109. $recv($self["@analyzer"])._visit_(ast);
  50110. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50111. return self;
  50112. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50113. },
  50114. args: [],
  50115. source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
  50116. referencedClasses: ["Smalltalk"],
  50117. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  50118. }),
  50119. $globals.SemanticAnalyzerTest);
  50120. $core.addMethod(
  50121. $core.method({
  50122. selector: "testScope",
  50123. protocol: "tests",
  50124. fn: function (){
  50125. var self=this,$self=this;
  50126. var src,ast;
  50127. return $core.withContext(function($ctx1) {
  50128. var $4,$3,$2,$1;
  50129. src="foo | a | a + 1. [ | b | b := a ]";
  50130. ast=$recv($globals.Smalltalk)._parse_(src);
  50131. $recv($self["@analyzer"])._visit_(ast);
  50132. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50133. $ctx1.sendIdx["dagChildren"]=1;
  50134. $3=$recv($4)._last();
  50135. $2=$recv($3)._scope();
  50136. $ctx1.sendIdx["scope"]=1;
  50137. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50138. $self._deny_($1);
  50139. return self;
  50140. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50141. },
  50142. args: [],
  50143. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast dagChildren first dagChildren last scope == ast scope.",
  50144. referencedClasses: ["Smalltalk"],
  50145. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  50146. }),
  50147. $globals.SemanticAnalyzerTest);
  50148. $core.addMethod(
  50149. $core.method({
  50150. selector: "testScope2",
  50151. protocol: "tests",
  50152. fn: function (){
  50153. var self=this,$self=this;
  50154. var src,ast;
  50155. return $core.withContext(function($ctx1) {
  50156. var $8,$7,$6,$5,$4,$3,$2,$1;
  50157. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50158. ast=$recv($globals.Smalltalk)._parse_(src);
  50159. $recv($self["@analyzer"])._visit_(ast);
  50160. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50161. $ctx1.sendIdx["dagChildren"]=3;
  50162. $7=$recv($8)._last();
  50163. $6=$recv($7)._dagChildren();
  50164. $ctx1.sendIdx["dagChildren"]=2;
  50165. $5=$recv($6)._first();
  50166. $ctx1.sendIdx["first"]=2;
  50167. $4=$recv($5)._dagChildren();
  50168. $ctx1.sendIdx["dagChildren"]=1;
  50169. $3=$recv($4)._first();
  50170. $ctx1.sendIdx["first"]=1;
  50171. $2=$recv($3)._scope();
  50172. $ctx1.sendIdx["scope"]=1;
  50173. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50174. $self._deny_($1);
  50175. return self;
  50176. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50177. },
  50178. args: [],
  50179. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast dagChildren first dagChildren last dagChildren first dagChildren first scope == ast scope.",
  50180. referencedClasses: ["Smalltalk"],
  50181. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  50182. }),
  50183. $globals.SemanticAnalyzerTest);
  50184. $core.addMethod(
  50185. $core.method({
  50186. selector: "testScopeLevel",
  50187. protocol: "tests",
  50188. fn: function (){
  50189. var self=this,$self=this;
  50190. var src,ast;
  50191. return $core.withContext(function($ctx1) {
  50192. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  50193. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50194. ast=$recv($globals.Smalltalk)._parse_(src);
  50195. $recv($self["@analyzer"])._visit_(ast);
  50196. $2=$recv(ast)._scope();
  50197. $ctx1.sendIdx["scope"]=1;
  50198. $1=$recv($2)._scopeLevel();
  50199. $ctx1.sendIdx["scopeLevel"]=1;
  50200. $self._assert_equals_($1,(1));
  50201. $ctx1.sendIdx["assert:equals:"]=1;
  50202. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50203. $ctx1.sendIdx["dagChildren"]=3;
  50204. $9=$recv($10)._last();
  50205. $8=$recv($9)._dagChildren();
  50206. $ctx1.sendIdx["dagChildren"]=2;
  50207. $7=$recv($8)._first();
  50208. $ctx1.sendIdx["first"]=2;
  50209. $6=$recv($7)._dagChildren();
  50210. $ctx1.sendIdx["dagChildren"]=1;
  50211. $5=$recv($6)._first();
  50212. $ctx1.sendIdx["first"]=1;
  50213. $4=$recv($5)._scope();
  50214. $3=$recv($4)._scopeLevel();
  50215. $self._assert_equals_($3,(3));
  50216. return self;
  50217. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50218. },
  50219. args: [],
  50220. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first scope scopeLevel equals: 3",
  50221. referencedClasses: ["Smalltalk"],
  50222. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50223. }),
  50224. $globals.SemanticAnalyzerTest);
  50225. $core.addMethod(
  50226. $core.method({
  50227. selector: "testUnknownVariables",
  50228. protocol: "tests",
  50229. fn: function (){
  50230. var self=this,$self=this;
  50231. var src,ast;
  50232. return $core.withContext(function($ctx1) {
  50233. src="foo | a | b + a";
  50234. ast=$recv($globals.Smalltalk)._parse_(src);
  50235. $self._should_raise_((function(){
  50236. return $core.withContext(function($ctx2) {
  50237. return $recv($self["@analyzer"])._visit_(ast);
  50238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50239. }),$globals.UnknownVariableError);
  50240. return self;
  50241. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50242. },
  50243. args: [],
  50244. source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  50245. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50246. messageSends: ["parse:", "should:raise:", "visit:"]
  50247. }),
  50248. $globals.SemanticAnalyzerTest);
  50249. $core.addMethod(
  50250. $core.method({
  50251. selector: "testUnknownVariablesWithScope",
  50252. protocol: "tests",
  50253. fn: function (){
  50254. var self=this,$self=this;
  50255. var src,ast;
  50256. return $core.withContext(function($ctx1) {
  50257. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50258. ast=$recv($globals.Smalltalk)._parse_(src);
  50259. $self._should_raise_((function(){
  50260. return $core.withContext(function($ctx2) {
  50261. return $recv($self["@analyzer"])._visit_(ast);
  50262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50263. }),$globals.UnknownVariableError);
  50264. return self;
  50265. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50266. },
  50267. args: [],
  50268. source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  50269. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50270. messageSends: ["parse:", "should:raise:", "visit:"]
  50271. }),
  50272. $globals.SemanticAnalyzerTest);
  50273. $core.addMethod(
  50274. $core.method({
  50275. selector: "testVariableShadowing",
  50276. protocol: "tests",
  50277. fn: function (){
  50278. var self=this,$self=this;
  50279. var src,ast;
  50280. return $core.withContext(function($ctx1) {
  50281. src="foo | a | a + 1";
  50282. ast=$recv($globals.Smalltalk)._parse_(src);
  50283. $recv($self["@analyzer"])._visit_(ast);
  50284. return self;
  50285. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50286. },
  50287. args: [],
  50288. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50289. referencedClasses: ["Smalltalk"],
  50290. messageSends: ["parse:", "visit:"]
  50291. }),
  50292. $globals.SemanticAnalyzerTest);
  50293. $core.addMethod(
  50294. $core.method({
  50295. selector: "testVariableShadowing2",
  50296. protocol: "tests",
  50297. fn: function (){
  50298. var self=this,$self=this;
  50299. var src,ast;
  50300. return $core.withContext(function($ctx1) {
  50301. src="foo | a | a + 1. [ | a | a := 2 ]";
  50302. ast=$recv($globals.Smalltalk)._parse_(src);
  50303. $self._should_raise_((function(){
  50304. return $core.withContext(function($ctx2) {
  50305. return $recv($self["@analyzer"])._visit_(ast);
  50306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50307. }),$globals.ShadowingVariableError);
  50308. return self;
  50309. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50310. },
  50311. args: [],
  50312. source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  50313. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50314. messageSends: ["parse:", "should:raise:", "visit:"]
  50315. }),
  50316. $globals.SemanticAnalyzerTest);
  50317. $core.addMethod(
  50318. $core.method({
  50319. selector: "testVariableShadowing3",
  50320. protocol: "tests",
  50321. fn: function (){
  50322. var self=this,$self=this;
  50323. var src,ast;
  50324. return $core.withContext(function($ctx1) {
  50325. src="foo | a | a + 1. [ | b | b := 2 ]";
  50326. ast=$recv($globals.Smalltalk)._parse_(src);
  50327. $recv($self["@analyzer"])._visit_(ast);
  50328. return self;
  50329. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50330. },
  50331. args: [],
  50332. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50333. referencedClasses: ["Smalltalk"],
  50334. messageSends: ["parse:", "visit:"]
  50335. }),
  50336. $globals.SemanticAnalyzerTest);
  50337. $core.addMethod(
  50338. $core.method({
  50339. selector: "testVariableShadowing4",
  50340. protocol: "tests",
  50341. fn: function (){
  50342. var self=this,$self=this;
  50343. var src,ast;
  50344. return $core.withContext(function($ctx1) {
  50345. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50346. ast=$recv($globals.Smalltalk)._parse_(src);
  50347. $recv($self["@analyzer"])._visit_(ast);
  50348. return self;
  50349. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50350. },
  50351. args: [],
  50352. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50353. referencedClasses: ["Smalltalk"],
  50354. messageSends: ["parse:", "visit:"]
  50355. }),
  50356. $globals.SemanticAnalyzerTest);
  50357. $core.addMethod(
  50358. $core.method({
  50359. selector: "testVariableShadowing5",
  50360. protocol: "tests",
  50361. fn: function (){
  50362. var self=this,$self=this;
  50363. var src,ast;
  50364. return $core.withContext(function($ctx1) {
  50365. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50366. ast=$recv($globals.Smalltalk)._parse_(src);
  50367. $self._should_raise_((function(){
  50368. return $core.withContext(function($ctx2) {
  50369. return $recv($self["@analyzer"])._visit_(ast);
  50370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50371. }),$globals.ShadowingVariableError);
  50372. return self;
  50373. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50374. },
  50375. args: [],
  50376. source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  50377. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50378. messageSends: ["parse:", "should:raise:", "visit:"]
  50379. }),
  50380. $globals.SemanticAnalyzerTest);
  50381. $core.addMethod(
  50382. $core.method({
  50383. selector: "testVariablesLookup",
  50384. protocol: "tests",
  50385. fn: function (){
  50386. var self=this,$self=this;
  50387. var src,ast;
  50388. return $core.withContext(function($ctx1) {
  50389. var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28;
  50390. src="foo | a | a + 1. [ | b | b := a ]";
  50391. ast=$recv($globals.Smalltalk)._parse_(src);
  50392. $recv($self["@analyzer"])._visit_(ast);
  50393. $7=$recv(ast)._dagChildren();
  50394. $ctx1.sendIdx["dagChildren"]=2;
  50395. $6=$recv($7)._first();
  50396. $ctx1.sendIdx["first"]=2;
  50397. $5=$recv($6)._dagChildren();
  50398. $ctx1.sendIdx["dagChildren"]=1;
  50399. $4=$recv($5)._first();
  50400. $ctx1.sendIdx["first"]=1;
  50401. $3=$recv($4)._receiver();
  50402. $ctx1.sendIdx["receiver"]=1;
  50403. $2=$recv($3)._binding();
  50404. $ctx1.sendIdx["binding"]=1;
  50405. $1=$recv($2)._isTempVar();
  50406. $ctx1.sendIdx["isTempVar"]=1;
  50407. $self._assert_($1);
  50408. $ctx1.sendIdx["assert:"]=1;
  50409. $15=$recv(ast)._dagChildren();
  50410. $ctx1.sendIdx["dagChildren"]=4;
  50411. $14=$recv($15)._first();
  50412. $ctx1.sendIdx["first"]=4;
  50413. $13=$recv($14)._dagChildren();
  50414. $ctx1.sendIdx["dagChildren"]=3;
  50415. $12=$recv($13)._first();
  50416. $ctx1.sendIdx["first"]=3;
  50417. $11=$recv($12)._receiver();
  50418. $10=$recv($11)._binding();
  50419. $ctx1.sendIdx["binding"]=2;
  50420. $9=$recv($10)._scope();
  50421. $ctx1.sendIdx["scope"]=1;
  50422. $16=$recv(ast)._scope();
  50423. $ctx1.sendIdx["scope"]=2;
  50424. $8=$recv($9).__eq_eq($16);
  50425. $ctx1.sendIdx["=="]=1;
  50426. $self._assert_($8);
  50427. $ctx1.sendIdx["assert:"]=2;
  50428. $27=$recv(ast)._dagChildren();
  50429. $ctx1.sendIdx["dagChildren"]=8;
  50430. $26=$recv($27)._first();
  50431. $ctx1.sendIdx["first"]=7;
  50432. $25=$recv($26)._dagChildren();
  50433. $ctx1.sendIdx["dagChildren"]=7;
  50434. $24=$recv($25)._last();
  50435. $ctx1.sendIdx["last"]=1;
  50436. $23=$recv($24)._dagChildren();
  50437. $ctx1.sendIdx["dagChildren"]=6;
  50438. $22=$recv($23)._first();
  50439. $ctx1.sendIdx["first"]=6;
  50440. $21=$recv($22)._dagChildren();
  50441. $ctx1.sendIdx["dagChildren"]=5;
  50442. $20=$recv($21)._first();
  50443. $ctx1.sendIdx["first"]=5;
  50444. $19=$recv($20)._left();
  50445. $ctx1.sendIdx["left"]=1;
  50446. $18=$recv($19)._binding();
  50447. $ctx1.sendIdx["binding"]=3;
  50448. $17=$recv($18)._isTempVar();
  50449. $self._assert_($17);
  50450. $ctx1.sendIdx["assert:"]=3;
  50451. $39=$recv(ast)._dagChildren();
  50452. $ctx1.sendIdx["dagChildren"]=12;
  50453. $38=$recv($39)._first();
  50454. $ctx1.sendIdx["first"]=10;
  50455. $37=$recv($38)._dagChildren();
  50456. $ctx1.sendIdx["dagChildren"]=11;
  50457. $36=$recv($37)._last();
  50458. $ctx1.sendIdx["last"]=2;
  50459. $35=$recv($36)._dagChildren();
  50460. $ctx1.sendIdx["dagChildren"]=10;
  50461. $34=$recv($35)._first();
  50462. $ctx1.sendIdx["first"]=9;
  50463. $33=$recv($34)._dagChildren();
  50464. $ctx1.sendIdx["dagChildren"]=9;
  50465. $32=$recv($33)._first();
  50466. $ctx1.sendIdx["first"]=8;
  50467. $31=$recv($32)._left();
  50468. $30=$recv($31)._binding();
  50469. $29=$recv($30)._scope();
  50470. $ctx1.sendIdx["scope"]=3;
  50471. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50472. $ctx1.sendIdx["dagChildren"]=13;
  50473. $41=$recv($42)._last();
  50474. $40=$recv($41)._scope();
  50475. $28=$recv($29).__eq_eq($40);
  50476. $self._assert_($28);
  50477. return self;
  50478. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50479. },
  50480. args: [],
  50481. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast dagChildren first dagChildren first receiver binding isTempVar.\x0a\x09self assert: ast dagChildren first dagChildren first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first left binding isTempVar.\x0a\x09self assert: ast dagChildren first dagChildren last dagChildren first dagChildren first left binding scope == ast dagChildren first dagChildren last scope.",
  50482. referencedClasses: ["Smalltalk"],
  50483. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50484. }),
  50485. $globals.SemanticAnalyzerTest);
  50486. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50487. $core.addMethod(
  50488. $core.method({
  50489. selector: "setUp",
  50490. protocol: "running",
  50491. fn: function (){
  50492. var self=this,$self=this;
  50493. return $core.withContext(function($ctx1) {
  50494. var $1,$3,$4,$2;
  50495. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50496. $3=$recv($globals.AIContext)._new();
  50497. $recv($3)._defineLocal_("local");
  50498. $recv($3)._localAt_put_("local",(3));
  50499. $4=$recv($3)._yourself();
  50500. $ctx1.sendIdx["yourself"]=1;
  50501. $2=$4;
  50502. $recv($1)._context_($2);
  50503. $self["@analyzer"]=$recv($1)._yourself();
  50504. return self;
  50505. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50506. },
  50507. args: [],
  50508. source: "setUp\x0a\x09analyzer := (AISemanticAnalyzer on: Object)\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09defineLocal: 'local';\x0a\x09\x09\x09localAt: 'local' put: 3;\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  50509. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50510. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50511. }),
  50512. $globals.AISemanticAnalyzerTest);
  50513. $core.addMethod(
  50514. $core.method({
  50515. selector: "testContextVariables",
  50516. protocol: "tests",
  50517. fn: function (){
  50518. var self=this,$self=this;
  50519. var src,ast;
  50520. return $core.withContext(function($ctx1) {
  50521. src="foo | a | local + a";
  50522. ast=$recv($globals.Smalltalk)._parse_(src);
  50523. $self._shouldnt_raise_((function(){
  50524. return $core.withContext(function($ctx2) {
  50525. return $recv($self["@analyzer"])._visit_(ast);
  50526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50527. }),$globals.UnknownVariableError);
  50528. return self;
  50529. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50530. },
  50531. args: [],
  50532. source: "testContextVariables\x0a\x09| src ast |\x0a\x09\x0a\x09src := 'foo | a | local + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError",
  50533. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50534. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50535. }),
  50536. $globals.AISemanticAnalyzerTest);
  50537. });
  50538. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50539. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50540. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50541. $core.addPackage("Kernel-Tests");
  50542. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  50543. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50544. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50545. $core.addMethod(
  50546. $core.method({
  50547. selector: "testAddExtensionMethod",
  50548. protocol: "tests",
  50549. fn: function (){
  50550. var self=this,$self=this;
  50551. var method,dirty;
  50552. return $core.withContext(function($ctx1) {
  50553. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50554. $2=$self._class();
  50555. $ctx1.sendIdx["class"]=1;
  50556. $1=$recv($2)._package();
  50557. $ctx1.sendIdx["package"]=1;
  50558. dirty=$recv($1)._isDirty();
  50559. $ctx1.sendIdx["isDirty"]=1;
  50560. $4=$self._class();
  50561. $ctx1.sendIdx["class"]=2;
  50562. $3=$recv($4)._package();
  50563. $ctx1.sendIdx["package"]=2;
  50564. $recv($3)._beClean();
  50565. $5=$self._class();
  50566. $ctx1.sendIdx["class"]=3;
  50567. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50568. $8=$self._class();
  50569. $ctx1.sendIdx["class"]=4;
  50570. $7=$recv($8)._package();
  50571. $ctx1.sendIdx["package"]=3;
  50572. $6=$recv($7)._isDirty();
  50573. $self._deny_($6);
  50574. $9=$self._class();
  50575. $ctx1.sendIdx["class"]=5;
  50576. $recv($9)._removeCompiledMethod_(method);
  50577. $10=dirty;
  50578. if($core.assert($10)){
  50579. $recv($recv($self._class())._package())._beDirty();
  50580. }
  50581. return self;
  50582. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50583. },
  50584. args: [],
  50585. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  50586. referencedClasses: [],
  50587. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50588. }),
  50589. $globals.AnnouncementSubscriptionTest);
  50590. $core.addMethod(
  50591. $core.method({
  50592. selector: "testHandlesAnnouncement",
  50593. protocol: "tests",
  50594. fn: function (){
  50595. var self=this,$self=this;
  50596. var subscription,announcementClass1,announcementClass2,classBuilder;
  50597. return $core.withContext(function($ctx1) {
  50598. var $1,$2;
  50599. classBuilder=$recv($globals.ClassBuilder)._new();
  50600. $ctx1.sendIdx["new"]=1;
  50601. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50602. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  50603. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  50604. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50605. $self._assert_equals_($1,true);
  50606. $ctx1.sendIdx["assert:equals:"]=1;
  50607. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  50608. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50609. $self._assert_equals_($2,true);
  50610. $ctx1.sendIdx["assert:equals:"]=2;
  50611. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  50612. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50613. return self;
  50614. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50615. },
  50616. args: [],
  50617. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  50618. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50619. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50620. }),
  50621. $globals.AnnouncementSubscriptionTest);
  50622. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50623. $core.addMethod(
  50624. $core.method({
  50625. selector: "testOnDo",
  50626. protocol: "tests",
  50627. fn: function (){
  50628. var self=this,$self=this;
  50629. var counter,announcer;
  50630. return $core.withContext(function($ctx1) {
  50631. var $1,$2;
  50632. counter=(0);
  50633. announcer=$recv($globals.Announcer)._new();
  50634. $ctx1.sendIdx["new"]=1;
  50635. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50636. return $core.withContext(function($ctx2) {
  50637. counter=$recv(counter).__plus((1));
  50638. return counter;
  50639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50640. }));
  50641. $1=announcer;
  50642. $2=$recv($globals.SystemAnnouncement)._new();
  50643. $ctx1.sendIdx["new"]=2;
  50644. $recv($1)._announce_($2);
  50645. $ctx1.sendIdx["announce:"]=1;
  50646. $self._assert_equals_(counter,(1));
  50647. $ctx1.sendIdx["assert:equals:"]=1;
  50648. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50649. $self._assert_equals_(counter,(2));
  50650. return self;
  50651. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50652. },
  50653. args: [],
  50654. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  50655. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50656. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50657. }),
  50658. $globals.AnnouncerTest);
  50659. $core.addMethod(
  50660. $core.method({
  50661. selector: "testOnDoFor",
  50662. protocol: "tests",
  50663. fn: function (){
  50664. var self=this,$self=this;
  50665. var counter,announcer;
  50666. return $core.withContext(function($ctx1) {
  50667. var $1,$2,$3,$4;
  50668. counter=(0);
  50669. announcer=$recv($globals.Announcer)._new();
  50670. $ctx1.sendIdx["new"]=1;
  50671. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50672. return $core.withContext(function($ctx2) {
  50673. counter=$recv(counter).__plus((1));
  50674. return counter;
  50675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50676. }),self);
  50677. $1=announcer;
  50678. $2=$recv($globals.SystemAnnouncement)._new();
  50679. $ctx1.sendIdx["new"]=2;
  50680. $recv($1)._announce_($2);
  50681. $ctx1.sendIdx["announce:"]=1;
  50682. $self._assert_equals_(counter,(1));
  50683. $ctx1.sendIdx["assert:equals:"]=1;
  50684. $3=announcer;
  50685. $4=$recv($globals.SystemAnnouncement)._new();
  50686. $ctx1.sendIdx["new"]=3;
  50687. $recv($3)._announce_($4);
  50688. $ctx1.sendIdx["announce:"]=2;
  50689. $self._assert_equals_(counter,(2));
  50690. $ctx1.sendIdx["assert:equals:"]=2;
  50691. $recv(announcer)._unsubscribe_(self);
  50692. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50693. $self._assert_equals_(counter,(2));
  50694. return self;
  50695. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50696. },
  50697. args: [],
  50698. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  50699. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50700. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50701. }),
  50702. $globals.AnnouncerTest);
  50703. $core.addMethod(
  50704. $core.method({
  50705. selector: "testOnDoOnce",
  50706. protocol: "tests",
  50707. fn: function (){
  50708. var self=this,$self=this;
  50709. var counter,announcer;
  50710. return $core.withContext(function($ctx1) {
  50711. var $1,$2;
  50712. counter=(0);
  50713. announcer=$recv($globals.Announcer)._new();
  50714. $ctx1.sendIdx["new"]=1;
  50715. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50716. return $core.withContext(function($ctx2) {
  50717. counter=$recv(counter).__plus((1));
  50718. return counter;
  50719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50720. }));
  50721. $1=announcer;
  50722. $2=$recv($globals.SystemAnnouncement)._new();
  50723. $ctx1.sendIdx["new"]=2;
  50724. $recv($1)._announce_($2);
  50725. $ctx1.sendIdx["announce:"]=1;
  50726. $self._assert_equals_(counter,(1));
  50727. $ctx1.sendIdx["assert:equals:"]=1;
  50728. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50729. $self._assert_equals_(counter,(1));
  50730. return self;
  50731. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50732. },
  50733. args: [],
  50734. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  50735. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50736. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50737. }),
  50738. $globals.AnnouncerTest);
  50739. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50740. $core.addMethod(
  50741. $core.method({
  50742. selector: "localReturnOnDoCatch",
  50743. protocol: "fixture",
  50744. fn: function (){
  50745. var self=this,$self=this;
  50746. return $core.withContext(function($ctx1) {
  50747. var $early={};
  50748. try {
  50749. $recv((function(){
  50750. throw $early=[(2)];
  50751. }))._on_do_($globals.Error,(function(){
  50752. }));
  50753. return (3);
  50754. }
  50755. catch(e) {if(e===$early)return e[0]; throw e}
  50756. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50757. },
  50758. args: [],
  50759. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50760. referencedClasses: ["Error"],
  50761. messageSends: ["on:do:"]
  50762. }),
  50763. $globals.BlockClosureTest);
  50764. $core.addMethod(
  50765. $core.method({
  50766. selector: "localReturnOnDoMiss",
  50767. protocol: "fixture",
  50768. fn: function (){
  50769. var self=this,$self=this;
  50770. return $core.withContext(function($ctx1) {
  50771. var $early={};
  50772. try {
  50773. $recv((function(){
  50774. throw $early=[(2)];
  50775. }))._on_do_($globals.Class,(function(){
  50776. }));
  50777. return (3);
  50778. }
  50779. catch(e) {if(e===$early)return e[0]; throw e}
  50780. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50781. },
  50782. args: [],
  50783. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50784. referencedClasses: ["Class"],
  50785. messageSends: ["on:do:"]
  50786. }),
  50787. $globals.BlockClosureTest);
  50788. $core.addMethod(
  50789. $core.method({
  50790. selector: "testCanClearInterval",
  50791. protocol: "tests",
  50792. fn: function (){
  50793. var self=this,$self=this;
  50794. return $core.withContext(function($ctx1) {
  50795. $self._shouldnt_raise_((function(){
  50796. return $core.withContext(function($ctx2) {
  50797. return $recv($recv((function(){
  50798. return $core.withContext(function($ctx3) {
  50799. return $recv($recv($globals.Error)._new())._signal();
  50800. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50801. }))._valueWithInterval_((0)))._clearInterval();
  50802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50803. }),$globals.Error);
  50804. return self;
  50805. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50806. },
  50807. args: [],
  50808. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50809. referencedClasses: ["Error"],
  50810. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50811. }),
  50812. $globals.BlockClosureTest);
  50813. $core.addMethod(
  50814. $core.method({
  50815. selector: "testCanClearTimeout",
  50816. protocol: "tests",
  50817. fn: function (){
  50818. var self=this,$self=this;
  50819. return $core.withContext(function($ctx1) {
  50820. $self._shouldnt_raise_((function(){
  50821. return $core.withContext(function($ctx2) {
  50822. return $recv($recv((function(){
  50823. return $core.withContext(function($ctx3) {
  50824. return $recv($recv($globals.Error)._new())._signal();
  50825. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50826. }))._valueWithTimeout_((0)))._clearTimeout();
  50827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50828. }),$globals.Error);
  50829. return self;
  50830. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50831. },
  50832. args: [],
  50833. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50834. referencedClasses: ["Error"],
  50835. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50836. }),
  50837. $globals.BlockClosureTest);
  50838. $core.addMethod(
  50839. $core.method({
  50840. selector: "testCompiledSource",
  50841. protocol: "tests",
  50842. fn: function (){
  50843. var self=this,$self=this;
  50844. return $core.withContext(function($ctx1) {
  50845. $self._assert_($recv($recv((function(){
  50846. return $core.withContext(function($ctx2) {
  50847. return (1).__plus((1));
  50848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50849. }))._compiledSource())._includesSubString_("function"));
  50850. return self;
  50851. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50852. },
  50853. args: [],
  50854. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50855. referencedClasses: [],
  50856. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50857. }),
  50858. $globals.BlockClosureTest);
  50859. $core.addMethod(
  50860. $core.method({
  50861. selector: "testCurrySelf",
  50862. protocol: "tests",
  50863. fn: function (){
  50864. var self=this,$self=this;
  50865. var curriedMethod,array;
  50866. return $core.withContext(function($ctx1) {
  50867. curriedMethod=$recv($recv((function(selfarg,x){
  50868. return $core.withContext(function($ctx2) {
  50869. return $recv(selfarg)._at_(x);
  50870. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50871. }))._currySelf())._asCompiledMethod_("foo:");
  50872. array=[(3), (1), (4)];
  50873. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  50874. $recv((function(){
  50875. return $core.withContext(function($ctx2) {
  50876. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50878. }))._ensure_((function(){
  50879. return $core.withContext(function($ctx2) {
  50880. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50882. }));
  50883. return self;
  50884. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  50885. },
  50886. args: [],
  50887. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  50888. referencedClasses: ["ClassBuilder", "Array"],
  50889. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50890. }),
  50891. $globals.BlockClosureTest);
  50892. $core.addMethod(
  50893. $core.method({
  50894. selector: "testEnsure",
  50895. protocol: "tests",
  50896. fn: function (){
  50897. var self=this,$self=this;
  50898. return $core.withContext(function($ctx1) {
  50899. $self._assert_equals_($recv((function(){
  50900. return (3);
  50901. }))._ensure_((function(){
  50902. return (4);
  50903. })),(3));
  50904. return self;
  50905. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  50906. },
  50907. args: [],
  50908. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50909. referencedClasses: [],
  50910. messageSends: ["assert:equals:", "ensure:"]
  50911. }),
  50912. $globals.BlockClosureTest);
  50913. $core.addMethod(
  50914. $core.method({
  50915. selector: "testEnsureRaises",
  50916. protocol: "tests",
  50917. fn: function (){
  50918. var self=this,$self=this;
  50919. return $core.withContext(function($ctx1) {
  50920. $self._should_raise_((function(){
  50921. return $core.withContext(function($ctx2) {
  50922. return $recv((function(){
  50923. return $core.withContext(function($ctx3) {
  50924. return $recv($recv($globals.Error)._new())._signal();
  50925. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50926. }))._ensure_((function(){
  50927. return true;
  50928. }));
  50929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50930. }),$globals.Error);
  50931. return self;
  50932. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  50933. },
  50934. args: [],
  50935. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  50936. referencedClasses: ["Error"],
  50937. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  50938. }),
  50939. $globals.BlockClosureTest);
  50940. $core.addMethod(
  50941. $core.method({
  50942. selector: "testExceptionSemantics",
  50943. protocol: "tests",
  50944. fn: function (){
  50945. var self=this,$self=this;
  50946. return $core.withContext(function($ctx1) {
  50947. $self._timeout_((100));
  50948. $recv($self._async_((function(){
  50949. return $core.withContext(function($ctx2) {
  50950. return $recv((function(){
  50951. return $core.withContext(function($ctx3) {
  50952. $self._assert_(true);
  50953. $recv($globals.Error)._signal();
  50954. $self._deny_(true);
  50955. return $self._finished();
  50956. $ctx3.sendIdx["finished"]=1;
  50957. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50958. }))._on_do_($globals.Error,(function(ex){
  50959. return $core.withContext(function($ctx3) {
  50960. return $self._finished();
  50961. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  50962. }));
  50963. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50964. })))._valueWithTimeout_((0));
  50965. return self;
  50966. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  50967. },
  50968. args: [],
  50969. source: "testExceptionSemantics\x0a\x09\x22See https://lolg.it/amber/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  50970. referencedClasses: ["Error"],
  50971. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  50972. }),
  50973. $globals.BlockClosureTest);
  50974. $core.addMethod(
  50975. $core.method({
  50976. selector: "testLocalReturnOnDoCatch",
  50977. protocol: "tests",
  50978. fn: function (){
  50979. var self=this,$self=this;
  50980. return $core.withContext(function($ctx1) {
  50981. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  50982. return self;
  50983. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50984. },
  50985. args: [],
  50986. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  50987. referencedClasses: [],
  50988. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  50989. }),
  50990. $globals.BlockClosureTest);
  50991. $core.addMethod(
  50992. $core.method({
  50993. selector: "testLocalReturnOnDoMiss",
  50994. protocol: "tests",
  50995. fn: function (){
  50996. var self=this,$self=this;
  50997. return $core.withContext(function($ctx1) {
  50998. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  50999. return self;
  51000. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51001. },
  51002. args: [],
  51003. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  51004. referencedClasses: [],
  51005. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  51006. }),
  51007. $globals.BlockClosureTest);
  51008. $core.addMethod(
  51009. $core.method({
  51010. selector: "testNewWithValues",
  51011. protocol: "tests",
  51012. fn: function (){
  51013. var self=this,$self=this;
  51014. return $core.withContext(function($ctx1) {
  51015. function TestConstructor(arg1, arg2, arg3) {}
  51016. TestConstructor.prototype.name = "theTestPrototype";
  51017. var wrappedConstructor = $recv(TestConstructor);
  51018. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  51019. $self._assert_(result instanceof TestConstructor);
  51020. $self._assert_equals_(result.name, "theTestPrototype");
  51021. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  51022. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  51023. return self;
  51024. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  51025. },
  51026. args: [],
  51027. source: "testNewWithValues\x0a<inlineJS: '\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = \x22theTestPrototype\x22;\x0a\x0a\x09var wrappedConstructor = $recv(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3]);\x0a\x09$self._assert_(result instanceof TestConstructor);\x0a\x09$self._assert_equals_(result.name, \x22theTestPrototype\x22);\x0a\x0a\x09/* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */\x0a\x09$self._should_raise_(function () {wrappedConstructor._newWithValues_(\x22single argument\x22);}, $globals.Error);\x0a'>",
  51028. referencedClasses: [],
  51029. messageSends: []
  51030. }),
  51031. $globals.BlockClosureTest);
  51032. $core.addMethod(
  51033. $core.method({
  51034. selector: "testNumArgs",
  51035. protocol: "tests",
  51036. fn: function (){
  51037. var self=this,$self=this;
  51038. return $core.withContext(function($ctx1) {
  51039. var $1;
  51040. $1=$recv((function(){
  51041. }))._numArgs();
  51042. $ctx1.sendIdx["numArgs"]=1;
  51043. $self._assert_equals_($1,(0));
  51044. $ctx1.sendIdx["assert:equals:"]=1;
  51045. $self._assert_equals_($recv((function(a,b){
  51046. }))._numArgs(),(2));
  51047. return self;
  51048. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  51049. },
  51050. args: [],
  51051. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  51052. referencedClasses: [],
  51053. messageSends: ["assert:equals:", "numArgs"]
  51054. }),
  51055. $globals.BlockClosureTest);
  51056. $core.addMethod(
  51057. $core.method({
  51058. selector: "testOnDo",
  51059. protocol: "tests",
  51060. fn: function (){
  51061. var self=this,$self=this;
  51062. return $core.withContext(function($ctx1) {
  51063. $self._assert_($recv((function(){
  51064. return $core.withContext(function($ctx2) {
  51065. return $recv($recv($globals.Error)._new())._signal();
  51066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51067. }))._on_do_($globals.Error,(function(ex){
  51068. return true;
  51069. })));
  51070. return self;
  51071. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  51072. },
  51073. args: [],
  51074. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  51075. referencedClasses: ["Error"],
  51076. messageSends: ["assert:", "on:do:", "signal", "new"]
  51077. }),
  51078. $globals.BlockClosureTest);
  51079. $core.addMethod(
  51080. $core.method({
  51081. selector: "testValue",
  51082. protocol: "tests",
  51083. fn: function (){
  51084. var self=this,$self=this;
  51085. return $core.withContext(function($ctx1) {
  51086. var $1;
  51087. $1=$recv((function(){
  51088. return $core.withContext(function($ctx2) {
  51089. return (1).__plus((1));
  51090. $ctx2.sendIdx["+"]=1;
  51091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51092. }))._value();
  51093. $ctx1.sendIdx["value"]=1;
  51094. $self._assert_equals_($1,(2));
  51095. $ctx1.sendIdx["assert:equals:"]=1;
  51096. $self._assert_equals_($recv((function(x){
  51097. return $core.withContext(function($ctx2) {
  51098. return $recv(x).__plus((1));
  51099. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  51100. }))._value_((2)),(3));
  51101. $ctx1.sendIdx["assert:equals:"]=2;
  51102. $self._assert_equals_($recv((function(x,y){
  51103. return $core.withContext(function($ctx2) {
  51104. return $recv(x).__star(y);
  51105. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  51106. }))._value_value_((2),(4)),(8));
  51107. $ctx1.sendIdx["assert:equals:"]=3;
  51108. $self._assert_equals_($recv((function(a,b,c){
  51109. return (1);
  51110. }))._value(),(1));
  51111. return self;
  51112. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  51113. },
  51114. args: [],
  51115. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  51116. referencedClasses: [],
  51117. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  51118. }),
  51119. $globals.BlockClosureTest);
  51120. $core.addMethod(
  51121. $core.method({
  51122. selector: "testValueWithPossibleArguments",
  51123. protocol: "tests",
  51124. fn: function (){
  51125. var self=this,$self=this;
  51126. return $core.withContext(function($ctx1) {
  51127. var $1,$2;
  51128. $1=$recv((function(){
  51129. return (1);
  51130. }))._valueWithPossibleArguments_([(3), (4)]);
  51131. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  51132. $self._assert_equals_($1,(1));
  51133. $ctx1.sendIdx["assert:equals:"]=1;
  51134. $2=$recv((function(a){
  51135. return $core.withContext(function($ctx2) {
  51136. return $recv(a).__plus((4));
  51137. $ctx2.sendIdx["+"]=1;
  51138. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  51139. }))._valueWithPossibleArguments_([(3), (4)]);
  51140. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  51141. $self._assert_equals_($2,(7));
  51142. $ctx1.sendIdx["assert:equals:"]=2;
  51143. $self._assert_equals_($recv((function(a,b){
  51144. return $core.withContext(function($ctx2) {
  51145. return $recv(a).__plus(b);
  51146. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  51147. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  51148. return self;
  51149. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  51150. },
  51151. args: [],
  51152. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  51153. referencedClasses: [],
  51154. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  51155. }),
  51156. $globals.BlockClosureTest);
  51157. $core.addMethod(
  51158. $core.method({
  51159. selector: "testWhileFalse",
  51160. protocol: "tests",
  51161. fn: function (){
  51162. var self=this,$self=this;
  51163. var i;
  51164. return $core.withContext(function($ctx1) {
  51165. i=(0);
  51166. $recv((function(){
  51167. return $core.withContext(function($ctx2) {
  51168. return $recv(i).__gt((5));
  51169. $ctx2.sendIdx[">"]=1;
  51170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51171. }))._whileFalse_((function(){
  51172. return $core.withContext(function($ctx2) {
  51173. i=$recv(i).__plus((1));
  51174. $ctx2.sendIdx["+"]=1;
  51175. return i;
  51176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51177. }));
  51178. $self._assert_equals_(i,(6));
  51179. $ctx1.sendIdx["assert:equals:"]=1;
  51180. i=(0);
  51181. $recv((function(){
  51182. return $core.withContext(function($ctx2) {
  51183. i=$recv(i).__plus((1));
  51184. return $recv(i).__gt((5));
  51185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51186. }))._whileFalse();
  51187. $self._assert_equals_(i,(6));
  51188. return self;
  51189. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  51190. },
  51191. args: [],
  51192. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  51193. referencedClasses: [],
  51194. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  51195. }),
  51196. $globals.BlockClosureTest);
  51197. $core.addMethod(
  51198. $core.method({
  51199. selector: "testWhileTrue",
  51200. protocol: "tests",
  51201. fn: function (){
  51202. var self=this,$self=this;
  51203. var i;
  51204. return $core.withContext(function($ctx1) {
  51205. i=(0);
  51206. $recv((function(){
  51207. return $core.withContext(function($ctx2) {
  51208. return $recv(i).__lt((5));
  51209. $ctx2.sendIdx["<"]=1;
  51210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51211. }))._whileTrue_((function(){
  51212. return $core.withContext(function($ctx2) {
  51213. i=$recv(i).__plus((1));
  51214. $ctx2.sendIdx["+"]=1;
  51215. return i;
  51216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51217. }));
  51218. $self._assert_equals_(i,(5));
  51219. $ctx1.sendIdx["assert:equals:"]=1;
  51220. i=(0);
  51221. $recv((function(){
  51222. return $core.withContext(function($ctx2) {
  51223. i=$recv(i).__plus((1));
  51224. return $recv(i).__lt((5));
  51225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51226. }))._whileTrue();
  51227. $self._assert_equals_(i,(5));
  51228. return self;
  51229. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51230. },
  51231. args: [],
  51232. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  51233. referencedClasses: [],
  51234. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51235. }),
  51236. $globals.BlockClosureTest);
  51237. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51238. $core.addMethod(
  51239. $core.method({
  51240. selector: "testEquality",
  51241. protocol: "tests",
  51242. fn: function (){
  51243. var self=this,$self=this;
  51244. return $core.withContext(function($ctx1) {
  51245. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51246. $1=(0).__eq(false);
  51247. $ctx1.sendIdx["="]=1;
  51248. $self._deny_($1);
  51249. $ctx1.sendIdx["deny:"]=1;
  51250. $2=false.__eq((0));
  51251. $ctx1.sendIdx["="]=2;
  51252. $self._deny_($2);
  51253. $ctx1.sendIdx["deny:"]=2;
  51254. $3="".__eq(false);
  51255. $ctx1.sendIdx["="]=3;
  51256. $self._deny_($3);
  51257. $ctx1.sendIdx["deny:"]=3;
  51258. $4=false.__eq("");
  51259. $ctx1.sendIdx["="]=4;
  51260. $self._deny_($4);
  51261. $ctx1.sendIdx["deny:"]=4;
  51262. $5=true.__eq(true);
  51263. $ctx1.sendIdx["="]=5;
  51264. $self._assert_($5);
  51265. $ctx1.sendIdx["assert:"]=1;
  51266. $6=false.__eq(true);
  51267. $ctx1.sendIdx["="]=6;
  51268. $self._deny_($6);
  51269. $ctx1.sendIdx["deny:"]=5;
  51270. $7=true.__eq(false);
  51271. $ctx1.sendIdx["="]=7;
  51272. $self._deny_($7);
  51273. $8=false.__eq(false);
  51274. $ctx1.sendIdx["="]=8;
  51275. $self._assert_($8);
  51276. $ctx1.sendIdx["assert:"]=2;
  51277. $10=true._yourself();
  51278. $ctx1.sendIdx["yourself"]=1;
  51279. $9=$recv($10).__eq(true);
  51280. $ctx1.sendIdx["="]=9;
  51281. $self._assert_($9);
  51282. $ctx1.sendIdx["assert:"]=3;
  51283. $12=true._yourself();
  51284. $ctx1.sendIdx["yourself"]=2;
  51285. $11=$recv($12).__eq(true._yourself());
  51286. $self._assert_($11);
  51287. return self;
  51288. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51289. },
  51290. args: [],
  51291. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  51292. referencedClasses: [],
  51293. messageSends: ["deny:", "=", "assert:", "yourself"]
  51294. }),
  51295. $globals.BooleanTest);
  51296. $core.addMethod(
  51297. $core.method({
  51298. selector: "testIdentity",
  51299. protocol: "tests",
  51300. fn: function (){
  51301. var self=this,$self=this;
  51302. return $core.withContext(function($ctx1) {
  51303. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51304. $1=(0).__eq_eq(false);
  51305. $ctx1.sendIdx["=="]=1;
  51306. $self._deny_($1);
  51307. $ctx1.sendIdx["deny:"]=1;
  51308. $2=false.__eq_eq((0));
  51309. $ctx1.sendIdx["=="]=2;
  51310. $self._deny_($2);
  51311. $ctx1.sendIdx["deny:"]=2;
  51312. $3="".__eq_eq(false);
  51313. $ctx1.sendIdx["=="]=3;
  51314. $self._deny_($3);
  51315. $ctx1.sendIdx["deny:"]=3;
  51316. $4=false.__eq_eq("");
  51317. $ctx1.sendIdx["=="]=4;
  51318. $self._deny_($4);
  51319. $ctx1.sendIdx["deny:"]=4;
  51320. $5=true.__eq_eq(true);
  51321. $ctx1.sendIdx["=="]=5;
  51322. $self._assert_($5);
  51323. $ctx1.sendIdx["assert:"]=1;
  51324. $6=false.__eq_eq(true);
  51325. $ctx1.sendIdx["=="]=6;
  51326. $self._deny_($6);
  51327. $ctx1.sendIdx["deny:"]=5;
  51328. $7=true.__eq_eq(false);
  51329. $ctx1.sendIdx["=="]=7;
  51330. $self._deny_($7);
  51331. $8=false.__eq_eq(false);
  51332. $ctx1.sendIdx["=="]=8;
  51333. $self._assert_($8);
  51334. $ctx1.sendIdx["assert:"]=2;
  51335. $10=true._yourself();
  51336. $ctx1.sendIdx["yourself"]=1;
  51337. $9=$recv($10).__eq_eq(true);
  51338. $ctx1.sendIdx["=="]=9;
  51339. $self._assert_($9);
  51340. $ctx1.sendIdx["assert:"]=3;
  51341. $12=true._yourself();
  51342. $ctx1.sendIdx["yourself"]=2;
  51343. $11=$recv($12).__eq_eq(true._yourself());
  51344. $self._assert_($11);
  51345. return self;
  51346. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51347. },
  51348. args: [],
  51349. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  51350. referencedClasses: [],
  51351. messageSends: ["deny:", "==", "assert:", "yourself"]
  51352. }),
  51353. $globals.BooleanTest);
  51354. $core.addMethod(
  51355. $core.method({
  51356. selector: "testIfTrueIfFalse",
  51357. protocol: "tests",
  51358. fn: function (){
  51359. var self=this,$self=this;
  51360. return $core.withContext(function($ctx1) {
  51361. var $1,$2,$3,$4,$5,$6,$7,$8;
  51362. if($core.assert(true)){
  51363. $1="alternative block";
  51364. }
  51365. $self._assert_equals_($1,"alternative block");
  51366. $ctx1.sendIdx["assert:equals:"]=1;
  51367. if(!$core.assert(true)){
  51368. $2="alternative block";
  51369. }
  51370. $self._assert_equals_($2,nil);
  51371. $ctx1.sendIdx["assert:equals:"]=2;
  51372. if($core.assert(false)){
  51373. $3="alternative block";
  51374. }
  51375. $self._assert_equals_($3,nil);
  51376. $ctx1.sendIdx["assert:equals:"]=3;
  51377. if(!$core.assert(false)){
  51378. $4="alternative block";
  51379. }
  51380. $self._assert_equals_($4,"alternative block");
  51381. $ctx1.sendIdx["assert:equals:"]=4;
  51382. if($core.assert(false)){
  51383. $5="alternative block";
  51384. } else {
  51385. $5="alternative block2";
  51386. }
  51387. $self._assert_equals_($5,"alternative block2");
  51388. $ctx1.sendIdx["assert:equals:"]=5;
  51389. if($core.assert(false)){
  51390. $6="alternative block2";
  51391. } else {
  51392. $6="alternative block";
  51393. }
  51394. $self._assert_equals_($6,"alternative block");
  51395. $ctx1.sendIdx["assert:equals:"]=6;
  51396. if($core.assert(true)){
  51397. $7="alternative block";
  51398. } else {
  51399. $7="alternative block2";
  51400. }
  51401. $self._assert_equals_($7,"alternative block");
  51402. $ctx1.sendIdx["assert:equals:"]=7;
  51403. if($core.assert(true)){
  51404. $8="alternative block2";
  51405. } else {
  51406. $8="alternative block";
  51407. }
  51408. $self._assert_equals_($8,"alternative block2");
  51409. return self;
  51410. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51411. },
  51412. args: [],
  51413. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  51414. referencedClasses: [],
  51415. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51416. }),
  51417. $globals.BooleanTest);
  51418. $core.addMethod(
  51419. $core.method({
  51420. selector: "testIfTrueIfFalseWithBoxing",
  51421. protocol: "tests",
  51422. fn: function (){
  51423. var self=this,$self=this;
  51424. return $core.withContext(function($ctx1) {
  51425. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51426. $2=true._yourself();
  51427. $ctx1.sendIdx["yourself"]=1;
  51428. if($core.assert($2)){
  51429. $1="alternative block";
  51430. }
  51431. $self._assert_equals_($1,"alternative block");
  51432. $ctx1.sendIdx["assert:equals:"]=1;
  51433. $4=true._yourself();
  51434. $ctx1.sendIdx["yourself"]=2;
  51435. if(!$core.assert($4)){
  51436. $3="alternative block";
  51437. }
  51438. $self._assert_equals_($3,nil);
  51439. $ctx1.sendIdx["assert:equals:"]=2;
  51440. $6=false._yourself();
  51441. $ctx1.sendIdx["yourself"]=3;
  51442. if($core.assert($6)){
  51443. $5="alternative block";
  51444. }
  51445. $self._assert_equals_($5,nil);
  51446. $ctx1.sendIdx["assert:equals:"]=3;
  51447. $8=false._yourself();
  51448. $ctx1.sendIdx["yourself"]=4;
  51449. if(!$core.assert($8)){
  51450. $7="alternative block";
  51451. }
  51452. $self._assert_equals_($7,"alternative block");
  51453. $ctx1.sendIdx["assert:equals:"]=4;
  51454. $10=false._yourself();
  51455. $ctx1.sendIdx["yourself"]=5;
  51456. if($core.assert($10)){
  51457. $9="alternative block";
  51458. } else {
  51459. $9="alternative block2";
  51460. }
  51461. $self._assert_equals_($9,"alternative block2");
  51462. $ctx1.sendIdx["assert:equals:"]=5;
  51463. $12=false._yourself();
  51464. $ctx1.sendIdx["yourself"]=6;
  51465. if($core.assert($12)){
  51466. $11="alternative block2";
  51467. } else {
  51468. $11="alternative block";
  51469. }
  51470. $self._assert_equals_($11,"alternative block");
  51471. $ctx1.sendIdx["assert:equals:"]=6;
  51472. $14=true._yourself();
  51473. $ctx1.sendIdx["yourself"]=7;
  51474. if($core.assert($14)){
  51475. $13="alternative block";
  51476. } else {
  51477. $13="alternative block2";
  51478. }
  51479. $self._assert_equals_($13,"alternative block");
  51480. $ctx1.sendIdx["assert:equals:"]=7;
  51481. $16=true._yourself();
  51482. if($core.assert($16)){
  51483. $15="alternative block2";
  51484. } else {
  51485. $15="alternative block";
  51486. }
  51487. $self._assert_equals_($15,"alternative block2");
  51488. return self;
  51489. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51490. },
  51491. args: [],
  51492. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  51493. referencedClasses: [],
  51494. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51495. }),
  51496. $globals.BooleanTest);
  51497. $core.addMethod(
  51498. $core.method({
  51499. selector: "testLogic",
  51500. protocol: "tests",
  51501. fn: function (){
  51502. var self=this,$self=this;
  51503. return $core.withContext(function($ctx1) {
  51504. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51505. $1=true.__and(true);
  51506. $ctx1.sendIdx["&"]=1;
  51507. $self._assert_($1);
  51508. $ctx1.sendIdx["assert:"]=1;
  51509. $2=true.__and(false);
  51510. $ctx1.sendIdx["&"]=2;
  51511. $self._deny_($2);
  51512. $ctx1.sendIdx["deny:"]=1;
  51513. $3=false.__and(true);
  51514. $ctx1.sendIdx["&"]=3;
  51515. $self._deny_($3);
  51516. $ctx1.sendIdx["deny:"]=2;
  51517. $5=false.__and(false);
  51518. $ctx1.sendIdx["&"]=4;
  51519. $4=$self._deny_($5);
  51520. $ctx1.sendIdx["deny:"]=3;
  51521. $6=true.__or(true);
  51522. $ctx1.sendIdx["|"]=1;
  51523. $self._assert_($6);
  51524. $ctx1.sendIdx["assert:"]=2;
  51525. $7=true.__or(false);
  51526. $ctx1.sendIdx["|"]=2;
  51527. $self._assert_($7);
  51528. $ctx1.sendIdx["assert:"]=3;
  51529. $8=false.__or(true);
  51530. $ctx1.sendIdx["|"]=3;
  51531. $self._assert_($8);
  51532. $ctx1.sendIdx["assert:"]=4;
  51533. $10=false.__or(false);
  51534. $ctx1.sendIdx["|"]=4;
  51535. $9=$self._deny_($10);
  51536. $ctx1.sendIdx["deny:"]=4;
  51537. $12=(1).__gt((0));
  51538. $ctx1.sendIdx[">"]=1;
  51539. $11=true.__and($12);
  51540. $ctx1.sendIdx["&"]=5;
  51541. $self._assert_($11);
  51542. $ctx1.sendIdx["assert:"]=5;
  51543. $14=(1).__gt((0));
  51544. $ctx1.sendIdx[">"]=2;
  51545. $13=$recv($14).__and(false);
  51546. $ctx1.sendIdx["&"]=6;
  51547. $self._deny_($13);
  51548. $ctx1.sendIdx["deny:"]=5;
  51549. $16=(1).__gt((0));
  51550. $ctx1.sendIdx[">"]=3;
  51551. $17=(1).__gt((2));
  51552. $ctx1.sendIdx[">"]=4;
  51553. $15=$recv($16).__and($17);
  51554. $self._deny_($15);
  51555. $19=(1).__gt((0));
  51556. $ctx1.sendIdx[">"]=5;
  51557. $18=false.__or($19);
  51558. $ctx1.sendIdx["|"]=5;
  51559. $self._assert_($18);
  51560. $ctx1.sendIdx["assert:"]=6;
  51561. $21=(1).__gt((0));
  51562. $ctx1.sendIdx[">"]=6;
  51563. $20=$recv($21).__or(false);
  51564. $ctx1.sendIdx["|"]=6;
  51565. $self._assert_($20);
  51566. $ctx1.sendIdx["assert:"]=7;
  51567. $23=(1).__gt((0));
  51568. $ctx1.sendIdx[">"]=7;
  51569. $22=$recv($23).__or((1).__gt((2)));
  51570. $self._assert_($22);
  51571. return self;
  51572. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51573. },
  51574. args: [],
  51575. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  51576. referencedClasses: [],
  51577. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51578. }),
  51579. $globals.BooleanTest);
  51580. $core.addMethod(
  51581. $core.method({
  51582. selector: "testLogicKeywords",
  51583. protocol: "tests",
  51584. fn: function (){
  51585. var self=this,$self=this;
  51586. return $core.withContext(function($ctx1) {
  51587. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51588. $1=true._and_((function(){
  51589. return true;
  51590. }));
  51591. $ctx1.sendIdx["and:"]=1;
  51592. $self._assert_($1);
  51593. $ctx1.sendIdx["assert:"]=1;
  51594. $2=true._and_((function(){
  51595. return false;
  51596. }));
  51597. $ctx1.sendIdx["and:"]=2;
  51598. $self._deny_($2);
  51599. $ctx1.sendIdx["deny:"]=1;
  51600. $3=false._and_((function(){
  51601. return true;
  51602. }));
  51603. $ctx1.sendIdx["and:"]=3;
  51604. $self._deny_($3);
  51605. $ctx1.sendIdx["deny:"]=2;
  51606. $5=false._and_((function(){
  51607. return false;
  51608. }));
  51609. $ctx1.sendIdx["and:"]=4;
  51610. $4=$self._deny_($5);
  51611. $ctx1.sendIdx["deny:"]=3;
  51612. $6=true._or_((function(){
  51613. return true;
  51614. }));
  51615. $ctx1.sendIdx["or:"]=1;
  51616. $self._assert_($6);
  51617. $ctx1.sendIdx["assert:"]=2;
  51618. $7=true._or_((function(){
  51619. return false;
  51620. }));
  51621. $ctx1.sendIdx["or:"]=2;
  51622. $self._assert_($7);
  51623. $ctx1.sendIdx["assert:"]=3;
  51624. $8=false._or_((function(){
  51625. return true;
  51626. }));
  51627. $ctx1.sendIdx["or:"]=3;
  51628. $self._assert_($8);
  51629. $ctx1.sendIdx["assert:"]=4;
  51630. $10=false._or_((function(){
  51631. return false;
  51632. }));
  51633. $ctx1.sendIdx["or:"]=4;
  51634. $9=$self._deny_($10);
  51635. $ctx1.sendIdx["deny:"]=4;
  51636. $11=true._and_((function(){
  51637. return $core.withContext(function($ctx2) {
  51638. return (1).__gt((0));
  51639. $ctx2.sendIdx[">"]=1;
  51640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51641. }));
  51642. $ctx1.sendIdx["and:"]=5;
  51643. $self._assert_($11);
  51644. $ctx1.sendIdx["assert:"]=5;
  51645. $13=(1).__gt((0));
  51646. $ctx1.sendIdx[">"]=2;
  51647. $12=$recv($13)._and_((function(){
  51648. return false;
  51649. }));
  51650. $ctx1.sendIdx["and:"]=6;
  51651. $self._deny_($12);
  51652. $ctx1.sendIdx["deny:"]=5;
  51653. $15=(1).__gt((0));
  51654. $ctx1.sendIdx[">"]=3;
  51655. $14=$recv($15)._and_((function(){
  51656. return $core.withContext(function($ctx2) {
  51657. return (1).__gt((2));
  51658. $ctx2.sendIdx[">"]=4;
  51659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51660. }));
  51661. $self._deny_($14);
  51662. $16=false._or_((function(){
  51663. return $core.withContext(function($ctx2) {
  51664. return (1).__gt((0));
  51665. $ctx2.sendIdx[">"]=5;
  51666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51667. }));
  51668. $ctx1.sendIdx["or:"]=5;
  51669. $self._assert_($16);
  51670. $ctx1.sendIdx["assert:"]=6;
  51671. $18=(1).__gt((0));
  51672. $ctx1.sendIdx[">"]=6;
  51673. $17=$recv($18)._or_((function(){
  51674. return false;
  51675. }));
  51676. $ctx1.sendIdx["or:"]=6;
  51677. $self._assert_($17);
  51678. $ctx1.sendIdx["assert:"]=7;
  51679. $20=(1).__gt((0));
  51680. $ctx1.sendIdx[">"]=7;
  51681. $19=$recv($20)._or_((function(){
  51682. return $core.withContext(function($ctx2) {
  51683. return (1).__gt((2));
  51684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51685. }));
  51686. $self._assert_($19);
  51687. return self;
  51688. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51689. },
  51690. args: [],
  51691. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  51692. referencedClasses: [],
  51693. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51694. }),
  51695. $globals.BooleanTest);
  51696. $core.addMethod(
  51697. $core.method({
  51698. selector: "testNonBooleanError",
  51699. protocol: "tests",
  51700. fn: function (){
  51701. var self=this,$self=this;
  51702. return $core.withContext(function($ctx1) {
  51703. $self._should_raise_((function(){
  51704. return $core.withContext(function($ctx2) {
  51705. if($core.assert("")){
  51706. } else {
  51707. }
  51708. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51709. }),$globals.NonBooleanReceiver);
  51710. return self;
  51711. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51712. },
  51713. args: [],
  51714. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51715. referencedClasses: ["NonBooleanReceiver"],
  51716. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51717. }),
  51718. $globals.BooleanTest);
  51719. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51720. $core.addMethod(
  51721. $core.method({
  51722. selector: "setUp",
  51723. protocol: "running",
  51724. fn: function (){
  51725. var self=this,$self=this;
  51726. return $core.withContext(function($ctx1) {
  51727. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51728. return self;
  51729. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51730. },
  51731. args: [],
  51732. source: "setUp\x0a\x09builder := ClassBuilder new",
  51733. referencedClasses: ["ClassBuilder"],
  51734. messageSends: ["new"]
  51735. }),
  51736. $globals.ClassBuilderTest);
  51737. $core.addMethod(
  51738. $core.method({
  51739. selector: "tearDown",
  51740. protocol: "running",
  51741. fn: function (){
  51742. var self=this,$self=this;
  51743. return $core.withContext(function($ctx1) {
  51744. var $1,$receiver;
  51745. $1=$self["@theClass"];
  51746. if(($receiver = $1) == null || $receiver.a$nil){
  51747. $1;
  51748. } else {
  51749. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51750. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51751. $self["@theClass"]=nil;
  51752. $self["@theClass"];
  51753. }
  51754. return self;
  51755. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51756. },
  51757. args: [],
  51758. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51759. referencedClasses: ["Smalltalk"],
  51760. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51761. }),
  51762. $globals.ClassBuilderTest);
  51763. $core.addMethod(
  51764. $core.method({
  51765. selector: "testAddTrait",
  51766. protocol: "tests",
  51767. fn: function (){
  51768. var self=this,$self=this;
  51769. return $core.withContext(function($ctx1) {
  51770. var $3,$2,$1,$4;
  51771. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51772. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51773. $ctx1.sendIdx["assert:equals:"]=1;
  51774. $3=$recv($self["@theClass"])._package();
  51775. $ctx1.sendIdx["package"]=1;
  51776. $2=$recv($3)._classes();
  51777. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51778. $self._assert_equals_($1,(1));
  51779. $ctx1.sendIdx["assert:equals:"]=2;
  51780. $4=$recv($self["@theClass"])._package();
  51781. $ctx1.sendIdx["package"]=2;
  51782. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51783. return self;
  51784. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51785. },
  51786. args: [],
  51787. source: "testAddTrait\x0a\x09theClass := builder addTraitNamed: 'ObjectMock2' package: 'Kernel-Tests'.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: (theClass package classes occurrencesOf: theClass) equals: 1.\x0a\x09self assert: theClass package equals: ObjectMock package",
  51788. referencedClasses: ["ObjectMock"],
  51789. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51790. }),
  51791. $globals.ClassBuilderTest);
  51792. $core.addMethod(
  51793. $core.method({
  51794. selector: "testClassCopy",
  51795. protocol: "tests",
  51796. fn: function (){
  51797. var self=this,$self=this;
  51798. return $core.withContext(function($ctx1) {
  51799. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51800. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51801. $2=$recv($self["@theClass"])._superclass();
  51802. $ctx1.sendIdx["superclass"]=1;
  51803. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51804. $ctx1.sendIdx["=="]=1;
  51805. $self._assert_($1);
  51806. $ctx1.sendIdx["assert:"]=1;
  51807. $4=$recv($self["@theClass"])._instanceVariableNames();
  51808. $ctx1.sendIdx["instanceVariableNames"]=1;
  51809. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51810. $ctx1.sendIdx["=="]=2;
  51811. $self._assert_($3);
  51812. $ctx1.sendIdx["assert:"]=2;
  51813. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51814. $ctx1.sendIdx["assert:equals:"]=1;
  51815. $6=$recv($self["@theClass"])._package();
  51816. $ctx1.sendIdx["package"]=1;
  51817. $7=$recv($globals.ObjectMock)._package();
  51818. $ctx1.sendIdx["package"]=2;
  51819. $5=$recv($6).__eq_eq($7);
  51820. $self._assert_($5);
  51821. $ctx1.sendIdx["assert:"]=3;
  51822. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51823. $9=$recv($self["@theClass"])._methodDictionary();
  51824. $ctx1.sendIdx["methodDictionary"]=1;
  51825. $8=$recv($9)._keys();
  51826. $ctx1.sendIdx["keys"]=1;
  51827. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51828. return self;
  51829. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51830. },
  51831. args: [],
  51832. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: (theClass package classes includes: theClass).\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  51833. referencedClasses: ["ObjectMock"],
  51834. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51835. }),
  51836. $globals.ClassBuilderTest);
  51837. $core.addMethod(
  51838. $core.method({
  51839. selector: "testClassMigration",
  51840. protocol: "tests",
  51841. fn: function (){
  51842. var self=this,$self=this;
  51843. var instance,oldClass;
  51844. return $core.withContext(function($ctx1) {
  51845. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51846. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51847. $2=$recv($globals.Smalltalk)._globals();
  51848. $ctx1.sendIdx["globals"]=1;
  51849. $1=$recv($2)._at_("ObjectMock2");
  51850. $ctx1.sendIdx["at:"]=1;
  51851. instance=$recv($1)._new();
  51852. $4=$recv($globals.Smalltalk)._globals();
  51853. $ctx1.sendIdx["globals"]=2;
  51854. $3=$recv($4)._at_("ObjectMock2");
  51855. $ctx1.sendIdx["at:"]=2;
  51856. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51857. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51858. $ctx1.sendIdx["=="]=1;
  51859. $self._deny_($5);
  51860. $ctx1.sendIdx["deny:"]=1;
  51861. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51862. $ctx1.sendIdx["=="]=2;
  51863. $self._assert_($6);
  51864. $ctx1.sendIdx["assert:"]=1;
  51865. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51866. $ctx1.sendIdx["assert:"]=2;
  51867. $7=$recv($globals.ObjectMock2)._selectors();
  51868. $ctx1.sendIdx["selectors"]=1;
  51869. $self._assert_equals_($7,$recv(oldClass)._selectors());
  51870. $ctx1.sendIdx["assert:equals:"]=1;
  51871. $8=$recv($globals.ObjectMock2)._comment();
  51872. $ctx1.sendIdx["comment"]=1;
  51873. $self._assert_equals_($8,$recv(oldClass)._comment());
  51874. $ctx1.sendIdx["assert:equals:"]=2;
  51875. $10=$recv($globals.ObjectMock2)._package();
  51876. $ctx1.sendIdx["package"]=1;
  51877. $9=$recv($10)._name();
  51878. $ctx1.sendIdx["name"]=1;
  51879. $self._assert_equals_($9,"Kernel-Tests");
  51880. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  51881. $ctx1.sendIdx["assert:"]=3;
  51882. $12=$recv(instance)._class();
  51883. $ctx1.sendIdx["class"]=1;
  51884. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  51885. $self._deny_($11);
  51886. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51887. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51888. return self;
  51889. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  51890. },
  51891. args: [],
  51892. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09self assert: (ObjectMock2 package classes includes: ObjectMock2).\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  51893. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51894. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "includes:", "classes", "class", "isNil", "removeClass:"]
  51895. }),
  51896. $globals.ClassBuilderTest);
  51897. $core.addMethod(
  51898. $core.method({
  51899. selector: "testClassMigrationWithClassInstanceVariables",
  51900. protocol: "tests",
  51901. fn: function (){
  51902. var self=this,$self=this;
  51903. return $core.withContext(function($ctx1) {
  51904. var $1;
  51905. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51906. $1=$recv($globals.ObjectMock2)._class();
  51907. $ctx1.sendIdx["class"]=1;
  51908. $recv($1)._instanceVariableNames_("foo bar");
  51909. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51910. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51911. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51912. return self;
  51913. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  51914. },
  51915. args: [],
  51916. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  51917. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  51918. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  51919. }),
  51920. $globals.ClassBuilderTest);
  51921. $core.addMethod(
  51922. $core.method({
  51923. selector: "testClassMigrationWithSubclasses",
  51924. protocol: "tests",
  51925. fn: function (){
  51926. var self=this,$self=this;
  51927. return $core.withContext(function($ctx1) {
  51928. var $2,$1,$4,$3;
  51929. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51930. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  51931. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  51932. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  51933. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  51934. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51935. $2=$recv($globals.ObjectMock)._subclasses();
  51936. $ctx1.sendIdx["subclasses"]=1;
  51937. $1=$recv($2)._includes_($globals.ObjectMock2);
  51938. $ctx1.sendIdx["includes:"]=1;
  51939. $self._assert_($1);
  51940. $ctx1.sendIdx["assert:"]=1;
  51941. $4=$recv($globals.ObjectMock2)._subclasses();
  51942. $ctx1.sendIdx["subclasses"]=2;
  51943. $3=$recv($4)._includes_($globals.ObjectMock3);
  51944. $ctx1.sendIdx["includes:"]=2;
  51945. $self._assert_($3);
  51946. $ctx1.sendIdx["assert:"]=2;
  51947. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  51948. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  51949. return $core.withContext(function($ctx2) {
  51950. return $recv($globals.Smalltalk)._removeClass_(each);
  51951. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51952. }));
  51953. return self;
  51954. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  51955. },
  51956. args: [],
  51957. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ]",
  51958. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  51959. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  51960. }),
  51961. $globals.ClassBuilderTest);
  51962. $core.addMethod(
  51963. $core.method({
  51964. selector: "testInstanceVariableNames",
  51965. protocol: "tests",
  51966. fn: function (){
  51967. var self=this,$self=this;
  51968. return $core.withContext(function($ctx1) {
  51969. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  51970. return self;
  51971. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  51972. },
  51973. args: [],
  51974. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  51975. referencedClasses: [],
  51976. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  51977. }),
  51978. $globals.ClassBuilderTest);
  51979. $core.addMethod(
  51980. $core.method({
  51981. selector: "testSubclass",
  51982. protocol: "tests",
  51983. fn: function (){
  51984. var self=this,$self=this;
  51985. return $core.withContext(function($ctx1) {
  51986. var $3,$2,$1,$4;
  51987. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  51988. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  51989. $ctx1.sendIdx["assert:equals:"]=1;
  51990. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  51991. $ctx1.sendIdx["assert:equals:"]=2;
  51992. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51993. $ctx1.sendIdx["assert:equals:"]=3;
  51994. $3=$recv($self["@theClass"])._package();
  51995. $ctx1.sendIdx["package"]=1;
  51996. $2=$recv($3)._classes();
  51997. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51998. $self._assert_equals_($1,(1));
  51999. $ctx1.sendIdx["assert:equals:"]=4;
  52000. $4=$recv($self["@theClass"])._package();
  52001. $ctx1.sendIdx["package"]=2;
  52002. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52003. $ctx1.sendIdx["assert:equals:"]=5;
  52004. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  52005. return self;
  52006. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  52007. },
  52008. args: [],
  52009. source: "testSubclass\x0a\x09theClass := builder addSubclassOf: ObjectMock named: 'ObjectMock2' instanceVariableNames: 'foo bar' package: 'Kernel-Tests'.\x0a\x09self assert: theClass superclass equals: ObjectMock.\x0a\x09self assert: theClass instanceVariableNames equals: 'foo bar'.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: (theClass package classes occurrencesOf: theClass) equals: 1.\x0a\x09self assert: theClass package equals: ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys size equals: 0",
  52010. referencedClasses: ["ObjectMock"],
  52011. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  52012. }),
  52013. $globals.ClassBuilderTest);
  52014. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52015. $core.addMethod(
  52016. $core.method({
  52017. selector: "jsConstructor",
  52018. protocol: "running",
  52019. fn: function (){
  52020. var self=this,$self=this;
  52021. return $core.withContext(function($ctx1) {
  52022. function Foo(){}
  52023. Foo.prototype.valueOf = function () {return 4;};
  52024. return Foo;
  52025. ;
  52026. return self;
  52027. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  52028. },
  52029. args: [],
  52030. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52031. referencedClasses: [],
  52032. messageSends: []
  52033. }),
  52034. $globals.ClassTest);
  52035. $core.addMethod(
  52036. $core.method({
  52037. selector: "setUp",
  52038. protocol: "running",
  52039. fn: function (){
  52040. var self=this,$self=this;
  52041. return $core.withContext(function($ctx1) {
  52042. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  52043. return self;
  52044. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  52045. },
  52046. args: [],
  52047. source: "setUp\x0a\x09builder := ClassBuilder new",
  52048. referencedClasses: ["ClassBuilder"],
  52049. messageSends: ["new"]
  52050. }),
  52051. $globals.ClassTest);
  52052. $core.addMethod(
  52053. $core.method({
  52054. selector: "tearDown",
  52055. protocol: "running",
  52056. fn: function (){
  52057. var self=this,$self=this;
  52058. return $core.withContext(function($ctx1) {
  52059. var $1,$receiver;
  52060. $1=$self["@theClass"];
  52061. if(($receiver = $1) == null || $receiver.a$nil){
  52062. $1;
  52063. } else {
  52064. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  52065. return $core.withContext(function($ctx2) {
  52066. return $recv($globals.Smalltalk)._removeClass_(each);
  52067. $ctx2.sendIdx["removeClass:"]=1;
  52068. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52069. }));
  52070. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  52071. $self["@theClass"]=nil;
  52072. $self["@theClass"];
  52073. }
  52074. return self;
  52075. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  52076. },
  52077. args: [],
  52078. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  52079. referencedClasses: ["Smalltalk"],
  52080. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  52081. }),
  52082. $globals.ClassTest);
  52083. $core.addMethod(
  52084. $core.method({
  52085. selector: "testAllSubclasses",
  52086. protocol: "tests",
  52087. fn: function (){
  52088. var self=this,$self=this;
  52089. var subclasses,index;
  52090. return $core.withContext(function($ctx1) {
  52091. subclasses=$recv($globals.Object)._subclasses();
  52092. $ctx1.sendIdx["subclasses"]=1;
  52093. index=(1);
  52094. $recv((function(){
  52095. return $core.withContext(function($ctx2) {
  52096. return $recv(index).__gt($recv(subclasses)._size());
  52097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52098. }))._whileFalse_((function(){
  52099. return $core.withContext(function($ctx2) {
  52100. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  52101. index=$recv(index).__plus((1));
  52102. return index;
  52103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52104. }));
  52105. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  52106. return self;
  52107. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  52108. },
  52109. args: [],
  52110. source: "testAllSubclasses\x0a\x09| subclasses index |\x0a\x0a\x09subclasses := Object subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09self assert: Object allSubclasses equals: subclasses",
  52111. referencedClasses: ["Object"],
  52112. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  52113. }),
  52114. $globals.ClassTest);
  52115. $core.addMethod(
  52116. $core.method({
  52117. selector: "testMetaclassSubclasses",
  52118. protocol: "tests",
  52119. fn: function (){
  52120. var self=this,$self=this;
  52121. var subclasses;
  52122. return $core.withContext(function($ctx1) {
  52123. var $4,$3,$2,$1;
  52124. $4=$recv($globals.Object)._class();
  52125. $ctx1.sendIdx["class"]=1;
  52126. $3=$recv($4)._instanceClass();
  52127. $2=$recv($3)._subclasses();
  52128. $ctx1.sendIdx["subclasses"]=1;
  52129. $1=$recv($2)._select_((function(each){
  52130. return $core.withContext(function($ctx2) {
  52131. return $recv($recv(each)._isMetaclass())._not();
  52132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52133. }));
  52134. subclasses=$recv($1)._collect_((function(each){
  52135. return $core.withContext(function($ctx2) {
  52136. return $recv(each)._theMetaClass();
  52137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52138. }));
  52139. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  52140. return self;
  52141. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  52142. },
  52143. args: [],
  52144. source: "testMetaclassSubclasses\x0a\x09| subclasses |\x0a\x0a\x09subclasses := (Object class instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ].\x0a\x0a\x09self assert: Object class subclasses equals: subclasses",
  52145. referencedClasses: ["Object"],
  52146. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  52147. }),
  52148. $globals.ClassTest);
  52149. $core.addMethod(
  52150. $core.method({
  52151. selector: "testSetJavaScriptConstructor",
  52152. protocol: "tests",
  52153. fn: function (){
  52154. var self=this,$self=this;
  52155. var instance;
  52156. return $core.withContext(function($ctx1) {
  52157. var $2,$1,$4,$3,$6,$5,$8,$7;
  52158. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52159. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  52160. $2=$recv($self["@theClass"])._superclass();
  52161. $ctx1.sendIdx["superclass"]=1;
  52162. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52163. $ctx1.sendIdx["=="]=1;
  52164. $self._assert_($1);
  52165. $ctx1.sendIdx["assert:"]=1;
  52166. $4=$recv($self["@theClass"])._instanceVariableNames();
  52167. $ctx1.sendIdx["instanceVariableNames"]=1;
  52168. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52169. $ctx1.sendIdx["=="]=2;
  52170. $self._assert_($3);
  52171. $ctx1.sendIdx["assert:"]=2;
  52172. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52173. $ctx1.sendIdx["assert:equals:"]=1;
  52174. $6=$recv($self["@theClass"])._package();
  52175. $ctx1.sendIdx["package"]=1;
  52176. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52177. $ctx1.sendIdx["=="]=3;
  52178. $self._assert_($5);
  52179. $ctx1.sendIdx["assert:"]=3;
  52180. $8=$recv($self["@theClass"])._methodDictionary();
  52181. $ctx1.sendIdx["methodDictionary"]=1;
  52182. $7=$recv($8)._keys();
  52183. $ctx1.sendIdx["keys"]=1;
  52184. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52185. $ctx1.sendIdx["assert:equals:"]=2;
  52186. instance=$recv($self["@theClass"])._new();
  52187. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52188. $self._assert_equals_($recv(instance)._value(),(4));
  52189. $ctx1.sendIdx["assert:equals:"]=3;
  52190. $self._shouldnt_raise_((function(){
  52191. return $core.withContext(function($ctx2) {
  52192. return $recv(instance)._foo_((9));
  52193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52194. }),$globals.Error);
  52195. $self._assert_equals_($recv(instance)._foo(),(9));
  52196. return self;
  52197. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52198. },
  52199. args: [],
  52200. source: "testSetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self jsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-coupled detached root class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  52201. referencedClasses: ["ObjectMock", "Error"],
  52202. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52203. }),
  52204. $globals.ClassTest);
  52205. $core.addMethod(
  52206. $core.method({
  52207. selector: "testTrickySetJavaScriptConstructor",
  52208. protocol: "tests",
  52209. fn: function (){
  52210. var self=this,$self=this;
  52211. var instance;
  52212. return $core.withContext(function($ctx1) {
  52213. var $2,$1,$4,$3,$6,$5,$8,$7;
  52214. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52215. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  52216. $2=$recv($self["@theClass"])._superclass();
  52217. $ctx1.sendIdx["superclass"]=1;
  52218. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52219. $ctx1.sendIdx["=="]=1;
  52220. $self._assert_($1);
  52221. $ctx1.sendIdx["assert:"]=1;
  52222. $4=$recv($self["@theClass"])._instanceVariableNames();
  52223. $ctx1.sendIdx["instanceVariableNames"]=1;
  52224. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52225. $ctx1.sendIdx["=="]=2;
  52226. $self._assert_($3);
  52227. $ctx1.sendIdx["assert:"]=2;
  52228. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52229. $ctx1.sendIdx["assert:equals:"]=1;
  52230. $6=$recv($self["@theClass"])._package();
  52231. $ctx1.sendIdx["package"]=1;
  52232. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52233. $ctx1.sendIdx["=="]=3;
  52234. $self._assert_($5);
  52235. $ctx1.sendIdx["assert:"]=3;
  52236. $8=$recv($self["@theClass"])._methodDictionary();
  52237. $ctx1.sendIdx["methodDictionary"]=1;
  52238. $7=$recv($8)._keys();
  52239. $ctx1.sendIdx["keys"]=1;
  52240. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52241. $ctx1.sendIdx["assert:equals:"]=2;
  52242. instance=$recv($self["@theClass"])._new();
  52243. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52244. $self._assert_equals_($recv(instance)._value(),(4));
  52245. $ctx1.sendIdx["assert:equals:"]=3;
  52246. $self._shouldnt_raise_((function(){
  52247. return $core.withContext(function($ctx2) {
  52248. return $recv(instance)._foo_((9));
  52249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52250. }),$globals.Error);
  52251. $self._assert_equals_($recv(instance)._foo(),(9));
  52252. return self;
  52253. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52254. },
  52255. args: [],
  52256. source: "testTrickySetJavaScriptConstructor\x0a\x09| instance |\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09theClass javascriptConstructor: self trickyJsConstructor.\x0a\x09\x22part took from copy class test\x22\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys.\x0a\x09\x22testing specific to late-coupled detached root class\x22\x0a\x09instance := theClass new.\x0a\x09self assert: instance class == theClass.\x0a\x09self assert: instance value equals: 4.\x0a\x09self shouldnt: [ instance foo: 9 ] raise: Error.\x0a\x09self assert: instance foo equals: 9",
  52257. referencedClasses: ["ObjectMock", "Error"],
  52258. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52259. }),
  52260. $globals.ClassTest);
  52261. $core.addMethod(
  52262. $core.method({
  52263. selector: "trickyJsConstructor",
  52264. protocol: "running",
  52265. fn: function (){
  52266. var self=this,$self=this;
  52267. return $core.withContext(function($ctx1) {
  52268. function Foo(){}
  52269. Foo.prototype.valueOf = function () {return 4;};
  52270. Foo.prototype._foo = function () {return "bar";};
  52271. return Foo;
  52272. ;
  52273. return self;
  52274. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52275. },
  52276. args: [],
  52277. source: "trickyJsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09Foo.prototype._foo = function () {return \x22bar\x22;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52278. referencedClasses: [],
  52279. messageSends: []
  52280. }),
  52281. $globals.ClassTest);
  52282. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52283. $core.addMethod(
  52284. $core.method({
  52285. selector: "assertSameContents:as:",
  52286. protocol: "convenience",
  52287. fn: function (aCollection,anotherCollection){
  52288. var self=this,$self=this;
  52289. return $core.withContext(function($ctx1) {
  52290. var $2,$1,$4,$3;
  52291. $2=$recv(aCollection)._size();
  52292. $ctx1.sendIdx["size"]=1;
  52293. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52294. $ctx1.sendIdx["="]=1;
  52295. $self._assert_($1);
  52296. $ctx1.sendIdx["assert:"]=1;
  52297. $recv(aCollection)._do_((function(each){
  52298. return $core.withContext(function($ctx2) {
  52299. $4=$recv(aCollection)._occurrencesOf_(each);
  52300. $ctx2.sendIdx["occurrencesOf:"]=1;
  52301. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52302. return $self._assert_($3);
  52303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52304. }));
  52305. return self;
  52306. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52307. },
  52308. args: ["aCollection", "anotherCollection"],
  52309. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  52310. referencedClasses: [],
  52311. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52312. }),
  52313. $globals.CollectionTest);
  52314. $core.addMethod(
  52315. $core.method({
  52316. selector: "collection",
  52317. protocol: "fixture",
  52318. fn: function (){
  52319. var self=this,$self=this;
  52320. return $core.withContext(function($ctx1) {
  52321. $self._subclassResponsibility();
  52322. return self;
  52323. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52324. },
  52325. args: [],
  52326. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52327. referencedClasses: [],
  52328. messageSends: ["subclassResponsibility"]
  52329. }),
  52330. $globals.CollectionTest);
  52331. $core.addMethod(
  52332. $core.method({
  52333. selector: "collectionClass",
  52334. protocol: "fixture",
  52335. fn: function (){
  52336. var self=this,$self=this;
  52337. return $core.withContext(function($ctx1) {
  52338. return $recv($self._class())._collectionClass();
  52339. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52340. },
  52341. args: [],
  52342. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52343. referencedClasses: [],
  52344. messageSends: ["collectionClass", "class"]
  52345. }),
  52346. $globals.CollectionTest);
  52347. $core.addMethod(
  52348. $core.method({
  52349. selector: "collectionOfPrintStrings",
  52350. protocol: "fixture",
  52351. fn: function (){
  52352. var self=this,$self=this;
  52353. return $core.withContext(function($ctx1) {
  52354. $self._subclassResponsibility();
  52355. return self;
  52356. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52357. },
  52358. args: [],
  52359. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52360. referencedClasses: [],
  52361. messageSends: ["subclassResponsibility"]
  52362. }),
  52363. $globals.CollectionTest);
  52364. $core.addMethod(
  52365. $core.method({
  52366. selector: "collectionSize",
  52367. protocol: "fixture",
  52368. fn: function (){
  52369. var self=this,$self=this;
  52370. return $core.withContext(function($ctx1) {
  52371. $self._subclassResponsibility();
  52372. return self;
  52373. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52374. },
  52375. args: [],
  52376. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52377. referencedClasses: [],
  52378. messageSends: ["subclassResponsibility"]
  52379. }),
  52380. $globals.CollectionTest);
  52381. $core.addMethod(
  52382. $core.method({
  52383. selector: "collectionWithDuplicates",
  52384. protocol: "fixture",
  52385. fn: function (){
  52386. var self=this,$self=this;
  52387. return $core.withContext(function($ctx1) {
  52388. $self._subclassResponsibility();
  52389. return self;
  52390. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52391. },
  52392. args: [],
  52393. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly six distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  52394. referencedClasses: [],
  52395. messageSends: ["subclassResponsibility"]
  52396. }),
  52397. $globals.CollectionTest);
  52398. $core.addMethod(
  52399. $core.method({
  52400. selector: "collectionWithNewValue",
  52401. protocol: "fixture",
  52402. fn: function (){
  52403. var self=this,$self=this;
  52404. return $core.withContext(function($ctx1) {
  52405. $self._subclassResponsibility();
  52406. return self;
  52407. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52408. },
  52409. args: [],
  52410. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  52411. referencedClasses: [],
  52412. messageSends: ["subclassResponsibility"]
  52413. }),
  52414. $globals.CollectionTest);
  52415. $core.addMethod(
  52416. $core.method({
  52417. selector: "initialize",
  52418. protocol: "initialization",
  52419. fn: function (){
  52420. var self=this,$self=this;
  52421. return $core.withContext(function($ctx1) {
  52422. (
  52423. $ctx1.supercall = true,
  52424. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52425. $ctx1.supercall = false;
  52426. $self["@sampleBlock"]=(function(){
  52427. });
  52428. return self;
  52429. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52430. },
  52431. args: [],
  52432. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52433. referencedClasses: [],
  52434. messageSends: ["initialize"]
  52435. }),
  52436. $globals.CollectionTest);
  52437. $core.addMethod(
  52438. $core.method({
  52439. selector: "sampleNewValue",
  52440. protocol: "fixture",
  52441. fn: function (){
  52442. var self=this,$self=this;
  52443. return "N";
  52444. },
  52445. args: [],
  52446. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  52447. referencedClasses: [],
  52448. messageSends: []
  52449. }),
  52450. $globals.CollectionTest);
  52451. $core.addMethod(
  52452. $core.method({
  52453. selector: "sampleNewValueAsCollection",
  52454. protocol: "fixture",
  52455. fn: function (){
  52456. var self=this,$self=this;
  52457. return $core.withContext(function($ctx1) {
  52458. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52459. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52460. },
  52461. args: [],
  52462. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  52463. referencedClasses: [],
  52464. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52465. }),
  52466. $globals.CollectionTest);
  52467. $core.addMethod(
  52468. $core.method({
  52469. selector: "testAddAll",
  52470. protocol: "tests",
  52471. fn: function (){
  52472. var self=this,$self=this;
  52473. return $core.withContext(function($ctx1) {
  52474. var $2,$4,$3,$5,$1,$6,$9,$8,$10,$11,$7,$12,$15,$14,$17,$16,$18,$13,$20,$21,$22,$19,$23,$25,$24;
  52475. $2=$self._collection();
  52476. $ctx1.sendIdx["collection"]=1;
  52477. $4=$self._collectionClass();
  52478. $ctx1.sendIdx["collectionClass"]=1;
  52479. $3=$recv($4)._new();
  52480. $ctx1.sendIdx["new"]=1;
  52481. $recv($2)._addAll_($3);
  52482. $ctx1.sendIdx["addAll:"]=1;
  52483. $5=$recv($2)._yourself();
  52484. $ctx1.sendIdx["yourself"]=1;
  52485. $1=$5;
  52486. $6=$self._collection();
  52487. $ctx1.sendIdx["collection"]=2;
  52488. $self._assert_equals_($1,$6);
  52489. $ctx1.sendIdx["assert:equals:"]=1;
  52490. $9=$self._collectionClass();
  52491. $ctx1.sendIdx["collectionClass"]=2;
  52492. $8=$recv($9)._new();
  52493. $ctx1.sendIdx["new"]=2;
  52494. $10=$self._collection();
  52495. $ctx1.sendIdx["collection"]=3;
  52496. $recv($8)._addAll_($10);
  52497. $ctx1.sendIdx["addAll:"]=2;
  52498. $11=$recv($8)._yourself();
  52499. $ctx1.sendIdx["yourself"]=2;
  52500. $7=$11;
  52501. $12=$self._collection();
  52502. $ctx1.sendIdx["collection"]=4;
  52503. $self._assert_equals_($7,$12);
  52504. $ctx1.sendIdx["assert:equals:"]=2;
  52505. $15=$self._collectionClass();
  52506. $ctx1.sendIdx["collectionClass"]=3;
  52507. $14=$recv($15)._new();
  52508. $ctx1.sendIdx["new"]=3;
  52509. $17=$self._collectionClass();
  52510. $ctx1.sendIdx["collectionClass"]=4;
  52511. $16=$recv($17)._new();
  52512. $ctx1.sendIdx["new"]=4;
  52513. $recv($14)._addAll_($16);
  52514. $ctx1.sendIdx["addAll:"]=3;
  52515. $18=$recv($14)._yourself();
  52516. $ctx1.sendIdx["yourself"]=3;
  52517. $13=$18;
  52518. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52519. $ctx1.sendIdx["assert:equals:"]=3;
  52520. $20=$self._collection();
  52521. $ctx1.sendIdx["collection"]=5;
  52522. $21=$self._sampleNewValueAsCollection();
  52523. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52524. $recv($20)._addAll_($21);
  52525. $ctx1.sendIdx["addAll:"]=4;
  52526. $22=$recv($20)._yourself();
  52527. $ctx1.sendIdx["yourself"]=4;
  52528. $19=$22;
  52529. $23=$self._collectionWithNewValue();
  52530. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52531. $self._assert_equals_($19,$23);
  52532. $25=$self._sampleNewValueAsCollection();
  52533. $recv($25)._addAll_($self._collection());
  52534. $24=$recv($25)._yourself();
  52535. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52536. return self;
  52537. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52538. },
  52539. args: [],
  52540. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  52541. referencedClasses: [],
  52542. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52543. }),
  52544. $globals.CollectionTest);
  52545. $core.addMethod(
  52546. $core.method({
  52547. selector: "testAllSatisfy",
  52548. protocol: "tests",
  52549. fn: function (){
  52550. var self=this,$self=this;
  52551. var collection,anyOne;
  52552. return $core.withContext(function($ctx1) {
  52553. var $1;
  52554. collection=$self._collection();
  52555. anyOne=$recv(collection)._anyOne();
  52556. $1=$recv(collection)._allSatisfy_((function(each){
  52557. return $core.withContext(function($ctx2) {
  52558. return $recv(collection)._includes_(each);
  52559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52560. }));
  52561. $ctx1.sendIdx["allSatisfy:"]=1;
  52562. $self._assert_($1);
  52563. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52564. return $core.withContext(function($ctx2) {
  52565. return $recv(each).__tild_eq(anyOne);
  52566. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52567. })));
  52568. return self;
  52569. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52570. },
  52571. args: [],
  52572. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  52573. referencedClasses: [],
  52574. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52575. }),
  52576. $globals.CollectionTest);
  52577. $core.addMethod(
  52578. $core.method({
  52579. selector: "testAnyOne",
  52580. protocol: "tests",
  52581. fn: function (){
  52582. var self=this,$self=this;
  52583. return $core.withContext(function($ctx1) {
  52584. var $2,$1;
  52585. $self._should_raise_((function(){
  52586. return $core.withContext(function($ctx2) {
  52587. return $recv($recv($self._collectionClass())._new())._anyOne();
  52588. $ctx2.sendIdx["anyOne"]=1;
  52589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52590. }),$globals.Error);
  52591. $2=$self._collection();
  52592. $ctx1.sendIdx["collection"]=1;
  52593. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52594. $self._assert_($1);
  52595. return self;
  52596. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52597. },
  52598. args: [],
  52599. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52600. referencedClasses: ["Error"],
  52601. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52602. }),
  52603. $globals.CollectionTest);
  52604. $core.addMethod(
  52605. $core.method({
  52606. selector: "testAnySatisfy",
  52607. protocol: "tests",
  52608. fn: function (){
  52609. var self=this,$self=this;
  52610. var anyOne;
  52611. return $core.withContext(function($ctx1) {
  52612. var $1,$3,$2;
  52613. $1=$self._collection();
  52614. $ctx1.sendIdx["collection"]=1;
  52615. anyOne=$recv($1)._anyOne();
  52616. $3=$self._collection();
  52617. $ctx1.sendIdx["collection"]=2;
  52618. $2=$recv($3)._anySatisfy_((function(each){
  52619. return $core.withContext(function($ctx2) {
  52620. return $recv(each).__eq(anyOne);
  52621. $ctx2.sendIdx["="]=1;
  52622. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52623. }));
  52624. $ctx1.sendIdx["anySatisfy:"]=1;
  52625. $self._assert_($2);
  52626. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52627. return $core.withContext(function($ctx2) {
  52628. return $recv(each).__eq($recv($globals.Object)._new());
  52629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52630. })));
  52631. return self;
  52632. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52633. },
  52634. args: [],
  52635. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  52636. referencedClasses: ["Object"],
  52637. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52638. }),
  52639. $globals.CollectionTest);
  52640. $core.addMethod(
  52641. $core.method({
  52642. selector: "testAsArray",
  52643. protocol: "tests",
  52644. fn: function (){
  52645. var self=this,$self=this;
  52646. return $core.withContext(function($ctx1) {
  52647. var $1;
  52648. $1=$self._collection();
  52649. $ctx1.sendIdx["collection"]=1;
  52650. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52651. return self;
  52652. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52653. },
  52654. args: [],
  52655. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52656. referencedClasses: [],
  52657. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52658. }),
  52659. $globals.CollectionTest);
  52660. $core.addMethod(
  52661. $core.method({
  52662. selector: "testAsOrderedCollection",
  52663. protocol: "tests",
  52664. fn: function (){
  52665. var self=this,$self=this;
  52666. return $core.withContext(function($ctx1) {
  52667. var $1;
  52668. $1=$self._collection();
  52669. $ctx1.sendIdx["collection"]=1;
  52670. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52671. return self;
  52672. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52673. },
  52674. args: [],
  52675. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52676. referencedClasses: [],
  52677. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52678. }),
  52679. $globals.CollectionTest);
  52680. $core.addMethod(
  52681. $core.method({
  52682. selector: "testAsSet",
  52683. protocol: "tests",
  52684. fn: function (){
  52685. var self=this,$self=this;
  52686. var c,set;
  52687. return $core.withContext(function($ctx1) {
  52688. c=$self._collectionWithDuplicates();
  52689. set=$recv(c)._asSet();
  52690. $self._assert_equals_($recv(set)._size(),(6));
  52691. $recv(c)._do_((function(each){
  52692. return $core.withContext(function($ctx2) {
  52693. return $self._assert_($recv(set)._includes_(each));
  52694. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52695. }));
  52696. return self;
  52697. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52698. },
  52699. args: [],
  52700. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 6.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  52701. referencedClasses: [],
  52702. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52703. }),
  52704. $globals.CollectionTest);
  52705. $core.addMethod(
  52706. $core.method({
  52707. selector: "testCollect",
  52708. protocol: "tests",
  52709. fn: function (){
  52710. var self=this,$self=this;
  52711. return $core.withContext(function($ctx1) {
  52712. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52713. $2=$self._collection();
  52714. $ctx1.sendIdx["collection"]=1;
  52715. $1=$recv($2)._collect_((function(each){
  52716. return each;
  52717. }));
  52718. $ctx1.sendIdx["collect:"]=1;
  52719. $3=$self._collection();
  52720. $ctx1.sendIdx["collection"]=2;
  52721. $self._assert_equals_($1,$3);
  52722. $ctx1.sendIdx["assert:equals:"]=1;
  52723. $5=$self._collectionWithNewValue();
  52724. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52725. $4=$recv($5)._collect_((function(each){
  52726. return each;
  52727. }));
  52728. $ctx1.sendIdx["collect:"]=2;
  52729. $self._assert_equals_($4,$self._collectionWithNewValue());
  52730. $ctx1.sendIdx["assert:equals:"]=2;
  52731. $8=$self._collectionClass();
  52732. $ctx1.sendIdx["collectionClass"]=1;
  52733. $7=$recv($8)._new();
  52734. $ctx1.sendIdx["new"]=1;
  52735. $6=$recv($7)._collect_((function(each){
  52736. return $core.withContext(function($ctx2) {
  52737. return $recv(each)._printString();
  52738. $ctx2.sendIdx["printString"]=1;
  52739. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52740. }));
  52741. $ctx1.sendIdx["collect:"]=3;
  52742. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52743. $ctx1.sendIdx["assert:equals:"]=3;
  52744. $11=$self._collection();
  52745. $ctx1.sendIdx["collection"]=3;
  52746. $10=$recv($11)._collect_((function(){
  52747. return $core.withContext(function($ctx2) {
  52748. return $self._sampleNewValue();
  52749. $ctx2.sendIdx["sampleNewValue"]=1;
  52750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52751. }));
  52752. $ctx1.sendIdx["collect:"]=4;
  52753. $9=$recv($10)._detect_((function(){
  52754. return true;
  52755. }));
  52756. $self._assert_equals_($9,$self._sampleNewValue());
  52757. $ctx1.sendIdx["assert:equals:"]=4;
  52758. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52759. return $core.withContext(function($ctx2) {
  52760. return $recv(each)._printString();
  52761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52762. })),$self._collectionOfPrintStrings());
  52763. return self;
  52764. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52765. },
  52766. args: [],
  52767. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  52768. referencedClasses: [],
  52769. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52770. }),
  52771. $globals.CollectionTest);
  52772. $core.addMethod(
  52773. $core.method({
  52774. selector: "testComma",
  52775. protocol: "tests",
  52776. fn: function (){
  52777. var self=this,$self=this;
  52778. return $core.withContext(function($ctx1) {
  52779. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52780. $2=$self._collection();
  52781. $ctx1.sendIdx["collection"]=1;
  52782. $4=$self._collectionClass();
  52783. $ctx1.sendIdx["collectionClass"]=1;
  52784. $3=$recv($4)._new();
  52785. $ctx1.sendIdx["new"]=1;
  52786. $1=$recv($2).__comma($3);
  52787. $ctx1.sendIdx[","]=1;
  52788. $5=$self._collection();
  52789. $ctx1.sendIdx["collection"]=2;
  52790. $self._assert_equals_($1,$5);
  52791. $ctx1.sendIdx["assert:equals:"]=1;
  52792. $8=$self._collectionClass();
  52793. $ctx1.sendIdx["collectionClass"]=2;
  52794. $7=$recv($8)._new();
  52795. $ctx1.sendIdx["new"]=2;
  52796. $9=$self._collection();
  52797. $ctx1.sendIdx["collection"]=3;
  52798. $6=$recv($7).__comma($9);
  52799. $ctx1.sendIdx[","]=2;
  52800. $10=$self._collection();
  52801. $ctx1.sendIdx["collection"]=4;
  52802. $self._assert_equals_($6,$10);
  52803. $ctx1.sendIdx["assert:equals:"]=2;
  52804. $13=$self._collectionClass();
  52805. $ctx1.sendIdx["collectionClass"]=3;
  52806. $12=$recv($13)._new();
  52807. $ctx1.sendIdx["new"]=3;
  52808. $15=$self._collectionClass();
  52809. $ctx1.sendIdx["collectionClass"]=4;
  52810. $14=$recv($15)._new();
  52811. $ctx1.sendIdx["new"]=4;
  52812. $11=$recv($12).__comma($14);
  52813. $ctx1.sendIdx[","]=3;
  52814. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52815. $ctx1.sendIdx["assert:equals:"]=3;
  52816. $17=$self._collection();
  52817. $ctx1.sendIdx["collection"]=5;
  52818. $18=$self._sampleNewValueAsCollection();
  52819. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52820. $16=$recv($17).__comma($18);
  52821. $ctx1.sendIdx[","]=4;
  52822. $19=$self._collectionWithNewValue();
  52823. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52824. $self._assert_equals_($16,$19);
  52825. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52826. return self;
  52827. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52828. },
  52829. args: [],
  52830. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  52831. referencedClasses: [],
  52832. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52833. }),
  52834. $globals.CollectionTest);
  52835. $core.addMethod(
  52836. $core.method({
  52837. selector: "testCopy",
  52838. protocol: "tests",
  52839. fn: function (){
  52840. var self=this,$self=this;
  52841. return $core.withContext(function($ctx1) {
  52842. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52843. $3=$self._collectionClass();
  52844. $ctx1.sendIdx["collectionClass"]=1;
  52845. $2=$recv($3)._new();
  52846. $ctx1.sendIdx["new"]=1;
  52847. $1=$recv($2)._copy();
  52848. $ctx1.sendIdx["copy"]=1;
  52849. $5=$self._collectionClass();
  52850. $ctx1.sendIdx["collectionClass"]=2;
  52851. $4=$recv($5)._new();
  52852. $ctx1.sendIdx["new"]=2;
  52853. $self._assert_equals_($1,$4);
  52854. $ctx1.sendIdx["assert:equals:"]=1;
  52855. $7=$self._collection();
  52856. $ctx1.sendIdx["collection"]=1;
  52857. $6=$recv($7)._copy();
  52858. $ctx1.sendIdx["copy"]=2;
  52859. $8=$self._collection();
  52860. $ctx1.sendIdx["collection"]=2;
  52861. $self._assert_equals_($6,$8);
  52862. $ctx1.sendIdx["assert:equals:"]=2;
  52863. $10=$self._collectionWithNewValue();
  52864. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52865. $9=$recv($10)._copy();
  52866. $ctx1.sendIdx["copy"]=3;
  52867. $11=$self._collectionWithNewValue();
  52868. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52869. $self._assert_equals_($9,$11);
  52870. $15=$self._collectionClass();
  52871. $ctx1.sendIdx["collectionClass"]=3;
  52872. $14=$recv($15)._new();
  52873. $ctx1.sendIdx["new"]=3;
  52874. $13=$recv($14)._copy();
  52875. $ctx1.sendIdx["copy"]=4;
  52876. $16=$self._collection();
  52877. $ctx1.sendIdx["collection"]=3;
  52878. $12=$recv($13).__eq($16);
  52879. $ctx1.sendIdx["="]=1;
  52880. $self._deny_($12);
  52881. $ctx1.sendIdx["deny:"]=1;
  52882. $19=$self._collection();
  52883. $ctx1.sendIdx["collection"]=4;
  52884. $18=$recv($19)._copy();
  52885. $ctx1.sendIdx["copy"]=5;
  52886. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  52887. $ctx1.sendIdx["="]=2;
  52888. $self._deny_($17);
  52889. $ctx1.sendIdx["deny:"]=2;
  52890. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52891. return self;
  52892. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  52893. },
  52894. args: [],
  52895. source: "testCopy\x0a\x09self assert: self collectionClass new copy equals: self collectionClass new.\x0a\x09self assert: self collection copy equals: self collection.\x0a\x09self assert: self collectionWithNewValue copy equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new copy = self collection.\x0a\x09self deny: self collection copy = self collectionClass new.\x0a\x09self deny: self collection copy = self collectionWithNewValue",
  52896. referencedClasses: [],
  52897. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52898. }),
  52899. $globals.CollectionTest);
  52900. $core.addMethod(
  52901. $core.method({
  52902. selector: "testCopySeparates",
  52903. protocol: "tests",
  52904. fn: function (){
  52905. var self=this,$self=this;
  52906. var original,copy;
  52907. return $core.withContext(function($ctx1) {
  52908. original=$self._collection();
  52909. $ctx1.sendIdx["collection"]=1;
  52910. copy=$recv(original)._copy();
  52911. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52912. $self._assert_($recv(original).__eq($self._collection()));
  52913. return self;
  52914. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  52915. },
  52916. args: [],
  52917. source: "testCopySeparates\x0a\x09| original copy |\x0a\x09original := self collection.\x0a\x09copy := original copy.\x0a\x09copy addAll: self sampleNewValueAsCollection.\x0a\x09self assert: original = self collection",
  52918. referencedClasses: [],
  52919. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  52920. }),
  52921. $globals.CollectionTest);
  52922. $core.addMethod(
  52923. $core.method({
  52924. selector: "testDetect",
  52925. protocol: "tests",
  52926. fn: function (){
  52927. var self=this,$self=this;
  52928. return $core.withContext(function($ctx1) {
  52929. var $1,$2,$3,$4,$6,$5,$7;
  52930. $self._shouldnt_raise_((function(){
  52931. return $core.withContext(function($ctx2) {
  52932. $1=$self._collection();
  52933. $ctx2.sendIdx["collection"]=1;
  52934. return $recv($1)._detect_((function(){
  52935. return true;
  52936. }));
  52937. $ctx2.sendIdx["detect:"]=1;
  52938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52939. }),$globals.Error);
  52940. $self._should_raise_((function(){
  52941. return $core.withContext(function($ctx2) {
  52942. $2=$self._collection();
  52943. $ctx2.sendIdx["collection"]=2;
  52944. return $recv($2)._detect_((function(){
  52945. return false;
  52946. }));
  52947. $ctx2.sendIdx["detect:"]=2;
  52948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  52949. }),$globals.Error);
  52950. $ctx1.sendIdx["should:raise:"]=1;
  52951. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  52952. return true;
  52953. }));
  52954. $ctx1.sendIdx["detect:"]=3;
  52955. $4=$self._sampleNewValue();
  52956. $ctx1.sendIdx["sampleNewValue"]=1;
  52957. $self._assert_equals_($3,$4);
  52958. $ctx1.sendIdx["assert:equals:"]=1;
  52959. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  52960. return $core.withContext(function($ctx2) {
  52961. $6=$self._sampleNewValue();
  52962. $ctx2.sendIdx["sampleNewValue"]=2;
  52963. return $recv(each).__eq($6);
  52964. $ctx2.sendIdx["="]=1;
  52965. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52966. }));
  52967. $ctx1.sendIdx["detect:"]=4;
  52968. $7=$self._sampleNewValue();
  52969. $ctx1.sendIdx["sampleNewValue"]=3;
  52970. $self._assert_equals_($5,$7);
  52971. $self._should_raise_((function(){
  52972. return $core.withContext(function($ctx2) {
  52973. return $recv($self._collection())._detect_((function(each){
  52974. return $core.withContext(function($ctx3) {
  52975. return $recv(each).__eq($self._sampleNewValue());
  52976. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  52977. }));
  52978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  52979. }),$globals.Error);
  52980. return self;
  52981. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  52982. },
  52983. args: [],
  52984. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  52985. referencedClasses: ["Error"],
  52986. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52987. }),
  52988. $globals.CollectionTest);
  52989. $core.addMethod(
  52990. $core.method({
  52991. selector: "testDetectIfNone",
  52992. protocol: "tests",
  52993. fn: function (){
  52994. var self=this,$self=this;
  52995. var sentinel;
  52996. return $core.withContext(function($ctx1) {
  52997. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  52998. sentinel=$recv($globals.Object)._new();
  52999. $3=$self._collection();
  53000. $ctx1.sendIdx["collection"]=1;
  53001. $2=$recv($3)._detect_ifNone_((function(){
  53002. return true;
  53003. }),(function(){
  53004. return sentinel;
  53005. }));
  53006. $ctx1.sendIdx["detect:ifNone:"]=1;
  53007. $1=$recv($2).__tild_eq(sentinel);
  53008. $self._assert_($1);
  53009. $5=$self._collection();
  53010. $ctx1.sendIdx["collection"]=2;
  53011. $4=$recv($5)._detect_ifNone_((function(){
  53012. return false;
  53013. }),(function(){
  53014. return sentinel;
  53015. }));
  53016. $ctx1.sendIdx["detect:ifNone:"]=2;
  53017. $self._assert_equals_($4,sentinel);
  53018. $ctx1.sendIdx["assert:equals:"]=1;
  53019. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  53020. return true;
  53021. }),(function(){
  53022. return sentinel;
  53023. }));
  53024. $ctx1.sendIdx["detect:ifNone:"]=3;
  53025. $7=$self._sampleNewValue();
  53026. $ctx1.sendIdx["sampleNewValue"]=1;
  53027. $self._assert_equals_($6,$7);
  53028. $ctx1.sendIdx["assert:equals:"]=2;
  53029. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  53030. return $core.withContext(function($ctx2) {
  53031. $9=$self._sampleNewValue();
  53032. $ctx2.sendIdx["sampleNewValue"]=2;
  53033. return $recv(each).__eq($9);
  53034. $ctx2.sendIdx["="]=1;
  53035. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  53036. }),(function(){
  53037. return sentinel;
  53038. }));
  53039. $ctx1.sendIdx["detect:ifNone:"]=4;
  53040. $10=$self._sampleNewValue();
  53041. $ctx1.sendIdx["sampleNewValue"]=3;
  53042. $self._assert_equals_($8,$10);
  53043. $ctx1.sendIdx["assert:equals:"]=3;
  53044. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  53045. return $core.withContext(function($ctx2) {
  53046. return $recv(each).__eq($self._sampleNewValue());
  53047. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  53048. }),(function(){
  53049. return sentinel;
  53050. })),sentinel);
  53051. return self;
  53052. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  53053. },
  53054. args: [],
  53055. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  53056. referencedClasses: ["Object"],
  53057. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53058. }),
  53059. $globals.CollectionTest);
  53060. $core.addMethod(
  53061. $core.method({
  53062. selector: "testDo",
  53063. protocol: "tests",
  53064. fn: function (){
  53065. var self=this,$self=this;
  53066. var newCollection;
  53067. return $core.withContext(function($ctx1) {
  53068. var $1,$2;
  53069. newCollection=$recv($globals.OrderedCollection)._new();
  53070. $ctx1.sendIdx["new"]=1;
  53071. $1=$self._collection();
  53072. $ctx1.sendIdx["collection"]=1;
  53073. $recv($1)._do_((function(each){
  53074. return $core.withContext(function($ctx2) {
  53075. return $recv(newCollection)._add_(each);
  53076. $ctx2.sendIdx["add:"]=1;
  53077. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53078. }));
  53079. $ctx1.sendIdx["do:"]=1;
  53080. $self._assertSameContents_as_($self._collection(),newCollection);
  53081. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53082. newCollection=$recv($globals.OrderedCollection)._new();
  53083. $2=$self._collectionWithDuplicates();
  53084. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  53085. $recv($2)._do_((function(each){
  53086. return $core.withContext(function($ctx2) {
  53087. return $recv(newCollection)._add_(each);
  53088. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53089. }));
  53090. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  53091. return self;
  53092. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  53093. },
  53094. args: [],
  53095. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  53096. referencedClasses: ["OrderedCollection"],
  53097. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  53098. }),
  53099. $globals.CollectionTest);
  53100. $core.addMethod(
  53101. $core.method({
  53102. selector: "testEquality",
  53103. protocol: "tests",
  53104. fn: function (){
  53105. var self=this,$self=this;
  53106. return $core.withContext(function($ctx1) {
  53107. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  53108. $2=$self._collectionClass();
  53109. $ctx1.sendIdx["collectionClass"]=1;
  53110. $1=$recv($2)._new();
  53111. $ctx1.sendIdx["new"]=1;
  53112. $4=$self._collectionClass();
  53113. $ctx1.sendIdx["collectionClass"]=2;
  53114. $3=$recv($4)._new();
  53115. $ctx1.sendIdx["new"]=2;
  53116. $self._assert_equals_($1,$3);
  53117. $ctx1.sendIdx["assert:equals:"]=1;
  53118. $5=$self._collection();
  53119. $ctx1.sendIdx["collection"]=1;
  53120. $6=$self._collection();
  53121. $ctx1.sendIdx["collection"]=2;
  53122. $self._assert_equals_($5,$6);
  53123. $ctx1.sendIdx["assert:equals:"]=2;
  53124. $7=$self._collectionWithNewValue();
  53125. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53126. $8=$self._collectionWithNewValue();
  53127. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53128. $self._assert_equals_($7,$8);
  53129. $11=$self._collectionClass();
  53130. $ctx1.sendIdx["collectionClass"]=3;
  53131. $10=$recv($11)._new();
  53132. $ctx1.sendIdx["new"]=3;
  53133. $12=$self._collection();
  53134. $ctx1.sendIdx["collection"]=3;
  53135. $9=$recv($10).__eq($12);
  53136. $ctx1.sendIdx["="]=1;
  53137. $self._deny_($9);
  53138. $ctx1.sendIdx["deny:"]=1;
  53139. $14=$self._collection();
  53140. $ctx1.sendIdx["collection"]=4;
  53141. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  53142. $ctx1.sendIdx["="]=2;
  53143. $self._deny_($13);
  53144. $ctx1.sendIdx["deny:"]=2;
  53145. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53146. return self;
  53147. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  53148. },
  53149. args: [],
  53150. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new.\x0a\x09self deny: self collection = self collectionWithNewValue",
  53151. referencedClasses: [],
  53152. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53153. }),
  53154. $globals.CollectionTest);
  53155. $core.addMethod(
  53156. $core.method({
  53157. selector: "testIfEmptyFamily",
  53158. protocol: "tests",
  53159. fn: function (){
  53160. var self=this,$self=this;
  53161. return $core.withContext(function($ctx1) {
  53162. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  53163. $3=$self._collectionClass();
  53164. $ctx1.sendIdx["collectionClass"]=1;
  53165. $2=$recv($3)._new();
  53166. $ctx1.sendIdx["new"]=1;
  53167. $1=$recv($2)._ifEmpty_((function(){
  53168. return (42);
  53169. }));
  53170. $ctx1.sendIdx["ifEmpty:"]=1;
  53171. $self._assert_equals_($1,(42));
  53172. $ctx1.sendIdx["assert:equals:"]=1;
  53173. $5=$self._collection();
  53174. $ctx1.sendIdx["collection"]=1;
  53175. $4=$recv($5)._ifEmpty_((function(){
  53176. return (42);
  53177. }));
  53178. $6=$self._collection();
  53179. $ctx1.sendIdx["collection"]=2;
  53180. $self._assert_equals_($4,$6);
  53181. $ctx1.sendIdx["assert:equals:"]=2;
  53182. $9=$self._collectionClass();
  53183. $ctx1.sendIdx["collectionClass"]=2;
  53184. $8=$recv($9)._new();
  53185. $ctx1.sendIdx["new"]=2;
  53186. $7=$recv($8)._ifNotEmpty_((function(){
  53187. return (42);
  53188. }));
  53189. $ctx1.sendIdx["ifNotEmpty:"]=1;
  53190. $11=$self._collectionClass();
  53191. $ctx1.sendIdx["collectionClass"]=3;
  53192. $10=$recv($11)._new();
  53193. $ctx1.sendIdx["new"]=3;
  53194. $self._assert_equals_($7,$10);
  53195. $ctx1.sendIdx["assert:equals:"]=3;
  53196. $13=$self._collection();
  53197. $ctx1.sendIdx["collection"]=3;
  53198. $12=$recv($13)._ifNotEmpty_((function(){
  53199. return (42);
  53200. }));
  53201. $ctx1.sendIdx["ifNotEmpty:"]=2;
  53202. $self._assert_equals_($12,(42));
  53203. $ctx1.sendIdx["assert:equals:"]=4;
  53204. $15=$self._collection();
  53205. $ctx1.sendIdx["collection"]=4;
  53206. $14=$recv($15)._ifNotEmpty_((function(col){
  53207. return col;
  53208. }));
  53209. $16=$self._collection();
  53210. $ctx1.sendIdx["collection"]=5;
  53211. $self._assert_equals_($14,$16);
  53212. $ctx1.sendIdx["assert:equals:"]=5;
  53213. $19=$self._collectionClass();
  53214. $ctx1.sendIdx["collectionClass"]=4;
  53215. $18=$recv($19)._new();
  53216. $ctx1.sendIdx["new"]=4;
  53217. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53218. return (42);
  53219. }),(function(){
  53220. return (999);
  53221. }));
  53222. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53223. $self._assert_equals_($17,(42));
  53224. $ctx1.sendIdx["assert:equals:"]=6;
  53225. $21=$self._collection();
  53226. $ctx1.sendIdx["collection"]=6;
  53227. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53228. return (42);
  53229. }),(function(){
  53230. return (999);
  53231. }));
  53232. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53233. $self._assert_equals_($20,(999));
  53234. $ctx1.sendIdx["assert:equals:"]=7;
  53235. $23=$self._collection();
  53236. $ctx1.sendIdx["collection"]=7;
  53237. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53238. return (42);
  53239. }),(function(col){
  53240. return col;
  53241. }));
  53242. $24=$self._collection();
  53243. $ctx1.sendIdx["collection"]=8;
  53244. $self._assert_equals_($22,$24);
  53245. $ctx1.sendIdx["assert:equals:"]=8;
  53246. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53247. return (42);
  53248. }),(function(){
  53249. return (999);
  53250. }));
  53251. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53252. $self._assert_equals_($25,(999));
  53253. $ctx1.sendIdx["assert:equals:"]=9;
  53254. $27=$self._collection();
  53255. $ctx1.sendIdx["collection"]=9;
  53256. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53257. return (42);
  53258. }),(function(){
  53259. return (999);
  53260. }));
  53261. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53262. $self._assert_equals_($26,(42));
  53263. $ctx1.sendIdx["assert:equals:"]=10;
  53264. $29=$self._collection();
  53265. $ctx1.sendIdx["collection"]=10;
  53266. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53267. return col;
  53268. }),(function(){
  53269. return (999);
  53270. }));
  53271. $self._assert_equals_($28,$self._collection());
  53272. return self;
  53273. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53274. },
  53275. args: [],
  53276. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.",
  53277. referencedClasses: [],
  53278. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53279. }),
  53280. $globals.CollectionTest);
  53281. $core.addMethod(
  53282. $core.method({
  53283. selector: "testIsEmpty",
  53284. protocol: "tests",
  53285. fn: function (){
  53286. var self=this,$self=this;
  53287. return $core.withContext(function($ctx1) {
  53288. var $1;
  53289. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53290. $ctx1.sendIdx["isEmpty"]=1;
  53291. $self._assert_($1);
  53292. $self._deny_($recv($self._collection())._isEmpty());
  53293. return self;
  53294. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53295. },
  53296. args: [],
  53297. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53298. referencedClasses: [],
  53299. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53300. }),
  53301. $globals.CollectionTest);
  53302. $core.addMethod(
  53303. $core.method({
  53304. selector: "testNoneSatisfy",
  53305. protocol: "tests",
  53306. fn: function (){
  53307. var self=this,$self=this;
  53308. var anyOne;
  53309. return $core.withContext(function($ctx1) {
  53310. var $1,$3,$2;
  53311. $1=$self._collection();
  53312. $ctx1.sendIdx["collection"]=1;
  53313. anyOne=$recv($1)._anyOne();
  53314. $3=$self._collection();
  53315. $ctx1.sendIdx["collection"]=2;
  53316. $2=$recv($3)._noneSatisfy_((function(each){
  53317. return $core.withContext(function($ctx2) {
  53318. return $recv(each).__eq(anyOne);
  53319. $ctx2.sendIdx["="]=1;
  53320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53321. }));
  53322. $ctx1.sendIdx["noneSatisfy:"]=1;
  53323. $self._deny_($2);
  53324. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53325. return $core.withContext(function($ctx2) {
  53326. return $recv(each).__eq($recv($globals.Object)._new());
  53327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53328. })));
  53329. return self;
  53330. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53331. },
  53332. args: [],
  53333. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  53334. referencedClasses: ["Object"],
  53335. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53336. }),
  53337. $globals.CollectionTest);
  53338. $core.addMethod(
  53339. $core.method({
  53340. selector: "testRegression1224",
  53341. protocol: "tests",
  53342. fn: function (){
  53343. var self=this,$self=this;
  53344. return $core.withContext(function($ctx1) {
  53345. var $3,$2,$1;
  53346. $3=$recv($self._collectionClass())._new();
  53347. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53348. }));
  53349. $2=$recv($3)._yourself();
  53350. $1=$recv($2)._size();
  53351. $self._assert_equals_($1,(0));
  53352. return self;
  53353. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53354. },
  53355. args: [],
  53356. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53357. referencedClasses: [],
  53358. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53359. }),
  53360. $globals.CollectionTest);
  53361. $core.addMethod(
  53362. $core.method({
  53363. selector: "testRemoveAll",
  53364. protocol: "tests",
  53365. fn: function (){
  53366. var self=this,$self=this;
  53367. return $core.withContext(function($ctx1) {
  53368. var $2,$1;
  53369. $2=$self._collection();
  53370. $recv($2)._removeAll();
  53371. $1=$recv($2)._yourself();
  53372. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53373. return self;
  53374. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53375. },
  53376. args: [],
  53377. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53378. referencedClasses: [],
  53379. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53380. }),
  53381. $globals.CollectionTest);
  53382. $core.addMethod(
  53383. $core.method({
  53384. selector: "testSelect",
  53385. protocol: "tests",
  53386. fn: function (){
  53387. var self=this,$self=this;
  53388. return $core.withContext(function($ctx1) {
  53389. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53390. $2=$self._collection();
  53391. $ctx1.sendIdx["collection"]=1;
  53392. $1=$recv($2)._select_((function(){
  53393. return false;
  53394. }));
  53395. $ctx1.sendIdx["select:"]=1;
  53396. $4=$self._collectionClass();
  53397. $ctx1.sendIdx["collectionClass"]=1;
  53398. $3=$recv($4)._new();
  53399. $ctx1.sendIdx["new"]=1;
  53400. $self._assert_equals_($1,$3);
  53401. $ctx1.sendIdx["assert:equals:"]=1;
  53402. $6=$self._collection();
  53403. $ctx1.sendIdx["collection"]=2;
  53404. $5=$recv($6)._select_((function(){
  53405. return true;
  53406. }));
  53407. $ctx1.sendIdx["select:"]=2;
  53408. $7=$self._collection();
  53409. $ctx1.sendIdx["collection"]=3;
  53410. $self._assert_equals_($5,$7);
  53411. $ctx1.sendIdx["assert:equals:"]=2;
  53412. $9=$self._collectionWithNewValue();
  53413. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53414. $8=$recv($9)._select_((function(each){
  53415. return $core.withContext(function($ctx2) {
  53416. $10=$self._sampleNewValue();
  53417. $ctx2.sendIdx["sampleNewValue"]=1;
  53418. return $recv(each).__eq($10);
  53419. $ctx2.sendIdx["="]=1;
  53420. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53421. }));
  53422. $ctx1.sendIdx["select:"]=3;
  53423. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53424. $ctx1.sendIdx["assert:equals:"]=3;
  53425. $12=$self._collectionWithNewValue();
  53426. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53427. $11=$recv($12)._select_((function(each){
  53428. return $core.withContext(function($ctx2) {
  53429. $13=$self._sampleNewValue();
  53430. $ctx2.sendIdx["sampleNewValue"]=2;
  53431. return $recv(each).__tild_eq($13);
  53432. $ctx2.sendIdx["~="]=1;
  53433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53434. }));
  53435. $ctx1.sendIdx["select:"]=4;
  53436. $14=$self._collection();
  53437. $ctx1.sendIdx["collection"]=4;
  53438. $self._assert_equals_($11,$14);
  53439. $ctx1.sendIdx["assert:equals:"]=4;
  53440. $16=$self._collection();
  53441. $ctx1.sendIdx["collection"]=5;
  53442. $15=$recv($16)._select_((function(each){
  53443. return $core.withContext(function($ctx2) {
  53444. $17=$self._sampleNewValue();
  53445. $ctx2.sendIdx["sampleNewValue"]=3;
  53446. return $recv(each).__eq($17);
  53447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53448. }));
  53449. $ctx1.sendIdx["select:"]=5;
  53450. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53451. $ctx1.sendIdx["assert:equals:"]=5;
  53452. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53453. return $core.withContext(function($ctx2) {
  53454. return $recv(each).__tild_eq($self._sampleNewValue());
  53455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53456. })),$self._collection());
  53457. return self;
  53458. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53459. },
  53460. args: [],
  53461. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  53462. referencedClasses: [],
  53463. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53464. }),
  53465. $globals.CollectionTest);
  53466. $core.addMethod(
  53467. $core.method({
  53468. selector: "testSelectThenCollect",
  53469. protocol: "tests",
  53470. fn: function (){
  53471. var self=this,$self=this;
  53472. return $core.withContext(function($ctx1) {
  53473. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53474. $2=$self._collection();
  53475. $ctx1.sendIdx["collection"]=1;
  53476. $1=$recv($2)._select_thenCollect_((function(){
  53477. return false;
  53478. }),"isString");
  53479. $ctx1.sendIdx["select:thenCollect:"]=1;
  53480. $4=$self._collectionClass();
  53481. $ctx1.sendIdx["collectionClass"]=1;
  53482. $3=$recv($4)._new();
  53483. $ctx1.sendIdx["new"]=1;
  53484. $self._assert_equals_($1,$3);
  53485. $ctx1.sendIdx["assert:equals:"]=1;
  53486. $6=$self._collection();
  53487. $ctx1.sendIdx["collection"]=2;
  53488. $5=$recv($6)._select_thenCollect_((function(){
  53489. return true;
  53490. }),(function(x){
  53491. return x;
  53492. }));
  53493. $ctx1.sendIdx["select:thenCollect:"]=2;
  53494. $7=$self._collection();
  53495. $ctx1.sendIdx["collection"]=3;
  53496. $self._assert_equals_($5,$7);
  53497. $ctx1.sendIdx["assert:equals:"]=2;
  53498. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53499. return $core.withContext(function($ctx2) {
  53500. $9=$self._sampleNewValue();
  53501. $ctx2.sendIdx["sampleNewValue"]=1;
  53502. return $recv(each).__eq($9);
  53503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53504. }),(function(x){
  53505. return x;
  53506. }));
  53507. $ctx1.sendIdx["select:thenCollect:"]=3;
  53508. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53509. $ctx1.sendIdx["assert:equals:"]=3;
  53510. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53511. return $core.withContext(function($ctx2) {
  53512. return $recv(each).__tild_eq($self._sampleNewValue());
  53513. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53514. }),"printString"),$self._collectionOfPrintStrings());
  53515. return self;
  53516. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53517. },
  53518. args: [],
  53519. source: "testSelectThenCollect\x0a\x09self assert: (self collection select: [ false ] thenCollect: #isString) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ] thenCollect: [:x|x]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ] thenCollect: [:x|x]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ] thenCollect: #printString) equals: self collectionOfPrintStrings",
  53520. referencedClasses: [],
  53521. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53522. }),
  53523. $globals.CollectionTest);
  53524. $core.addMethod(
  53525. $core.method({
  53526. selector: "testSingle",
  53527. protocol: "tests",
  53528. fn: function (){
  53529. var self=this,$self=this;
  53530. return $core.withContext(function($ctx1) {
  53531. $self._should_raise_((function(){
  53532. return $core.withContext(function($ctx2) {
  53533. return $recv($recv($self._collectionClass())._new())._single();
  53534. $ctx2.sendIdx["single"]=1;
  53535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53536. }),$globals.Error);
  53537. $ctx1.sendIdx["should:raise:"]=1;
  53538. $self._should_raise_((function(){
  53539. return $core.withContext(function($ctx2) {
  53540. return $recv($self._collection())._single();
  53541. $ctx2.sendIdx["single"]=2;
  53542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53543. }),$globals.Error);
  53544. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53545. return self;
  53546. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53547. },
  53548. args: [],
  53549. source: "testSingle\x0a\x09self should: [ self collectionClass new single ] raise: Error.\x0a\x09self should: [ self collection single ] raise: Error.\x0a\x09self assert: self sampleNewValueAsCollection single equals: self sampleNewValue",
  53550. referencedClasses: ["Error"],
  53551. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53552. }),
  53553. $globals.CollectionTest);
  53554. $core.addMethod(
  53555. $core.method({
  53556. selector: "testSize",
  53557. protocol: "tests",
  53558. fn: function (){
  53559. var self=this,$self=this;
  53560. return $core.withContext(function($ctx1) {
  53561. var $1,$2;
  53562. $1=$recv($recv($self._collectionClass())._new())._size();
  53563. $ctx1.sendIdx["size"]=1;
  53564. $self._assert_equals_($1,(0));
  53565. $ctx1.sendIdx["assert:equals:"]=1;
  53566. $2=$recv($self._sampleNewValueAsCollection())._size();
  53567. $ctx1.sendIdx["size"]=2;
  53568. $self._assert_equals_($2,(1));
  53569. $ctx1.sendIdx["assert:equals:"]=2;
  53570. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53571. return self;
  53572. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53573. },
  53574. args: [],
  53575. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  53576. referencedClasses: [],
  53577. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53578. }),
  53579. $globals.CollectionTest);
  53580. $core.addMethod(
  53581. $core.method({
  53582. selector: "collectionClass",
  53583. protocol: "fixture",
  53584. fn: function (){
  53585. var self=this,$self=this;
  53586. return nil;
  53587. },
  53588. args: [],
  53589. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53590. referencedClasses: [],
  53591. messageSends: []
  53592. }),
  53593. $globals.CollectionTest.a$cls);
  53594. $core.addMethod(
  53595. $core.method({
  53596. selector: "isAbstract",
  53597. protocol: "testing",
  53598. fn: function (){
  53599. var self=this,$self=this;
  53600. return $core.withContext(function($ctx1) {
  53601. return $recv($self._collectionClass())._isNil();
  53602. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53603. },
  53604. args: [],
  53605. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53606. referencedClasses: [],
  53607. messageSends: ["isNil", "collectionClass"]
  53608. }),
  53609. $globals.CollectionTest.a$cls);
  53610. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53611. $core.addMethod(
  53612. $core.method({
  53613. selector: "collectionWithNewValue",
  53614. protocol: "fixture",
  53615. fn: function (){
  53616. var self=this,$self=this;
  53617. return $core.withContext(function($ctx1) {
  53618. $self._subclassResponsibility();
  53619. return self;
  53620. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53621. },
  53622. args: [],
  53623. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  53624. referencedClasses: [],
  53625. messageSends: ["subclassResponsibility"]
  53626. }),
  53627. $globals.IndexableCollectionTest);
  53628. $core.addMethod(
  53629. $core.method({
  53630. selector: "nonIndexesDo:",
  53631. protocol: "fixture",
  53632. fn: function (aBlock){
  53633. var self=this,$self=this;
  53634. return $core.withContext(function($ctx1) {
  53635. $self._subclassResponsibility();
  53636. return self;
  53637. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53638. },
  53639. args: ["aBlock"],
  53640. source: "nonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  53641. referencedClasses: [],
  53642. messageSends: ["subclassResponsibility"]
  53643. }),
  53644. $globals.IndexableCollectionTest);
  53645. $core.addMethod(
  53646. $core.method({
  53647. selector: "sampleNewIndex",
  53648. protocol: "fixture",
  53649. fn: function (){
  53650. var self=this,$self=this;
  53651. return $core.withContext(function($ctx1) {
  53652. $self._subclassResponsibility();
  53653. return self;
  53654. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53655. },
  53656. args: [],
  53657. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  53658. referencedClasses: [],
  53659. messageSends: ["subclassResponsibility"]
  53660. }),
  53661. $globals.IndexableCollectionTest);
  53662. $core.addMethod(
  53663. $core.method({
  53664. selector: "samplesDo:",
  53665. protocol: "fixture",
  53666. fn: function (aBlock){
  53667. var self=this,$self=this;
  53668. return $core.withContext(function($ctx1) {
  53669. $self._subclassResponsibility();
  53670. return self;
  53671. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53672. },
  53673. args: ["aBlock"],
  53674. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  53675. referencedClasses: [],
  53676. messageSends: ["subclassResponsibility"]
  53677. }),
  53678. $globals.IndexableCollectionTest);
  53679. $core.addMethod(
  53680. $core.method({
  53681. selector: "testAt",
  53682. protocol: "tests",
  53683. fn: function (){
  53684. var self=this,$self=this;
  53685. return $core.withContext(function($ctx1) {
  53686. var $1;
  53687. $self._nonIndexesDo_((function(each){
  53688. return $core.withContext(function($ctx2) {
  53689. return $self._should_raise_((function(){
  53690. return $core.withContext(function($ctx3) {
  53691. $1=$self._collection();
  53692. $ctx3.sendIdx["collection"]=1;
  53693. return $recv($1)._at_(each);
  53694. $ctx3.sendIdx["at:"]=1;
  53695. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53696. }),$globals.Error);
  53697. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53698. }));
  53699. $self._samplesDo_((function(index,value){
  53700. return $core.withContext(function($ctx2) {
  53701. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53702. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53703. }));
  53704. return self;
  53705. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53706. },
  53707. args: [],
  53708. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  53709. referencedClasses: ["Error"],
  53710. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53711. }),
  53712. $globals.IndexableCollectionTest);
  53713. $core.addMethod(
  53714. $core.method({
  53715. selector: "testAtIfAbsent",
  53716. protocol: "tests",
  53717. fn: function (){
  53718. var self=this,$self=this;
  53719. return $core.withContext(function($ctx1) {
  53720. var $2,$1,$3;
  53721. $self._nonIndexesDo_((function(each){
  53722. return $core.withContext(function($ctx2) {
  53723. $2=$self._collection();
  53724. $ctx2.sendIdx["collection"]=1;
  53725. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53726. return $core.withContext(function($ctx3) {
  53727. return $self._sampleNewValue();
  53728. $ctx3.sendIdx["sampleNewValue"]=1;
  53729. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53730. }));
  53731. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53732. $3=$self._sampleNewValue();
  53733. $ctx2.sendIdx["sampleNewValue"]=2;
  53734. return $self._assert_equals_($1,$3);
  53735. $ctx2.sendIdx["assert:equals:"]=1;
  53736. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53737. }));
  53738. $self._samplesDo_((function(index,value){
  53739. return $core.withContext(function($ctx2) {
  53740. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53741. return $core.withContext(function($ctx3) {
  53742. return $self._sampleNewValue();
  53743. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53744. })),value);
  53745. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53746. }));
  53747. return self;
  53748. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53749. },
  53750. args: [],
  53751. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  53752. referencedClasses: [],
  53753. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53754. }),
  53755. $globals.IndexableCollectionTest);
  53756. $core.addMethod(
  53757. $core.method({
  53758. selector: "testAtIfAbsentPut",
  53759. protocol: "tests",
  53760. fn: function (){
  53761. var self=this,$self=this;
  53762. var newCollection;
  53763. return $core.withContext(function($ctx1) {
  53764. var $1;
  53765. newCollection=$self._collection();
  53766. $ctx1.sendIdx["collection"]=1;
  53767. $self._samplesDo_((function(index,value){
  53768. return $core.withContext(function($ctx2) {
  53769. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53770. return $core.withContext(function($ctx3) {
  53771. return $self._sampleNewValue();
  53772. $ctx3.sendIdx["sampleNewValue"]=1;
  53773. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53774. }));
  53775. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53776. return $self._assert_equals_($1,value);
  53777. $ctx2.sendIdx["assert:equals:"]=1;
  53778. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53779. }));
  53780. $self._assert_equals_(newCollection,$self._collection());
  53781. $ctx1.sendIdx["assert:equals:"]=2;
  53782. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53783. return $core.withContext(function($ctx2) {
  53784. return $self._sampleNewValue();
  53785. $ctx2.sendIdx["sampleNewValue"]=2;
  53786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53787. })),$self._sampleNewValue());
  53788. $ctx1.sendIdx["assert:equals:"]=3;
  53789. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53790. return self;
  53791. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53792. },
  53793. args: [],
  53794. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  53795. referencedClasses: [],
  53796. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53797. }),
  53798. $globals.IndexableCollectionTest);
  53799. $core.addMethod(
  53800. $core.method({
  53801. selector: "testAtIfPresent",
  53802. protocol: "tests",
  53803. fn: function (){
  53804. var self=this,$self=this;
  53805. var visited,sentinel;
  53806. return $core.withContext(function($ctx1) {
  53807. var $2,$1,$4,$3;
  53808. sentinel=$recv($globals.Object)._new();
  53809. $self._nonIndexesDo_((function(each){
  53810. return $core.withContext(function($ctx2) {
  53811. visited=nil;
  53812. $2=$self._collection();
  53813. $ctx2.sendIdx["collection"]=1;
  53814. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53815. visited=value1;
  53816. return sentinel;
  53817. }));
  53818. $ctx2.sendIdx["at:ifPresent:"]=1;
  53819. $self._assert_equals_($1,nil);
  53820. $ctx2.sendIdx["assert:equals:"]=1;
  53821. return $self._assert_($recv(visited)._isNil());
  53822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53823. }));
  53824. $self._samplesDo_((function(index,value){
  53825. return $core.withContext(function($ctx2) {
  53826. visited=nil;
  53827. $4=$self._collection();
  53828. $ctx2.sendIdx["collection"]=2;
  53829. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53830. visited=value2;
  53831. return sentinel;
  53832. }));
  53833. $self._assert_equals_($3,sentinel);
  53834. $ctx2.sendIdx["assert:equals:"]=2;
  53835. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53836. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53837. }));
  53838. return self;
  53839. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53840. },
  53841. args: [],
  53842. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  53843. referencedClasses: ["Object"],
  53844. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53845. }),
  53846. $globals.IndexableCollectionTest);
  53847. $core.addMethod(
  53848. $core.method({
  53849. selector: "testAtIfPresentIfAbsent",
  53850. protocol: "tests",
  53851. fn: function (){
  53852. var self=this,$self=this;
  53853. var visited,sentinel;
  53854. return $core.withContext(function($ctx1) {
  53855. var $2,$1,$3,$5,$4;
  53856. sentinel=$recv($globals.Object)._new();
  53857. $self._nonIndexesDo_((function(each){
  53858. return $core.withContext(function($ctx2) {
  53859. visited=nil;
  53860. $2=$self._collection();
  53861. $ctx2.sendIdx["collection"]=1;
  53862. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53863. visited=value1;
  53864. return sentinel;
  53865. }),(function(){
  53866. return $core.withContext(function($ctx3) {
  53867. return $self._sampleNewValue();
  53868. $ctx3.sendIdx["sampleNewValue"]=1;
  53869. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53870. }));
  53871. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53872. $3=$self._sampleNewValue();
  53873. $ctx2.sendIdx["sampleNewValue"]=2;
  53874. $self._assert_equals_($1,$3);
  53875. $ctx2.sendIdx["assert:equals:"]=1;
  53876. return $self._assert_($recv(visited)._isNil());
  53877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53878. }));
  53879. $self._samplesDo_((function(index,value){
  53880. return $core.withContext(function($ctx2) {
  53881. visited=nil;
  53882. $5=$self._collection();
  53883. $ctx2.sendIdx["collection"]=2;
  53884. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  53885. visited=value2;
  53886. return sentinel;
  53887. }),(function(){
  53888. return $core.withContext(function($ctx3) {
  53889. return $self._sampleNewValue();
  53890. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  53891. }));
  53892. $self._assert_equals_($4,sentinel);
  53893. $ctx2.sendIdx["assert:equals:"]=2;
  53894. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53895. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  53896. }));
  53897. return self;
  53898. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53899. },
  53900. args: [],
  53901. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  53902. referencedClasses: ["Object"],
  53903. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  53904. }),
  53905. $globals.IndexableCollectionTest);
  53906. $core.addMethod(
  53907. $core.method({
  53908. selector: "testAtPut",
  53909. protocol: "tests",
  53910. fn: function (){
  53911. var self=this,$self=this;
  53912. var newCollection;
  53913. return $core.withContext(function($ctx1) {
  53914. newCollection=$self._collection();
  53915. $ctx1.sendIdx["collection"]=1;
  53916. $self._samplesDo_((function(index,value){
  53917. return $core.withContext(function($ctx2) {
  53918. return $recv(newCollection)._at_put_(index,value);
  53919. $ctx2.sendIdx["at:put:"]=1;
  53920. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53921. }));
  53922. $self._assert_equals_(newCollection,$self._collection());
  53923. $ctx1.sendIdx["assert:equals:"]=1;
  53924. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  53925. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53926. return self;
  53927. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53928. },
  53929. args: [],
  53930. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  53931. referencedClasses: [],
  53932. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  53933. }),
  53934. $globals.IndexableCollectionTest);
  53935. $core.addMethod(
  53936. $core.method({
  53937. selector: "testIndexOf",
  53938. protocol: "tests",
  53939. fn: function (){
  53940. var self=this,$self=this;
  53941. return $core.withContext(function($ctx1) {
  53942. var $1;
  53943. $self._should_raise_((function(){
  53944. return $core.withContext(function($ctx2) {
  53945. $1=$self._collection();
  53946. $ctx2.sendIdx["collection"]=1;
  53947. return $recv($1)._indexOf_($self._sampleNewValue());
  53948. $ctx2.sendIdx["indexOf:"]=1;
  53949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53950. }),$globals.Error);
  53951. $self._samplesDo_((function(index,value){
  53952. return $core.withContext(function($ctx2) {
  53953. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  53954. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  53955. }));
  53956. return self;
  53957. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  53958. },
  53959. args: [],
  53960. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  53961. referencedClasses: ["Error"],
  53962. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  53963. }),
  53964. $globals.IndexableCollectionTest);
  53965. $core.addMethod(
  53966. $core.method({
  53967. selector: "testIndexOfWithNull",
  53968. protocol: "tests",
  53969. fn: function (){
  53970. var self=this,$self=this;
  53971. var jsNull;
  53972. return $core.withContext(function($ctx1) {
  53973. var $2,$1;
  53974. jsNull=$recv($globals.JSON)._parse_("null");
  53975. $self._samplesDo_((function(index,value){
  53976. return $core.withContext(function($ctx2) {
  53977. $2=$self._collection();
  53978. $recv($2)._at_put_(index,jsNull);
  53979. $1=$recv($2)._indexOf_(jsNull);
  53980. return $self._assert_equals_($1,index);
  53981. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53982. }));
  53983. return self;
  53984. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  53985. },
  53986. args: [],
  53987. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  53988. referencedClasses: ["JSON"],
  53989. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  53990. }),
  53991. $globals.IndexableCollectionTest);
  53992. $core.addMethod(
  53993. $core.method({
  53994. selector: "testWithIndexDo",
  53995. protocol: "tests",
  53996. fn: function (){
  53997. var self=this,$self=this;
  53998. var collection;
  53999. return $core.withContext(function($ctx1) {
  54000. collection=$self._collection();
  54001. $ctx1.sendIdx["collection"]=1;
  54002. $recv($self._collection())._withIndexDo_((function(each,index){
  54003. return $core.withContext(function($ctx2) {
  54004. return $self._assert_equals_($recv(collection)._at_(index),each);
  54005. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  54006. }));
  54007. return self;
  54008. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  54009. },
  54010. args: [],
  54011. source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]",
  54012. referencedClasses: [],
  54013. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  54014. }),
  54015. $globals.IndexableCollectionTest);
  54016. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54017. $core.addMethod(
  54018. $core.method({
  54019. selector: "collectionKeys",
  54020. protocol: "fixture",
  54021. fn: function (){
  54022. var self=this,$self=this;
  54023. return $core.withContext(function($ctx1) {
  54024. $self._subclassResponsibility();
  54025. return self;
  54026. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  54027. },
  54028. args: [],
  54029. source: "collectionKeys\x0a\x09self subclassResponsibility",
  54030. referencedClasses: [],
  54031. messageSends: ["subclassResponsibility"]
  54032. }),
  54033. $globals.AssociativeCollectionTest);
  54034. $core.addMethod(
  54035. $core.method({
  54036. selector: "collectionValues",
  54037. protocol: "fixture",
  54038. fn: function (){
  54039. var self=this,$self=this;
  54040. return $core.withContext(function($ctx1) {
  54041. $self._subclassResponsibility();
  54042. return self;
  54043. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  54044. },
  54045. args: [],
  54046. source: "collectionValues\x0a\x09self subclassResponsibility",
  54047. referencedClasses: [],
  54048. messageSends: ["subclassResponsibility"]
  54049. }),
  54050. $globals.AssociativeCollectionTest);
  54051. $core.addMethod(
  54052. $core.method({
  54053. selector: "nonIndexesDo:",
  54054. protocol: "fixture",
  54055. fn: function (aBlock){
  54056. var self=this,$self=this;
  54057. return $core.withContext(function($ctx1) {
  54058. $recv(aBlock)._value_((5));
  54059. $ctx1.sendIdx["value:"]=1;
  54060. $recv(aBlock)._value_((function(){
  54061. }));
  54062. $ctx1.sendIdx["value:"]=2;
  54063. $recv(aBlock)._value_($recv($globals.Object)._new());
  54064. $ctx1.sendIdx["value:"]=3;
  54065. $recv(aBlock)._value_("z");
  54066. return self;
  54067. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54068. },
  54069. args: ["aBlock"],
  54070. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  54071. referencedClasses: ["Object"],
  54072. messageSends: ["value:", "new"]
  54073. }),
  54074. $globals.AssociativeCollectionTest);
  54075. $core.addMethod(
  54076. $core.method({
  54077. selector: "sampleNewIndex",
  54078. protocol: "fixture",
  54079. fn: function (){
  54080. var self=this,$self=this;
  54081. return "new";
  54082. },
  54083. args: [],
  54084. source: "sampleNewIndex\x0a\x09^ 'new'",
  54085. referencedClasses: [],
  54086. messageSends: []
  54087. }),
  54088. $globals.AssociativeCollectionTest);
  54089. $core.addMethod(
  54090. $core.method({
  54091. selector: "samplesDo:",
  54092. protocol: "fixture",
  54093. fn: function (aBlock){
  54094. var self=this,$self=this;
  54095. return $core.withContext(function($ctx1) {
  54096. $recv(aBlock)._value_value_("a",(2));
  54097. return self;
  54098. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54099. },
  54100. args: ["aBlock"],
  54101. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  54102. referencedClasses: [],
  54103. messageSends: ["value:value:"]
  54104. }),
  54105. $globals.AssociativeCollectionTest);
  54106. $core.addMethod(
  54107. $core.method({
  54108. selector: "testAddAll",
  54109. protocol: "tests",
  54110. fn: function (){
  54111. var self=this,$self=this;
  54112. return $core.withContext(function($ctx1) {
  54113. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54114. (
  54115. $ctx1.supercall = true,
  54116. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54117. $ctx1.supercall = false;
  54118. $2=$self._collection();
  54119. $ctx1.sendIdx["collection"]=1;
  54120. $3=$self._collection();
  54121. $ctx1.sendIdx["collection"]=2;
  54122. $recv($2)._addAll_($3);
  54123. $ctx1.sendIdx["addAll:"]=1;
  54124. $4=$recv($2)._yourself();
  54125. $ctx1.sendIdx["yourself"]=1;
  54126. $1=$4;
  54127. $5=$self._collection();
  54128. $ctx1.sendIdx["collection"]=3;
  54129. $self._assert_equals_($1,$5);
  54130. $ctx1.sendIdx["assert:equals:"]=1;
  54131. $7=$self._collection();
  54132. $ctx1.sendIdx["collection"]=4;
  54133. $8=$self._collectionWithNewValue();
  54134. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54135. $recv($7)._addAll_($8);
  54136. $ctx1.sendIdx["addAll:"]=2;
  54137. $9=$recv($7)._yourself();
  54138. $ctx1.sendIdx["yourself"]=2;
  54139. $6=$9;
  54140. $10=$self._collectionWithNewValue();
  54141. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54142. $self._assert_equals_($6,$10);
  54143. $ctx1.sendIdx["assert:equals:"]=2;
  54144. $12=$self._collectionWithNewValue();
  54145. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54146. $recv($12)._addAll_($self._collection());
  54147. $11=$recv($12)._yourself();
  54148. $self._assert_equals_($11,$self._collectionWithNewValue());
  54149. return self;
  54150. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  54151. },
  54152. args: [],
  54153. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  54154. referencedClasses: [],
  54155. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54156. }),
  54157. $globals.AssociativeCollectionTest);
  54158. $core.addMethod(
  54159. $core.method({
  54160. selector: "testAsDictionary",
  54161. protocol: "tests",
  54162. fn: function (){
  54163. var self=this,$self=this;
  54164. return $core.withContext(function($ctx1) {
  54165. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  54166. return self;
  54167. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  54168. },
  54169. args: [],
  54170. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  54171. referencedClasses: ["Dictionary"],
  54172. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  54173. }),
  54174. $globals.AssociativeCollectionTest);
  54175. $core.addMethod(
  54176. $core.method({
  54177. selector: "testAsHashedCollection",
  54178. protocol: "tests",
  54179. fn: function (){
  54180. var self=this,$self=this;
  54181. return $core.withContext(function($ctx1) {
  54182. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  54183. return self;
  54184. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  54185. },
  54186. args: [],
  54187. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  54188. referencedClasses: ["HashedCollection"],
  54189. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  54190. }),
  54191. $globals.AssociativeCollectionTest);
  54192. $core.addMethod(
  54193. $core.method({
  54194. selector: "testComma",
  54195. protocol: "tests",
  54196. fn: function (){
  54197. var self=this,$self=this;
  54198. return $core.withContext(function($ctx1) {
  54199. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54200. (
  54201. $ctx1.supercall = true,
  54202. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54203. $ctx1.supercall = false;
  54204. $2=$self._collection();
  54205. $ctx1.sendIdx["collection"]=1;
  54206. $3=$self._collection();
  54207. $ctx1.sendIdx["collection"]=2;
  54208. $1=$recv($2).__comma($3);
  54209. $ctx1.sendIdx[","]=1;
  54210. $4=$self._collection();
  54211. $ctx1.sendIdx["collection"]=3;
  54212. $self._assert_equals_($1,$4);
  54213. $ctx1.sendIdx["assert:equals:"]=1;
  54214. $6=$self._collection();
  54215. $ctx1.sendIdx["collection"]=4;
  54216. $7=$self._collectionWithNewValue();
  54217. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54218. $5=$recv($6).__comma($7);
  54219. $ctx1.sendIdx[","]=2;
  54220. $8=$self._collectionWithNewValue();
  54221. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54222. $self._assert_equals_($5,$8);
  54223. $ctx1.sendIdx["assert:equals:"]=2;
  54224. $10=$self._collectionWithNewValue();
  54225. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54226. $9=$recv($10).__comma($self._collection());
  54227. $self._assert_equals_($9,$self._collectionWithNewValue());
  54228. return self;
  54229. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54230. },
  54231. args: [],
  54232. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  54233. referencedClasses: [],
  54234. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54235. }),
  54236. $globals.AssociativeCollectionTest);
  54237. $core.addMethod(
  54238. $core.method({
  54239. selector: "testFrom",
  54240. protocol: "tests",
  54241. fn: function (){
  54242. var self=this,$self=this;
  54243. var associations;
  54244. return $core.withContext(function($ctx1) {
  54245. var $1;
  54246. $1="a".__minus_gt((1));
  54247. $ctx1.sendIdx["->"]=1;
  54248. associations=[$1,"b".__minus_gt((2))];
  54249. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54250. return self;
  54251. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54252. },
  54253. args: [],
  54254. source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  54255. referencedClasses: [],
  54256. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54257. }),
  54258. $globals.AssociativeCollectionTest);
  54259. $core.addMethod(
  54260. $core.method({
  54261. selector: "testKeys",
  54262. protocol: "tests",
  54263. fn: function (){
  54264. var self=this,$self=this;
  54265. return $core.withContext(function($ctx1) {
  54266. var $2,$1,$3,$4;
  54267. $2=$recv($recv($self._collectionClass())._new())._keys();
  54268. $ctx1.sendIdx["keys"]=1;
  54269. $1=$recv($2)._isEmpty();
  54270. $self._assert_($1);
  54271. $3=$recv($self._collection())._keys();
  54272. $ctx1.sendIdx["keys"]=2;
  54273. $4=$self._collectionKeys();
  54274. $ctx1.sendIdx["collectionKeys"]=1;
  54275. $self._assertSameContents_as_($3,$4);
  54276. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54277. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54278. return self;
  54279. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54280. },
  54281. args: [],
  54282. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  54283. referencedClasses: [],
  54284. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54285. }),
  54286. $globals.AssociativeCollectionTest);
  54287. $core.addMethod(
  54288. $core.method({
  54289. selector: "testNewFromPairs",
  54290. protocol: "tests",
  54291. fn: function (){
  54292. var self=this,$self=this;
  54293. var flattenedAssociations;
  54294. return $core.withContext(function($ctx1) {
  54295. flattenedAssociations=["a",(1),"b",(2)];
  54296. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54297. return self;
  54298. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54299. },
  54300. args: [],
  54301. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  54302. referencedClasses: [],
  54303. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54304. }),
  54305. $globals.AssociativeCollectionTest);
  54306. $core.addMethod(
  54307. $core.method({
  54308. selector: "testPrintString",
  54309. protocol: "tests",
  54310. fn: function (){
  54311. var self=this,$self=this;
  54312. return $core.withContext(function($ctx1) {
  54313. var $3,$2,$1,$4;
  54314. $3=$self._collectionClass();
  54315. $ctx1.sendIdx["collectionClass"]=1;
  54316. $2=$recv($3)._new();
  54317. $recv($2)._at_put_("firstname","James");
  54318. $ctx1.sendIdx["at:put:"]=1;
  54319. $recv($2)._at_put_("lastname","Bond");
  54320. $1=$recv($2)._printString();
  54321. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54322. $ctx1.sendIdx[","]=1;
  54323. $self._assert_equals_($1,$4);
  54324. return self;
  54325. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54326. },
  54327. args: [],
  54328. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  54329. referencedClasses: [],
  54330. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54331. }),
  54332. $globals.AssociativeCollectionTest);
  54333. $core.addMethod(
  54334. $core.method({
  54335. selector: "testRemoveKey",
  54336. protocol: "tests",
  54337. fn: function (){
  54338. var self=this,$self=this;
  54339. return $core.withContext(function($ctx1) {
  54340. var $1,$2,$3,$5,$6,$4,$8,$7;
  54341. $self._nonIndexesDo_((function(each){
  54342. var collection;
  54343. return $core.withContext(function($ctx2) {
  54344. collection=$self._collection();
  54345. $ctx2.sendIdx["collection"]=1;
  54346. $self._should_raise_((function(){
  54347. return $core.withContext(function($ctx3) {
  54348. return $recv(collection)._removeKey_(each);
  54349. $ctx3.sendIdx["removeKey:"]=1;
  54350. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54351. }),$globals.Error);
  54352. $1=collection;
  54353. $2=$self._collection();
  54354. $ctx2.sendIdx["collection"]=2;
  54355. return $self._assert_equals_($1,$2);
  54356. $ctx2.sendIdx["assert:equals:"]=1;
  54357. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54358. }));
  54359. $self._samplesDo_((function(index,value){
  54360. var collection;
  54361. return $core.withContext(function($ctx2) {
  54362. collection=$self._collection();
  54363. $ctx2.sendIdx["collection"]=3;
  54364. $3=$recv(collection)._removeKey_(index);
  54365. $ctx2.sendIdx["removeKey:"]=2;
  54366. $self._assert_equals_($3,value);
  54367. $ctx2.sendIdx["assert:equals:"]=2;
  54368. $5=collection;
  54369. $6=$self._collection();
  54370. $ctx2.sendIdx["collection"]=4;
  54371. $4=$recv($5).__eq($6);
  54372. return $self._deny_($4);
  54373. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54374. }));
  54375. $8=$self._collectionWithNewValue();
  54376. $recv($8)._removeKey_($self._sampleNewIndex());
  54377. $7=$recv($8)._yourself();
  54378. $self._assert_equals_($7,$self._collection());
  54379. return self;
  54380. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54381. },
  54382. args: [],
  54383. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  54384. referencedClasses: ["Error"],
  54385. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54386. }),
  54387. $globals.AssociativeCollectionTest);
  54388. $core.addMethod(
  54389. $core.method({
  54390. selector: "testRemoveKeyIfAbsent",
  54391. protocol: "tests",
  54392. fn: function (){
  54393. var self=this,$self=this;
  54394. return $core.withContext(function($ctx1) {
  54395. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54396. $self._nonIndexesDo_((function(each){
  54397. var collection;
  54398. return $core.withContext(function($ctx2) {
  54399. collection=$self._collection();
  54400. $ctx2.sendIdx["collection"]=1;
  54401. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54402. return $core.withContext(function($ctx3) {
  54403. return $self._sampleNewValue();
  54404. $ctx3.sendIdx["sampleNewValue"]=1;
  54405. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54406. }));
  54407. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54408. $2=$self._sampleNewValue();
  54409. $ctx2.sendIdx["sampleNewValue"]=2;
  54410. $self._assert_equals_($1,$2);
  54411. $ctx2.sendIdx["assert:equals:"]=1;
  54412. $3=collection;
  54413. $4=$self._collection();
  54414. $ctx2.sendIdx["collection"]=2;
  54415. return $self._assert_equals_($3,$4);
  54416. $ctx2.sendIdx["assert:equals:"]=2;
  54417. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54418. }));
  54419. $self._samplesDo_((function(index,value){
  54420. var collection;
  54421. return $core.withContext(function($ctx2) {
  54422. collection=$self._collection();
  54423. $ctx2.sendIdx["collection"]=3;
  54424. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54425. return $core.withContext(function($ctx3) {
  54426. return $self._sampleNewValue();
  54427. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54428. }));
  54429. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54430. $self._assert_equals_($5,value);
  54431. $ctx2.sendIdx["assert:equals:"]=3;
  54432. $7=collection;
  54433. $8=$self._collection();
  54434. $ctx2.sendIdx["collection"]=4;
  54435. $6=$recv($7).__eq($8);
  54436. return $self._deny_($6);
  54437. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54438. }));
  54439. $10=$self._collectionWithNewValue();
  54440. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54441. return $core.withContext(function($ctx2) {
  54442. return $self._assert_(false);
  54443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54444. }));
  54445. $9=$recv($10)._yourself();
  54446. $self._assert_equals_($9,$self._collection());
  54447. return self;
  54448. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54449. },
  54450. args: [],
  54451. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  54452. referencedClasses: [],
  54453. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54454. }),
  54455. $globals.AssociativeCollectionTest);
  54456. $core.addMethod(
  54457. $core.method({
  54458. selector: "testValues",
  54459. protocol: "tests",
  54460. fn: function (){
  54461. var self=this,$self=this;
  54462. return $core.withContext(function($ctx1) {
  54463. var $2,$1,$3,$4;
  54464. $2=$recv($recv($self._collectionClass())._new())._values();
  54465. $ctx1.sendIdx["values"]=1;
  54466. $1=$recv($2)._isEmpty();
  54467. $self._assert_($1);
  54468. $3=$recv($self._collection())._values();
  54469. $ctx1.sendIdx["values"]=2;
  54470. $4=$self._collectionValues();
  54471. $ctx1.sendIdx["collectionValues"]=1;
  54472. $self._assertSameContents_as_($3,$4);
  54473. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54474. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54475. return self;
  54476. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54477. },
  54478. args: [],
  54479. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  54480. referencedClasses: [],
  54481. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54482. }),
  54483. $globals.AssociativeCollectionTest);
  54484. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54485. $core.addMethod(
  54486. $core.method({
  54487. selector: "collection",
  54488. protocol: "fixture",
  54489. fn: function (){
  54490. var self=this,$self=this;
  54491. return $core.withContext(function($ctx1) {
  54492. var $1;
  54493. $1=$recv($globals.Dictionary)._new();
  54494. $recv($1)._at_put_((1),(1));
  54495. $ctx1.sendIdx["at:put:"]=1;
  54496. $recv($1)._at_put_("a",(2));
  54497. $ctx1.sendIdx["at:put:"]=2;
  54498. $recv($1)._at_put_(true,(3));
  54499. $ctx1.sendIdx["at:put:"]=3;
  54500. $recv($1)._at_put_((1).__at((3)),(-4));
  54501. $ctx1.sendIdx["at:put:"]=4;
  54502. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54503. return $recv($1)._yourself();
  54504. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54505. },
  54506. args: [],
  54507. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: sampleBlock put: 9;\x0a\x09\x09yourself",
  54508. referencedClasses: ["Dictionary"],
  54509. messageSends: ["at:put:", "new", "@", "yourself"]
  54510. }),
  54511. $globals.DictionaryTest);
  54512. $core.addMethod(
  54513. $core.method({
  54514. selector: "collectionKeys",
  54515. protocol: "fixture",
  54516. fn: function (){
  54517. var self=this,$self=this;
  54518. return $core.withContext(function($ctx1) {
  54519. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54520. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54521. },
  54522. args: [],
  54523. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54524. referencedClasses: [],
  54525. messageSends: ["@"]
  54526. }),
  54527. $globals.DictionaryTest);
  54528. $core.addMethod(
  54529. $core.method({
  54530. selector: "collectionOfPrintStrings",
  54531. protocol: "fixture",
  54532. fn: function (){
  54533. var self=this,$self=this;
  54534. return $core.withContext(function($ctx1) {
  54535. var $1;
  54536. $1=$recv($globals.Dictionary)._new();
  54537. $recv($1)._at_put_((1),"1");
  54538. $ctx1.sendIdx["at:put:"]=1;
  54539. $recv($1)._at_put_("a","2");
  54540. $ctx1.sendIdx["at:put:"]=2;
  54541. $recv($1)._at_put_(true,"3");
  54542. $ctx1.sendIdx["at:put:"]=3;
  54543. $recv($1)._at_put_((1).__at((3)),"-4");
  54544. $ctx1.sendIdx["at:put:"]=4;
  54545. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54546. return $recv($1)._yourself();
  54547. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54548. },
  54549. args: [],
  54550. source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09at: sampleBlock put: '9';\x0a\x09\x09yourself",
  54551. referencedClasses: ["Dictionary"],
  54552. messageSends: ["at:put:", "new", "@", "yourself"]
  54553. }),
  54554. $globals.DictionaryTest);
  54555. $core.addMethod(
  54556. $core.method({
  54557. selector: "collectionSize",
  54558. protocol: "fixture",
  54559. fn: function (){
  54560. var self=this,$self=this;
  54561. return (5);
  54562. },
  54563. args: [],
  54564. source: "collectionSize\x0a\x09^ 5",
  54565. referencedClasses: [],
  54566. messageSends: []
  54567. }),
  54568. $globals.DictionaryTest);
  54569. $core.addMethod(
  54570. $core.method({
  54571. selector: "collectionValues",
  54572. protocol: "fixture",
  54573. fn: function (){
  54574. var self=this,$self=this;
  54575. return [(1),(2),(3),(-4),(9)];
  54576. },
  54577. args: [],
  54578. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54579. referencedClasses: [],
  54580. messageSends: []
  54581. }),
  54582. $globals.DictionaryTest);
  54583. $core.addMethod(
  54584. $core.method({
  54585. selector: "collectionWithDuplicates",
  54586. protocol: "fixture",
  54587. fn: function (){
  54588. var self=this,$self=this;
  54589. return $core.withContext(function($ctx1) {
  54590. var $1;
  54591. $1=$recv($globals.Dictionary)._new();
  54592. $recv($1)._at_put_((1),(1));
  54593. $ctx1.sendIdx["at:put:"]=1;
  54594. $recv($1)._at_put_("a",(2));
  54595. $ctx1.sendIdx["at:put:"]=2;
  54596. $recv($1)._at_put_(true,(3));
  54597. $ctx1.sendIdx["at:put:"]=3;
  54598. $recv($1)._at_put_((4),(-4));
  54599. $ctx1.sendIdx["at:put:"]=4;
  54600. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54601. $ctx1.sendIdx["at:put:"]=5;
  54602. $recv($1)._at_put_("b",(1));
  54603. $ctx1.sendIdx["at:put:"]=6;
  54604. $recv($1)._at_put_((3),(3));
  54605. $ctx1.sendIdx["at:put:"]=7;
  54606. $recv($1)._at_put_(false,(12));
  54607. return $recv($1)._yourself();
  54608. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54609. },
  54610. args: [],
  54611. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: sampleBlock put: 9;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  54612. referencedClasses: ["Dictionary"],
  54613. messageSends: ["at:put:", "new", "yourself"]
  54614. }),
  54615. $globals.DictionaryTest);
  54616. $core.addMethod(
  54617. $core.method({
  54618. selector: "collectionWithNewValue",
  54619. protocol: "fixture",
  54620. fn: function (){
  54621. var self=this,$self=this;
  54622. return $core.withContext(function($ctx1) {
  54623. var $1;
  54624. $1=$recv($globals.Dictionary)._new();
  54625. $recv($1)._at_put_((1),(1));
  54626. $ctx1.sendIdx["at:put:"]=1;
  54627. $recv($1)._at_put_("a",(2));
  54628. $ctx1.sendIdx["at:put:"]=2;
  54629. $recv($1)._at_put_(true,(3));
  54630. $ctx1.sendIdx["at:put:"]=3;
  54631. $recv($1)._at_put_((1).__at((3)),(-4));
  54632. $ctx1.sendIdx["at:put:"]=4;
  54633. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54634. $ctx1.sendIdx["at:put:"]=5;
  54635. $recv($1)._at_put_("new","N");
  54636. return $recv($1)._yourself();
  54637. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54638. },
  54639. args: [],
  54640. source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: sampleBlock put: 9;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54641. referencedClasses: ["Dictionary"],
  54642. messageSends: ["at:put:", "new", "@", "yourself"]
  54643. }),
  54644. $globals.DictionaryTest);
  54645. $core.addMethod(
  54646. $core.method({
  54647. selector: "sampleNewValueAsCollection",
  54648. protocol: "fixture",
  54649. fn: function (){
  54650. var self=this,$self=this;
  54651. return $core.withContext(function($ctx1) {
  54652. var $1;
  54653. $1=$recv($globals.Dictionary)._new();
  54654. $recv($1)._at_put_("new","N");
  54655. return $recv($1)._yourself();
  54656. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54657. },
  54658. args: [],
  54659. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54660. referencedClasses: ["Dictionary"],
  54661. messageSends: ["at:put:", "new", "yourself"]
  54662. }),
  54663. $globals.DictionaryTest);
  54664. $core.addMethod(
  54665. $core.method({
  54666. selector: "samplesDo:",
  54667. protocol: "fixture",
  54668. fn: function (aBlock){
  54669. var self=this,$self=this;
  54670. return $core.withContext(function($ctx1) {
  54671. (
  54672. $ctx1.supercall = true,
  54673. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54674. $ctx1.supercall = false;
  54675. $recv(aBlock)._value_value_(true,(3));
  54676. $ctx1.sendIdx["value:value:"]=1;
  54677. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54678. $ctx1.sendIdx["value:value:"]=2;
  54679. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54680. return self;
  54681. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54682. },
  54683. args: ["aBlock"],
  54684. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4.\x0a\x09aBlock value: sampleBlock value: 9",
  54685. referencedClasses: [],
  54686. messageSends: ["samplesDo:", "value:value:", "@"]
  54687. }),
  54688. $globals.DictionaryTest);
  54689. $core.addMethod(
  54690. $core.method({
  54691. selector: "testAccessing",
  54692. protocol: "tests",
  54693. fn: function (){
  54694. var self=this,$self=this;
  54695. var d;
  54696. return $core.withContext(function($ctx1) {
  54697. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54698. d=$recv($globals.Dictionary)._new();
  54699. $recv(d)._at_put_("hello","world");
  54700. $ctx1.sendIdx["at:put:"]=1;
  54701. $1=$recv(d)._at_("hello");
  54702. $ctx1.sendIdx["at:"]=1;
  54703. $self._assert_equals_($1,"world");
  54704. $ctx1.sendIdx["assert:equals:"]=1;
  54705. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54706. return nil;
  54707. }));
  54708. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54709. $self._assert_equals_($2,"world");
  54710. $ctx1.sendIdx["assert:equals:"]=2;
  54711. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54712. return nil;
  54713. }))).__eq("world"));
  54714. $ctx1.sendIdx["deny:"]=1;
  54715. $3=$recv(d)._includesKey_("hello");
  54716. $ctx1.sendIdx["includesKey:"]=1;
  54717. $self._assert_($3);
  54718. $ctx1.sendIdx["assert:"]=1;
  54719. $4=$recv(d)._includesKey_("foo");
  54720. $ctx1.sendIdx["includesKey:"]=2;
  54721. $self._deny_($4);
  54722. $ctx1.sendIdx["deny:"]=2;
  54723. $recv(d)._at_put_((1),(2));
  54724. $ctx1.sendIdx["at:put:"]=2;
  54725. $5=$recv(d)._at_((1));
  54726. $ctx1.sendIdx["at:"]=2;
  54727. $self._assert_equals_($5,(2));
  54728. $ctx1.sendIdx["assert:equals:"]=3;
  54729. $6=d;
  54730. $7=(1).__at((3));
  54731. $ctx1.sendIdx["@"]=1;
  54732. $recv($6)._at_put_($7,(3));
  54733. $9=d;
  54734. $10=(1).__at((3));
  54735. $ctx1.sendIdx["@"]=2;
  54736. $8=$recv($9)._at_($10);
  54737. $self._assert_equals_($8,(3));
  54738. $12=d;
  54739. $13=(1).__at((3));
  54740. $ctx1.sendIdx["@"]=3;
  54741. $11=$recv($12)._includesKey_($13);
  54742. $ctx1.sendIdx["includesKey:"]=3;
  54743. $self._assert_($11);
  54744. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54745. return self;
  54746. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54747. },
  54748. args: [],
  54749. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [ nil ]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [ nil ]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)",
  54750. referencedClasses: ["Dictionary"],
  54751. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54752. }),
  54753. $globals.DictionaryTest);
  54754. $core.addMethod(
  54755. $core.method({
  54756. selector: "testDynamicDictionaries",
  54757. protocol: "tests",
  54758. fn: function (){
  54759. var self=this,$self=this;
  54760. return $core.withContext(function($ctx1) {
  54761. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54762. return self;
  54763. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54764. },
  54765. args: [],
  54766. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54767. referencedClasses: ["Dictionary"],
  54768. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54769. }),
  54770. $globals.DictionaryTest);
  54771. $core.addMethod(
  54772. $core.method({
  54773. selector: "collectionClass",
  54774. protocol: "fixture",
  54775. fn: function (){
  54776. var self=this,$self=this;
  54777. return $globals.Dictionary;
  54778. },
  54779. args: [],
  54780. source: "collectionClass\x0a\x09^ Dictionary",
  54781. referencedClasses: ["Dictionary"],
  54782. messageSends: []
  54783. }),
  54784. $globals.DictionaryTest.a$cls);
  54785. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54786. $core.addMethod(
  54787. $core.method({
  54788. selector: "collection",
  54789. protocol: "fixture",
  54790. fn: function (){
  54791. var self=this,$self=this;
  54792. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54793. },
  54794. args: [],
  54795. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54796. referencedClasses: [],
  54797. messageSends: []
  54798. }),
  54799. $globals.HashedCollectionTest);
  54800. $core.addMethod(
  54801. $core.method({
  54802. selector: "collectionKeys",
  54803. protocol: "fixture",
  54804. fn: function (){
  54805. var self=this,$self=this;
  54806. return ["b","a","c","d"];
  54807. },
  54808. args: [],
  54809. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54810. referencedClasses: [],
  54811. messageSends: []
  54812. }),
  54813. $globals.HashedCollectionTest);
  54814. $core.addMethod(
  54815. $core.method({
  54816. selector: "collectionOfPrintStrings",
  54817. protocol: "fixture",
  54818. fn: function (){
  54819. var self=this,$self=this;
  54820. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54821. },
  54822. args: [],
  54823. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54824. referencedClasses: [],
  54825. messageSends: []
  54826. }),
  54827. $globals.HashedCollectionTest);
  54828. $core.addMethod(
  54829. $core.method({
  54830. selector: "collectionSize",
  54831. protocol: "fixture",
  54832. fn: function (){
  54833. var self=this,$self=this;
  54834. return (4);
  54835. },
  54836. args: [],
  54837. source: "collectionSize\x0a\x09^ 4",
  54838. referencedClasses: [],
  54839. messageSends: []
  54840. }),
  54841. $globals.HashedCollectionTest);
  54842. $core.addMethod(
  54843. $core.method({
  54844. selector: "collectionValues",
  54845. protocol: "fixture",
  54846. fn: function (){
  54847. var self=this,$self=this;
  54848. return [(1),(2),(3),(-4)];
  54849. },
  54850. args: [],
  54851. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54852. referencedClasses: [],
  54853. messageSends: []
  54854. }),
  54855. $globals.HashedCollectionTest);
  54856. $core.addMethod(
  54857. $core.method({
  54858. selector: "collectionWithDuplicates",
  54859. protocol: "fixture",
  54860. fn: function (){
  54861. var self=this,$self=this;
  54862. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54863. },
  54864. args: [],
  54865. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54866. referencedClasses: [],
  54867. messageSends: []
  54868. }),
  54869. $globals.HashedCollectionTest);
  54870. $core.addMethod(
  54871. $core.method({
  54872. selector: "collectionWithNewValue",
  54873. protocol: "fixture",
  54874. fn: function (){
  54875. var self=this,$self=this;
  54876. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54877. },
  54878. args: [],
  54879. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54880. referencedClasses: [],
  54881. messageSends: []
  54882. }),
  54883. $globals.HashedCollectionTest);
  54884. $core.addMethod(
  54885. $core.method({
  54886. selector: "sampleNewValueAsCollection",
  54887. protocol: "fixture",
  54888. fn: function (){
  54889. var self=this,$self=this;
  54890. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54891. },
  54892. args: [],
  54893. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54894. referencedClasses: [],
  54895. messageSends: []
  54896. }),
  54897. $globals.HashedCollectionTest);
  54898. $core.addMethod(
  54899. $core.method({
  54900. selector: "testDynamicDictionaries",
  54901. protocol: "tests",
  54902. fn: function (){
  54903. var self=this,$self=this;
  54904. return $core.withContext(function($ctx1) {
  54905. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54906. return self;
  54907. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  54908. },
  54909. args: [],
  54910. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54911. referencedClasses: ["HashedCollection"],
  54912. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54913. }),
  54914. $globals.HashedCollectionTest);
  54915. $core.addMethod(
  54916. $core.method({
  54917. selector: "collectionClass",
  54918. protocol: "fixture",
  54919. fn: function (){
  54920. var self=this,$self=this;
  54921. return $globals.HashedCollection;
  54922. },
  54923. args: [],
  54924. source: "collectionClass\x0a\x09^ HashedCollection",
  54925. referencedClasses: ["HashedCollection"],
  54926. messageSends: []
  54927. }),
  54928. $globals.HashedCollectionTest.a$cls);
  54929. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54930. $core.addMethod(
  54931. $core.method({
  54932. selector: "collectionFirst",
  54933. protocol: "fixture",
  54934. fn: function (){
  54935. var self=this,$self=this;
  54936. return $core.withContext(function($ctx1) {
  54937. $self._subclassResponsibility();
  54938. return self;
  54939. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  54940. },
  54941. args: [],
  54942. source: "collectionFirst\x0a\x09self subclassResponsibility",
  54943. referencedClasses: [],
  54944. messageSends: ["subclassResponsibility"]
  54945. }),
  54946. $globals.SequenceableCollectionTest);
  54947. $core.addMethod(
  54948. $core.method({
  54949. selector: "collectionFirstTwo",
  54950. protocol: "fixture",
  54951. fn: function (){
  54952. var self=this,$self=this;
  54953. return $core.withContext(function($ctx1) {
  54954. $self._subclassResponsibility();
  54955. return self;
  54956. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  54957. },
  54958. args: [],
  54959. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  54960. referencedClasses: [],
  54961. messageSends: ["subclassResponsibility"]
  54962. }),
  54963. $globals.SequenceableCollectionTest);
  54964. $core.addMethod(
  54965. $core.method({
  54966. selector: "collectionLast",
  54967. protocol: "fixture",
  54968. fn: function (){
  54969. var self=this,$self=this;
  54970. return $core.withContext(function($ctx1) {
  54971. $self._subclassResponsibility();
  54972. return self;
  54973. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  54974. },
  54975. args: [],
  54976. source: "collectionLast\x0a\x09self subclassResponsibility",
  54977. referencedClasses: [],
  54978. messageSends: ["subclassResponsibility"]
  54979. }),
  54980. $globals.SequenceableCollectionTest);
  54981. $core.addMethod(
  54982. $core.method({
  54983. selector: "collectionLastTwo",
  54984. protocol: "fixture",
  54985. fn: function (){
  54986. var self=this,$self=this;
  54987. return $core.withContext(function($ctx1) {
  54988. $self._subclassResponsibility();
  54989. return self;
  54990. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  54991. },
  54992. args: [],
  54993. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  54994. referencedClasses: [],
  54995. messageSends: ["subclassResponsibility"]
  54996. }),
  54997. $globals.SequenceableCollectionTest);
  54998. $core.addMethod(
  54999. $core.method({
  55000. selector: "nonIndexesDo:",
  55001. protocol: "fixture",
  55002. fn: function (aBlock){
  55003. var self=this,$self=this;
  55004. return $core.withContext(function($ctx1) {
  55005. $recv(aBlock)._value_((0));
  55006. $ctx1.sendIdx["value:"]=1;
  55007. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  55008. $ctx1.sendIdx["value:"]=2;
  55009. $recv(aBlock)._value_("z");
  55010. return self;
  55011. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55012. },
  55013. args: ["aBlock"],
  55014. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  55015. referencedClasses: [],
  55016. messageSends: ["value:", "+", "collectionSize"]
  55017. }),
  55018. $globals.SequenceableCollectionTest);
  55019. $core.addMethod(
  55020. $core.method({
  55021. selector: "samplesDo:",
  55022. protocol: "fixture",
  55023. fn: function (aBlock){
  55024. var self=this,$self=this;
  55025. return $core.withContext(function($ctx1) {
  55026. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  55027. $ctx1.sendIdx["value:value:"]=1;
  55028. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  55029. return self;
  55030. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55031. },
  55032. args: ["aBlock"],
  55033. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  55034. referencedClasses: [],
  55035. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  55036. }),
  55037. $globals.SequenceableCollectionTest);
  55038. $core.addMethod(
  55039. $core.method({
  55040. selector: "testBeginsWith",
  55041. protocol: "tests",
  55042. fn: function (){
  55043. var self=this,$self=this;
  55044. return $core.withContext(function($ctx1) {
  55045. var $2,$1,$4,$5,$3,$7,$6;
  55046. $2=$self._collection();
  55047. $ctx1.sendIdx["collection"]=1;
  55048. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  55049. $ctx1.sendIdx["beginsWith:"]=1;
  55050. $self._assert_($1);
  55051. $ctx1.sendIdx["assert:"]=1;
  55052. $4=$self._collection();
  55053. $ctx1.sendIdx["collection"]=2;
  55054. $5=$self._collection();
  55055. $ctx1.sendIdx["collection"]=3;
  55056. $3=$recv($4)._beginsWith_($5);
  55057. $ctx1.sendIdx["beginsWith:"]=2;
  55058. $self._assert_($3);
  55059. $ctx1.sendIdx["assert:"]=2;
  55060. $7=$self._collection();
  55061. $ctx1.sendIdx["collection"]=4;
  55062. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  55063. $ctx1.sendIdx["beginsWith:"]=3;
  55064. $self._assert_($6);
  55065. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  55066. return self;
  55067. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  55068. },
  55069. args: [],
  55070. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  55071. referencedClasses: [],
  55072. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  55073. }),
  55074. $globals.SequenceableCollectionTest);
  55075. $core.addMethod(
  55076. $core.method({
  55077. selector: "testEndsWith",
  55078. protocol: "tests",
  55079. fn: function (){
  55080. var self=this,$self=this;
  55081. return $core.withContext(function($ctx1) {
  55082. var $2,$1,$4,$5,$3,$7,$6;
  55083. $2=$self._collection();
  55084. $ctx1.sendIdx["collection"]=1;
  55085. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  55086. $ctx1.sendIdx["endsWith:"]=1;
  55087. $self._assert_($1);
  55088. $ctx1.sendIdx["assert:"]=1;
  55089. $4=$self._collection();
  55090. $ctx1.sendIdx["collection"]=2;
  55091. $5=$self._collection();
  55092. $ctx1.sendIdx["collection"]=3;
  55093. $3=$recv($4)._endsWith_($5);
  55094. $ctx1.sendIdx["endsWith:"]=2;
  55095. $self._assert_($3);
  55096. $ctx1.sendIdx["assert:"]=2;
  55097. $7=$self._collection();
  55098. $ctx1.sendIdx["collection"]=4;
  55099. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  55100. $ctx1.sendIdx["endsWith:"]=3;
  55101. $self._assert_($6);
  55102. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  55103. return self;
  55104. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  55105. },
  55106. args: [],
  55107. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  55108. referencedClasses: [],
  55109. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  55110. }),
  55111. $globals.SequenceableCollectionTest);
  55112. $core.addMethod(
  55113. $core.method({
  55114. selector: "testFirst",
  55115. protocol: "tests",
  55116. fn: function (){
  55117. var self=this,$self=this;
  55118. return $core.withContext(function($ctx1) {
  55119. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  55120. return self;
  55121. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  55122. },
  55123. args: [],
  55124. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  55125. referencedClasses: [],
  55126. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  55127. }),
  55128. $globals.SequenceableCollectionTest);
  55129. $core.addMethod(
  55130. $core.method({
  55131. selector: "testFirstN",
  55132. protocol: "tests",
  55133. fn: function (){
  55134. var self=this,$self=this;
  55135. return $core.withContext(function($ctx1) {
  55136. var $2,$1,$4,$3,$6,$5,$7;
  55137. $2=$self._collection();
  55138. $ctx1.sendIdx["collection"]=1;
  55139. $1=$recv($2)._first_((2));
  55140. $ctx1.sendIdx["first:"]=1;
  55141. $self._assert_equals_($1,$self._collectionFirstTwo());
  55142. $ctx1.sendIdx["assert:equals:"]=1;
  55143. $4=$self._collection();
  55144. $ctx1.sendIdx["collection"]=2;
  55145. $3=$recv($4)._first_((0));
  55146. $ctx1.sendIdx["first:"]=2;
  55147. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55148. $ctx1.sendIdx["assert:equals:"]=2;
  55149. $6=$self._collection();
  55150. $ctx1.sendIdx["collection"]=3;
  55151. $5=$recv($6)._first_($self._collectionSize());
  55152. $ctx1.sendIdx["first:"]=3;
  55153. $7=$self._collection();
  55154. $ctx1.sendIdx["collection"]=4;
  55155. $self._assert_equals_($5,$7);
  55156. $self._should_raise_((function(){
  55157. return $core.withContext(function($ctx2) {
  55158. return $recv($self._collection())._first_((33));
  55159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55160. }),$globals.Error);
  55161. return self;
  55162. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  55163. },
  55164. args: [],
  55165. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  55166. referencedClasses: ["Error"],
  55167. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55168. }),
  55169. $globals.SequenceableCollectionTest);
  55170. $core.addMethod(
  55171. $core.method({
  55172. selector: "testFourth",
  55173. protocol: "tests",
  55174. fn: function (){
  55175. var self=this,$self=this;
  55176. return $core.withContext(function($ctx1) {
  55177. var $2,$1;
  55178. $2=$self._collection();
  55179. $ctx1.sendIdx["collection"]=1;
  55180. $1=$recv($2)._fourth();
  55181. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  55182. return self;
  55183. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  55184. },
  55185. args: [],
  55186. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  55187. referencedClasses: [],
  55188. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  55189. }),
  55190. $globals.SequenceableCollectionTest);
  55191. $core.addMethod(
  55192. $core.method({
  55193. selector: "testIndexOfStartingAt",
  55194. protocol: "tests",
  55195. fn: function (){
  55196. var self=this,$self=this;
  55197. var jsNull;
  55198. return $core.withContext(function($ctx1) {
  55199. var $2,$1,$4,$3;
  55200. jsNull=$recv($globals.JSON)._parse_("null");
  55201. $self._samplesDo_((function(index,value){
  55202. return $core.withContext(function($ctx2) {
  55203. $2=$self._collection();
  55204. $ctx2.sendIdx["collection"]=1;
  55205. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55206. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55207. $self._assert_equals_($1,index);
  55208. $ctx2.sendIdx["assert:equals:"]=1;
  55209. $4=$self._collection();
  55210. $ctx2.sendIdx["collection"]=2;
  55211. $3=$recv($4)._indexOf_startingAt_(value,index);
  55212. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55213. $self._assert_equals_($3,index);
  55214. $ctx2.sendIdx["assert:equals:"]=2;
  55215. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55216. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55217. }));
  55218. return self;
  55219. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55220. },
  55221. args: [],
  55222. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  55223. referencedClasses: ["JSON"],
  55224. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55225. }),
  55226. $globals.SequenceableCollectionTest);
  55227. $core.addMethod(
  55228. $core.method({
  55229. selector: "testIndexOfStartingAtWithNull",
  55230. protocol: "tests",
  55231. fn: function (){
  55232. var self=this,$self=this;
  55233. var jsNull;
  55234. return $core.withContext(function($ctx1) {
  55235. var $1,$2;
  55236. jsNull=$recv($globals.JSON)._parse_("null");
  55237. $self._samplesDo_((function(index,value){
  55238. var collection;
  55239. return $core.withContext(function($ctx2) {
  55240. collection=$self._collection();
  55241. $recv(collection)._at_put_(index,jsNull);
  55242. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55243. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55244. $self._assert_equals_($1,index);
  55245. $ctx2.sendIdx["assert:equals:"]=1;
  55246. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55247. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55248. $self._assert_equals_($2,index);
  55249. $ctx2.sendIdx["assert:equals:"]=2;
  55250. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55251. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55252. }));
  55253. return self;
  55254. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55255. },
  55256. args: [],
  55257. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  55258. referencedClasses: ["JSON"],
  55259. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55260. }),
  55261. $globals.SequenceableCollectionTest);
  55262. $core.addMethod(
  55263. $core.method({
  55264. selector: "testLast",
  55265. protocol: "tests",
  55266. fn: function (){
  55267. var self=this,$self=this;
  55268. return $core.withContext(function($ctx1) {
  55269. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55270. return self;
  55271. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55272. },
  55273. args: [],
  55274. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55275. referencedClasses: [],
  55276. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55277. }),
  55278. $globals.SequenceableCollectionTest);
  55279. $core.addMethod(
  55280. $core.method({
  55281. selector: "testLastN",
  55282. protocol: "tests",
  55283. fn: function (){
  55284. var self=this,$self=this;
  55285. return $core.withContext(function($ctx1) {
  55286. var $2,$1,$4,$3,$6,$5,$7;
  55287. $2=$self._collection();
  55288. $ctx1.sendIdx["collection"]=1;
  55289. $1=$recv($2)._last_((2));
  55290. $ctx1.sendIdx["last:"]=1;
  55291. $self._assert_equals_($1,$self._collectionLastTwo());
  55292. $ctx1.sendIdx["assert:equals:"]=1;
  55293. $4=$self._collection();
  55294. $ctx1.sendIdx["collection"]=2;
  55295. $3=$recv($4)._last_((0));
  55296. $ctx1.sendIdx["last:"]=2;
  55297. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55298. $ctx1.sendIdx["assert:equals:"]=2;
  55299. $6=$self._collection();
  55300. $ctx1.sendIdx["collection"]=3;
  55301. $5=$recv($6)._last_($self._collectionSize());
  55302. $ctx1.sendIdx["last:"]=3;
  55303. $7=$self._collection();
  55304. $ctx1.sendIdx["collection"]=4;
  55305. $self._assert_equals_($5,$7);
  55306. $self._should_raise_((function(){
  55307. return $core.withContext(function($ctx2) {
  55308. return $recv($self._collection())._last_((33));
  55309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55310. }),$globals.Error);
  55311. return self;
  55312. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55313. },
  55314. args: [],
  55315. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  55316. referencedClasses: ["Error"],
  55317. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55318. }),
  55319. $globals.SequenceableCollectionTest);
  55320. $core.addMethod(
  55321. $core.method({
  55322. selector: "testSecond",
  55323. protocol: "tests",
  55324. fn: function (){
  55325. var self=this,$self=this;
  55326. return $core.withContext(function($ctx1) {
  55327. var $2,$1;
  55328. $2=$self._collection();
  55329. $ctx1.sendIdx["collection"]=1;
  55330. $1=$recv($2)._second();
  55331. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55332. return self;
  55333. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55334. },
  55335. args: [],
  55336. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55337. referencedClasses: [],
  55338. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55339. }),
  55340. $globals.SequenceableCollectionTest);
  55341. $core.addMethod(
  55342. $core.method({
  55343. selector: "testThird",
  55344. protocol: "tests",
  55345. fn: function (){
  55346. var self=this,$self=this;
  55347. return $core.withContext(function($ctx1) {
  55348. var $2,$1;
  55349. $2=$self._collection();
  55350. $ctx1.sendIdx["collection"]=1;
  55351. $1=$recv($2)._third();
  55352. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55353. return self;
  55354. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55355. },
  55356. args: [],
  55357. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55358. referencedClasses: [],
  55359. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55360. }),
  55361. $globals.SequenceableCollectionTest);
  55362. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55363. $core.addMethod(
  55364. $core.method({
  55365. selector: "collection",
  55366. protocol: "fixture",
  55367. fn: function (){
  55368. var self=this,$self=this;
  55369. return [(1), (2), (3), (-4)];
  55370. },
  55371. args: [],
  55372. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55373. referencedClasses: [],
  55374. messageSends: []
  55375. }),
  55376. $globals.ArrayTest);
  55377. $core.addMethod(
  55378. $core.method({
  55379. selector: "collectionFirst",
  55380. protocol: "fixture",
  55381. fn: function (){
  55382. var self=this,$self=this;
  55383. return (1);
  55384. },
  55385. args: [],
  55386. source: "collectionFirst\x0a\x09^ 1",
  55387. referencedClasses: [],
  55388. messageSends: []
  55389. }),
  55390. $globals.ArrayTest);
  55391. $core.addMethod(
  55392. $core.method({
  55393. selector: "collectionFirstTwo",
  55394. protocol: "fixture",
  55395. fn: function (){
  55396. var self=this,$self=this;
  55397. return [(1), (2)];
  55398. },
  55399. args: [],
  55400. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55401. referencedClasses: [],
  55402. messageSends: []
  55403. }),
  55404. $globals.ArrayTest);
  55405. $core.addMethod(
  55406. $core.method({
  55407. selector: "collectionLast",
  55408. protocol: "fixture",
  55409. fn: function (){
  55410. var self=this,$self=this;
  55411. return (-4);
  55412. },
  55413. args: [],
  55414. source: "collectionLast\x0a\x09^ -4",
  55415. referencedClasses: [],
  55416. messageSends: []
  55417. }),
  55418. $globals.ArrayTest);
  55419. $core.addMethod(
  55420. $core.method({
  55421. selector: "collectionLastTwo",
  55422. protocol: "fixture",
  55423. fn: function (){
  55424. var self=this,$self=this;
  55425. return [(3), (-4)];
  55426. },
  55427. args: [],
  55428. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55429. referencedClasses: [],
  55430. messageSends: []
  55431. }),
  55432. $globals.ArrayTest);
  55433. $core.addMethod(
  55434. $core.method({
  55435. selector: "collectionOfPrintStrings",
  55436. protocol: "fixture",
  55437. fn: function (){
  55438. var self=this,$self=this;
  55439. return ["1", "2", "3", "-4"];
  55440. },
  55441. args: [],
  55442. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55443. referencedClasses: [],
  55444. messageSends: []
  55445. }),
  55446. $globals.ArrayTest);
  55447. $core.addMethod(
  55448. $core.method({
  55449. selector: "collectionSize",
  55450. protocol: "fixture",
  55451. fn: function (){
  55452. var self=this,$self=this;
  55453. return (4);
  55454. },
  55455. args: [],
  55456. source: "collectionSize\x0a\x09^ 4",
  55457. referencedClasses: [],
  55458. messageSends: []
  55459. }),
  55460. $globals.ArrayTest);
  55461. $core.addMethod(
  55462. $core.method({
  55463. selector: "collectionWithDuplicates",
  55464. protocol: "fixture",
  55465. fn: function (){
  55466. var self=this,$self=this;
  55467. return ["a", "b", "c", (1), (2), (1), "a", []];
  55468. },
  55469. args: [],
  55470. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55471. referencedClasses: [],
  55472. messageSends: []
  55473. }),
  55474. $globals.ArrayTest);
  55475. $core.addMethod(
  55476. $core.method({
  55477. selector: "collectionWithNewValue",
  55478. protocol: "fixture",
  55479. fn: function (){
  55480. var self=this,$self=this;
  55481. return [(1), (2), (3), (-4), "N"];
  55482. },
  55483. args: [],
  55484. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55485. referencedClasses: [],
  55486. messageSends: []
  55487. }),
  55488. $globals.ArrayTest);
  55489. $core.addMethod(
  55490. $core.method({
  55491. selector: "sampleNewIndex",
  55492. protocol: "fixture",
  55493. fn: function (){
  55494. var self=this,$self=this;
  55495. return (5);
  55496. },
  55497. args: [],
  55498. source: "sampleNewIndex\x0a\x09^ 5",
  55499. referencedClasses: [],
  55500. messageSends: []
  55501. }),
  55502. $globals.ArrayTest);
  55503. $core.addMethod(
  55504. $core.method({
  55505. selector: "samplesDo:",
  55506. protocol: "fixture",
  55507. fn: function (aBlock){
  55508. var self=this,$self=this;
  55509. return $core.withContext(function($ctx1) {
  55510. (
  55511. $ctx1.supercall = true,
  55512. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55513. $ctx1.supercall = false;
  55514. $recv(aBlock)._value_value_((3),(3));
  55515. return self;
  55516. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55517. },
  55518. args: ["aBlock"],
  55519. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55520. referencedClasses: [],
  55521. messageSends: ["samplesDo:", "value:value:"]
  55522. }),
  55523. $globals.ArrayTest);
  55524. $core.addMethod(
  55525. $core.method({
  55526. selector: "testAdd",
  55527. protocol: "tests",
  55528. fn: function (){
  55529. var self=this,$self=this;
  55530. var array;
  55531. return $core.withContext(function($ctx1) {
  55532. array=$self._collection();
  55533. $recv(array)._add_((6));
  55534. $self._assert_equals_($recv(array)._last(),(6));
  55535. return self;
  55536. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55537. },
  55538. args: [],
  55539. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55540. referencedClasses: [],
  55541. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55542. }),
  55543. $globals.ArrayTest);
  55544. $core.addMethod(
  55545. $core.method({
  55546. selector: "testAddFirst",
  55547. protocol: "tests",
  55548. fn: function (){
  55549. var self=this,$self=this;
  55550. return $core.withContext(function($ctx1) {
  55551. var $3,$2,$1;
  55552. $3=$self._collection();
  55553. $recv($3)._addFirst_((0));
  55554. $2=$recv($3)._yourself();
  55555. $1=$recv($2)._first();
  55556. $self._assert_equals_($1,(0));
  55557. return self;
  55558. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55559. },
  55560. args: [],
  55561. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55562. referencedClasses: [],
  55563. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55564. }),
  55565. $globals.ArrayTest);
  55566. $core.addMethod(
  55567. $core.method({
  55568. selector: "testPrintString",
  55569. protocol: "tests",
  55570. fn: function (){
  55571. var self=this,$self=this;
  55572. var array;
  55573. return $core.withContext(function($ctx1) {
  55574. var $1,$2,$3,$4,$5,$6,$7,$8;
  55575. array=$recv($globals.Array)._new();
  55576. $1=$recv(array)._printString();
  55577. $ctx1.sendIdx["printString"]=1;
  55578. $self._assert_equals_($1,"an Array ()");
  55579. $ctx1.sendIdx["assert:equals:"]=1;
  55580. $2=array;
  55581. $recv($2)._add_((1));
  55582. $ctx1.sendIdx["add:"]=1;
  55583. $3=$recv($2)._add_((3));
  55584. $ctx1.sendIdx["add:"]=2;
  55585. $4=$recv(array)._printString();
  55586. $ctx1.sendIdx["printString"]=2;
  55587. $self._assert_equals_($4,"an Array (1 3)");
  55588. $ctx1.sendIdx["assert:equals:"]=2;
  55589. $recv(array)._add_("foo");
  55590. $5=$recv(array)._printString();
  55591. $ctx1.sendIdx["printString"]=3;
  55592. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55593. $ctx1.sendIdx["assert:equals:"]=3;
  55594. $6=array;
  55595. $recv($6)._remove_((1));
  55596. $ctx1.sendIdx["remove:"]=1;
  55597. $recv($6)._remove_((3));
  55598. $7=$recv(array)._printString();
  55599. $ctx1.sendIdx["printString"]=4;
  55600. $self._assert_equals_($7,"an Array ('foo')");
  55601. $ctx1.sendIdx["assert:equals:"]=4;
  55602. $recv(array)._addLast_((3));
  55603. $ctx1.sendIdx["addLast:"]=1;
  55604. $8=$recv(array)._printString();
  55605. $ctx1.sendIdx["printString"]=5;
  55606. $self._assert_equals_($8,"an Array ('foo' 3)");
  55607. $ctx1.sendIdx["assert:equals:"]=5;
  55608. $recv(array)._addLast_((3));
  55609. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55610. return self;
  55611. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55612. },
  55613. args: [],
  55614. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.",
  55615. referencedClasses: ["Array"],
  55616. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55617. }),
  55618. $globals.ArrayTest);
  55619. $core.addMethod(
  55620. $core.method({
  55621. selector: "testRemove",
  55622. protocol: "tests",
  55623. fn: function (){
  55624. var self=this,$self=this;
  55625. var array;
  55626. return $core.withContext(function($ctx1) {
  55627. array=[(1), (2), (3), (4), (5)];
  55628. $recv(array)._remove_((3));
  55629. $ctx1.sendIdx["remove:"]=1;
  55630. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55631. $self._should_raise_((function(){
  55632. return $core.withContext(function($ctx2) {
  55633. return $recv(array)._remove_((3));
  55634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55635. }),$globals.Error);
  55636. return self;
  55637. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55638. },
  55639. args: [],
  55640. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  55641. referencedClasses: ["Error"],
  55642. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55643. }),
  55644. $globals.ArrayTest);
  55645. $core.addMethod(
  55646. $core.method({
  55647. selector: "testRemoveFromTo",
  55648. protocol: "tests",
  55649. fn: function (){
  55650. var self=this,$self=this;
  55651. return $core.withContext(function($ctx1) {
  55652. var $1,$2;
  55653. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55654. $ctx1.sendIdx["removeFrom:to:"]=1;
  55655. $self._assert_equals_($1,[(4)]);
  55656. $ctx1.sendIdx["assert:equals:"]=1;
  55657. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55658. $ctx1.sendIdx["removeFrom:to:"]=2;
  55659. $self._assert_equals_($2,[(1), (4)]);
  55660. $ctx1.sendIdx["assert:equals:"]=2;
  55661. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55662. return self;
  55663. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55664. },
  55665. args: [],
  55666. source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)",
  55667. referencedClasses: [],
  55668. messageSends: ["assert:equals:", "removeFrom:to:"]
  55669. }),
  55670. $globals.ArrayTest);
  55671. $core.addMethod(
  55672. $core.method({
  55673. selector: "testRemoveIndex",
  55674. protocol: "tests",
  55675. fn: function (){
  55676. var self=this,$self=this;
  55677. return $core.withContext(function($ctx1) {
  55678. var $1,$2;
  55679. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55680. $ctx1.sendIdx["removeIndex:"]=1;
  55681. $self._assert_equals_($1,[(1), (3), (4)]);
  55682. $ctx1.sendIdx["assert:equals:"]=1;
  55683. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55684. $ctx1.sendIdx["removeIndex:"]=2;
  55685. $self._assert_equals_($2,[(2), (3), (4)]);
  55686. $ctx1.sendIdx["assert:equals:"]=2;
  55687. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55688. return self;
  55689. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55690. },
  55691. args: [],
  55692. source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()",
  55693. referencedClasses: [],
  55694. messageSends: ["assert:equals:", "removeIndex:"]
  55695. }),
  55696. $globals.ArrayTest);
  55697. $core.addMethod(
  55698. $core.method({
  55699. selector: "testRemoveLast",
  55700. protocol: "tests",
  55701. fn: function (){
  55702. var self=this,$self=this;
  55703. var array;
  55704. return $core.withContext(function($ctx1) {
  55705. array=[(1), (2)];
  55706. $recv(array)._removeLast();
  55707. $self._assert_equals_($recv(array)._last(),(1));
  55708. return self;
  55709. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55710. },
  55711. args: [],
  55712. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55713. referencedClasses: [],
  55714. messageSends: ["removeLast", "assert:equals:", "last"]
  55715. }),
  55716. $globals.ArrayTest);
  55717. $core.addMethod(
  55718. $core.method({
  55719. selector: "testReversed",
  55720. protocol: "tests",
  55721. fn: function (){
  55722. var self=this,$self=this;
  55723. var array;
  55724. return $core.withContext(function($ctx1) {
  55725. array=[(5), (4), (3), (2), (1)];
  55726. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55727. return self;
  55728. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55729. },
  55730. args: [],
  55731. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55732. referencedClasses: [],
  55733. messageSends: ["assert:equals:", "reversed"]
  55734. }),
  55735. $globals.ArrayTest);
  55736. $core.addMethod(
  55737. $core.method({
  55738. selector: "testSort",
  55739. protocol: "tests",
  55740. fn: function (){
  55741. var self=this,$self=this;
  55742. var array;
  55743. return $core.withContext(function($ctx1) {
  55744. array=[(10), (1), (5)];
  55745. $recv(array)._sort();
  55746. $self._assert_equals_(array,[(1), (5), (10)]);
  55747. return self;
  55748. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55749. },
  55750. args: [],
  55751. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55752. referencedClasses: [],
  55753. messageSends: ["sort", "assert:equals:"]
  55754. }),
  55755. $globals.ArrayTest);
  55756. $core.addMethod(
  55757. $core.method({
  55758. selector: "collectionClass",
  55759. protocol: "fixture",
  55760. fn: function (){
  55761. var self=this,$self=this;
  55762. return $globals.Array;
  55763. },
  55764. args: [],
  55765. source: "collectionClass\x0a\x09^ Array",
  55766. referencedClasses: ["Array"],
  55767. messageSends: []
  55768. }),
  55769. $globals.ArrayTest.a$cls);
  55770. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55771. $core.addMethod(
  55772. $core.method({
  55773. selector: "collection",
  55774. protocol: "fixture",
  55775. fn: function (){
  55776. var self=this,$self=this;
  55777. return "helLo";
  55778. },
  55779. args: [],
  55780. source: "collection\x0a\x09^ 'helLo'",
  55781. referencedClasses: [],
  55782. messageSends: []
  55783. }),
  55784. $globals.StringTest);
  55785. $core.addMethod(
  55786. $core.method({
  55787. selector: "collectionFirst",
  55788. protocol: "fixture",
  55789. fn: function (){
  55790. var self=this,$self=this;
  55791. return "h";
  55792. },
  55793. args: [],
  55794. source: "collectionFirst\x0a\x09^ 'h'",
  55795. referencedClasses: [],
  55796. messageSends: []
  55797. }),
  55798. $globals.StringTest);
  55799. $core.addMethod(
  55800. $core.method({
  55801. selector: "collectionFirstTwo",
  55802. protocol: "fixture",
  55803. fn: function (){
  55804. var self=this,$self=this;
  55805. return "he";
  55806. },
  55807. args: [],
  55808. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55809. referencedClasses: [],
  55810. messageSends: []
  55811. }),
  55812. $globals.StringTest);
  55813. $core.addMethod(
  55814. $core.method({
  55815. selector: "collectionLast",
  55816. protocol: "fixture",
  55817. fn: function (){
  55818. var self=this,$self=this;
  55819. return "o";
  55820. },
  55821. args: [],
  55822. source: "collectionLast\x0a\x09^ 'o'",
  55823. referencedClasses: [],
  55824. messageSends: []
  55825. }),
  55826. $globals.StringTest);
  55827. $core.addMethod(
  55828. $core.method({
  55829. selector: "collectionLastTwo",
  55830. protocol: "fixture",
  55831. fn: function (){
  55832. var self=this,$self=this;
  55833. return "Lo";
  55834. },
  55835. args: [],
  55836. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55837. referencedClasses: [],
  55838. messageSends: []
  55839. }),
  55840. $globals.StringTest);
  55841. $core.addMethod(
  55842. $core.method({
  55843. selector: "collectionOfPrintStrings",
  55844. protocol: "fixture",
  55845. fn: function (){
  55846. var self=this,$self=this;
  55847. return "'h''e''l''L''o'";
  55848. },
  55849. args: [],
  55850. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55851. referencedClasses: [],
  55852. messageSends: []
  55853. }),
  55854. $globals.StringTest);
  55855. $core.addMethod(
  55856. $core.method({
  55857. selector: "collectionSize",
  55858. protocol: "fixture",
  55859. fn: function (){
  55860. var self=this,$self=this;
  55861. return (5);
  55862. },
  55863. args: [],
  55864. source: "collectionSize\x0a\x09^ 5",
  55865. referencedClasses: [],
  55866. messageSends: []
  55867. }),
  55868. $globals.StringTest);
  55869. $core.addMethod(
  55870. $core.method({
  55871. selector: "collectionWithDuplicates",
  55872. protocol: "fixture",
  55873. fn: function (){
  55874. var self=this,$self=this;
  55875. return "abbaerten";
  55876. },
  55877. args: [],
  55878. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55879. referencedClasses: [],
  55880. messageSends: []
  55881. }),
  55882. $globals.StringTest);
  55883. $core.addMethod(
  55884. $core.method({
  55885. selector: "collectionWithNewValue",
  55886. protocol: "fixture",
  55887. fn: function (){
  55888. var self=this,$self=this;
  55889. return "helLoN";
  55890. },
  55891. args: [],
  55892. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55893. referencedClasses: [],
  55894. messageSends: []
  55895. }),
  55896. $globals.StringTest);
  55897. $core.addMethod(
  55898. $core.method({
  55899. selector: "sampleNewValueAsCollection",
  55900. protocol: "fixture",
  55901. fn: function (){
  55902. var self=this,$self=this;
  55903. return "N";
  55904. },
  55905. args: [],
  55906. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55907. referencedClasses: [],
  55908. messageSends: []
  55909. }),
  55910. $globals.StringTest);
  55911. $core.addMethod(
  55912. $core.method({
  55913. selector: "samplesDo:",
  55914. protocol: "fixture",
  55915. fn: function (aBlock){
  55916. var self=this,$self=this;
  55917. return $core.withContext(function($ctx1) {
  55918. (
  55919. $ctx1.supercall = true,
  55920. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55921. $ctx1.supercall = false;
  55922. $recv(aBlock)._value_value_((3),"l");
  55923. return self;
  55924. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  55925. },
  55926. args: ["aBlock"],
  55927. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  55928. referencedClasses: [],
  55929. messageSends: ["samplesDo:", "value:value:"]
  55930. }),
  55931. $globals.StringTest);
  55932. $core.addMethod(
  55933. $core.method({
  55934. selector: "testAddAll",
  55935. protocol: "tests",
  55936. fn: function (){
  55937. var self=this,$self=this;
  55938. return $core.withContext(function($ctx1) {
  55939. var $1;
  55940. $self._should_raise_((function(){
  55941. return $core.withContext(function($ctx2) {
  55942. $1=$self._collection();
  55943. $ctx2.sendIdx["collection"]=1;
  55944. return $recv($1)._addAll_($self._collection());
  55945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55946. }),$globals.Error);
  55947. return self;
  55948. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  55949. },
  55950. args: [],
  55951. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  55952. referencedClasses: ["Error"],
  55953. messageSends: ["should:raise:", "addAll:", "collection"]
  55954. }),
  55955. $globals.StringTest);
  55956. $core.addMethod(
  55957. $core.method({
  55958. selector: "testAddRemove",
  55959. protocol: "tests",
  55960. fn: function (){
  55961. var self=this,$self=this;
  55962. return $core.withContext(function($ctx1) {
  55963. $self._should_raise_((function(){
  55964. return $core.withContext(function($ctx2) {
  55965. return "hello"._add_("a");
  55966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55967. }),$globals.Error);
  55968. $ctx1.sendIdx["should:raise:"]=1;
  55969. $self._should_raise_((function(){
  55970. return $core.withContext(function($ctx2) {
  55971. return "hello"._remove_("h");
  55972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55973. }),$globals.Error);
  55974. return self;
  55975. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  55976. },
  55977. args: [],
  55978. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  55979. referencedClasses: ["Error"],
  55980. messageSends: ["should:raise:", "add:", "remove:"]
  55981. }),
  55982. $globals.StringTest);
  55983. $core.addMethod(
  55984. $core.method({
  55985. selector: "testAsArray",
  55986. protocol: "tests",
  55987. fn: function (){
  55988. var self=this,$self=this;
  55989. return $core.withContext(function($ctx1) {
  55990. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  55991. return self;
  55992. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  55993. },
  55994. args: [],
  55995. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  55996. referencedClasses: [],
  55997. messageSends: ["assert:equals:", "asArray"]
  55998. }),
  55999. $globals.StringTest);
  56000. $core.addMethod(
  56001. $core.method({
  56002. selector: "testAsLowerCase",
  56003. protocol: "tests",
  56004. fn: function (){
  56005. var self=this,$self=this;
  56006. return $core.withContext(function($ctx1) {
  56007. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  56008. return self;
  56009. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  56010. },
  56011. args: [],
  56012. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  56013. referencedClasses: [],
  56014. messageSends: ["assert:equals:", "asLowercase"]
  56015. }),
  56016. $globals.StringTest);
  56017. $core.addMethod(
  56018. $core.method({
  56019. selector: "testAsNumber",
  56020. protocol: "tests",
  56021. fn: function (){
  56022. var self=this,$self=this;
  56023. return $core.withContext(function($ctx1) {
  56024. var $1,$2;
  56025. $1="3"._asNumber();
  56026. $ctx1.sendIdx["asNumber"]=1;
  56027. $self._assert_equals_($1,(3));
  56028. $ctx1.sendIdx["assert:equals:"]=1;
  56029. $2="-3"._asNumber();
  56030. $ctx1.sendIdx["asNumber"]=2;
  56031. $self._assert_equals_($2,(-3));
  56032. $ctx1.sendIdx["assert:equals:"]=2;
  56033. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  56034. return self;
  56035. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  56036. },
  56037. args: [],
  56038. source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.",
  56039. referencedClasses: [],
  56040. messageSends: ["assert:equals:", "asNumber"]
  56041. }),
  56042. $globals.StringTest);
  56043. $core.addMethod(
  56044. $core.method({
  56045. selector: "testAsUpperCase",
  56046. protocol: "tests",
  56047. fn: function (){
  56048. var self=this,$self=this;
  56049. return $core.withContext(function($ctx1) {
  56050. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  56051. return self;
  56052. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  56053. },
  56054. args: [],
  56055. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  56056. referencedClasses: [],
  56057. messageSends: ["assert:equals:", "asUppercase"]
  56058. }),
  56059. $globals.StringTest);
  56060. $core.addMethod(
  56061. $core.method({
  56062. selector: "testAsciiValue",
  56063. protocol: "tests",
  56064. fn: function (){
  56065. var self=this,$self=this;
  56066. var characterA,characterU;
  56067. return $core.withContext(function($ctx1) {
  56068. var $1;
  56069. characterA="A";
  56070. characterU="U";
  56071. $1=$recv(characterA)._asciiValue();
  56072. $ctx1.sendIdx["asciiValue"]=1;
  56073. $self._assert_equals_($1,(65));
  56074. $ctx1.sendIdx["assert:equals:"]=1;
  56075. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  56076. return self;
  56077. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  56078. },
  56079. args: [],
  56080. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  56081. referencedClasses: [],
  56082. messageSends: ["assert:equals:", "asciiValue"]
  56083. }),
  56084. $globals.StringTest);
  56085. $core.addMethod(
  56086. $core.method({
  56087. selector: "testAtIfAbsentPut",
  56088. protocol: "tests",
  56089. fn: function (){
  56090. var self=this,$self=this;
  56091. return $core.withContext(function($ctx1) {
  56092. $self._should_raise_((function(){
  56093. return $core.withContext(function($ctx2) {
  56094. return "hello"._at_ifAbsentPut_((6),(function(){
  56095. return "a";
  56096. }));
  56097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56098. }),$globals.Error);
  56099. return self;
  56100. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  56101. },
  56102. args: [],
  56103. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  56104. referencedClasses: ["Error"],
  56105. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  56106. }),
  56107. $globals.StringTest);
  56108. $core.addMethod(
  56109. $core.method({
  56110. selector: "testAtPut",
  56111. protocol: "tests",
  56112. fn: function (){
  56113. var self=this,$self=this;
  56114. return $core.withContext(function($ctx1) {
  56115. $self._should_raise_((function(){
  56116. return $core.withContext(function($ctx2) {
  56117. return "hello"._at_put_((1),"a");
  56118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56119. }),$globals.Error);
  56120. return self;
  56121. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  56122. },
  56123. args: [],
  56124. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  56125. referencedClasses: ["Error"],
  56126. messageSends: ["should:raise:", "at:put:"]
  56127. }),
  56128. $globals.StringTest);
  56129. $core.addMethod(
  56130. $core.method({
  56131. selector: "testCapitalized",
  56132. protocol: "tests",
  56133. fn: function (){
  56134. var self=this,$self=this;
  56135. return $core.withContext(function($ctx1) {
  56136. var $1,$2,$3;
  56137. $1="test"._capitalized();
  56138. $ctx1.sendIdx["capitalized"]=1;
  56139. $self._assert_equals_($1,"Test");
  56140. $ctx1.sendIdx["assert:equals:"]=1;
  56141. $2="Test"._capitalized();
  56142. $ctx1.sendIdx["capitalized"]=2;
  56143. $self._assert_equals_($2,"Test");
  56144. $ctx1.sendIdx["assert:equals:"]=2;
  56145. $self._assert_equals_(""._capitalized(),"");
  56146. $ctx1.sendIdx["assert:equals:"]=3;
  56147. $3="Test"._isCapitalized();
  56148. $ctx1.sendIdx["isCapitalized"]=1;
  56149. $self._assert_equals_($3,true);
  56150. $ctx1.sendIdx["assert:equals:"]=4;
  56151. $self._assert_equals_("test"._isCapitalized(),false);
  56152. return self;
  56153. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  56154. },
  56155. args: [],
  56156. source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.",
  56157. referencedClasses: [],
  56158. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  56159. }),
  56160. $globals.StringTest);
  56161. $core.addMethod(
  56162. $core.method({
  56163. selector: "testCharCodeAt",
  56164. protocol: "tests",
  56165. fn: function (){
  56166. var self=this,$self=this;
  56167. return $core.withContext(function($ctx1) {
  56168. var $1,$2,$3,$4,$5;
  56169. $1="jackie"._charCodeAt_((1));
  56170. $ctx1.sendIdx["charCodeAt:"]=1;
  56171. $self._assert_equals_($1,(106));
  56172. $ctx1.sendIdx["assert:equals:"]=1;
  56173. $2="jackie"._charCodeAt_((2));
  56174. $ctx1.sendIdx["charCodeAt:"]=2;
  56175. $self._assert_equals_($2,(97));
  56176. $ctx1.sendIdx["assert:equals:"]=2;
  56177. $3="jackie"._charCodeAt_((3));
  56178. $ctx1.sendIdx["charCodeAt:"]=3;
  56179. $self._assert_equals_($3,(99));
  56180. $ctx1.sendIdx["assert:equals:"]=3;
  56181. $4="jackie"._charCodeAt_((4));
  56182. $ctx1.sendIdx["charCodeAt:"]=4;
  56183. $self._assert_equals_($4,(107));
  56184. $ctx1.sendIdx["assert:equals:"]=4;
  56185. $5="jackie"._charCodeAt_((5));
  56186. $ctx1.sendIdx["charCodeAt:"]=5;
  56187. $self._assert_equals_($5,(105));
  56188. $ctx1.sendIdx["assert:equals:"]=5;
  56189. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  56190. return self;
  56191. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56192. },
  56193. args: [],
  56194. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  56195. referencedClasses: [],
  56196. messageSends: ["assert:equals:", "charCodeAt:"]
  56197. }),
  56198. $globals.StringTest);
  56199. $core.addMethod(
  56200. $core.method({
  56201. selector: "testCopyFromTo",
  56202. protocol: "tests",
  56203. fn: function (){
  56204. var self=this,$self=this;
  56205. return $core.withContext(function($ctx1) {
  56206. var $1;
  56207. $1="jackie"._copyFrom_to_((1),(3));
  56208. $ctx1.sendIdx["copyFrom:to:"]=1;
  56209. $self._assert_equals_($1,"jac");
  56210. $ctx1.sendIdx["assert:equals:"]=1;
  56211. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56212. return self;
  56213. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56214. },
  56215. args: [],
  56216. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56217. referencedClasses: [],
  56218. messageSends: ["assert:equals:", "copyFrom:to:"]
  56219. }),
  56220. $globals.StringTest);
  56221. $core.addMethod(
  56222. $core.method({
  56223. selector: "testCopySeparates",
  56224. protocol: "tests",
  56225. fn: function (){
  56226. var self=this,$self=this;
  56227. return $core.withContext(function($ctx1) {
  56228. var $3,$2,$1;
  56229. $3=$self._collection();
  56230. $ctx1.sendIdx["collection"]=1;
  56231. $2=$recv($3)._copy();
  56232. $1=$recv($2).__eq_eq($self._collection());
  56233. $self._assert_($1);
  56234. return self;
  56235. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56236. },
  56237. args: [],
  56238. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56239. referencedClasses: [],
  56240. messageSends: ["assert:", "==", "copy", "collection"]
  56241. }),
  56242. $globals.StringTest);
  56243. $core.addMethod(
  56244. $core.method({
  56245. selector: "testCopyWithoutAll",
  56246. protocol: "tests",
  56247. fn: function (){
  56248. var self=this,$self=this;
  56249. return $core.withContext(function($ctx1) {
  56250. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56251. return self;
  56252. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56253. },
  56254. args: [],
  56255. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56256. referencedClasses: [],
  56257. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56258. }),
  56259. $globals.StringTest);
  56260. $core.addMethod(
  56261. $core.method({
  56262. selector: "testEquality",
  56263. protocol: "tests",
  56264. fn: function (){
  56265. var self=this,$self=this;
  56266. return $core.withContext(function($ctx1) {
  56267. var $1,$2,$3;
  56268. $self._assert_equals_("hello","hello");
  56269. $ctx1.sendIdx["assert:equals:"]=1;
  56270. $1="hello".__eq("world");
  56271. $ctx1.sendIdx["="]=1;
  56272. $self._deny_($1);
  56273. $ctx1.sendIdx["deny:"]=1;
  56274. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56275. })));
  56276. $ctx1.sendIdx["="]=2;
  56277. $self._deny_($2);
  56278. $ctx1.sendIdx["deny:"]=2;
  56279. $3="hello"._yourself();
  56280. $ctx1.sendIdx["yourself"]=1;
  56281. $self._assert_equals_("hello",$3);
  56282. $ctx1.sendIdx["assert:equals:"]=2;
  56283. $self._assert_equals_("hello"._yourself(),"hello");
  56284. $self._deny_("".__eq((0)));
  56285. return self;
  56286. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56287. },
  56288. args: [],
  56289. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  56290. referencedClasses: [],
  56291. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56292. }),
  56293. $globals.StringTest);
  56294. $core.addMethod(
  56295. $core.method({
  56296. selector: "testIdentity",
  56297. protocol: "tests",
  56298. fn: function (){
  56299. var self=this,$self=this;
  56300. return $core.withContext(function($ctx1) {
  56301. var $1,$2,$4,$3,$5;
  56302. $1="hello".__eq_eq("hello");
  56303. $ctx1.sendIdx["=="]=1;
  56304. $self._assert_($1);
  56305. $ctx1.sendIdx["assert:"]=1;
  56306. $2="hello".__eq_eq("world");
  56307. $ctx1.sendIdx["=="]=2;
  56308. $self._deny_($2);
  56309. $ctx1.sendIdx["deny:"]=1;
  56310. $4="hello"._yourself();
  56311. $ctx1.sendIdx["yourself"]=1;
  56312. $3="hello".__eq_eq($4);
  56313. $ctx1.sendIdx["=="]=3;
  56314. $self._assert_($3);
  56315. $ctx1.sendIdx["assert:"]=2;
  56316. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56317. $ctx1.sendIdx["=="]=4;
  56318. $self._assert_($5);
  56319. $self._deny_("".__eq_eq((0)));
  56320. return self;
  56321. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56322. },
  56323. args: [],
  56324. source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
  56325. referencedClasses: [],
  56326. messageSends: ["assert:", "==", "deny:", "yourself"]
  56327. }),
  56328. $globals.StringTest);
  56329. $core.addMethod(
  56330. $core.method({
  56331. selector: "testIncludesSubString",
  56332. protocol: "tests",
  56333. fn: function (){
  56334. var self=this,$self=this;
  56335. return $core.withContext(function($ctx1) {
  56336. var $1;
  56337. $1="amber"._includesSubString_("ber");
  56338. $ctx1.sendIdx["includesSubString:"]=1;
  56339. $self._assert_($1);
  56340. $self._deny_("amber"._includesSubString_("zork"));
  56341. return self;
  56342. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56343. },
  56344. args: [],
  56345. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56346. referencedClasses: [],
  56347. messageSends: ["assert:", "includesSubString:", "deny:"]
  56348. }),
  56349. $globals.StringTest);
  56350. $core.addMethod(
  56351. $core.method({
  56352. selector: "testIndexOfStartingAtWithNull",
  56353. protocol: "tests",
  56354. fn: function (){
  56355. var self=this,$self=this;
  56356. return self;
  56357. },
  56358. args: [],
  56359. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56360. referencedClasses: [],
  56361. messageSends: []
  56362. }),
  56363. $globals.StringTest);
  56364. $core.addMethod(
  56365. $core.method({
  56366. selector: "testIndexOfWithNull",
  56367. protocol: "tests",
  56368. fn: function (){
  56369. var self=this,$self=this;
  56370. return self;
  56371. },
  56372. args: [],
  56373. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56374. referencedClasses: [],
  56375. messageSends: []
  56376. }),
  56377. $globals.StringTest);
  56378. $core.addMethod(
  56379. $core.method({
  56380. selector: "testIsVowel",
  56381. protocol: "tests",
  56382. fn: function (){
  56383. var self=this,$self=this;
  56384. var vowel,consonant;
  56385. return $core.withContext(function($ctx1) {
  56386. var $1;
  56387. vowel="u";
  56388. consonant="z";
  56389. $1=$recv(vowel)._isVowel();
  56390. $ctx1.sendIdx["isVowel"]=1;
  56391. $self._assert_equals_($1,true);
  56392. $ctx1.sendIdx["assert:equals:"]=1;
  56393. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56394. return self;
  56395. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56396. },
  56397. args: [],
  56398. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  56399. referencedClasses: [],
  56400. messageSends: ["assert:equals:", "isVowel"]
  56401. }),
  56402. $globals.StringTest);
  56403. $core.addMethod(
  56404. $core.method({
  56405. selector: "testJoin",
  56406. protocol: "tests",
  56407. fn: function (){
  56408. var self=this,$self=this;
  56409. return $core.withContext(function($ctx1) {
  56410. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56411. return self;
  56412. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56413. },
  56414. args: [],
  56415. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56416. referencedClasses: [],
  56417. messageSends: ["assert:equals:", "join:"]
  56418. }),
  56419. $globals.StringTest);
  56420. $core.addMethod(
  56421. $core.method({
  56422. selector: "testRegression1224",
  56423. protocol: "tests",
  56424. fn: function (){
  56425. var self=this,$self=this;
  56426. return $core.withContext(function($ctx1) {
  56427. var $2,$1;
  56428. $self._should_raise_((function(){
  56429. return $core.withContext(function($ctx2) {
  56430. $2=$recv($self._collectionClass())._new();
  56431. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56432. }));
  56433. $1=$recv($2)._yourself();
  56434. return $recv($1)._size();
  56435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56436. }),$globals.Error);
  56437. return self;
  56438. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56439. },
  56440. args: [],
  56441. source: "testRegression1224\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size ] raise: Error",
  56442. referencedClasses: ["Error"],
  56443. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56444. }),
  56445. $globals.StringTest);
  56446. $core.addMethod(
  56447. $core.method({
  56448. selector: "testRemoveAll",
  56449. protocol: "tests",
  56450. fn: function (){
  56451. var self=this,$self=this;
  56452. return $core.withContext(function($ctx1) {
  56453. $self._should_raise_((function(){
  56454. return $core.withContext(function($ctx2) {
  56455. return $recv($self._collection())._removeAll();
  56456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56457. }),$globals.Error);
  56458. return self;
  56459. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56460. },
  56461. args: [],
  56462. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56463. referencedClasses: ["Error"],
  56464. messageSends: ["should:raise:", "removeAll", "collection"]
  56465. }),
  56466. $globals.StringTest);
  56467. $core.addMethod(
  56468. $core.method({
  56469. selector: "testReversed",
  56470. protocol: "tests",
  56471. fn: function (){
  56472. var self=this,$self=this;
  56473. return $core.withContext(function($ctx1) {
  56474. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56475. return self;
  56476. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56477. },
  56478. args: [],
  56479. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56480. referencedClasses: [],
  56481. messageSends: ["assert:equals:", "reversed"]
  56482. }),
  56483. $globals.StringTest);
  56484. $core.addMethod(
  56485. $core.method({
  56486. selector: "testStreamContents",
  56487. protocol: "tests",
  56488. fn: function (){
  56489. var self=this,$self=this;
  56490. return $core.withContext(function($ctx1) {
  56491. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56492. return $core.withContext(function($ctx2) {
  56493. $recv(aStream)._nextPutAll_("hello");
  56494. $ctx2.sendIdx["nextPutAll:"]=1;
  56495. $recv(aStream)._space();
  56496. return $recv(aStream)._nextPutAll_("world");
  56497. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56498. })),"hello world");
  56499. return self;
  56500. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56501. },
  56502. args: [],
  56503. source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'",
  56504. referencedClasses: ["String"],
  56505. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56506. }),
  56507. $globals.StringTest);
  56508. $core.addMethod(
  56509. $core.method({
  56510. selector: "testSubStrings",
  56511. protocol: "tests",
  56512. fn: function (){
  56513. var self=this,$self=this;
  56514. return $core.withContext(function($ctx1) {
  56515. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56516. return self;
  56517. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56518. },
  56519. args: [],
  56520. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56521. referencedClasses: [],
  56522. messageSends: ["assert:equals:", "subStrings:"]
  56523. }),
  56524. $globals.StringTest);
  56525. $core.addMethod(
  56526. $core.method({
  56527. selector: "testTrim",
  56528. protocol: "tests",
  56529. fn: function (){
  56530. var self=this,$self=this;
  56531. return $core.withContext(function($ctx1) {
  56532. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56533. $ctx1.sendIdx["assert:equals:"]=1;
  56534. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56535. return self;
  56536. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56537. },
  56538. args: [],
  56539. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56540. referencedClasses: [],
  56541. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56542. }),
  56543. $globals.StringTest);
  56544. $core.addMethod(
  56545. $core.method({
  56546. selector: "testValue",
  56547. protocol: "tests",
  56548. fn: function (){
  56549. var self=this,$self=this;
  56550. return $core.withContext(function($ctx1) {
  56551. $self._assert_equals_("asString"._value_((1)),"1");
  56552. $ctx1.sendIdx["assert:equals:"]=1;
  56553. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56554. return self;
  56555. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56556. },
  56557. args: [],
  56558. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  56559. referencedClasses: [],
  56560. messageSends: ["assert:equals:", "value:", "collect:"]
  56561. }),
  56562. $globals.StringTest);
  56563. $core.addMethod(
  56564. $core.method({
  56565. selector: "collectionClass",
  56566. protocol: "fixture",
  56567. fn: function (){
  56568. var self=this,$self=this;
  56569. return $globals.String;
  56570. },
  56571. args: [],
  56572. source: "collectionClass\x0a\x09^ String",
  56573. referencedClasses: ["String"],
  56574. messageSends: []
  56575. }),
  56576. $globals.StringTest.a$cls);
  56577. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56578. $core.addMethod(
  56579. $core.method({
  56580. selector: "collection",
  56581. protocol: "fixture",
  56582. fn: function (){
  56583. var self=this,$self=this;
  56584. return $core.withContext(function($ctx1) {
  56585. var $1;
  56586. $1=$recv($globals.Set)._new();
  56587. $recv($1)._add_($globals.Smalltalk);
  56588. $ctx1.sendIdx["add:"]=1;
  56589. $recv($1)._add_(nil);
  56590. $ctx1.sendIdx["add:"]=2;
  56591. $recv($1)._add_((3).__at((3)));
  56592. $ctx1.sendIdx["add:"]=3;
  56593. $recv($1)._add_(false);
  56594. $ctx1.sendIdx["add:"]=4;
  56595. $recv($1)._add_($self["@sampleBlock"]);
  56596. return $recv($1)._yourself();
  56597. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56598. },
  56599. args: [],
  56600. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09add: sampleBlock;\x0a\x09\x09yourself",
  56601. referencedClasses: ["Set", "Smalltalk"],
  56602. messageSends: ["add:", "new", "@", "yourself"]
  56603. }),
  56604. $globals.SetTest);
  56605. $core.addMethod(
  56606. $core.method({
  56607. selector: "collectionOfPrintStrings",
  56608. protocol: "fixture",
  56609. fn: function (){
  56610. var self=this,$self=this;
  56611. return $core.withContext(function($ctx1) {
  56612. var $1;
  56613. $1=$recv($globals.Set)._new();
  56614. $recv($1)._add_("a SmalltalkImage");
  56615. $ctx1.sendIdx["add:"]=1;
  56616. $recv($1)._add_("nil");
  56617. $ctx1.sendIdx["add:"]=2;
  56618. $recv($1)._add_("3@3");
  56619. $ctx1.sendIdx["add:"]=3;
  56620. $recv($1)._add_("false");
  56621. $ctx1.sendIdx["add:"]=4;
  56622. $recv($1)._add_("a BlockClosure");
  56623. return $recv($1)._yourself();
  56624. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56625. },
  56626. args: [],
  56627. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09add: 'a BlockClosure';\x0a\x09\x09yourself",
  56628. referencedClasses: ["Set"],
  56629. messageSends: ["add:", "new", "yourself"]
  56630. }),
  56631. $globals.SetTest);
  56632. $core.addMethod(
  56633. $core.method({
  56634. selector: "collectionSize",
  56635. protocol: "fixture",
  56636. fn: function (){
  56637. var self=this,$self=this;
  56638. return (5);
  56639. },
  56640. args: [],
  56641. source: "collectionSize\x0a\x09^ 5",
  56642. referencedClasses: [],
  56643. messageSends: []
  56644. }),
  56645. $globals.SetTest);
  56646. $core.addMethod(
  56647. $core.method({
  56648. selector: "collectionWithDuplicates",
  56649. protocol: "fixture",
  56650. fn: function (){
  56651. var self=this,$self=this;
  56652. return $core.withContext(function($ctx1) {
  56653. var $1;
  56654. $1=$self._collection();
  56655. $recv($1)._add_((0));
  56656. return $recv($1)._yourself();
  56657. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56658. },
  56659. args: [],
  56660. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56661. referencedClasses: [],
  56662. messageSends: ["add:", "collection", "yourself"]
  56663. }),
  56664. $globals.SetTest);
  56665. $core.addMethod(
  56666. $core.method({
  56667. selector: "collectionWithNewValue",
  56668. protocol: "fixture",
  56669. fn: function (){
  56670. var self=this,$self=this;
  56671. return $core.withContext(function($ctx1) {
  56672. var $1;
  56673. $1=$recv($globals.Set)._new();
  56674. $recv($1)._add_($globals.Smalltalk);
  56675. $ctx1.sendIdx["add:"]=1;
  56676. $recv($1)._add_(nil);
  56677. $ctx1.sendIdx["add:"]=2;
  56678. $recv($1)._add_((3).__at((3)));
  56679. $ctx1.sendIdx["add:"]=3;
  56680. $recv($1)._add_("N");
  56681. $ctx1.sendIdx["add:"]=4;
  56682. $recv($1)._add_(false);
  56683. $ctx1.sendIdx["add:"]=5;
  56684. $recv($1)._add_($self["@sampleBlock"]);
  56685. return $recv($1)._yourself();
  56686. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56687. },
  56688. args: [],
  56689. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09add: sampleBlock;\x0a\x09\x09yourself",
  56690. referencedClasses: ["Set", "Smalltalk"],
  56691. messageSends: ["add:", "new", "@", "yourself"]
  56692. }),
  56693. $globals.SetTest);
  56694. $core.addMethod(
  56695. $core.method({
  56696. selector: "testAddAll",
  56697. protocol: "tests",
  56698. fn: function (){
  56699. var self=this,$self=this;
  56700. return $core.withContext(function($ctx1) {
  56701. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56702. (
  56703. $ctx1.supercall = true,
  56704. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56705. $ctx1.supercall = false;
  56706. $2=$self._collection();
  56707. $ctx1.sendIdx["collection"]=1;
  56708. $3=$self._collection();
  56709. $ctx1.sendIdx["collection"]=2;
  56710. $recv($2)._addAll_($3);
  56711. $ctx1.sendIdx["addAll:"]=1;
  56712. $4=$recv($2)._yourself();
  56713. $ctx1.sendIdx["yourself"]=1;
  56714. $1=$4;
  56715. $5=$self._collection();
  56716. $ctx1.sendIdx["collection"]=3;
  56717. $self._assert_equals_($1,$5);
  56718. $ctx1.sendIdx["assert:equals:"]=1;
  56719. $7=$self._collection();
  56720. $ctx1.sendIdx["collection"]=4;
  56721. $8=$self._collectionWithNewValue();
  56722. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56723. $recv($7)._addAll_($8);
  56724. $ctx1.sendIdx["addAll:"]=2;
  56725. $9=$recv($7)._yourself();
  56726. $ctx1.sendIdx["yourself"]=2;
  56727. $6=$9;
  56728. $10=$self._collectionWithNewValue();
  56729. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56730. $self._assert_equals_($6,$10);
  56731. $ctx1.sendIdx["assert:equals:"]=2;
  56732. $12=$self._collectionWithNewValue();
  56733. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56734. $recv($12)._addAll_($self._collection());
  56735. $11=$recv($12)._yourself();
  56736. $self._assert_equals_($11,$self._collectionWithNewValue());
  56737. return self;
  56738. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56739. },
  56740. args: [],
  56741. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  56742. referencedClasses: [],
  56743. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56744. }),
  56745. $globals.SetTest);
  56746. $core.addMethod(
  56747. $core.method({
  56748. selector: "testAddRemove",
  56749. protocol: "tests",
  56750. fn: function (){
  56751. var self=this,$self=this;
  56752. var set;
  56753. return $core.withContext(function($ctx1) {
  56754. var $1,$2;
  56755. set=$recv($globals.Set)._new();
  56756. $self._assert_($recv(set)._isEmpty());
  56757. $ctx1.sendIdx["assert:"]=1;
  56758. $recv(set)._add_((3));
  56759. $ctx1.sendIdx["add:"]=1;
  56760. $1=$recv(set)._includes_((3));
  56761. $ctx1.sendIdx["includes:"]=1;
  56762. $self._assert_($1);
  56763. $ctx1.sendIdx["assert:"]=2;
  56764. $recv(set)._add_((5));
  56765. $2=$recv(set)._includes_((5));
  56766. $ctx1.sendIdx["includes:"]=2;
  56767. $self._assert_($2);
  56768. $recv(set)._remove_((3));
  56769. $self._deny_($recv(set)._includes_((3)));
  56770. return self;
  56771. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56772. },
  56773. args: [],
  56774. source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)",
  56775. referencedClasses: ["Set"],
  56776. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56777. }),
  56778. $globals.SetTest);
  56779. $core.addMethod(
  56780. $core.method({
  56781. selector: "testAt",
  56782. protocol: "tests",
  56783. fn: function (){
  56784. var self=this,$self=this;
  56785. return $core.withContext(function($ctx1) {
  56786. $self._should_raise_((function(){
  56787. return $core.withContext(function($ctx2) {
  56788. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56790. }),$globals.Error);
  56791. return self;
  56792. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56793. },
  56794. args: [],
  56795. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56796. referencedClasses: ["Set", "Error"],
  56797. messageSends: ["should:raise:", "at:put:", "new"]
  56798. }),
  56799. $globals.SetTest);
  56800. $core.addMethod(
  56801. $core.method({
  56802. selector: "testCollect",
  56803. protocol: "tests",
  56804. fn: function (){
  56805. var self=this,$self=this;
  56806. return $core.withContext(function($ctx1) {
  56807. var $2,$1;
  56808. (
  56809. $ctx1.supercall = true,
  56810. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56811. $ctx1.supercall = false;
  56812. $2=[(5), (6), (8)]._asSet();
  56813. $ctx1.sendIdx["asSet"]=1;
  56814. $1=$recv($2)._collect_((function(x){
  56815. return $core.withContext(function($ctx2) {
  56816. return $recv(x).__backslash_backslash((3));
  56817. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56818. }));
  56819. $self._assert_equals_($1,[(0), (2)]._asSet());
  56820. return self;
  56821. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56822. },
  56823. args: [],
  56824. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56825. referencedClasses: [],
  56826. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56827. }),
  56828. $globals.SetTest);
  56829. $core.addMethod(
  56830. $core.method({
  56831. selector: "testComma",
  56832. protocol: "tests",
  56833. fn: function (){
  56834. var self=this,$self=this;
  56835. return $core.withContext(function($ctx1) {
  56836. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56837. (
  56838. $ctx1.supercall = true,
  56839. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56840. $ctx1.supercall = false;
  56841. $2=$self._collection();
  56842. $ctx1.sendIdx["collection"]=1;
  56843. $3=$self._collection();
  56844. $ctx1.sendIdx["collection"]=2;
  56845. $1=$recv($2).__comma($3);
  56846. $ctx1.sendIdx[","]=1;
  56847. $4=$self._collection();
  56848. $ctx1.sendIdx["collection"]=3;
  56849. $self._assert_equals_($1,$4);
  56850. $ctx1.sendIdx["assert:equals:"]=1;
  56851. $6=$self._collection();
  56852. $ctx1.sendIdx["collection"]=4;
  56853. $7=$self._collectionWithNewValue();
  56854. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56855. $5=$recv($6).__comma($7);
  56856. $ctx1.sendIdx[","]=2;
  56857. $8=$self._collectionWithNewValue();
  56858. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56859. $self._assert_equals_($5,$8);
  56860. $ctx1.sendIdx["assert:equals:"]=2;
  56861. $10=$self._collectionWithNewValue();
  56862. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56863. $9=$recv($10).__comma($self._collection());
  56864. $self._assert_equals_($9,$self._collectionWithNewValue());
  56865. return self;
  56866. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56867. },
  56868. args: [],
  56869. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  56870. referencedClasses: [],
  56871. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56872. }),
  56873. $globals.SetTest);
  56874. $core.addMethod(
  56875. $core.method({
  56876. selector: "testComparing",
  56877. protocol: "tests",
  56878. fn: function (){
  56879. var self=this,$self=this;
  56880. return $core.withContext(function($ctx1) {
  56881. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  56882. $1=[(0), (2)]._asSet();
  56883. $ctx1.sendIdx["asSet"]=1;
  56884. $2=[(0), (2)]._asSet();
  56885. $ctx1.sendIdx["asSet"]=2;
  56886. $self._assert_equals_($1,$2);
  56887. $ctx1.sendIdx["assert:equals:"]=1;
  56888. $3=[(2), (0)]._asSet();
  56889. $ctx1.sendIdx["asSet"]=3;
  56890. $4=[(0), (2)]._asSet();
  56891. $ctx1.sendIdx["asSet"]=4;
  56892. $self._assert_equals_($3,$4);
  56893. $6=[(0), (2), (3)]._asSet();
  56894. $ctx1.sendIdx["asSet"]=5;
  56895. $7=[(0), (2)]._asSet();
  56896. $ctx1.sendIdx["asSet"]=6;
  56897. $5=$recv($6).__eq($7);
  56898. $ctx1.sendIdx["="]=1;
  56899. $self._deny_($5);
  56900. $ctx1.sendIdx["deny:"]=1;
  56901. $9=[(1), (2)]._asSet();
  56902. $ctx1.sendIdx["asSet"]=7;
  56903. $8=$recv($9).__eq([(0), (2)]._asSet());
  56904. $self._deny_($8);
  56905. return self;
  56906. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  56907. },
  56908. args: [],
  56909. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet",
  56910. referencedClasses: [],
  56911. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56912. }),
  56913. $globals.SetTest);
  56914. $core.addMethod(
  56915. $core.method({
  56916. selector: "testPrintString",
  56917. protocol: "tests",
  56918. fn: function (){
  56919. var self=this,$self=this;
  56920. var set;
  56921. return $core.withContext(function($ctx1) {
  56922. var $1,$2,$3,$4,$5,$6,$7,$8;
  56923. set=$recv($globals.Set)._new();
  56924. $1=$recv(set)._printString();
  56925. $ctx1.sendIdx["printString"]=1;
  56926. $self._assert_equals_($1,"a Set ()");
  56927. $ctx1.sendIdx["assert:equals:"]=1;
  56928. $2=set;
  56929. $recv($2)._add_((1));
  56930. $ctx1.sendIdx["add:"]=1;
  56931. $3=$recv($2)._add_((3));
  56932. $ctx1.sendIdx["add:"]=2;
  56933. $4=$recv(set)._printString();
  56934. $ctx1.sendIdx["printString"]=2;
  56935. $self._assert_equals_($4,"a Set (1 3)");
  56936. $ctx1.sendIdx["assert:equals:"]=2;
  56937. $recv(set)._add_("foo");
  56938. $ctx1.sendIdx["add:"]=3;
  56939. $5=$recv(set)._printString();
  56940. $ctx1.sendIdx["printString"]=3;
  56941. $self._assert_equals_($5,"a Set (1 3 'foo')");
  56942. $ctx1.sendIdx["assert:equals:"]=3;
  56943. $6=set;
  56944. $recv($6)._remove_((1));
  56945. $ctx1.sendIdx["remove:"]=1;
  56946. $recv($6)._remove_((3));
  56947. $7=$recv(set)._printString();
  56948. $ctx1.sendIdx["printString"]=4;
  56949. $self._assert_equals_($7,"a Set ('foo')");
  56950. $ctx1.sendIdx["assert:equals:"]=4;
  56951. $recv(set)._add_((3));
  56952. $ctx1.sendIdx["add:"]=4;
  56953. $8=$recv(set)._printString();
  56954. $ctx1.sendIdx["printString"]=5;
  56955. $self._assert_equals_($8,"a Set (3 'foo')");
  56956. $ctx1.sendIdx["assert:equals:"]=5;
  56957. $recv(set)._add_((3));
  56958. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  56959. return self;
  56960. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  56961. },
  56962. args: [],
  56963. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  56964. referencedClasses: ["Set"],
  56965. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  56966. }),
  56967. $globals.SetTest);
  56968. $core.addMethod(
  56969. $core.method({
  56970. selector: "testUnboxedObjects",
  56971. protocol: "tests",
  56972. fn: function (){
  56973. var self=this,$self=this;
  56974. return $core.withContext(function($ctx1) {
  56975. var $4,$3,$2,$1;
  56976. $4="foo"._yourself();
  56977. $ctx1.sendIdx["yourself"]=1;
  56978. $3=[$4,"foo"._yourself()];
  56979. $2=$recv($3)._asSet();
  56980. $1=$recv($2)._asArray();
  56981. $self._assert_equals_($1,["foo"]);
  56982. return self;
  56983. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  56984. },
  56985. args: [],
  56986. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  56987. referencedClasses: [],
  56988. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  56989. }),
  56990. $globals.SetTest);
  56991. $core.addMethod(
  56992. $core.method({
  56993. selector: "testUnicity",
  56994. protocol: "tests",
  56995. fn: function (){
  56996. var self=this,$self=this;
  56997. var set;
  56998. return $core.withContext(function($ctx1) {
  56999. var $1;
  57000. set=$recv($globals.Set)._new();
  57001. $recv(set)._add_((21));
  57002. $ctx1.sendIdx["add:"]=1;
  57003. $recv(set)._add_("hello");
  57004. $ctx1.sendIdx["add:"]=2;
  57005. $recv(set)._add_((21));
  57006. $ctx1.sendIdx["add:"]=3;
  57007. $1=$recv(set)._size();
  57008. $ctx1.sendIdx["size"]=1;
  57009. $self._assert_equals_($1,(2));
  57010. $ctx1.sendIdx["assert:equals:"]=1;
  57011. $recv(set)._add_("hello");
  57012. $self._assert_equals_($recv(set)._size(),(2));
  57013. $ctx1.sendIdx["assert:equals:"]=2;
  57014. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  57015. return self;
  57016. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  57017. },
  57018. args: [],
  57019. source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  57020. referencedClasses: ["Set"],
  57021. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  57022. }),
  57023. $globals.SetTest);
  57024. $core.addMethod(
  57025. $core.method({
  57026. selector: "collectionClass",
  57027. protocol: "fixture",
  57028. fn: function (){
  57029. var self=this,$self=this;
  57030. return $globals.Set;
  57031. },
  57032. args: [],
  57033. source: "collectionClass\x0a\x09^ Set",
  57034. referencedClasses: ["Set"],
  57035. messageSends: []
  57036. }),
  57037. $globals.SetTest.a$cls);
  57038. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  57039. $core.addMethod(
  57040. $core.method({
  57041. selector: "testShow",
  57042. protocol: "tests",
  57043. fn: function (){
  57044. var self=this,$self=this;
  57045. var originalTranscript;
  57046. return $core.withContext(function($ctx1) {
  57047. originalTranscript=$recv($globals.Transcript)._current();
  57048. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  57049. $ctx1.sendIdx["register:"]=1;
  57050. $self._shouldnt_raise_((function(){
  57051. return $core.withContext(function($ctx2) {
  57052. return $recv($globals.Transcript)._show_("Hello console!");
  57053. $ctx2.sendIdx["show:"]=1;
  57054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57055. }),$globals.Error);
  57056. $ctx1.sendIdx["shouldnt:raise:"]=1;
  57057. $self._shouldnt_raise_((function(){
  57058. return $core.withContext(function($ctx2) {
  57059. return $recv($globals.Transcript)._show_(console);
  57060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57061. }),$globals.Error);
  57062. $recv($globals.Transcript)._register_(originalTranscript);
  57063. return self;
  57064. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  57065. },
  57066. args: [],
  57067. source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
  57068. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  57069. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  57070. }),
  57071. $globals.ConsoleTranscriptTest);
  57072. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  57073. $core.addMethod(
  57074. $core.method({
  57075. selector: "testEquality",
  57076. protocol: "tests",
  57077. fn: function (){
  57078. var self=this,$self=this;
  57079. var now;
  57080. return $core.withContext(function($ctx1) {
  57081. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57082. now=$recv($globals.Date)._new();
  57083. $1=$recv(now).__eq(now);
  57084. $ctx1.sendIdx["="]=1;
  57085. $self._assert_($1);
  57086. $ctx1.sendIdx["assert:"]=1;
  57087. $3=now;
  57088. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57089. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57090. $2=$recv($3).__eq($4);
  57091. $ctx1.sendIdx["="]=2;
  57092. $self._deny_($2);
  57093. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57094. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57095. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57096. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57097. $5=$recv($6).__eq($7);
  57098. $ctx1.sendIdx["="]=3;
  57099. $self._assert_($5);
  57100. $ctx1.sendIdx["assert:"]=2;
  57101. $9=now;
  57102. $11=$recv(now)._asMilliseconds();
  57103. $ctx1.sendIdx["asMilliseconds"]=1;
  57104. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57105. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57106. $8=$recv($9).__eq($10);
  57107. $ctx1.sendIdx["="]=4;
  57108. $self._assert_($8);
  57109. $ctx1.sendIdx["assert:"]=3;
  57110. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  57111. return self;
  57112. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  57113. },
  57114. args: [],
  57115. source: "testEquality\x0a\x09| now |\x0a\x09now := Date new.\x0a\x0a\x09self assert: now = now.\x0a\x0a\x09self deny: now = (Date fromMilliseconds: 0).\x0a\x0a\x09self assert: (Date fromMilliseconds: 12345678) = (Date fromMilliseconds: 12345678).\x0a\x09self assert: now = (Date fromMilliseconds: now asMilliseconds).\x0a\x09self assert: (Date fromMilliseconds: now asMilliseconds) = now",
  57116. referencedClasses: ["Date"],
  57117. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57118. }),
  57119. $globals.DateTest);
  57120. $core.addMethod(
  57121. $core.method({
  57122. selector: "testIdentity",
  57123. protocol: "tests",
  57124. fn: function (){
  57125. var self=this,$self=this;
  57126. var now;
  57127. return $core.withContext(function($ctx1) {
  57128. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57129. now=$recv($globals.Date)._new();
  57130. $1=$recv(now).__eq_eq(now);
  57131. $ctx1.sendIdx["=="]=1;
  57132. $self._assert_($1);
  57133. $3=now;
  57134. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57135. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57136. $2=$recv($3).__eq_eq($4);
  57137. $ctx1.sendIdx["=="]=2;
  57138. $self._deny_($2);
  57139. $ctx1.sendIdx["deny:"]=1;
  57140. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57141. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57142. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57143. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57144. $5=$recv($6).__eq_eq($7);
  57145. $ctx1.sendIdx["=="]=3;
  57146. $self._deny_($5);
  57147. $ctx1.sendIdx["deny:"]=2;
  57148. $9=now;
  57149. $11=$recv(now)._asMilliseconds();
  57150. $ctx1.sendIdx["asMilliseconds"]=1;
  57151. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57152. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57153. $8=$recv($9).__eq_eq($10);
  57154. $ctx1.sendIdx["=="]=4;
  57155. $self._deny_($8);
  57156. $ctx1.sendIdx["deny:"]=3;
  57157. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  57158. return self;
  57159. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  57160. },
  57161. args: [],
  57162. source: "testIdentity\x0a\x09| now |\x0a\x09now := Date new.\x0a\x0a\x09self assert: now == now.\x0a\x0a\x09self deny: now == (Date fromMilliseconds: 0).\x0a\x0a\x09self deny: (Date fromMilliseconds: 12345678) == (Date fromMilliseconds: 12345678).\x0a\x09self deny: now == (Date fromMilliseconds: now asMilliseconds).\x0a\x09self deny: (Date fromMilliseconds: now asMilliseconds) == now",
  57163. referencedClasses: ["Date"],
  57164. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57165. }),
  57166. $globals.DateTest);
  57167. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  57168. $core.addMethod(
  57169. $core.method({
  57170. selector: "jsObject",
  57171. protocol: "accessing",
  57172. fn: function (){
  57173. var self=this,$self=this;
  57174. return $core.withContext(function($ctx1) {
  57175. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  57176. return self;
  57177. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  57178. },
  57179. args: [],
  57180. source: "jsObject\x0a\x09<inlineJS: \x0a\x09\x09'return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: \x22\x22, \x22e\x22: null, \x22f\x22: void 0}'>",
  57181. referencedClasses: [],
  57182. messageSends: []
  57183. }),
  57184. $globals.JSObjectProxyTest);
  57185. $core.addMethod(
  57186. $core.method({
  57187. selector: "jsUndefined",
  57188. protocol: "accessing",
  57189. fn: function (){
  57190. var self=this,$self=this;
  57191. return $core.withContext(function($ctx1) {
  57192. return;
  57193. return self;
  57194. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57195. },
  57196. args: [],
  57197. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57198. referencedClasses: [],
  57199. messageSends: []
  57200. }),
  57201. $globals.JSObjectProxyTest);
  57202. $core.addMethod(
  57203. $core.method({
  57204. selector: "testAtIfAbsent",
  57205. protocol: "tests",
  57206. fn: function (){
  57207. var self=this,$self=this;
  57208. var testObject;
  57209. return $core.withContext(function($ctx1) {
  57210. var $1,$2,$3;
  57211. testObject=$self._jsObject();
  57212. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57213. return "Property does not exist";
  57214. }));
  57215. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57216. $self._assert_equals_($1,"Property does not exist");
  57217. $ctx1.sendIdx["assert:equals:"]=1;
  57218. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57219. return "Property does not exist";
  57220. }));
  57221. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57222. $self._assert_equals_($2,nil);
  57223. $ctx1.sendIdx["assert:equals:"]=2;
  57224. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57225. return "Property does not exist";
  57226. }));
  57227. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57228. $self._assert_equals_($3,(1));
  57229. $ctx1.sendIdx["assert:equals:"]=3;
  57230. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57231. return "Property does not exist";
  57232. })),nil);
  57233. return self;
  57234. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57235. },
  57236. args: [],
  57237. source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: [ 'Property does not exist' ]) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: [ 'Property does not exist' ]) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: [ 'Property does not exist' ]) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: [ 'Property does not exist' ]) equals: nil.",
  57238. referencedClasses: [],
  57239. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57240. }),
  57241. $globals.JSObjectProxyTest);
  57242. $core.addMethod(
  57243. $core.method({
  57244. selector: "testAtIfPresent",
  57245. protocol: "tests",
  57246. fn: function (){
  57247. var self=this,$self=this;
  57248. var testObject;
  57249. return $core.withContext(function($ctx1) {
  57250. var $2,$1,$4,$3,$6,$5;
  57251. testObject=$self._jsObject();
  57252. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57253. return $core.withContext(function($ctx2) {
  57254. $2=$recv(x)._asString();
  57255. $ctx2.sendIdx["asString"]=1;
  57256. return "hello ".__comma($2);
  57257. $ctx2.sendIdx[","]=1;
  57258. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57259. }));
  57260. $ctx1.sendIdx["at:ifPresent:"]=1;
  57261. $self._assert_equals_($1,nil);
  57262. $ctx1.sendIdx["assert:equals:"]=1;
  57263. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57264. return $core.withContext(function($ctx2) {
  57265. $4=$recv(x)._asString();
  57266. $ctx2.sendIdx["asString"]=2;
  57267. return "hello ".__comma($4);
  57268. $ctx2.sendIdx[","]=2;
  57269. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57270. }));
  57271. $ctx1.sendIdx["at:ifPresent:"]=2;
  57272. $self._assert_equals_($3,"hello nil");
  57273. $ctx1.sendIdx["assert:equals:"]=2;
  57274. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57275. return $core.withContext(function($ctx2) {
  57276. $6=$recv(x)._asString();
  57277. $ctx2.sendIdx["asString"]=3;
  57278. return "hello ".__comma($6);
  57279. $ctx2.sendIdx[","]=3;
  57280. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57281. }));
  57282. $ctx1.sendIdx["at:ifPresent:"]=3;
  57283. $self._assert_equals_($5,"hello 1");
  57284. $ctx1.sendIdx["assert:equals:"]=3;
  57285. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57286. return $core.withContext(function($ctx2) {
  57287. return "hello ".__comma($recv(x)._asString());
  57288. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57289. })),"hello nil");
  57290. return self;
  57291. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57292. },
  57293. args: [],
  57294. source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.",
  57295. referencedClasses: [],
  57296. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57297. }),
  57298. $globals.JSObjectProxyTest);
  57299. $core.addMethod(
  57300. $core.method({
  57301. selector: "testAtIfPresentIfAbsent",
  57302. protocol: "tests",
  57303. fn: function (){
  57304. var self=this,$self=this;
  57305. var testObject;
  57306. return $core.withContext(function($ctx1) {
  57307. var $2,$1,$4,$3,$6,$5;
  57308. testObject=$self._jsObject();
  57309. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57310. return $core.withContext(function($ctx2) {
  57311. $2=$recv(x)._asString();
  57312. $ctx2.sendIdx["asString"]=1;
  57313. return "hello ".__comma($2);
  57314. $ctx2.sendIdx[","]=1;
  57315. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57316. }),(function(){
  57317. return "not present";
  57318. }));
  57319. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57320. $self._assert_equals_($1,"not present");
  57321. $ctx1.sendIdx["assert:equals:"]=1;
  57322. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57323. return $core.withContext(function($ctx2) {
  57324. $4=$recv(x)._asString();
  57325. $ctx2.sendIdx["asString"]=2;
  57326. return "hello ".__comma($4);
  57327. $ctx2.sendIdx[","]=2;
  57328. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57329. }),(function(){
  57330. return "not present";
  57331. }));
  57332. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57333. $self._assert_equals_($3,"hello nil");
  57334. $ctx1.sendIdx["assert:equals:"]=2;
  57335. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57336. return $core.withContext(function($ctx2) {
  57337. $6=$recv(x)._asString();
  57338. $ctx2.sendIdx["asString"]=3;
  57339. return "hello ".__comma($6);
  57340. $ctx2.sendIdx[","]=3;
  57341. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57342. }),(function(){
  57343. return "not present";
  57344. }));
  57345. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57346. $self._assert_equals_($5,"hello 1");
  57347. $ctx1.sendIdx["assert:equals:"]=3;
  57348. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57349. return $core.withContext(function($ctx2) {
  57350. return "hello ".__comma($recv(x)._asString());
  57351. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57352. }),(function(){
  57353. return "not present";
  57354. })),"hello nil");
  57355. return self;
  57356. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57357. },
  57358. args: [],
  57359. source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.",
  57360. referencedClasses: [],
  57361. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57362. }),
  57363. $globals.JSObjectProxyTest);
  57364. $core.addMethod(
  57365. $core.method({
  57366. selector: "testAtPut",
  57367. protocol: "tests",
  57368. fn: function (){
  57369. var self=this,$self=this;
  57370. var testObject;
  57371. return $core.withContext(function($ctx1) {
  57372. var $2,$1;
  57373. testObject=$self._jsObject();
  57374. $2=$recv(testObject)._at_("abc");
  57375. $ctx1.sendIdx["at:"]=1;
  57376. $1=$recv($2).__tild_eq("xyz");
  57377. $self._assert_($1);
  57378. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57379. $ctx1.sendIdx["assert:equals:"]=1;
  57380. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57381. return self;
  57382. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57383. },
  57384. args: [],
  57385. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  57386. referencedClasses: [],
  57387. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57388. }),
  57389. $globals.JSObjectProxyTest);
  57390. $core.addMethod(
  57391. $core.method({
  57392. selector: "testComparison",
  57393. protocol: "tests",
  57394. fn: function (){
  57395. var self=this,$self=this;
  57396. return $core.withContext(function($ctx1) {
  57397. var $1,$2;
  57398. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57399. $1=$recv(console).__eq(console);
  57400. $ctx1.sendIdx["="]=1;
  57401. $self._assert_($1);
  57402. $2=$recv(console).__eq($recv($globals.Object)._new());
  57403. $ctx1.sendIdx["="]=2;
  57404. $self._deny_($2);
  57405. $ctx1.sendIdx["deny:"]=1;
  57406. $self._deny_($recv(console).__eq($self._jsObject()));
  57407. return self;
  57408. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57409. },
  57410. args: [],
  57411. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  57412. referencedClasses: ["Object"],
  57413. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57414. }),
  57415. $globals.JSObjectProxyTest);
  57416. $core.addMethod(
  57417. $core.method({
  57418. selector: "testDNU",
  57419. protocol: "tests",
  57420. fn: function (){
  57421. var self=this,$self=this;
  57422. return $core.withContext(function($ctx1) {
  57423. $self._should_raise_((function(){
  57424. return $core.withContext(function($ctx2) {
  57425. return $recv($self._jsObject())._foo();
  57426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57427. }),$globals.MessageNotUnderstood);
  57428. return self;
  57429. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57430. },
  57431. args: [],
  57432. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57433. referencedClasses: ["MessageNotUnderstood"],
  57434. messageSends: ["should:raise:", "foo", "jsObject"]
  57435. }),
  57436. $globals.JSObjectProxyTest);
  57437. $core.addMethod(
  57438. $core.method({
  57439. selector: "testDNUWithAllowJavaScriptCalls",
  57440. protocol: "tests",
  57441. fn: function (){
  57442. var self=this,$self=this;
  57443. var jsObject;
  57444. return $core.withContext(function($ctx1) {
  57445. jsObject=[];
  57446. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57447. $self._should_raise_((function(){
  57448. return $core.withContext(function($ctx2) {
  57449. return $recv(jsObject)._foo();
  57450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57451. }),$globals.MessageNotUnderstood);
  57452. return self;
  57453. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57454. },
  57455. args: [],
  57456. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57457. referencedClasses: ["MessageNotUnderstood"],
  57458. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57459. }),
  57460. $globals.JSObjectProxyTest);
  57461. $core.addMethod(
  57462. $core.method({
  57463. selector: "testMessageSend",
  57464. protocol: "tests",
  57465. fn: function (){
  57466. var self=this,$self=this;
  57467. return $core.withContext(function($ctx1) {
  57468. var $2,$1,$4,$3;
  57469. $2=$self._jsObject();
  57470. $ctx1.sendIdx["jsObject"]=1;
  57471. $1=$recv($2)._a();
  57472. $self._assert_equals_($1,(1));
  57473. $ctx1.sendIdx["assert:equals:"]=1;
  57474. $4=$self._jsObject();
  57475. $ctx1.sendIdx["jsObject"]=2;
  57476. $3=$recv($4)._b();
  57477. $self._assert_equals_($3,(2));
  57478. $ctx1.sendIdx["assert:equals:"]=2;
  57479. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57480. return self;
  57481. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57482. },
  57483. args: [],
  57484. source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3",
  57485. referencedClasses: [],
  57486. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57487. }),
  57488. $globals.JSObjectProxyTest);
  57489. $core.addMethod(
  57490. $core.method({
  57491. selector: "testMethodWithArguments",
  57492. protocol: "tests",
  57493. fn: function (){
  57494. var self=this,$self=this;
  57495. return $core.withContext(function($ctx1) {
  57496. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57497. return self;
  57498. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57499. },
  57500. args: [],
  57501. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57502. referencedClasses: [],
  57503. messageSends: ["assert:equals:", "c:", "jsObject"]
  57504. }),
  57505. $globals.JSObjectProxyTest);
  57506. $core.addMethod(
  57507. $core.method({
  57508. selector: "testNull",
  57509. protocol: "tests",
  57510. fn: function (){
  57511. var self=this,$self=this;
  57512. return $core.withContext(function($ctx1) {
  57513. var $2,$1;
  57514. $2=$recv($globals.JSObjectProxy)._null();
  57515. $ctx1.sendIdx["null"]=1;
  57516. $1=$recv($2)._isNil();
  57517. $self._assert_($1);
  57518. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57519. return self;
  57520. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57521. },
  57522. args: [],
  57523. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57524. referencedClasses: ["JSObjectProxy", "JSON"],
  57525. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57526. }),
  57527. $globals.JSObjectProxyTest);
  57528. $core.addMethod(
  57529. $core.method({
  57530. selector: "testPrinting",
  57531. protocol: "tests",
  57532. fn: function (){
  57533. var self=this,$self=this;
  57534. return $core.withContext(function($ctx1) {
  57535. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57536. return self;
  57537. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57538. },
  57539. args: [],
  57540. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57541. referencedClasses: [],
  57542. messageSends: ["assert:equals:", "printString", "jsObject"]
  57543. }),
  57544. $globals.JSObjectProxyTest);
  57545. $core.addMethod(
  57546. $core.method({
  57547. selector: "testPropertyThatReturnsEmptyString",
  57548. protocol: "tests",
  57549. fn: function (){
  57550. var self=this,$self=this;
  57551. var object;
  57552. return $core.withContext(function($ctx1) {
  57553. var $1;
  57554. object=$self._jsObject();
  57555. $1=$recv(object)._d();
  57556. $ctx1.sendIdx["d"]=1;
  57557. $self._assert_equals_($1,"");
  57558. $ctx1.sendIdx["assert:equals:"]=1;
  57559. $recv(object)._d_("hello");
  57560. $self._assert_equals_($recv(object)._d(),"hello");
  57561. return self;
  57562. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57563. },
  57564. args: [],
  57565. source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'",
  57566. referencedClasses: [],
  57567. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57568. }),
  57569. $globals.JSObjectProxyTest);
  57570. $core.addMethod(
  57571. $core.method({
  57572. selector: "testPropertyThatReturnsUndefined",
  57573. protocol: "tests",
  57574. fn: function (){
  57575. var self=this,$self=this;
  57576. var object;
  57577. return $core.withContext(function($ctx1) {
  57578. object=$self._jsObject();
  57579. $self._shouldnt_raise_((function(){
  57580. return $core.withContext(function($ctx2) {
  57581. return $recv(object)._e();
  57582. $ctx2.sendIdx["e"]=1;
  57583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57584. }),$globals.MessageNotUnderstood);
  57585. $self._assert_($recv($recv(object)._e())._isNil());
  57586. return self;
  57587. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57588. },
  57589. args: [],
  57590. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57591. referencedClasses: ["MessageNotUnderstood"],
  57592. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57593. }),
  57594. $globals.JSObjectProxyTest);
  57595. $core.addMethod(
  57596. $core.method({
  57597. selector: "testSetPropertyWithFalsyValue",
  57598. protocol: "tests",
  57599. fn: function (){
  57600. var self=this,$self=this;
  57601. var jsObject;
  57602. return $core.withContext(function($ctx1) {
  57603. var $1,$2,$3,$4,$5;
  57604. jsObject=$self._jsObject();
  57605. $1=$recv(jsObject)._a();
  57606. $ctx1.sendIdx["a"]=1;
  57607. $self._assert_equals_($1,(1));
  57608. $ctx1.sendIdx["assert:equals:"]=1;
  57609. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  57610. $ctx1.sendIdx["a:"]=1;
  57611. $2=$recv(jsObject)._a();
  57612. $ctx1.sendIdx["a"]=2;
  57613. $self._assert_equals_($2,nil);
  57614. $ctx1.sendIdx["assert:equals:"]=2;
  57615. $recv(jsObject)._a_((0));
  57616. $ctx1.sendIdx["a:"]=2;
  57617. $3=$recv(jsObject)._a();
  57618. $ctx1.sendIdx["a"]=3;
  57619. $self._assert_equals_($3,(0));
  57620. $ctx1.sendIdx["assert:equals:"]=3;
  57621. $recv(jsObject)._a_($self._jsUndefined());
  57622. $ctx1.sendIdx["a:"]=3;
  57623. $4=$recv(jsObject)._a();
  57624. $ctx1.sendIdx["a"]=4;
  57625. $self._assert_equals_($4,nil);
  57626. $ctx1.sendIdx["assert:equals:"]=4;
  57627. $recv(jsObject)._a_("");
  57628. $ctx1.sendIdx["a:"]=4;
  57629. $5=$recv(jsObject)._a();
  57630. $ctx1.sendIdx["a"]=5;
  57631. $self._assert_equals_($5,"");
  57632. $ctx1.sendIdx["assert:equals:"]=5;
  57633. $recv(jsObject)._a_(false);
  57634. $self._assert_equals_($recv(jsObject)._a(),false);
  57635. return self;
  57636. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57637. },
  57638. args: [],
  57639. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: JSObjectProxy null.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  57640. referencedClasses: ["JSObjectProxy"],
  57641. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57642. }),
  57643. $globals.JSObjectProxyTest);
  57644. $core.addMethod(
  57645. $core.method({
  57646. selector: "testUndefined",
  57647. protocol: "tests",
  57648. fn: function (){
  57649. var self=this,$self=this;
  57650. return $core.withContext(function($ctx1) {
  57651. var $2,$1;
  57652. $2=$recv($globals.JSObjectProxy)._undefined();
  57653. $ctx1.sendIdx["undefined"]=1;
  57654. $1=$recv($2)._isNil();
  57655. $self._assert_($1);
  57656. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57657. return self;
  57658. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  57659. },
  57660. args: [],
  57661. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57662. referencedClasses: ["JSObjectProxy", "JSON"],
  57663. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57664. }),
  57665. $globals.JSObjectProxyTest);
  57666. $core.addMethod(
  57667. $core.method({
  57668. selector: "testValue",
  57669. protocol: "tests",
  57670. fn: function (){
  57671. var self=this,$self=this;
  57672. var testObject;
  57673. return $core.withContext(function($ctx1) {
  57674. testObject=$self._jsObject();
  57675. $recv(testObject)._at_put_("value","aValue");
  57676. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57677. return self;
  57678. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57679. },
  57680. args: [],
  57681. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57682. referencedClasses: [],
  57683. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57684. }),
  57685. $globals.JSObjectProxyTest);
  57686. $core.addMethod(
  57687. $core.method({
  57688. selector: "testYourself",
  57689. protocol: "tests",
  57690. fn: function (){
  57691. var self=this,$self=this;
  57692. var object;
  57693. return $core.withContext(function($ctx1) {
  57694. var $1;
  57695. $1=$self._jsObject();
  57696. $recv($1)._d_("test");
  57697. object=$recv($1)._yourself();
  57698. $self._assert_equals_($recv(object)._d(),"test");
  57699. return self;
  57700. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57701. },
  57702. args: [],
  57703. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57704. referencedClasses: [],
  57705. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57706. }),
  57707. $globals.JSObjectProxyTest);
  57708. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57709. $core.addMethod(
  57710. $core.method({
  57711. selector: "testCatchingException",
  57712. protocol: "tests",
  57713. fn: function (){
  57714. var self=this,$self=this;
  57715. return $core.withContext(function($ctx1) {
  57716. $recv((function(){
  57717. return $core.withContext(function($ctx2) {
  57718. return $self._throwException();
  57719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57720. }))._on_do_($globals.Error,(function(error){
  57721. return $core.withContext(function($ctx2) {
  57722. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57723. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57724. }));
  57725. return self;
  57726. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57727. },
  57728. args: [],
  57729. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57730. referencedClasses: ["Error"],
  57731. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57732. }),
  57733. $globals.JavaScriptExceptionTest);
  57734. $core.addMethod(
  57735. $core.method({
  57736. selector: "testRaisingException",
  57737. protocol: "tests",
  57738. fn: function (){
  57739. var self=this,$self=this;
  57740. return $core.withContext(function($ctx1) {
  57741. $self._should_raise_((function(){
  57742. return $core.withContext(function($ctx2) {
  57743. return $self._throwException();
  57744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57745. }),$globals.JavaScriptException);
  57746. return self;
  57747. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57748. },
  57749. args: [],
  57750. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57751. referencedClasses: ["JavaScriptException"],
  57752. messageSends: ["should:raise:", "throwException"]
  57753. }),
  57754. $globals.JavaScriptExceptionTest);
  57755. $core.addMethod(
  57756. $core.method({
  57757. selector: "throwException",
  57758. protocol: "helpers",
  57759. fn: function (){
  57760. var self=this,$self=this;
  57761. return $core.withContext(function($ctx1) {
  57762. throw "test";
  57763. return self;
  57764. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57765. },
  57766. args: [],
  57767. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57768. referencedClasses: [],
  57769. messageSends: []
  57770. }),
  57771. $globals.JavaScriptExceptionTest);
  57772. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57773. $core.addMethod(
  57774. $core.method({
  57775. selector: "testValue",
  57776. protocol: "tests",
  57777. fn: function (){
  57778. var self=this,$self=this;
  57779. var messageSend;
  57780. return $core.withContext(function($ctx1) {
  57781. var $1;
  57782. $1=$recv($globals.MessageSend)._new();
  57783. $ctx1.sendIdx["new"]=1;
  57784. $recv($1)._receiver_($recv($globals.Object)._new());
  57785. $recv($1)._selector_("asString");
  57786. messageSend=$recv($1)._yourself();
  57787. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57788. return self;
  57789. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57790. },
  57791. args: [],
  57792. source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'",
  57793. referencedClasses: ["MessageSend", "Object"],
  57794. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57795. }),
  57796. $globals.MessageSendTest);
  57797. $core.addMethod(
  57798. $core.method({
  57799. selector: "testValueWithArguments",
  57800. protocol: "tests",
  57801. fn: function (){
  57802. var self=this,$self=this;
  57803. var messageSend;
  57804. return $core.withContext(function($ctx1) {
  57805. var $1;
  57806. $1=$recv($globals.MessageSend)._new();
  57807. $recv($1)._receiver_((2));
  57808. $recv($1)._selector_("+");
  57809. messageSend=$recv($1)._yourself();
  57810. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57811. $ctx1.sendIdx["assert:equals:"]=1;
  57812. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57813. return self;
  57814. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57815. },
  57816. args: [],
  57817. source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6",
  57818. referencedClasses: ["MessageSend"],
  57819. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57820. }),
  57821. $globals.MessageSendTest);
  57822. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57823. $core.addMethod(
  57824. $core.method({
  57825. selector: "codeGeneratorClass",
  57826. protocol: "accessing",
  57827. fn: function (){
  57828. var self=this,$self=this;
  57829. return $globals.CodeGenerator;
  57830. },
  57831. args: [],
  57832. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57833. referencedClasses: ["CodeGenerator"],
  57834. messageSends: []
  57835. }),
  57836. $globals.MethodInheritanceTest);
  57837. $core.addMethod(
  57838. $core.method({
  57839. selector: "compiler",
  57840. protocol: "factory",
  57841. fn: function (){
  57842. var self=this,$self=this;
  57843. return $core.withContext(function($ctx1) {
  57844. var $1;
  57845. $1=$recv($globals.Compiler)._new();
  57846. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  57847. return $recv($1)._yourself();
  57848. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  57849. },
  57850. args: [],
  57851. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  57852. referencedClasses: ["Compiler"],
  57853. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  57854. }),
  57855. $globals.MethodInheritanceTest);
  57856. $core.addMethod(
  57857. $core.method({
  57858. selector: "deinstallBottom",
  57859. protocol: "testing",
  57860. fn: function (){
  57861. var self=this,$self=this;
  57862. return $core.withContext(function($ctx1) {
  57863. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  57864. return self;
  57865. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  57866. },
  57867. args: [],
  57868. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  57869. referencedClasses: [],
  57870. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  57871. }),
  57872. $globals.MethodInheritanceTest);
  57873. $core.addMethod(
  57874. $core.method({
  57875. selector: "deinstallMiddle",
  57876. protocol: "testing",
  57877. fn: function (){
  57878. var self=this,$self=this;
  57879. return $core.withContext(function($ctx1) {
  57880. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  57881. return self;
  57882. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  57883. },
  57884. args: [],
  57885. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  57886. referencedClasses: [],
  57887. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  57888. }),
  57889. $globals.MethodInheritanceTest);
  57890. $core.addMethod(
  57891. $core.method({
  57892. selector: "deinstallTop",
  57893. protocol: "testing",
  57894. fn: function (){
  57895. var self=this,$self=this;
  57896. return $core.withContext(function($ctx1) {
  57897. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  57898. return self;
  57899. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  57900. },
  57901. args: [],
  57902. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  57903. referencedClasses: [],
  57904. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  57905. }),
  57906. $globals.MethodInheritanceTest);
  57907. $core.addMethod(
  57908. $core.method({
  57909. selector: "installBottom:",
  57910. protocol: "testing",
  57911. fn: function (aString){
  57912. var self=this,$self=this;
  57913. return $core.withContext(function($ctx1) {
  57914. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  57915. return self;
  57916. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  57917. },
  57918. args: ["aString"],
  57919. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  57920. referencedClasses: [],
  57921. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  57922. }),
  57923. $globals.MethodInheritanceTest);
  57924. $core.addMethod(
  57925. $core.method({
  57926. selector: "installMiddle:",
  57927. protocol: "testing",
  57928. fn: function (aString){
  57929. var self=this,$self=this;
  57930. return $core.withContext(function($ctx1) {
  57931. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  57932. return self;
  57933. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  57934. },
  57935. args: ["aString"],
  57936. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  57937. referencedClasses: [],
  57938. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  57939. }),
  57940. $globals.MethodInheritanceTest);
  57941. $core.addMethod(
  57942. $core.method({
  57943. selector: "installTop:",
  57944. protocol: "testing",
  57945. fn: function (aString){
  57946. var self=this,$self=this;
  57947. return $core.withContext(function($ctx1) {
  57948. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  57949. return self;
  57950. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  57951. },
  57952. args: ["aString"],
  57953. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  57954. referencedClasses: [],
  57955. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  57956. }),
  57957. $globals.MethodInheritanceTest);
  57958. $core.addMethod(
  57959. $core.method({
  57960. selector: "setUp",
  57961. protocol: "initialization",
  57962. fn: function (){
  57963. var self=this,$self=this;
  57964. return $core.withContext(function($ctx1) {
  57965. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  57966. $ctx1.sendIdx["new"]=1;
  57967. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  57968. $ctx1.sendIdx["new"]=2;
  57969. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  57970. $self["@method"]=nil;
  57971. $self["@performBlock"]=(function(){
  57972. return $core.withContext(function($ctx2) {
  57973. return $self._error_("performBlock not initialized");
  57974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57975. });
  57976. return self;
  57977. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  57978. },
  57979. args: [],
  57980. source: "setUp\x0a\x09receiverTop := self targetClassTop new.\x0a\x09receiverMiddle := self targetClassMiddle new.\x0a\x09receiverBottom := self targetClassBottom new.\x0a\x09method := nil.\x0a\x09performBlock := [ self error: 'performBlock not initialized' ]",
  57981. referencedClasses: [],
  57982. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  57983. }),
  57984. $globals.MethodInheritanceTest);
  57985. $core.addMethod(
  57986. $core.method({
  57987. selector: "shouldMNU",
  57988. protocol: "testing",
  57989. fn: function (){
  57990. var self=this,$self=this;
  57991. return $core.withContext(function($ctx1) {
  57992. $self._shouldMNUTop();
  57993. $self._shouldMNUMiddle();
  57994. $self._shouldMNUBottom();
  57995. return self;
  57996. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  57997. },
  57998. args: [],
  57999. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  58000. referencedClasses: [],
  58001. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  58002. }),
  58003. $globals.MethodInheritanceTest);
  58004. $core.addMethod(
  58005. $core.method({
  58006. selector: "shouldMNUBottom",
  58007. protocol: "testing",
  58008. fn: function (){
  58009. var self=this,$self=this;
  58010. return $core.withContext(function($ctx1) {
  58011. $self._should_raise_((function(){
  58012. return $core.withContext(function($ctx2) {
  58013. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58015. }),$globals.MessageNotUnderstood);
  58016. return self;
  58017. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  58018. },
  58019. args: [],
  58020. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  58021. referencedClasses: ["MessageNotUnderstood"],
  58022. messageSends: ["should:raise:", "value:"]
  58023. }),
  58024. $globals.MethodInheritanceTest);
  58025. $core.addMethod(
  58026. $core.method({
  58027. selector: "shouldMNUMiddle",
  58028. protocol: "testing",
  58029. fn: function (){
  58030. var self=this,$self=this;
  58031. return $core.withContext(function($ctx1) {
  58032. $self._should_raise_((function(){
  58033. return $core.withContext(function($ctx2) {
  58034. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58036. }),$globals.MessageNotUnderstood);
  58037. return self;
  58038. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  58039. },
  58040. args: [],
  58041. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  58042. referencedClasses: ["MessageNotUnderstood"],
  58043. messageSends: ["should:raise:", "value:"]
  58044. }),
  58045. $globals.MethodInheritanceTest);
  58046. $core.addMethod(
  58047. $core.method({
  58048. selector: "shouldMNUTop",
  58049. protocol: "testing",
  58050. fn: function (){
  58051. var self=this,$self=this;
  58052. return $core.withContext(function($ctx1) {
  58053. $self._should_raise_((function(){
  58054. return $core.withContext(function($ctx2) {
  58055. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58057. }),$globals.MessageNotUnderstood);
  58058. return self;
  58059. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  58060. },
  58061. args: [],
  58062. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  58063. referencedClasses: ["MessageNotUnderstood"],
  58064. messageSends: ["should:raise:", "value:"]
  58065. }),
  58066. $globals.MethodInheritanceTest);
  58067. $core.addMethod(
  58068. $core.method({
  58069. selector: "shouldReturn:",
  58070. protocol: "testing",
  58071. fn: function (anObject){
  58072. var self=this,$self=this;
  58073. var result;
  58074. return $core.withContext(function($ctx1) {
  58075. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58076. $ctx1.sendIdx["value:"]=1;
  58077. $self._assert_equals_(["top",anObject],["top",result]);
  58078. $ctx1.sendIdx["assert:equals:"]=1;
  58079. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58080. $ctx1.sendIdx["value:"]=2;
  58081. $self._assert_equals_(["middle",anObject],["middle",result]);
  58082. $ctx1.sendIdx["assert:equals:"]=2;
  58083. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58084. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  58085. return self;
  58086. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  58087. },
  58088. args: ["anObject"],
  58089. source: "shouldReturn: anObject\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject } equals: { 'bottom'. result }",
  58090. referencedClasses: [],
  58091. messageSends: ["value:", "assert:equals:"]
  58092. }),
  58093. $globals.MethodInheritanceTest);
  58094. $core.addMethod(
  58095. $core.method({
  58096. selector: "shouldReturn:and:and:",
  58097. protocol: "testing",
  58098. fn: function (anObject,anObject2,anObject3){
  58099. var self=this,$self=this;
  58100. var result;
  58101. return $core.withContext(function($ctx1) {
  58102. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58103. $ctx1.sendIdx["value:"]=1;
  58104. $self._assert_equals_(["top",anObject],["top",result]);
  58105. $ctx1.sendIdx["assert:equals:"]=1;
  58106. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58107. $ctx1.sendIdx["value:"]=2;
  58108. $self._assert_equals_(["middle",anObject2],["middle",result]);
  58109. $ctx1.sendIdx["assert:equals:"]=2;
  58110. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58111. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  58112. return self;
  58113. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  58114. },
  58115. args: ["anObject", "anObject2", "anObject3"],
  58116. source: "shouldReturn: anObject and: anObject2 and: anObject3\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject2 } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject3 } equals: { 'bottom'. result }",
  58117. referencedClasses: [],
  58118. messageSends: ["value:", "assert:equals:"]
  58119. }),
  58120. $globals.MethodInheritanceTest);
  58121. $core.addMethod(
  58122. $core.method({
  58123. selector: "targetClassBottom",
  58124. protocol: "accessing",
  58125. fn: function (){
  58126. var self=this,$self=this;
  58127. return $globals.JavaScriptException;
  58128. },
  58129. args: [],
  58130. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  58131. referencedClasses: ["JavaScriptException"],
  58132. messageSends: []
  58133. }),
  58134. $globals.MethodInheritanceTest);
  58135. $core.addMethod(
  58136. $core.method({
  58137. selector: "targetClassMiddle",
  58138. protocol: "accessing",
  58139. fn: function (){
  58140. var self=this,$self=this;
  58141. return $globals.Error;
  58142. },
  58143. args: [],
  58144. source: "targetClassMiddle\x0a\x09^ Error",
  58145. referencedClasses: ["Error"],
  58146. messageSends: []
  58147. }),
  58148. $globals.MethodInheritanceTest);
  58149. $core.addMethod(
  58150. $core.method({
  58151. selector: "targetClassTop",
  58152. protocol: "accessing",
  58153. fn: function (){
  58154. var self=this,$self=this;
  58155. return $globals.Object;
  58156. },
  58157. args: [],
  58158. source: "targetClassTop\x0a\x09^ Object",
  58159. referencedClasses: ["Object"],
  58160. messageSends: []
  58161. }),
  58162. $globals.MethodInheritanceTest);
  58163. $core.addMethod(
  58164. $core.method({
  58165. selector: "tearDown",
  58166. protocol: "initialization",
  58167. fn: function (){
  58168. var self=this,$self=this;
  58169. return $core.withContext(function($ctx1) {
  58170. $recv((function(){
  58171. return $core.withContext(function($ctx2) {
  58172. return $self._deinstallTop();
  58173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58174. }))._on_do_($globals.Error,(function(){
  58175. }));
  58176. $ctx1.sendIdx["on:do:"]=1;
  58177. $recv((function(){
  58178. return $core.withContext(function($ctx2) {
  58179. return $self._deinstallMiddle();
  58180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58181. }))._on_do_($globals.Error,(function(){
  58182. }));
  58183. $ctx1.sendIdx["on:do:"]=2;
  58184. $recv((function(){
  58185. return $core.withContext(function($ctx2) {
  58186. return $self._deinstallBottom();
  58187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58188. }))._on_do_($globals.Error,(function(){
  58189. }));
  58190. return self;
  58191. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58192. },
  58193. args: [],
  58194. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58195. referencedClasses: ["Error"],
  58196. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58197. }),
  58198. $globals.MethodInheritanceTest);
  58199. $core.addMethod(
  58200. $core.method({
  58201. selector: "testMNU11",
  58202. protocol: "tests",
  58203. fn: function (){
  58204. var self=this,$self=this;
  58205. return $core.withContext(function($ctx1) {
  58206. $self["@performBlock"]=(function(x){
  58207. return $core.withContext(function($ctx2) {
  58208. return $recv(x)._foo();
  58209. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58210. });
  58211. $self._shouldMNU();
  58212. $ctx1.sendIdx["shouldMNU"]=1;
  58213. $self._installTop_("foo ^ false");
  58214. $ctx1.sendIdx["installTop:"]=1;
  58215. $self._installTop_("foo ^ true");
  58216. $self._deinstallTop();
  58217. $self._shouldMNU();
  58218. return self;
  58219. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58220. },
  58221. args: [],
  58222. source: "testMNU11\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self deinstallTop.\x0a\x09self shouldMNU",
  58223. referencedClasses: [],
  58224. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58225. }),
  58226. $globals.MethodInheritanceTest);
  58227. $core.addMethod(
  58228. $core.method({
  58229. selector: "testMNU22",
  58230. protocol: "tests",
  58231. fn: function (){
  58232. var self=this,$self=this;
  58233. return $core.withContext(function($ctx1) {
  58234. $self["@performBlock"]=(function(x){
  58235. return $core.withContext(function($ctx2) {
  58236. return $recv(x)._foo();
  58237. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58238. });
  58239. $self._shouldMNU();
  58240. $ctx1.sendIdx["shouldMNU"]=1;
  58241. $self._installMiddle_("foo ^ false");
  58242. $ctx1.sendIdx["installMiddle:"]=1;
  58243. $self._installMiddle_("foo ^ true");
  58244. $self._deinstallMiddle();
  58245. $self._shouldMNU();
  58246. return self;
  58247. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58248. },
  58249. args: [],
  58250. source: "testMNU22\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installMiddle: 'foo ^ false'.\x0a\x09self installMiddle: 'foo ^ true'.\x0a\x09self deinstallMiddle.\x0a\x09self shouldMNU",
  58251. referencedClasses: [],
  58252. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58253. }),
  58254. $globals.MethodInheritanceTest);
  58255. $core.addMethod(
  58256. $core.method({
  58257. selector: "testReturns1",
  58258. protocol: "tests",
  58259. fn: function (){
  58260. var self=this,$self=this;
  58261. return $core.withContext(function($ctx1) {
  58262. $self["@performBlock"]=(function(x){
  58263. return $core.withContext(function($ctx2) {
  58264. return $recv(x)._foo();
  58265. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58266. });
  58267. $self._installTop_("foo ^ false");
  58268. $ctx1.sendIdx["installTop:"]=1;
  58269. $self._shouldReturn_(false);
  58270. $ctx1.sendIdx["shouldReturn:"]=1;
  58271. $self._installTop_("foo ^ true");
  58272. $self._shouldReturn_(true);
  58273. return self;
  58274. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58275. },
  58276. args: [],
  58277. source: "testReturns1\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self shouldReturn: false.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self shouldReturn: true",
  58278. referencedClasses: [],
  58279. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58280. }),
  58281. $globals.MethodInheritanceTest);
  58282. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58283. $core.addMethod(
  58284. $core.method({
  58285. selector: "testAbs",
  58286. protocol: "tests",
  58287. fn: function (){
  58288. var self=this,$self=this;
  58289. return $core.withContext(function($ctx1) {
  58290. var $1;
  58291. $1=(4)._abs();
  58292. $ctx1.sendIdx["abs"]=1;
  58293. $self._assert_equals_($1,(4));
  58294. $ctx1.sendIdx["assert:equals:"]=1;
  58295. $self._assert_equals_((-4)._abs(),(4));
  58296. return self;
  58297. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58298. },
  58299. args: [],
  58300. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58301. referencedClasses: [],
  58302. messageSends: ["assert:equals:", "abs"]
  58303. }),
  58304. $globals.NumberTest);
  58305. $core.addMethod(
  58306. $core.method({
  58307. selector: "testArithmetic",
  58308. protocol: "tests",
  58309. fn: function (){
  58310. var self=this,$self=this;
  58311. return $core.withContext(function($ctx1) {
  58312. var $1,$2,$3,$5,$4;
  58313. $1=(1.5).__plus((1));
  58314. $ctx1.sendIdx["+"]=1;
  58315. $self._assert_equals_($1,(2.5));
  58316. $ctx1.sendIdx["assert:equals:"]=1;
  58317. $2=(2).__minus((1));
  58318. $ctx1.sendIdx["-"]=1;
  58319. $self._assert_equals_($2,(1));
  58320. $ctx1.sendIdx["assert:equals:"]=2;
  58321. $self._assert_equals_((-2).__minus((1)),(-3));
  58322. $ctx1.sendIdx["assert:equals:"]=3;
  58323. $self._assert_equals_((12).__slash((2)),(6));
  58324. $ctx1.sendIdx["assert:equals:"]=4;
  58325. $3=(3).__star((4));
  58326. $ctx1.sendIdx["*"]=1;
  58327. $self._assert_equals_($3,(12));
  58328. $ctx1.sendIdx["assert:equals:"]=5;
  58329. $self._assert_equals_((7).__slash_slash((2)),(3));
  58330. $ctx1.sendIdx["assert:equals:"]=6;
  58331. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58332. $ctx1.sendIdx["assert:equals:"]=7;
  58333. $5=(1).__plus((2));
  58334. $ctx1.sendIdx["+"]=2;
  58335. $4=$recv($5).__star((3));
  58336. $ctx1.sendIdx["*"]=2;
  58337. $self._assert_equals_($4,(9));
  58338. $ctx1.sendIdx["assert:equals:"]=8;
  58339. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58340. return self;
  58341. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58342. },
  58343. args: [],
  58344. source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if\x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  58345. referencedClasses: [],
  58346. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58347. }),
  58348. $globals.NumberTest);
  58349. $core.addMethod(
  58350. $core.method({
  58351. selector: "testAsNumber",
  58352. protocol: "tests",
  58353. fn: function (){
  58354. var self=this,$self=this;
  58355. return $core.withContext(function($ctx1) {
  58356. $self._assert_equals_((3)._asNumber(),(3));
  58357. return self;
  58358. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58359. },
  58360. args: [],
  58361. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58362. referencedClasses: [],
  58363. messageSends: ["assert:equals:", "asNumber"]
  58364. }),
  58365. $globals.NumberTest);
  58366. $core.addMethod(
  58367. $core.method({
  58368. selector: "testBetweenAnd",
  58369. protocol: "tests",
  58370. fn: function (){
  58371. var self=this,$self=this;
  58372. return $core.withContext(function($ctx1) {
  58373. var $1,$3,$2,$5,$4;
  58374. $1=(4)._between_and_((3),(5));
  58375. $ctx1.sendIdx["between:and:"]=1;
  58376. $self._assert_($1);
  58377. $ctx1.sendIdx["assert:"]=1;
  58378. $3=(1)._between_and_((5),(6));
  58379. $ctx1.sendIdx["between:and:"]=2;
  58380. $2=$recv($3)._not();
  58381. $ctx1.sendIdx["not"]=1;
  58382. $self._assert_($2);
  58383. $ctx1.sendIdx["assert:"]=2;
  58384. $5=(90)._between_and_((67),(87));
  58385. $ctx1.sendIdx["between:and:"]=3;
  58386. $4=$recv($5)._not();
  58387. $self._assert_($4);
  58388. $ctx1.sendIdx["assert:"]=3;
  58389. $self._assert_((1)._between_and_((1),(1)));
  58390. return self;
  58391. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58392. },
  58393. args: [],
  58394. source: "testBetweenAnd\x0a\x09self assert: (4 between: 3 and: 5).\x0a\x09self assert: (1 between: 5 and: 6) not.\x0a\x09self assert: (90 between: 67 and: 87) not.\x0a\x09self assert: (1 between: 1 and: 1).",
  58395. referencedClasses: [],
  58396. messageSends: ["assert:", "between:and:", "not"]
  58397. }),
  58398. $globals.NumberTest);
  58399. $core.addMethod(
  58400. $core.method({
  58401. selector: "testBitAnd",
  58402. protocol: "tests",
  58403. fn: function (){
  58404. var self=this,$self=this;
  58405. return $core.withContext(function($ctx1) {
  58406. var $1,$2;
  58407. $1=(15)._bitAnd_((2));
  58408. $ctx1.sendIdx["bitAnd:"]=1;
  58409. $self._assert_equals_($1,(2));
  58410. $ctx1.sendIdx["assert:equals:"]=1;
  58411. $2=(15)._bitAnd_((15));
  58412. $ctx1.sendIdx["bitAnd:"]=2;
  58413. $self._assert_equals_($2,(15));
  58414. $ctx1.sendIdx["assert:equals:"]=2;
  58415. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58416. return self;
  58417. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58418. },
  58419. args: [],
  58420. source: "testBitAnd\x0a\x09self assert: (15 bitAnd: 2) equals: 2.\x0a\x09self assert: (15 bitAnd: 15) equals: 15.\x0a\x09self assert: (-1 bitAnd: 1021) equals: 1021",
  58421. referencedClasses: [],
  58422. messageSends: ["assert:equals:", "bitAnd:"]
  58423. }),
  58424. $globals.NumberTest);
  58425. $core.addMethod(
  58426. $core.method({
  58427. selector: "testBitNot",
  58428. protocol: "tests",
  58429. fn: function (){
  58430. var self=this,$self=this;
  58431. return $core.withContext(function($ctx1) {
  58432. var $1,$2;
  58433. $1=(2)._bitNot();
  58434. $ctx1.sendIdx["bitNot"]=1;
  58435. $self._assert_equals_($1,(-3));
  58436. $ctx1.sendIdx["assert:equals:"]=1;
  58437. $2=(-1)._bitNot();
  58438. $ctx1.sendIdx["bitNot"]=2;
  58439. $self._assert_equals_($2,(0));
  58440. $ctx1.sendIdx["assert:equals:"]=2;
  58441. $self._assert_equals_((-1022)._bitNot(),(1021));
  58442. return self;
  58443. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58444. },
  58445. args: [],
  58446. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58447. referencedClasses: [],
  58448. messageSends: ["assert:equals:", "bitNot"]
  58449. }),
  58450. $globals.NumberTest);
  58451. $core.addMethod(
  58452. $core.method({
  58453. selector: "testBitOr",
  58454. protocol: "tests",
  58455. fn: function (){
  58456. var self=this,$self=this;
  58457. return $core.withContext(function($ctx1) {
  58458. var $1,$2;
  58459. $1=(2)._bitOr_((4));
  58460. $ctx1.sendIdx["bitOr:"]=1;
  58461. $self._assert_equals_($1,(6));
  58462. $ctx1.sendIdx["assert:equals:"]=1;
  58463. $2=(7)._bitOr_((2));
  58464. $ctx1.sendIdx["bitOr:"]=2;
  58465. $self._assert_equals_($2,(7));
  58466. $ctx1.sendIdx["assert:equals:"]=2;
  58467. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58468. return self;
  58469. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58470. },
  58471. args: [],
  58472. source: "testBitOr\x0a\x09self assert: (2 bitOr: 4) equals: 6.\x0a\x09self assert: (7 bitOr: 2) equals: 7.\x0a\x09self assert: (-1 bitOr: 1021) equals: -1",
  58473. referencedClasses: [],
  58474. messageSends: ["assert:equals:", "bitOr:"]
  58475. }),
  58476. $globals.NumberTest);
  58477. $core.addMethod(
  58478. $core.method({
  58479. selector: "testBitXor",
  58480. protocol: "tests",
  58481. fn: function (){
  58482. var self=this,$self=this;
  58483. return $core.withContext(function($ctx1) {
  58484. var $1,$2,$3;
  58485. $1=(2)._bitXor_((4));
  58486. $ctx1.sendIdx["bitXor:"]=1;
  58487. $self._assert_equals_($1,(6));
  58488. $ctx1.sendIdx["assert:equals:"]=1;
  58489. $2=(7)._bitXor_((2));
  58490. $ctx1.sendIdx["bitXor:"]=2;
  58491. $self._assert_equals_($2,(5));
  58492. $ctx1.sendIdx["assert:equals:"]=2;
  58493. $3=(-1)._bitXor_((1021));
  58494. $ctx1.sendIdx["bitXor:"]=3;
  58495. $self._assert_equals_($3,(-1022));
  58496. $ctx1.sendIdx["assert:equals:"]=3;
  58497. $self._assert_equals_((91)._bitXor_((91)),(0));
  58498. return self;
  58499. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58500. },
  58501. args: [],
  58502. source: "testBitXor\x0a\x09self assert: (2 bitXor: 4) equals: 6.\x0a\x09self assert: (7 bitXor: 2) equals: 5.\x0a\x09self assert: (-1 bitXor: 1021) equals: -1022.\x0a\x09self assert: (91 bitXor: 91) equals: 0",
  58503. referencedClasses: [],
  58504. messageSends: ["assert:equals:", "bitXor:"]
  58505. }),
  58506. $globals.NumberTest);
  58507. $core.addMethod(
  58508. $core.method({
  58509. selector: "testCeiling",
  58510. protocol: "tests",
  58511. fn: function (){
  58512. var self=this,$self=this;
  58513. return $core.withContext(function($ctx1) {
  58514. var $1,$2;
  58515. $1=(1.2)._ceiling();
  58516. $ctx1.sendIdx["ceiling"]=1;
  58517. $self._assert_equals_($1,(2));
  58518. $ctx1.sendIdx["assert:equals:"]=1;
  58519. $2=(-1.2)._ceiling();
  58520. $ctx1.sendIdx["ceiling"]=2;
  58521. $self._assert_equals_($2,(-1));
  58522. $ctx1.sendIdx["assert:equals:"]=2;
  58523. $self._assert_equals_((1)._ceiling(),(1));
  58524. return self;
  58525. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58526. },
  58527. args: [],
  58528. source: "testCeiling\x0a\x09self assert: 1.2 ceiling equals: 2.\x0a\x09self assert: -1.2 ceiling equals: -1.\x0a\x09self assert: 1.0 ceiling equals: 1.",
  58529. referencedClasses: [],
  58530. messageSends: ["assert:equals:", "ceiling"]
  58531. }),
  58532. $globals.NumberTest);
  58533. $core.addMethod(
  58534. $core.method({
  58535. selector: "testComparison",
  58536. protocol: "tests",
  58537. fn: function (){
  58538. var self=this,$self=this;
  58539. return $core.withContext(function($ctx1) {
  58540. var $1,$2,$3,$4;
  58541. $1=(3).__gt((2));
  58542. $ctx1.sendIdx[">"]=1;
  58543. $self._assert_($1);
  58544. $ctx1.sendIdx["assert:"]=1;
  58545. $2=(2).__lt((3));
  58546. $ctx1.sendIdx["<"]=1;
  58547. $self._assert_($2);
  58548. $ctx1.sendIdx["assert:"]=2;
  58549. $self._deny_((3).__lt((2)));
  58550. $ctx1.sendIdx["deny:"]=1;
  58551. $self._deny_((2).__gt((3)));
  58552. $3=(3).__gt_eq((3));
  58553. $ctx1.sendIdx[">="]=1;
  58554. $self._assert_($3);
  58555. $ctx1.sendIdx["assert:"]=3;
  58556. $self._assert_((3.1).__gt_eq((3)));
  58557. $ctx1.sendIdx["assert:"]=4;
  58558. $4=(3).__lt_eq((3));
  58559. $ctx1.sendIdx["<="]=1;
  58560. $self._assert_($4);
  58561. $ctx1.sendIdx["assert:"]=5;
  58562. $self._assert_((3).__lt_eq((3.1)));
  58563. return self;
  58564. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58565. },
  58566. args: [],
  58567. source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1",
  58568. referencedClasses: [],
  58569. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58570. }),
  58571. $globals.NumberTest);
  58572. $core.addMethod(
  58573. $core.method({
  58574. selector: "testCopying",
  58575. protocol: "tests",
  58576. fn: function (){
  58577. var self=this,$self=this;
  58578. return $core.withContext(function($ctx1) {
  58579. var $1;
  58580. $1=$recv((1)._copy()).__eq_eq((1));
  58581. $ctx1.sendIdx["=="]=1;
  58582. $self._assert_($1);
  58583. $ctx1.sendIdx["assert:"]=1;
  58584. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58585. return self;
  58586. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58587. },
  58588. args: [],
  58589. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58590. referencedClasses: [],
  58591. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58592. }),
  58593. $globals.NumberTest);
  58594. $core.addMethod(
  58595. $core.method({
  58596. selector: "testDegreesToRadians",
  58597. protocol: "tests",
  58598. fn: function (){
  58599. var self=this,$self=this;
  58600. return $core.withContext(function($ctx1) {
  58601. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58602. return self;
  58603. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58604. },
  58605. args: [],
  58606. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58607. referencedClasses: ["Number"],
  58608. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58609. }),
  58610. $globals.NumberTest);
  58611. $core.addMethod(
  58612. $core.method({
  58613. selector: "testEquality",
  58614. protocol: "tests",
  58615. fn: function (){
  58616. var self=this,$self=this;
  58617. return $core.withContext(function($ctx1) {
  58618. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58619. $1=(1).__eq((1));
  58620. $ctx1.sendIdx["="]=1;
  58621. $self._assert_($1);
  58622. $ctx1.sendIdx["assert:"]=1;
  58623. $2=(0).__eq((0));
  58624. $ctx1.sendIdx["="]=2;
  58625. $self._assert_($2);
  58626. $ctx1.sendIdx["assert:"]=2;
  58627. $3=(1).__eq((0));
  58628. $ctx1.sendIdx["="]=3;
  58629. $self._deny_($3);
  58630. $ctx1.sendIdx["deny:"]=1;
  58631. $5=(1)._yourself();
  58632. $ctx1.sendIdx["yourself"]=1;
  58633. $4=$recv($5).__eq((1));
  58634. $ctx1.sendIdx["="]=4;
  58635. $self._assert_($4);
  58636. $ctx1.sendIdx["assert:"]=3;
  58637. $7=(1)._yourself();
  58638. $ctx1.sendIdx["yourself"]=2;
  58639. $6=(1).__eq($7);
  58640. $ctx1.sendIdx["="]=5;
  58641. $self._assert_($6);
  58642. $ctx1.sendIdx["assert:"]=4;
  58643. $9=(1)._yourself();
  58644. $ctx1.sendIdx["yourself"]=3;
  58645. $8=$recv($9).__eq((1)._yourself());
  58646. $ctx1.sendIdx["="]=6;
  58647. $self._assert_($8);
  58648. $10=(0).__eq(false);
  58649. $ctx1.sendIdx["="]=7;
  58650. $self._deny_($10);
  58651. $ctx1.sendIdx["deny:"]=2;
  58652. $11=false.__eq((0));
  58653. $ctx1.sendIdx["="]=8;
  58654. $self._deny_($11);
  58655. $ctx1.sendIdx["deny:"]=3;
  58656. $12="".__eq((0));
  58657. $ctx1.sendIdx["="]=9;
  58658. $self._deny_($12);
  58659. $ctx1.sendIdx["deny:"]=4;
  58660. $self._deny_((0).__eq(""));
  58661. return self;
  58662. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58663. },
  58664. args: [],
  58665. source: "testEquality\x0a\x09self assert: (1 = 1).\x0a\x09self assert: (0 = 0).\x0a\x09self deny: (1 = 0).\x0a\x0a\x09self assert: (1 yourself = 1).\x0a\x09self assert: (1 = 1 yourself).\x0a\x09self assert: (1 yourself = 1 yourself).\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''",
  58666. referencedClasses: [],
  58667. messageSends: ["assert:", "=", "deny:", "yourself"]
  58668. }),
  58669. $globals.NumberTest);
  58670. $core.addMethod(
  58671. $core.method({
  58672. selector: "testFloor",
  58673. protocol: "tests",
  58674. fn: function (){
  58675. var self=this,$self=this;
  58676. return $core.withContext(function($ctx1) {
  58677. var $1,$2;
  58678. $1=(1.2)._floor();
  58679. $ctx1.sendIdx["floor"]=1;
  58680. $self._assert_equals_($1,(1));
  58681. $ctx1.sendIdx["assert:equals:"]=1;
  58682. $2=(-1.2)._floor();
  58683. $ctx1.sendIdx["floor"]=2;
  58684. $self._assert_equals_($2,(-2));
  58685. $ctx1.sendIdx["assert:equals:"]=2;
  58686. $self._assert_equals_((1)._floor(),(1));
  58687. return self;
  58688. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58689. },
  58690. args: [],
  58691. source: "testFloor\x0a\x09self assert: 1.2 floor equals: 1.\x0a\x09self assert: -1.2 floor equals: -2.\x0a\x09self assert: 1.0 floor equals: 1.",
  58692. referencedClasses: [],
  58693. messageSends: ["assert:equals:", "floor"]
  58694. }),
  58695. $globals.NumberTest);
  58696. $core.addMethod(
  58697. $core.method({
  58698. selector: "testHexNumbers",
  58699. protocol: "tests",
  58700. fn: function (){
  58701. var self=this,$self=this;
  58702. return $core.withContext(function($ctx1) {
  58703. var $1,$2,$3,$4,$5;
  58704. $self._assert_equals_((9),(9));
  58705. $ctx1.sendIdx["assert:equals:"]=1;
  58706. $1=(10)._truncated();
  58707. $ctx1.sendIdx["truncated"]=1;
  58708. $self._assert_equals_($1,(10));
  58709. $ctx1.sendIdx["assert:equals:"]=2;
  58710. $2=(11)._truncated();
  58711. $ctx1.sendIdx["truncated"]=2;
  58712. $self._assert_equals_($2,(11));
  58713. $ctx1.sendIdx["assert:equals:"]=3;
  58714. $3=(12)._truncated();
  58715. $ctx1.sendIdx["truncated"]=3;
  58716. $self._assert_equals_($3,(12));
  58717. $ctx1.sendIdx["assert:equals:"]=4;
  58718. $4=(13)._truncated();
  58719. $ctx1.sendIdx["truncated"]=4;
  58720. $self._assert_equals_($4,(13));
  58721. $ctx1.sendIdx["assert:equals:"]=5;
  58722. $5=(14)._truncated();
  58723. $ctx1.sendIdx["truncated"]=5;
  58724. $self._assert_equals_($5,(14));
  58725. $ctx1.sendIdx["assert:equals:"]=6;
  58726. $self._assert_equals_((15)._truncated(),(15));
  58727. return self;
  58728. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58729. },
  58730. args: [],
  58731. source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15",
  58732. referencedClasses: [],
  58733. messageSends: ["assert:equals:", "truncated"]
  58734. }),
  58735. $globals.NumberTest);
  58736. $core.addMethod(
  58737. $core.method({
  58738. selector: "testIdentity",
  58739. protocol: "tests",
  58740. fn: function (){
  58741. var self=this,$self=this;
  58742. return $core.withContext(function($ctx1) {
  58743. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58744. $1=(1).__eq_eq((1));
  58745. $ctx1.sendIdx["=="]=1;
  58746. $self._assert_($1);
  58747. $ctx1.sendIdx["assert:"]=1;
  58748. $2=(0).__eq_eq((0));
  58749. $ctx1.sendIdx["=="]=2;
  58750. $self._assert_($2);
  58751. $ctx1.sendIdx["assert:"]=2;
  58752. $3=(1).__eq_eq((0));
  58753. $ctx1.sendIdx["=="]=3;
  58754. $self._deny_($3);
  58755. $ctx1.sendIdx["deny:"]=1;
  58756. $5=(1)._yourself();
  58757. $ctx1.sendIdx["yourself"]=1;
  58758. $4=$recv($5).__eq_eq((1));
  58759. $ctx1.sendIdx["=="]=4;
  58760. $self._assert_($4);
  58761. $ctx1.sendIdx["assert:"]=3;
  58762. $7=(1)._yourself();
  58763. $ctx1.sendIdx["yourself"]=2;
  58764. $6=(1).__eq_eq($7);
  58765. $ctx1.sendIdx["=="]=5;
  58766. $self._assert_($6);
  58767. $ctx1.sendIdx["assert:"]=4;
  58768. $9=(1)._yourself();
  58769. $ctx1.sendIdx["yourself"]=3;
  58770. $8=$recv($9).__eq_eq((1)._yourself());
  58771. $ctx1.sendIdx["=="]=6;
  58772. $self._assert_($8);
  58773. $self._deny_((1).__eq_eq((2)));
  58774. return self;
  58775. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58776. },
  58777. args: [],
  58778. source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2",
  58779. referencedClasses: [],
  58780. messageSends: ["assert:", "==", "deny:", "yourself"]
  58781. }),
  58782. $globals.NumberTest);
  58783. $core.addMethod(
  58784. $core.method({
  58785. selector: "testInvalidHexNumbers",
  58786. protocol: "tests",
  58787. fn: function (){
  58788. var self=this,$self=this;
  58789. return $core.withContext(function($ctx1) {
  58790. $self._should_raise_((function(){
  58791. return $core.withContext(function($ctx2) {
  58792. return (16)._rG();
  58793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58794. }),$globals.MessageNotUnderstood);
  58795. $ctx1.sendIdx["should:raise:"]=1;
  58796. $self._should_raise_((function(){
  58797. return $core.withContext(function($ctx2) {
  58798. return (16)._rg();
  58799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58800. }),$globals.MessageNotUnderstood);
  58801. $ctx1.sendIdx["should:raise:"]=2;
  58802. $self._should_raise_((function(){
  58803. return $core.withContext(function($ctx2) {
  58804. return (16)._rH();
  58805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58806. }),$globals.MessageNotUnderstood);
  58807. $ctx1.sendIdx["should:raise:"]=3;
  58808. $self._should_raise_((function(){
  58809. return $core.withContext(function($ctx2) {
  58810. return (16)._rh();
  58811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58812. }),$globals.MessageNotUnderstood);
  58813. $ctx1.sendIdx["should:raise:"]=4;
  58814. $self._should_raise_((function(){
  58815. return $core.withContext(function($ctx2) {
  58816. return (16)._rI();
  58817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58818. }),$globals.MessageNotUnderstood);
  58819. $ctx1.sendIdx["should:raise:"]=5;
  58820. $self._should_raise_((function(){
  58821. return $core.withContext(function($ctx2) {
  58822. return (16)._ri();
  58823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58824. }),$globals.MessageNotUnderstood);
  58825. $ctx1.sendIdx["should:raise:"]=6;
  58826. $self._should_raise_((function(){
  58827. return $core.withContext(function($ctx2) {
  58828. return (16)._rJ();
  58829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58830. }),$globals.MessageNotUnderstood);
  58831. $ctx1.sendIdx["should:raise:"]=7;
  58832. $self._should_raise_((function(){
  58833. return $core.withContext(function($ctx2) {
  58834. return (16)._rj();
  58835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58836. }),$globals.MessageNotUnderstood);
  58837. $ctx1.sendIdx["should:raise:"]=8;
  58838. $self._should_raise_((function(){
  58839. return $core.withContext(function($ctx2) {
  58840. return (16)._rK();
  58841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58842. }),$globals.MessageNotUnderstood);
  58843. $ctx1.sendIdx["should:raise:"]=9;
  58844. $self._should_raise_((function(){
  58845. return $core.withContext(function($ctx2) {
  58846. return (16)._rk();
  58847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  58848. }),$globals.MessageNotUnderstood);
  58849. $ctx1.sendIdx["should:raise:"]=10;
  58850. $self._should_raise_((function(){
  58851. return $core.withContext(function($ctx2) {
  58852. return (16)._rL();
  58853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  58854. }),$globals.MessageNotUnderstood);
  58855. $ctx1.sendIdx["should:raise:"]=11;
  58856. $self._should_raise_((function(){
  58857. return $core.withContext(function($ctx2) {
  58858. return (16)._rl();
  58859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  58860. }),$globals.MessageNotUnderstood);
  58861. $ctx1.sendIdx["should:raise:"]=12;
  58862. $self._should_raise_((function(){
  58863. return $core.withContext(function($ctx2) {
  58864. return (16)._rM();
  58865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  58866. }),$globals.MessageNotUnderstood);
  58867. $ctx1.sendIdx["should:raise:"]=13;
  58868. $self._should_raise_((function(){
  58869. return $core.withContext(function($ctx2) {
  58870. return (16)._rm();
  58871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  58872. }),$globals.MessageNotUnderstood);
  58873. $ctx1.sendIdx["should:raise:"]=14;
  58874. $self._should_raise_((function(){
  58875. return $core.withContext(function($ctx2) {
  58876. return (16)._rN();
  58877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  58878. }),$globals.MessageNotUnderstood);
  58879. $ctx1.sendIdx["should:raise:"]=15;
  58880. $self._should_raise_((function(){
  58881. return $core.withContext(function($ctx2) {
  58882. return (16)._rn();
  58883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  58884. }),$globals.MessageNotUnderstood);
  58885. $ctx1.sendIdx["should:raise:"]=16;
  58886. $self._should_raise_((function(){
  58887. return $core.withContext(function($ctx2) {
  58888. return (16)._rO();
  58889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  58890. }),$globals.MessageNotUnderstood);
  58891. $ctx1.sendIdx["should:raise:"]=17;
  58892. $self._should_raise_((function(){
  58893. return $core.withContext(function($ctx2) {
  58894. return (16)._ro();
  58895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  58896. }),$globals.MessageNotUnderstood);
  58897. $ctx1.sendIdx["should:raise:"]=18;
  58898. $self._should_raise_((function(){
  58899. return $core.withContext(function($ctx2) {
  58900. return (16)._rP();
  58901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  58902. }),$globals.MessageNotUnderstood);
  58903. $ctx1.sendIdx["should:raise:"]=19;
  58904. $self._should_raise_((function(){
  58905. return $core.withContext(function($ctx2) {
  58906. return (16)._rp();
  58907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  58908. }),$globals.MessageNotUnderstood);
  58909. $ctx1.sendIdx["should:raise:"]=20;
  58910. $self._should_raise_((function(){
  58911. return $core.withContext(function($ctx2) {
  58912. return (16)._rQ();
  58913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  58914. }),$globals.MessageNotUnderstood);
  58915. $ctx1.sendIdx["should:raise:"]=21;
  58916. $self._should_raise_((function(){
  58917. return $core.withContext(function($ctx2) {
  58918. return (16)._rq();
  58919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  58920. }),$globals.MessageNotUnderstood);
  58921. $ctx1.sendIdx["should:raise:"]=22;
  58922. $self._should_raise_((function(){
  58923. return $core.withContext(function($ctx2) {
  58924. return (16)._rR();
  58925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  58926. }),$globals.MessageNotUnderstood);
  58927. $ctx1.sendIdx["should:raise:"]=23;
  58928. $self._should_raise_((function(){
  58929. return $core.withContext(function($ctx2) {
  58930. return (16)._rr();
  58931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  58932. }),$globals.MessageNotUnderstood);
  58933. $ctx1.sendIdx["should:raise:"]=24;
  58934. $self._should_raise_((function(){
  58935. return $core.withContext(function($ctx2) {
  58936. return (16)._rS();
  58937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  58938. }),$globals.MessageNotUnderstood);
  58939. $ctx1.sendIdx["should:raise:"]=25;
  58940. $self._should_raise_((function(){
  58941. return $core.withContext(function($ctx2) {
  58942. return (16)._rs();
  58943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  58944. }),$globals.MessageNotUnderstood);
  58945. $ctx1.sendIdx["should:raise:"]=26;
  58946. $self._should_raise_((function(){
  58947. return $core.withContext(function($ctx2) {
  58948. return (16)._rT();
  58949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  58950. }),$globals.MessageNotUnderstood);
  58951. $ctx1.sendIdx["should:raise:"]=27;
  58952. $self._should_raise_((function(){
  58953. return $core.withContext(function($ctx2) {
  58954. return (16)._rt();
  58955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  58956. }),$globals.MessageNotUnderstood);
  58957. $ctx1.sendIdx["should:raise:"]=28;
  58958. $self._should_raise_((function(){
  58959. return $core.withContext(function($ctx2) {
  58960. return (16)._rU();
  58961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  58962. }),$globals.MessageNotUnderstood);
  58963. $ctx1.sendIdx["should:raise:"]=29;
  58964. $self._should_raise_((function(){
  58965. return $core.withContext(function($ctx2) {
  58966. return (16)._ru();
  58967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  58968. }),$globals.MessageNotUnderstood);
  58969. $ctx1.sendIdx["should:raise:"]=30;
  58970. $self._should_raise_((function(){
  58971. return $core.withContext(function($ctx2) {
  58972. return (16)._rV();
  58973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  58974. }),$globals.MessageNotUnderstood);
  58975. $ctx1.sendIdx["should:raise:"]=31;
  58976. $self._should_raise_((function(){
  58977. return $core.withContext(function($ctx2) {
  58978. return (16)._rv();
  58979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  58980. }),$globals.MessageNotUnderstood);
  58981. $ctx1.sendIdx["should:raise:"]=32;
  58982. $self._should_raise_((function(){
  58983. return $core.withContext(function($ctx2) {
  58984. return (16)._rW();
  58985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  58986. }),$globals.MessageNotUnderstood);
  58987. $ctx1.sendIdx["should:raise:"]=33;
  58988. $self._should_raise_((function(){
  58989. return $core.withContext(function($ctx2) {
  58990. return (16)._rw();
  58991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  58992. }),$globals.MessageNotUnderstood);
  58993. $ctx1.sendIdx["should:raise:"]=34;
  58994. $self._should_raise_((function(){
  58995. return $core.withContext(function($ctx2) {
  58996. return (16)._rX();
  58997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  58998. }),$globals.MessageNotUnderstood);
  58999. $ctx1.sendIdx["should:raise:"]=35;
  59000. $self._should_raise_((function(){
  59001. return $core.withContext(function($ctx2) {
  59002. return (16)._rx();
  59003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  59004. }),$globals.MessageNotUnderstood);
  59005. $ctx1.sendIdx["should:raise:"]=36;
  59006. $self._should_raise_((function(){
  59007. return $core.withContext(function($ctx2) {
  59008. return (16)._rY();
  59009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  59010. }),$globals.MessageNotUnderstood);
  59011. $ctx1.sendIdx["should:raise:"]=37;
  59012. $self._should_raise_((function(){
  59013. return $core.withContext(function($ctx2) {
  59014. return (16)._ry();
  59015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  59016. }),$globals.MessageNotUnderstood);
  59017. $ctx1.sendIdx["should:raise:"]=38;
  59018. $self._should_raise_((function(){
  59019. return $core.withContext(function($ctx2) {
  59020. return (16)._rZ();
  59021. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  59022. }),$globals.MessageNotUnderstood);
  59023. $ctx1.sendIdx["should:raise:"]=39;
  59024. $self._should_raise_((function(){
  59025. return $core.withContext(function($ctx2) {
  59026. return (16)._rz();
  59027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  59028. }),$globals.MessageNotUnderstood);
  59029. $ctx1.sendIdx["should:raise:"]=40;
  59030. $self._should_raise_((function(){
  59031. return $core.withContext(function($ctx2) {
  59032. return (11259375)._Z();
  59033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  59034. }),$globals.MessageNotUnderstood);
  59035. return self;
  59036. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  59037. },
  59038. args: [],
  59039. source: "testInvalidHexNumbers\x0a\x0a\x09self should: [ 16rG ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rg ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rH ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rh ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rI ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ri ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rJ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rj ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rK ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rk ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rL ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rl ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rM ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rm ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rN ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rn ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rO ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ro ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rP ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rp ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rQ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rq ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rR ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rr ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rS ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rs ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rT ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rt ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rU ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ru ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rV ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rv ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rW ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rw ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rX ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rx ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rY ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ry ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rZ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rz ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rABcdEfZ ] raise: MessageNotUnderstood.",
  59040. referencedClasses: ["MessageNotUnderstood"],
  59041. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"]
  59042. }),
  59043. $globals.NumberTest);
  59044. $core.addMethod(
  59045. $core.method({
  59046. selector: "testLog",
  59047. protocol: "tests",
  59048. fn: function (){
  59049. var self=this,$self=this;
  59050. return $core.withContext(function($ctx1) {
  59051. $self._assert_equals_((10000)._log(),(4));
  59052. $ctx1.sendIdx["assert:equals:"]=1;
  59053. $self._assert_equals_((512)._log_((2)),(9));
  59054. $ctx1.sendIdx["assert:equals:"]=2;
  59055. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  59056. return self;
  59057. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  59058. },
  59059. args: [],
  59060. source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.",
  59061. referencedClasses: ["Number"],
  59062. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  59063. }),
  59064. $globals.NumberTest);
  59065. $core.addMethod(
  59066. $core.method({
  59067. selector: "testMinMax",
  59068. protocol: "tests",
  59069. fn: function (){
  59070. var self=this,$self=this;
  59071. return $core.withContext(function($ctx1) {
  59072. var $1,$2;
  59073. $self._assert_equals_((2)._max_((5)),(5));
  59074. $ctx1.sendIdx["assert:equals:"]=1;
  59075. $self._assert_equals_((2)._min_((5)),(2));
  59076. $ctx1.sendIdx["assert:equals:"]=2;
  59077. $1=(2)._min_max_((5),(3));
  59078. $ctx1.sendIdx["min:max:"]=1;
  59079. $self._assert_equals_($1,(3));
  59080. $ctx1.sendIdx["assert:equals:"]=3;
  59081. $2=(7)._min_max_((5),(3));
  59082. $ctx1.sendIdx["min:max:"]=2;
  59083. $self._assert_equals_($2,(5));
  59084. $ctx1.sendIdx["assert:equals:"]=4;
  59085. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  59086. return self;
  59087. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  59088. },
  59089. args: [],
  59090. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2.\x0a\x09self assert: (2 min: 5 max: 3) equals: 3.\x0a\x09self assert: (7 min: 5 max: 3) equals: 5.\x0a\x09self assert: (4 min: 5 max: 3) equals: 4.",
  59091. referencedClasses: [],
  59092. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  59093. }),
  59094. $globals.NumberTest);
  59095. $core.addMethod(
  59096. $core.method({
  59097. selector: "testNegated",
  59098. protocol: "tests",
  59099. fn: function (){
  59100. var self=this,$self=this;
  59101. return $core.withContext(function($ctx1) {
  59102. var $1;
  59103. $1=(3)._negated();
  59104. $ctx1.sendIdx["negated"]=1;
  59105. $self._assert_equals_($1,(-3));
  59106. $ctx1.sendIdx["assert:equals:"]=1;
  59107. $self._assert_equals_((-3)._negated(),(3));
  59108. return self;
  59109. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  59110. },
  59111. args: [],
  59112. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  59113. referencedClasses: [],
  59114. messageSends: ["assert:equals:", "negated"]
  59115. }),
  59116. $globals.NumberTest);
  59117. $core.addMethod(
  59118. $core.method({
  59119. selector: "testPrintShowingDecimalPlaces",
  59120. protocol: "tests",
  59121. fn: function (){
  59122. var self=this,$self=this;
  59123. return $core.withContext(function($ctx1) {
  59124. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  59125. $1=(23)._printShowingDecimalPlaces_((2));
  59126. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  59127. $self._assert_equals_($1,"23.00");
  59128. $ctx1.sendIdx["assert:equals:"]=1;
  59129. $2=(23.5698)._printShowingDecimalPlaces_((2));
  59130. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  59131. $self._assert_equals_($2,"23.57");
  59132. $ctx1.sendIdx["assert:equals:"]=2;
  59133. $4=(234.567)._negated();
  59134. $ctx1.sendIdx["negated"]=1;
  59135. $3=$recv($4)._printShowingDecimalPlaces_((5));
  59136. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  59137. $self._assert_equals_($3,"-234.56700");
  59138. $ctx1.sendIdx["assert:equals:"]=3;
  59139. $5=(23.4567)._printShowingDecimalPlaces_((0));
  59140. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  59141. $self._assert_equals_($5,"23");
  59142. $ctx1.sendIdx["assert:equals:"]=4;
  59143. $6=(23.5567)._printShowingDecimalPlaces_((0));
  59144. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  59145. $self._assert_equals_($6,"24");
  59146. $ctx1.sendIdx["assert:equals:"]=5;
  59147. $8=(23.4567)._negated();
  59148. $ctx1.sendIdx["negated"]=2;
  59149. $7=$recv($8)._printShowingDecimalPlaces_((0));
  59150. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  59151. $self._assert_equals_($7,"-23");
  59152. $ctx1.sendIdx["assert:equals:"]=6;
  59153. $10=(23.5567)._negated();
  59154. $ctx1.sendIdx["negated"]=3;
  59155. $9=$recv($10)._printShowingDecimalPlaces_((0));
  59156. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  59157. $self._assert_equals_($9,"-24");
  59158. $ctx1.sendIdx["assert:equals:"]=7;
  59159. $11=(100000000)._printShowingDecimalPlaces_((1));
  59160. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  59161. $self._assert_equals_($11,"100000000.0");
  59162. $ctx1.sendIdx["assert:equals:"]=8;
  59163. $12=(0.98)._printShowingDecimalPlaces_((5));
  59164. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  59165. $self._assert_equals_($12,"0.98000");
  59166. $ctx1.sendIdx["assert:equals:"]=9;
  59167. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  59168. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  59169. $self._assert_equals_($13,"-0.98");
  59170. $ctx1.sendIdx["assert:equals:"]=10;
  59171. $14=(2.567)._printShowingDecimalPlaces_((2));
  59172. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  59173. $self._assert_equals_($14,"2.57");
  59174. $ctx1.sendIdx["assert:equals:"]=11;
  59175. $15=(-2.567)._printShowingDecimalPlaces_((2));
  59176. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  59177. $self._assert_equals_($15,"-2.57");
  59178. $ctx1.sendIdx["assert:equals:"]=12;
  59179. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59180. return self;
  59181. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  59182. },
  59183. args: [],
  59184. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.",
  59185. referencedClasses: [],
  59186. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  59187. }),
  59188. $globals.NumberTest);
  59189. $core.addMethod(
  59190. $core.method({
  59191. selector: "testPrintStringBase",
  59192. protocol: "tests",
  59193. fn: function (){
  59194. var self=this,$self=this;
  59195. return $core.withContext(function($ctx1) {
  59196. var $1,$2,$3;
  59197. $1=(15)._printStringBase_((2));
  59198. $ctx1.sendIdx["printStringBase:"]=1;
  59199. $self._assert_equals_($1,"1111");
  59200. $ctx1.sendIdx["assert:equals:"]=1;
  59201. $2=(15)._printStringBase_((16));
  59202. $ctx1.sendIdx["printStringBase:"]=2;
  59203. $self._assert_equals_($2,"f");
  59204. $ctx1.sendIdx["assert:equals:"]=2;
  59205. $3=(256)._printStringBase_((16));
  59206. $ctx1.sendIdx["printStringBase:"]=3;
  59207. $self._assert_equals_($3,"100");
  59208. $ctx1.sendIdx["assert:equals:"]=3;
  59209. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59210. return self;
  59211. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59212. },
  59213. args: [],
  59214. source: "testPrintStringBase\x0a\x09self assert: (15 printStringBase: 2) equals: '1111'.\x0a\x09self assert: (15 printStringBase: 16) equals: 'f'.\x0a\x09self assert: (256 printStringBase: 16) equals: '100'.\x0a\x09self assert: (256 printStringBase: 2) equals: '100000000'",
  59215. referencedClasses: [],
  59216. messageSends: ["assert:equals:", "printStringBase:"]
  59217. }),
  59218. $globals.NumberTest);
  59219. $core.addMethod(
  59220. $core.method({
  59221. selector: "testRadiansToDegrees",
  59222. protocol: "tests",
  59223. fn: function (){
  59224. var self=this,$self=this;
  59225. return $core.withContext(function($ctx1) {
  59226. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59227. return self;
  59228. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59229. },
  59230. args: [],
  59231. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59232. referencedClasses: ["Number"],
  59233. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59234. }),
  59235. $globals.NumberTest);
  59236. $core.addMethod(
  59237. $core.method({
  59238. selector: "testRaisedTo",
  59239. protocol: "tests",
  59240. fn: function (){
  59241. var self=this,$self=this;
  59242. return $core.withContext(function($ctx1) {
  59243. var $1,$2,$3;
  59244. $1=(2)._raisedTo_((4));
  59245. $ctx1.sendIdx["raisedTo:"]=1;
  59246. $self._assert_equals_($1,(16));
  59247. $ctx1.sendIdx["assert:equals:"]=1;
  59248. $2=(2)._raisedTo_((0));
  59249. $ctx1.sendIdx["raisedTo:"]=2;
  59250. $self._assert_equals_($2,(1));
  59251. $ctx1.sendIdx["assert:equals:"]=2;
  59252. $3=(2)._raisedTo_((-3));
  59253. $ctx1.sendIdx["raisedTo:"]=3;
  59254. $self._assert_equals_($3,(0.125));
  59255. $ctx1.sendIdx["assert:equals:"]=3;
  59256. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59257. $ctx1.sendIdx["assert:equals:"]=4;
  59258. $self._assert_equals_((2).__star_star((4)),(16));
  59259. return self;
  59260. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59261. },
  59262. args: [],
  59263. source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.",
  59264. referencedClasses: [],
  59265. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59266. }),
  59267. $globals.NumberTest);
  59268. $core.addMethod(
  59269. $core.method({
  59270. selector: "testRounded",
  59271. protocol: "tests",
  59272. fn: function (){
  59273. var self=this,$self=this;
  59274. return $core.withContext(function($ctx1) {
  59275. var $1,$2;
  59276. $1=(3)._rounded();
  59277. $ctx1.sendIdx["rounded"]=1;
  59278. $self._assert_equals_($1,(3));
  59279. $ctx1.sendIdx["assert:equals:"]=1;
  59280. $2=(3.212)._rounded();
  59281. $ctx1.sendIdx["rounded"]=2;
  59282. $self._assert_equals_($2,(3));
  59283. $ctx1.sendIdx["assert:equals:"]=2;
  59284. $self._assert_equals_((3.51)._rounded(),(4));
  59285. return self;
  59286. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59287. },
  59288. args: [],
  59289. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4",
  59290. referencedClasses: [],
  59291. messageSends: ["assert:equals:", "rounded"]
  59292. }),
  59293. $globals.NumberTest);
  59294. $core.addMethod(
  59295. $core.method({
  59296. selector: "testSign",
  59297. protocol: "tests",
  59298. fn: function (){
  59299. var self=this,$self=this;
  59300. return $core.withContext(function($ctx1) {
  59301. var $1,$2;
  59302. $1=(5)._sign();
  59303. $ctx1.sendIdx["sign"]=1;
  59304. $self._assert_equals_($1,(1));
  59305. $ctx1.sendIdx["assert:equals:"]=1;
  59306. $2=(0)._sign();
  59307. $ctx1.sendIdx["sign"]=2;
  59308. $self._assert_equals_($2,(0));
  59309. $ctx1.sendIdx["assert:equals:"]=2;
  59310. $self._assert_equals_((-1.4)._sign(),(-1));
  59311. return self;
  59312. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59313. },
  59314. args: [],
  59315. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59316. referencedClasses: [],
  59317. messageSends: ["assert:equals:", "sign"]
  59318. }),
  59319. $globals.NumberTest);
  59320. $core.addMethod(
  59321. $core.method({
  59322. selector: "testSqrt",
  59323. protocol: "tests",
  59324. fn: function (){
  59325. var self=this,$self=this;
  59326. return $core.withContext(function($ctx1) {
  59327. var $1;
  59328. $1=(4)._sqrt();
  59329. $ctx1.sendIdx["sqrt"]=1;
  59330. $self._assert_equals_($1,(2));
  59331. $ctx1.sendIdx["assert:equals:"]=1;
  59332. $self._assert_equals_((16)._sqrt(),(4));
  59333. return self;
  59334. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59335. },
  59336. args: [],
  59337. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59338. referencedClasses: [],
  59339. messageSends: ["assert:equals:", "sqrt"]
  59340. }),
  59341. $globals.NumberTest);
  59342. $core.addMethod(
  59343. $core.method({
  59344. selector: "testSquared",
  59345. protocol: "tests",
  59346. fn: function (){
  59347. var self=this,$self=this;
  59348. return $core.withContext(function($ctx1) {
  59349. $self._assert_equals_((4)._squared(),(16));
  59350. return self;
  59351. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59352. },
  59353. args: [],
  59354. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59355. referencedClasses: [],
  59356. messageSends: ["assert:equals:", "squared"]
  59357. }),
  59358. $globals.NumberTest);
  59359. $core.addMethod(
  59360. $core.method({
  59361. selector: "testTimesRepeat",
  59362. protocol: "tests",
  59363. fn: function (){
  59364. var self=this,$self=this;
  59365. var i;
  59366. return $core.withContext(function($ctx1) {
  59367. i=(0);
  59368. (0)._timesRepeat_((function(){
  59369. return $core.withContext(function($ctx2) {
  59370. i=$recv(i).__plus((1));
  59371. $ctx2.sendIdx["+"]=1;
  59372. return i;
  59373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59374. }));
  59375. $ctx1.sendIdx["timesRepeat:"]=1;
  59376. $self._assert_equals_(i,(0));
  59377. $ctx1.sendIdx["assert:equals:"]=1;
  59378. (5)._timesRepeat_((function(){
  59379. return $core.withContext(function($ctx2) {
  59380. i=$recv(i).__plus((1));
  59381. return i;
  59382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59383. }));
  59384. $self._assert_equals_(i,(5));
  59385. return self;
  59386. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59387. },
  59388. args: [],
  59389. source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 5",
  59390. referencedClasses: [],
  59391. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59392. }),
  59393. $globals.NumberTest);
  59394. $core.addMethod(
  59395. $core.method({
  59396. selector: "testTo",
  59397. protocol: "tests",
  59398. fn: function (){
  59399. var self=this,$self=this;
  59400. return $core.withContext(function($ctx1) {
  59401. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59402. return self;
  59403. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59404. },
  59405. args: [],
  59406. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59407. referencedClasses: [],
  59408. messageSends: ["assert:equals:", "to:"]
  59409. }),
  59410. $globals.NumberTest);
  59411. $core.addMethod(
  59412. $core.method({
  59413. selector: "testToBy",
  59414. protocol: "tests",
  59415. fn: function (){
  59416. var self=this,$self=this;
  59417. return $core.withContext(function($ctx1) {
  59418. var $1;
  59419. $1=(0)._to_by_((6),(2));
  59420. $ctx1.sendIdx["to:by:"]=1;
  59421. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59422. $self._should_raise_((function(){
  59423. return $core.withContext(function($ctx2) {
  59424. return (1)._to_by_((4),(0));
  59425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59426. }),$globals.Error);
  59427. return self;
  59428. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59429. },
  59430. args: [],
  59431. source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [ 1 to: 4 by: 0 ] raise: Error",
  59432. referencedClasses: ["Error"],
  59433. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59434. }),
  59435. $globals.NumberTest);
  59436. $core.addMethod(
  59437. $core.method({
  59438. selector: "testTrigonometry",
  59439. protocol: "tests",
  59440. fn: function (){
  59441. var self=this,$self=this;
  59442. return $core.withContext(function($ctx1) {
  59443. var $1;
  59444. $self._assert_equals_((0)._cos(),(1));
  59445. $ctx1.sendIdx["assert:equals:"]=1;
  59446. $self._assert_equals_((0)._sin(),(0));
  59447. $ctx1.sendIdx["assert:equals:"]=2;
  59448. $self._assert_equals_((0)._tan(),(0));
  59449. $ctx1.sendIdx["assert:equals:"]=3;
  59450. $self._assert_equals_((1)._arcCos(),(0));
  59451. $ctx1.sendIdx["assert:equals:"]=4;
  59452. $self._assert_equals_((0)._arcSin(),(0));
  59453. $ctx1.sendIdx["assert:equals:"]=5;
  59454. $self._assert_equals_((0)._arcTan(),(0));
  59455. $ctx1.sendIdx["assert:equals:"]=6;
  59456. $1=(0)._arcTan_((1));
  59457. $ctx1.sendIdx["arcTan:"]=1;
  59458. $self._assert_equals_($1,(0));
  59459. $ctx1.sendIdx["assert:equals:"]=7;
  59460. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59461. return self;
  59462. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59463. },
  59464. args: [],
  59465. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.\x0a\x09\x0a\x09self assert: (0 arcTan: 1) equals: 0.\x0a\x09self assert: (1 arcTan: 0) equals: (Number pi / 2)",
  59466. referencedClasses: ["Number"],
  59467. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59468. }),
  59469. $globals.NumberTest);
  59470. $core.addMethod(
  59471. $core.method({
  59472. selector: "testTruncated",
  59473. protocol: "tests",
  59474. fn: function (){
  59475. var self=this,$self=this;
  59476. return $core.withContext(function($ctx1) {
  59477. var $1,$2;
  59478. $1=(3)._truncated();
  59479. $ctx1.sendIdx["truncated"]=1;
  59480. $self._assert_equals_($1,(3));
  59481. $ctx1.sendIdx["assert:equals:"]=1;
  59482. $2=(3.212)._truncated();
  59483. $ctx1.sendIdx["truncated"]=2;
  59484. $self._assert_equals_($2,(3));
  59485. $ctx1.sendIdx["assert:equals:"]=2;
  59486. $self._assert_equals_((3.51)._truncated(),(3));
  59487. return self;
  59488. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59489. },
  59490. args: [],
  59491. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3",
  59492. referencedClasses: [],
  59493. messageSends: ["assert:equals:", "truncated"]
  59494. }),
  59495. $globals.NumberTest);
  59496. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59497. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59498. $core.addMethod(
  59499. $core.method({
  59500. selector: "foo",
  59501. protocol: "not yet classified",
  59502. fn: function (){
  59503. var self=this,$self=this;
  59504. return $self["@foo"];
  59505. },
  59506. args: [],
  59507. source: "foo\x0a\x09^ foo",
  59508. referencedClasses: [],
  59509. messageSends: []
  59510. }),
  59511. $globals.ObjectMock);
  59512. $core.addMethod(
  59513. $core.method({
  59514. selector: "foo:",
  59515. protocol: "not yet classified",
  59516. fn: function (anObject){
  59517. var self=this,$self=this;
  59518. $self["@foo"]=anObject;
  59519. return self;
  59520. },
  59521. args: ["anObject"],
  59522. source: "foo: anObject\x0a\x09foo := anObject",
  59523. referencedClasses: [],
  59524. messageSends: []
  59525. }),
  59526. $globals.ObjectMock);
  59527. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59528. $core.addMethod(
  59529. $core.method({
  59530. selector: "notDefined",
  59531. protocol: "tests",
  59532. fn: function (){
  59533. var self=this,$self=this;
  59534. return $core.withContext(function($ctx1) {
  59535. return void 0;;
  59536. return self;
  59537. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59538. },
  59539. args: [],
  59540. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59541. referencedClasses: [],
  59542. messageSends: []
  59543. }),
  59544. $globals.ObjectTest);
  59545. $core.addMethod(
  59546. $core.method({
  59547. selector: "testBasicAccess",
  59548. protocol: "tests",
  59549. fn: function (){
  59550. var self=this,$self=this;
  59551. var o;
  59552. return $core.withContext(function($ctx1) {
  59553. var $1;
  59554. o=$recv($globals.Object)._new();
  59555. $recv(o)._basicAt_put_("a",(1));
  59556. $1=$recv(o)._basicAt_("a");
  59557. $ctx1.sendIdx["basicAt:"]=1;
  59558. $self._assert_equals_($1,(1));
  59559. $ctx1.sendIdx["assert:equals:"]=1;
  59560. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59561. return self;
  59562. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59563. },
  59564. args: [],
  59565. source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil",
  59566. referencedClasses: ["Object"],
  59567. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59568. }),
  59569. $globals.ObjectTest);
  59570. $core.addMethod(
  59571. $core.method({
  59572. selector: "testBasicPerform",
  59573. protocol: "tests",
  59574. fn: function (){
  59575. var self=this,$self=this;
  59576. var o;
  59577. return $core.withContext(function($ctx1) {
  59578. o=$recv($globals.Object)._new();
  59579. $recv(o)._basicAt_put_("func",(function(){
  59580. return "hello";
  59581. }));
  59582. $ctx1.sendIdx["basicAt:put:"]=1;
  59583. $recv(o)._basicAt_put_("func2",(function(a){
  59584. return $core.withContext(function($ctx2) {
  59585. return $recv(a).__plus((1));
  59586. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59587. }));
  59588. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59589. $ctx1.sendIdx["assert:equals:"]=1;
  59590. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59591. return self;
  59592. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59593. },
  59594. args: [],
  59595. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: [ 'hello' ].\x0a\x09o basicAt: 'func2' put: [ :a | a + 1 ].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  59596. referencedClasses: ["Object"],
  59597. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59598. }),
  59599. $globals.ObjectTest);
  59600. $core.addMethod(
  59601. $core.method({
  59602. selector: "testDNU",
  59603. protocol: "tests",
  59604. fn: function (){
  59605. var self=this,$self=this;
  59606. return $core.withContext(function($ctx1) {
  59607. $self._should_raise_((function(){
  59608. return $core.withContext(function($ctx2) {
  59609. return $recv($recv($globals.Object)._new())._foo();
  59610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59611. }),$globals.MessageNotUnderstood);
  59612. return self;
  59613. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59614. },
  59615. args: [],
  59616. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59617. referencedClasses: ["Object", "MessageNotUnderstood"],
  59618. messageSends: ["should:raise:", "foo", "new"]
  59619. }),
  59620. $globals.ObjectTest);
  59621. $core.addMethod(
  59622. $core.method({
  59623. selector: "testEquality",
  59624. protocol: "tests",
  59625. fn: function (){
  59626. var self=this,$self=this;
  59627. var o;
  59628. return $core.withContext(function($ctx1) {
  59629. var $1,$2,$4,$3;
  59630. o=$recv($globals.Object)._new();
  59631. $ctx1.sendIdx["new"]=1;
  59632. $1=$recv(o).__eq($recv($globals.Object)._new());
  59633. $ctx1.sendIdx["="]=1;
  59634. $self._deny_($1);
  59635. $2=$recv(o).__eq(o);
  59636. $ctx1.sendIdx["="]=2;
  59637. $self._assert_($2);
  59638. $ctx1.sendIdx["assert:"]=1;
  59639. $4=$recv(o)._yourself();
  59640. $ctx1.sendIdx["yourself"]=1;
  59641. $3=$recv($4).__eq(o);
  59642. $ctx1.sendIdx["="]=3;
  59643. $self._assert_($3);
  59644. $ctx1.sendIdx["assert:"]=2;
  59645. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59646. return self;
  59647. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59648. },
  59649. args: [],
  59650. source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: (o = o).\x0a\x09self assert: (o yourself = o).\x0a\x09self assert: (o = o yourself)",
  59651. referencedClasses: ["Object"],
  59652. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59653. }),
  59654. $globals.ObjectTest);
  59655. $core.addMethod(
  59656. $core.method({
  59657. selector: "testHalt",
  59658. protocol: "tests",
  59659. fn: function (){
  59660. var self=this,$self=this;
  59661. return $core.withContext(function($ctx1) {
  59662. $self._should_raise_((function(){
  59663. return $core.withContext(function($ctx2) {
  59664. return $recv($recv($globals.Object)._new())._halt();
  59665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59666. }),$globals.Error);
  59667. return self;
  59668. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59669. },
  59670. args: [],
  59671. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59672. referencedClasses: ["Object", "Error"],
  59673. messageSends: ["should:raise:", "halt", "new"]
  59674. }),
  59675. $globals.ObjectTest);
  59676. $core.addMethod(
  59677. $core.method({
  59678. selector: "testIdentity",
  59679. protocol: "tests",
  59680. fn: function (){
  59681. var self=this,$self=this;
  59682. var o;
  59683. return $core.withContext(function($ctx1) {
  59684. var $1,$2,$4,$3;
  59685. o=$recv($globals.Object)._new();
  59686. $ctx1.sendIdx["new"]=1;
  59687. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59688. $ctx1.sendIdx["=="]=1;
  59689. $self._deny_($1);
  59690. $2=$recv(o).__eq_eq(o);
  59691. $ctx1.sendIdx["=="]=2;
  59692. $self._assert_($2);
  59693. $ctx1.sendIdx["assert:"]=1;
  59694. $4=$recv(o)._yourself();
  59695. $ctx1.sendIdx["yourself"]=1;
  59696. $3=$recv($4).__eq_eq(o);
  59697. $ctx1.sendIdx["=="]=3;
  59698. $self._assert_($3);
  59699. $ctx1.sendIdx["assert:"]=2;
  59700. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59701. return self;
  59702. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59703. },
  59704. args: [],
  59705. source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself",
  59706. referencedClasses: ["Object"],
  59707. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59708. }),
  59709. $globals.ObjectTest);
  59710. $core.addMethod(
  59711. $core.method({
  59712. selector: "testIfNil",
  59713. protocol: "tests",
  59714. fn: function (){
  59715. var self=this,$self=this;
  59716. return $core.withContext(function($ctx1) {
  59717. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59718. $2=$recv($globals.Object)._new();
  59719. $ctx1.sendIdx["new"]=1;
  59720. $1=$recv($2)._isNil();
  59721. $self._deny_($1);
  59722. $ctx1.sendIdx["deny:"]=1;
  59723. $5=$recv($globals.Object)._new();
  59724. $ctx1.sendIdx["new"]=2;
  59725. if(($receiver = $5) == null || $receiver.a$nil){
  59726. $4=true;
  59727. } else {
  59728. $4=$5;
  59729. }
  59730. $3=$recv($4).__eq(true);
  59731. $self._deny_($3);
  59732. $7=$recv($globals.Object)._new();
  59733. $ctx1.sendIdx["new"]=3;
  59734. if(($receiver = $7) == null || $receiver.a$nil){
  59735. $6=$7;
  59736. } else {
  59737. $6=true;
  59738. }
  59739. $self._assert_equals_($6,true);
  59740. $ctx1.sendIdx["assert:equals:"]=1;
  59741. $9=$recv($globals.Object)._new();
  59742. $ctx1.sendIdx["new"]=4;
  59743. if(($receiver = $9) == null || $receiver.a$nil){
  59744. $8=false;
  59745. } else {
  59746. $8=true;
  59747. }
  59748. $self._assert_equals_($8,true);
  59749. $ctx1.sendIdx["assert:equals:"]=2;
  59750. $11=$recv($globals.Object)._new();
  59751. if(($receiver = $11) == null || $receiver.a$nil){
  59752. $10=false;
  59753. } else {
  59754. $10=true;
  59755. }
  59756. $self._assert_equals_($10,true);
  59757. return self;
  59758. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59759. },
  59760. args: [],
  59761. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [ true ]) = true.\x0a\x09self assert: (Object new ifNotNil: [ true ]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [ false ] ifNotNil: [ true ]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [ true ] ifNil: [ false ]) equals: true",
  59762. referencedClasses: ["Object"],
  59763. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59764. }),
  59765. $globals.ObjectTest);
  59766. $core.addMethod(
  59767. $core.method({
  59768. selector: "testInstVars",
  59769. protocol: "tests",
  59770. fn: function (){
  59771. var self=this,$self=this;
  59772. var o;
  59773. return $core.withContext(function($ctx1) {
  59774. var $1,$2;
  59775. o=$recv($globals.ObjectMock)._new();
  59776. $1=$recv(o)._instVarAt_("foo");
  59777. $ctx1.sendIdx["instVarAt:"]=1;
  59778. $self._assert_equals_($1,nil);
  59779. $ctx1.sendIdx["assert:equals:"]=1;
  59780. $recv(o)._instVarAt_put_("foo",(1));
  59781. $2=$recv(o)._instVarAt_("foo");
  59782. $ctx1.sendIdx["instVarAt:"]=2;
  59783. $self._assert_equals_($2,(1));
  59784. $ctx1.sendIdx["assert:equals:"]=2;
  59785. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59786. return self;
  59787. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59788. },
  59789. args: [],
  59790. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1",
  59791. referencedClasses: ["ObjectMock"],
  59792. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59793. }),
  59794. $globals.ObjectTest);
  59795. $core.addMethod(
  59796. $core.method({
  59797. selector: "testNilUndefined",
  59798. protocol: "tests",
  59799. fn: function (){
  59800. var self=this,$self=this;
  59801. return $core.withContext(function($ctx1) {
  59802. $self._assert_equals_($self._notDefined(),nil);
  59803. return self;
  59804. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59805. },
  59806. args: [],
  59807. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59808. referencedClasses: [],
  59809. messageSends: ["assert:equals:", "notDefined"]
  59810. }),
  59811. $globals.ObjectTest);
  59812. $core.addMethod(
  59813. $core.method({
  59814. selector: "testYourself",
  59815. protocol: "tests",
  59816. fn: function (){
  59817. var self=this,$self=this;
  59818. var o;
  59819. return $core.withContext(function($ctx1) {
  59820. o=$recv($globals.ObjectMock)._new();
  59821. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59822. return self;
  59823. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59824. },
  59825. args: [],
  59826. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59827. referencedClasses: ["ObjectMock"],
  59828. messageSends: ["new", "assert:", "==", "yourself"]
  59829. }),
  59830. $globals.ObjectTest);
  59831. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59832. $core.addMethod(
  59833. $core.method({
  59834. selector: "testAccessing",
  59835. protocol: "tests",
  59836. fn: function (){
  59837. var self=this,$self=this;
  59838. return $core.withContext(function($ctx1) {
  59839. var $2,$1,$3,$6,$5,$4;
  59840. $2=$recv($globals.Point)._x_y_((3),(4));
  59841. $ctx1.sendIdx["x:y:"]=1;
  59842. $1=$recv($2)._x();
  59843. $ctx1.sendIdx["x"]=1;
  59844. $self._assert_equals_($1,(3));
  59845. $ctx1.sendIdx["assert:equals:"]=1;
  59846. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  59847. $ctx1.sendIdx["y"]=1;
  59848. $self._assert_equals_($3,(4));
  59849. $ctx1.sendIdx["assert:equals:"]=2;
  59850. $6=$recv($globals.Point)._new();
  59851. $ctx1.sendIdx["new"]=1;
  59852. $5=$recv($6)._x_((3));
  59853. $4=$recv($5)._x();
  59854. $self._assert_equals_($4,(3));
  59855. $ctx1.sendIdx["assert:equals:"]=3;
  59856. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  59857. return self;
  59858. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  59859. },
  59860. args: [],
  59861. source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4",
  59862. referencedClasses: ["Point"],
  59863. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  59864. }),
  59865. $globals.PointTest);
  59866. $core.addMethod(
  59867. $core.method({
  59868. selector: "testAngle",
  59869. protocol: "tests",
  59870. fn: function (){
  59871. var self=this,$self=this;
  59872. return $core.withContext(function($ctx1) {
  59873. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  59874. return self;
  59875. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  59876. },
  59877. args: [],
  59878. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  59879. referencedClasses: ["Number"],
  59880. messageSends: ["assert:equals:", "angle", "@", "pi"]
  59881. }),
  59882. $globals.PointTest);
  59883. $core.addMethod(
  59884. $core.method({
  59885. selector: "testArithmetic",
  59886. protocol: "tests",
  59887. fn: function (){
  59888. var self=this,$self=this;
  59889. return $core.withContext(function($ctx1) {
  59890. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  59891. $2=(3).__at((4));
  59892. $ctx1.sendIdx["@"]=1;
  59893. $3=(3).__at((4));
  59894. $ctx1.sendIdx["@"]=2;
  59895. $1=$recv($2).__star($3);
  59896. $4=$recv($globals.Point)._x_y_((9),(16));
  59897. $ctx1.sendIdx["x:y:"]=1;
  59898. $self._assert_equals_($1,$4);
  59899. $ctx1.sendIdx["assert:equals:"]=1;
  59900. $6=(3).__at((4));
  59901. $ctx1.sendIdx["@"]=3;
  59902. $7=(3).__at((4));
  59903. $ctx1.sendIdx["@"]=4;
  59904. $5=$recv($6).__plus($7);
  59905. $8=$recv($globals.Point)._x_y_((6),(8));
  59906. $ctx1.sendIdx["x:y:"]=2;
  59907. $self._assert_equals_($5,$8);
  59908. $ctx1.sendIdx["assert:equals:"]=2;
  59909. $10=(3).__at((4));
  59910. $ctx1.sendIdx["@"]=5;
  59911. $11=(3).__at((4));
  59912. $ctx1.sendIdx["@"]=6;
  59913. $9=$recv($10).__minus($11);
  59914. $12=$recv($globals.Point)._x_y_((0),(0));
  59915. $ctx1.sendIdx["x:y:"]=3;
  59916. $self._assert_equals_($9,$12);
  59917. $ctx1.sendIdx["assert:equals:"]=3;
  59918. $14=(6).__at((8));
  59919. $ctx1.sendIdx["@"]=7;
  59920. $13=$recv($14).__slash((3).__at((4)));
  59921. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  59922. return self;
  59923. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  59924. },
  59925. args: [],
  59926. source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)",
  59927. referencedClasses: ["Point"],
  59928. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  59929. }),
  59930. $globals.PointTest);
  59931. $core.addMethod(
  59932. $core.method({
  59933. selector: "testAt",
  59934. protocol: "tests",
  59935. fn: function (){
  59936. var self=this,$self=this;
  59937. return $core.withContext(function($ctx1) {
  59938. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  59939. return self;
  59940. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  59941. },
  59942. args: [],
  59943. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  59944. referencedClasses: ["Point"],
  59945. messageSends: ["assert:equals:", "@", "x:y:"]
  59946. }),
  59947. $globals.PointTest);
  59948. $core.addMethod(
  59949. $core.method({
  59950. selector: "testComparison",
  59951. protocol: "tests",
  59952. fn: function (){
  59953. var self=this,$self=this;
  59954. return $core.withContext(function($ctx1) {
  59955. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  59956. $2=(3).__at((4));
  59957. $ctx1.sendIdx["@"]=1;
  59958. $3=(4).__at((5));
  59959. $ctx1.sendIdx["@"]=2;
  59960. $1=$recv($2).__lt($3);
  59961. $ctx1.sendIdx["<"]=1;
  59962. $self._assert_($1);
  59963. $ctx1.sendIdx["assert:"]=1;
  59964. $5=(3).__at((4));
  59965. $ctx1.sendIdx["@"]=3;
  59966. $6=(4).__at((4));
  59967. $ctx1.sendIdx["@"]=4;
  59968. $4=$recv($5).__lt($6);
  59969. $self._deny_($4);
  59970. $ctx1.sendIdx["deny:"]=1;
  59971. $8=(4).__at((5));
  59972. $ctx1.sendIdx["@"]=5;
  59973. $9=(4).__at((5));
  59974. $ctx1.sendIdx["@"]=6;
  59975. $7=$recv($8).__lt_eq($9);
  59976. $ctx1.sendIdx["<="]=1;
  59977. $self._assert_($7);
  59978. $ctx1.sendIdx["assert:"]=2;
  59979. $11=(4).__at((5));
  59980. $ctx1.sendIdx["@"]=7;
  59981. $12=(3).__at((5));
  59982. $ctx1.sendIdx["@"]=8;
  59983. $10=$recv($11).__lt_eq($12);
  59984. $self._deny_($10);
  59985. $ctx1.sendIdx["deny:"]=2;
  59986. $14=(5).__at((6));
  59987. $ctx1.sendIdx["@"]=9;
  59988. $15=(4).__at((5));
  59989. $ctx1.sendIdx["@"]=10;
  59990. $13=$recv($14).__gt($15);
  59991. $ctx1.sendIdx[">"]=1;
  59992. $self._assert_($13);
  59993. $ctx1.sendIdx["assert:"]=3;
  59994. $17=(5).__at((6));
  59995. $ctx1.sendIdx["@"]=11;
  59996. $18=(6).__at((6));
  59997. $ctx1.sendIdx["@"]=12;
  59998. $16=$recv($17).__gt($18);
  59999. $self._deny_($16);
  60000. $ctx1.sendIdx["deny:"]=3;
  60001. $20=(4).__at((5));
  60002. $ctx1.sendIdx["@"]=13;
  60003. $21=(4).__at((5));
  60004. $ctx1.sendIdx["@"]=14;
  60005. $19=$recv($20).__gt_eq($21);
  60006. $ctx1.sendIdx[">="]=1;
  60007. $self._assert_($19);
  60008. $23=(4).__at((5));
  60009. $ctx1.sendIdx["@"]=15;
  60010. $22=$recv($23).__gt_eq((5).__at((5)));
  60011. $self._deny_($22);
  60012. return self;
  60013. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  60014. },
  60015. args: [],
  60016. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  60017. referencedClasses: [],
  60018. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  60019. }),
  60020. $globals.PointTest);
  60021. $core.addMethod(
  60022. $core.method({
  60023. selector: "testDotProduct",
  60024. protocol: "tests",
  60025. fn: function (){
  60026. var self=this,$self=this;
  60027. return $core.withContext(function($ctx1) {
  60028. var $2,$1;
  60029. $2=(2).__at((3));
  60030. $ctx1.sendIdx["@"]=1;
  60031. $1=$recv($2)._dotProduct_((3).__at((7)));
  60032. $self._assert_equals_($1,(27));
  60033. return self;
  60034. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  60035. },
  60036. args: [],
  60037. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  60038. referencedClasses: [],
  60039. messageSends: ["assert:equals:", "dotProduct:", "@"]
  60040. }),
  60041. $globals.PointTest);
  60042. $core.addMethod(
  60043. $core.method({
  60044. selector: "testEgality",
  60045. protocol: "tests",
  60046. fn: function (){
  60047. var self=this,$self=this;
  60048. return $core.withContext(function($ctx1) {
  60049. var $2,$3,$1,$5,$4;
  60050. $2=(3).__at((4));
  60051. $ctx1.sendIdx["@"]=1;
  60052. $3=(3).__at((4));
  60053. $ctx1.sendIdx["@"]=2;
  60054. $1=$recv($2).__eq($3);
  60055. $ctx1.sendIdx["="]=1;
  60056. $self._assert_($1);
  60057. $5=(3).__at((5));
  60058. $ctx1.sendIdx["@"]=3;
  60059. $4=$recv($5).__eq((3).__at((6)));
  60060. $self._deny_($4);
  60061. return self;
  60062. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  60063. },
  60064. args: [],
  60065. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  60066. referencedClasses: [],
  60067. messageSends: ["assert:", "=", "@", "deny:"]
  60068. }),
  60069. $globals.PointTest);
  60070. $core.addMethod(
  60071. $core.method({
  60072. selector: "testNew",
  60073. protocol: "tests",
  60074. fn: function (){
  60075. var self=this,$self=this;
  60076. return $core.withContext(function($ctx1) {
  60077. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  60078. $3=$recv($globals.Point)._new();
  60079. $ctx1.sendIdx["new"]=1;
  60080. $2=$recv($3)._x_((3));
  60081. $ctx1.sendIdx["x:"]=1;
  60082. $1=$recv($2)._y();
  60083. $ctx1.sendIdx["y"]=1;
  60084. $self._assert_equals_($1,nil);
  60085. $ctx1.sendIdx["assert:equals:"]=1;
  60086. $7=$recv($globals.Point)._new();
  60087. $ctx1.sendIdx["new"]=2;
  60088. $6=$recv($7)._x_((3));
  60089. $5=$recv($6)._x();
  60090. $ctx1.sendIdx["x"]=1;
  60091. $4=$recv($5).__eq((0));
  60092. $ctx1.sendIdx["="]=1;
  60093. $self._deny_($4);
  60094. $ctx1.sendIdx["deny:"]=1;
  60095. $10=$recv($globals.Point)._new();
  60096. $ctx1.sendIdx["new"]=3;
  60097. $9=$recv($10)._y_((4));
  60098. $ctx1.sendIdx["y:"]=1;
  60099. $8=$recv($9)._x();
  60100. $self._assert_equals_($8,nil);
  60101. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  60102. return self;
  60103. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  60104. },
  60105. args: [],
  60106. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  60107. referencedClasses: ["Point"],
  60108. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  60109. }),
  60110. $globals.PointTest);
  60111. $core.addMethod(
  60112. $core.method({
  60113. selector: "testNormal",
  60114. protocol: "tests",
  60115. fn: function (){
  60116. var self=this,$self=this;
  60117. return $core.withContext(function($ctx1) {
  60118. var $2,$1;
  60119. $2=(1).__at((0));
  60120. $ctx1.sendIdx["@"]=1;
  60121. $1=$recv($2)._normal();
  60122. $self._assert_equals_($1,(0).__at((1)));
  60123. return self;
  60124. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  60125. },
  60126. args: [],
  60127. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60128. referencedClasses: [],
  60129. messageSends: ["assert:equals:", "normal", "@"]
  60130. }),
  60131. $globals.PointTest);
  60132. $core.addMethod(
  60133. $core.method({
  60134. selector: "testNormalized",
  60135. protocol: "tests",
  60136. fn: function (){
  60137. var self=this,$self=this;
  60138. return $core.withContext(function($ctx1) {
  60139. var $2,$1,$3,$5,$4;
  60140. $2=(0).__at((2));
  60141. $ctx1.sendIdx["@"]=1;
  60142. $1=$recv($2)._normalized();
  60143. $ctx1.sendIdx["normalized"]=1;
  60144. $3=(0).__at((1));
  60145. $ctx1.sendIdx["@"]=2;
  60146. $self._assert_equals_($1,$3);
  60147. $ctx1.sendIdx["assert:equals:"]=1;
  60148. $5=(0).__at((0));
  60149. $ctx1.sendIdx["@"]=3;
  60150. $4=$recv($5)._normalized();
  60151. $self._assert_equals_($4,(0).__at((0)));
  60152. return self;
  60153. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  60154. },
  60155. args: [],
  60156. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60157. referencedClasses: [],
  60158. messageSends: ["assert:equals:", "normalized", "@"]
  60159. }),
  60160. $globals.PointTest);
  60161. $core.addMethod(
  60162. $core.method({
  60163. selector: "testPolarCoordinates",
  60164. protocol: "tests",
  60165. fn: function (){
  60166. var self=this,$self=this;
  60167. return $core.withContext(function($ctx1) {
  60168. var $2,$1;
  60169. $2=(1).__at((0));
  60170. $ctx1.sendIdx["@"]=1;
  60171. $1=$recv($2)._r();
  60172. $ctx1.sendIdx["r"]=1;
  60173. $self._assert_equals_($1,(1));
  60174. $ctx1.sendIdx["assert:equals:"]=1;
  60175. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60176. return self;
  60177. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  60178. },
  60179. args: [],
  60180. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60181. referencedClasses: [],
  60182. messageSends: ["assert:equals:", "r", "@"]
  60183. }),
  60184. $globals.PointTest);
  60185. $core.addMethod(
  60186. $core.method({
  60187. selector: "testRectangleCreation",
  60188. protocol: "tests",
  60189. fn: function (){
  60190. var self=this,$self=this;
  60191. return $core.withContext(function($ctx1) {
  60192. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60193. $2=(1).__at((1));
  60194. $ctx1.sendIdx["@"]=1;
  60195. $3=(2).__at((2));
  60196. $ctx1.sendIdx["@"]=2;
  60197. $1=$recv($2)._corner_($3);
  60198. $5=(1).__at((1));
  60199. $ctx1.sendIdx["@"]=3;
  60200. $6=(2).__at((2));
  60201. $ctx1.sendIdx["@"]=4;
  60202. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60203. $self._assert_equals_($1,$4);
  60204. $ctx1.sendIdx["assert:equals:"]=1;
  60205. $8=(1).__at((1));
  60206. $ctx1.sendIdx["@"]=5;
  60207. $9=(2).__at((2));
  60208. $ctx1.sendIdx["@"]=6;
  60209. $7=$recv($8)._rectangle_($9);
  60210. $11=(1).__at((1));
  60211. $ctx1.sendIdx["@"]=7;
  60212. $12=(2).__at((2));
  60213. $ctx1.sendIdx["@"]=8;
  60214. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60215. $self._assert_equals_($7,$10);
  60216. $ctx1.sendIdx["assert:equals:"]=2;
  60217. $14=(1).__at((1));
  60218. $ctx1.sendIdx["@"]=9;
  60219. $15=(2).__at((2));
  60220. $ctx1.sendIdx["@"]=10;
  60221. $13=$recv($14)._extent_($15);
  60222. $17=(1).__at((1));
  60223. $ctx1.sendIdx["@"]=11;
  60224. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60225. $self._assert_equals_($13,$16);
  60226. return self;
  60227. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60228. },
  60229. args: [],
  60230. source: "testRectangleCreation\x0a\x09self assert: (1@1 corner: 2@2) equals: (Rectangle origin: 1@1 corner: 2@2).\x0a\x09self assert: (1@1 rectangle: 2@2) equals: (Rectangle point: 1@1 point: 2@2).\x0a\x09self assert: (1@1 extent: 2@2) equals: (Rectangle origin: 1@1 extent: 2@2)",
  60231. referencedClasses: ["Rectangle"],
  60232. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60233. }),
  60234. $globals.PointTest);
  60235. $core.addMethod(
  60236. $core.method({
  60237. selector: "testTranslateBy",
  60238. protocol: "tests",
  60239. fn: function (){
  60240. var self=this,$self=this;
  60241. return $core.withContext(function($ctx1) {
  60242. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60243. $2=(3).__at((3));
  60244. $ctx1.sendIdx["@"]=1;
  60245. $3=(0).__at((1));
  60246. $ctx1.sendIdx["@"]=2;
  60247. $1=$recv($2)._translateBy_($3);
  60248. $ctx1.sendIdx["translateBy:"]=1;
  60249. $4=(3).__at((4));
  60250. $ctx1.sendIdx["@"]=3;
  60251. $self._assert_equals_($1,$4);
  60252. $ctx1.sendIdx["assert:equals:"]=1;
  60253. $6=(3).__at((3));
  60254. $ctx1.sendIdx["@"]=4;
  60255. $8=(1)._negated();
  60256. $ctx1.sendIdx["negated"]=1;
  60257. $7=(0).__at($8);
  60258. $ctx1.sendIdx["@"]=5;
  60259. $5=$recv($6)._translateBy_($7);
  60260. $ctx1.sendIdx["translateBy:"]=2;
  60261. $9=(3).__at((2));
  60262. $ctx1.sendIdx["@"]=6;
  60263. $self._assert_equals_($5,$9);
  60264. $ctx1.sendIdx["assert:equals:"]=2;
  60265. $11=(3).__at((3));
  60266. $ctx1.sendIdx["@"]=7;
  60267. $12=(2).__at((3));
  60268. $ctx1.sendIdx["@"]=8;
  60269. $10=$recv($11)._translateBy_($12);
  60270. $ctx1.sendIdx["translateBy:"]=3;
  60271. $13=(5).__at((6));
  60272. $ctx1.sendIdx["@"]=9;
  60273. $self._assert_equals_($10,$13);
  60274. $ctx1.sendIdx["assert:equals:"]=3;
  60275. $15=(3).__at((3));
  60276. $ctx1.sendIdx["@"]=10;
  60277. $16=$recv((3)._negated()).__at((0));
  60278. $ctx1.sendIdx["@"]=11;
  60279. $14=$recv($15)._translateBy_($16);
  60280. $self._assert_equals_($14,(0).__at((3)));
  60281. return self;
  60282. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60283. },
  60284. args: [],
  60285. source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.",
  60286. referencedClasses: [],
  60287. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60288. }),
  60289. $globals.PointTest);
  60290. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60291. $core.addMethod(
  60292. $core.method({
  60293. selector: "testNextIfAbsent",
  60294. protocol: "tests",
  60295. fn: function (){
  60296. var self=this,$self=this;
  60297. var queue;
  60298. return $core.withContext(function($ctx1) {
  60299. var $2,$1;
  60300. queue=$recv($globals.Queue)._new();
  60301. $recv(queue)._nextPut_("index1");
  60302. $2=$recv(queue)._nextIfAbsent_("empty");
  60303. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60304. $1=$recv($2).__eq("index1");
  60305. $ctx1.sendIdx["="]=1;
  60306. $self._assert_($1);
  60307. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60308. return self;
  60309. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60310. },
  60311. args: [],
  60312. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  60313. referencedClasses: ["Queue"],
  60314. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60315. }),
  60316. $globals.QueueTest);
  60317. $core.addMethod(
  60318. $core.method({
  60319. selector: "testQueueNext",
  60320. protocol: "tests",
  60321. fn: function (){
  60322. var self=this,$self=this;
  60323. var queue;
  60324. return $core.withContext(function($ctx1) {
  60325. var $1,$3,$2,$5,$4;
  60326. queue=$recv($globals.Queue)._new();
  60327. $1=queue;
  60328. $recv($1)._nextPut_("index1");
  60329. $ctx1.sendIdx["nextPut:"]=1;
  60330. $recv($1)._nextPut_("index2");
  60331. $3=$recv(queue)._next();
  60332. $ctx1.sendIdx["next"]=1;
  60333. $2=$recv($3).__eq("index1");
  60334. $ctx1.sendIdx["="]=1;
  60335. $self._assert_($2);
  60336. $5=$recv(queue)._next();
  60337. $ctx1.sendIdx["next"]=2;
  60338. $4=$recv($5).__eq("index");
  60339. $self._deny_($4);
  60340. $self._should_raise_((function(){
  60341. return $core.withContext(function($ctx2) {
  60342. return $recv(queue)._next();
  60343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60344. }),$globals.Error);
  60345. return self;
  60346. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60347. },
  60348. args: [],
  60349. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  60350. referencedClasses: ["Queue", "Error"],
  60351. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60352. }),
  60353. $globals.QueueTest);
  60354. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60355. $core.addMethod(
  60356. $core.method({
  60357. selector: "testAtRandomNumber",
  60358. protocol: "tests",
  60359. fn: function (){
  60360. var self=this,$self=this;
  60361. var val;
  60362. return $core.withContext(function($ctx1) {
  60363. (100)._timesRepeat_((function(){
  60364. return $core.withContext(function($ctx2) {
  60365. val=(10)._atRandom();
  60366. $self._assert_($recv(val).__gt((0)));
  60367. $ctx2.sendIdx["assert:"]=1;
  60368. return $self._assert_($recv(val).__lt((11)));
  60369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60370. }));
  60371. return self;
  60372. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60373. },
  60374. args: [],
  60375. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  60376. referencedClasses: [],
  60377. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60378. }),
  60379. $globals.RandomTest);
  60380. $core.addMethod(
  60381. $core.method({
  60382. selector: "testAtRandomSequenceableCollection",
  60383. protocol: "tests",
  60384. fn: function (){
  60385. var self=this,$self=this;
  60386. var val;
  60387. return $core.withContext(function($ctx1) {
  60388. var $3,$4,$2,$1;
  60389. (100)._timesRepeat_((function(){
  60390. return $core.withContext(function($ctx2) {
  60391. val="abc"._atRandom();
  60392. $3=$recv(val).__eq("a");
  60393. $ctx2.sendIdx["="]=1;
  60394. $4=$recv(val).__eq("b");
  60395. $ctx2.sendIdx["="]=2;
  60396. $2=$recv($3).__or($4);
  60397. $1=$recv($2).__or($recv(val).__eq("c"));
  60398. $ctx2.sendIdx["|"]=1;
  60399. return $self._assert_($1);
  60400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60401. }));
  60402. return self;
  60403. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60404. },
  60405. args: [],
  60406. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  60407. referencedClasses: [],
  60408. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60409. }),
  60410. $globals.RandomTest);
  60411. $core.addMethod(
  60412. $core.method({
  60413. selector: "textNext",
  60414. protocol: "tests",
  60415. fn: function (){
  60416. var self=this,$self=this;
  60417. return $core.withContext(function($ctx1) {
  60418. var $1;
  60419. (10000)._timesRepeat_((function(){
  60420. var current,next;
  60421. return $core.withContext(function($ctx2) {
  60422. next=$recv($recv($globals.Random)._new())._next();
  60423. $self._assert_($recv(next).__gt_eq((0)));
  60424. $ctx2.sendIdx["assert:"]=1;
  60425. $self._assert_($recv(next).__lt((1)));
  60426. $1=$recv(current).__eq(next);
  60427. $ctx2.sendIdx["="]=1;
  60428. $self._deny_($1);
  60429. return $recv(next).__eq(current);
  60430. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60431. }));
  60432. return self;
  60433. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60434. },
  60435. args: [],
  60436. source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next |\x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current ]",
  60437. referencedClasses: ["Random"],
  60438. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60439. }),
  60440. $globals.RandomTest);
  60441. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60442. $core.addMethod(
  60443. $core.method({
  60444. selector: "testContainsPoint",
  60445. protocol: "tests",
  60446. fn: function (){
  60447. var self=this,$self=this;
  60448. var rect;
  60449. return $core.withContext(function($ctx1) {
  60450. var $1,$2,$4,$5,$3;
  60451. $1=(0).__at((0));
  60452. $ctx1.sendIdx["@"]=1;
  60453. $2=(4).__at((4));
  60454. $ctx1.sendIdx["@"]=2;
  60455. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60456. $4=rect;
  60457. $5=(1).__at((2));
  60458. $ctx1.sendIdx["@"]=3;
  60459. $3=$recv($4)._containsPoint_($5);
  60460. $ctx1.sendIdx["containsPoint:"]=1;
  60461. $self._assert_($3);
  60462. $ctx1.sendIdx["assert:"]=1;
  60463. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60464. return self;
  60465. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60466. },
  60467. args: [],
  60468. source: "testContainsPoint\x0a\x09| rect |\x0a\x09rect := Rectangle origin: 0@0 corner: 4@4.\x0a\x09\x0a\x09self assert: (rect containsPoint: 1@2).\x0a\x09self assert: (rect containsPoint: 5@4) not.",
  60469. referencedClasses: ["Rectangle"],
  60470. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60471. }),
  60472. $globals.RectangleTest);
  60473. $core.addMethod(
  60474. $core.method({
  60475. selector: "testContainsRect",
  60476. protocol: "tests",
  60477. fn: function (){
  60478. var self=this,$self=this;
  60479. return $core.withContext(function($ctx1) {
  60480. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60481. $3=(0).__at((0));
  60482. $ctx1.sendIdx["@"]=1;
  60483. $4=(6).__at((6));
  60484. $ctx1.sendIdx["@"]=2;
  60485. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60486. $ctx1.sendIdx["origin:corner:"]=1;
  60487. $6=(1).__at((1));
  60488. $ctx1.sendIdx["@"]=3;
  60489. $7=(5).__at((5));
  60490. $ctx1.sendIdx["@"]=4;
  60491. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60492. $ctx1.sendIdx["origin:corner:"]=2;
  60493. $1=$recv($2)._containsRect_($5);
  60494. $ctx1.sendIdx["containsRect:"]=1;
  60495. $self._assert_($1);
  60496. $ctx1.sendIdx["assert:"]=1;
  60497. $11=(0).__at((0));
  60498. $ctx1.sendIdx["@"]=5;
  60499. $12=(6).__at((6));
  60500. $ctx1.sendIdx["@"]=6;
  60501. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60502. $ctx1.sendIdx["origin:corner:"]=3;
  60503. $14=(1).__at((-1));
  60504. $ctx1.sendIdx["@"]=7;
  60505. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60506. $9=$recv($10)._containsRect_($13);
  60507. $8=$recv($9)._not();
  60508. $self._assert_($8);
  60509. return self;
  60510. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60511. },
  60512. args: [],
  60513. source: "testContainsRect\x0a\x09self assert: ((Rectangle origin: 0@0 corner: 6@6) containsRect: (Rectangle origin: 1@1 corner: 5@5)).\x0a\x09self assert: ((Rectangle origin: 0@0 corner: 6@6) containsRect: (Rectangle origin: 1@(-1) corner: 5@5)) not.",
  60514. referencedClasses: ["Rectangle"],
  60515. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60516. }),
  60517. $globals.RectangleTest);
  60518. $core.addMethod(
  60519. $core.method({
  60520. selector: "testOriginExtent",
  60521. protocol: "tests",
  60522. fn: function (){
  60523. var self=this,$self=this;
  60524. var rectangle;
  60525. return $core.withContext(function($ctx1) {
  60526. var $1,$2,$3,$4;
  60527. $1=(3).__at((4));
  60528. $ctx1.sendIdx["@"]=1;
  60529. $2=(7).__at((8));
  60530. $ctx1.sendIdx["@"]=2;
  60531. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60532. $3=$recv(rectangle)._origin();
  60533. $4=(3).__at((4));
  60534. $ctx1.sendIdx["@"]=3;
  60535. $self._assert_equals_($3,$4);
  60536. $ctx1.sendIdx["assert:equals:"]=1;
  60537. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60538. return self;
  60539. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60540. },
  60541. args: [],
  60542. source: "testOriginExtent\x0a\x09| rectangle |\x0a\x09rectangle := Rectangle origin: 3@4 extent: 7@8.\x0a\x09\x0a\x09self assert: rectangle origin equals: 3@4.\x0a\x09self assert: rectangle corner equals: 10@12.",
  60543. referencedClasses: ["Rectangle"],
  60544. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60545. }),
  60546. $globals.RectangleTest);
  60547. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60548. $core.addMethod(
  60549. $core.method({
  60550. selector: "collectionClass",
  60551. protocol: "accessing",
  60552. fn: function (){
  60553. var self=this,$self=this;
  60554. return $core.withContext(function($ctx1) {
  60555. return $recv($self._class())._collectionClass();
  60556. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60557. },
  60558. args: [],
  60559. source: "collectionClass\x0a\x09^ self class collectionClass",
  60560. referencedClasses: [],
  60561. messageSends: ["collectionClass", "class"]
  60562. }),
  60563. $globals.StreamTest);
  60564. $core.addMethod(
  60565. $core.method({
  60566. selector: "newCollection",
  60567. protocol: "accessing",
  60568. fn: function (){
  60569. var self=this,$self=this;
  60570. return $core.withContext(function($ctx1) {
  60571. return $recv($self._collectionClass())._new();
  60572. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60573. },
  60574. args: [],
  60575. source: "newCollection\x0a\x09^ self collectionClass new",
  60576. referencedClasses: [],
  60577. messageSends: ["new", "collectionClass"]
  60578. }),
  60579. $globals.StreamTest);
  60580. $core.addMethod(
  60581. $core.method({
  60582. selector: "newStream",
  60583. protocol: "accessing",
  60584. fn: function (){
  60585. var self=this,$self=this;
  60586. return $core.withContext(function($ctx1) {
  60587. return $recv($recv($self._collectionClass())._new())._stream();
  60588. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60589. },
  60590. args: [],
  60591. source: "newStream\x0a\x09^ self collectionClass new stream",
  60592. referencedClasses: [],
  60593. messageSends: ["stream", "new", "collectionClass"]
  60594. }),
  60595. $globals.StreamTest);
  60596. $core.addMethod(
  60597. $core.method({
  60598. selector: "testAtStartAtEnd",
  60599. protocol: "tests",
  60600. fn: function (){
  60601. var self=this,$self=this;
  60602. var stream;
  60603. return $core.withContext(function($ctx1) {
  60604. var $1,$2,$3,$4;
  60605. stream=$self._newStream();
  60606. $1=$recv(stream)._atStart();
  60607. $ctx1.sendIdx["atStart"]=1;
  60608. $self._assert_($1);
  60609. $ctx1.sendIdx["assert:"]=1;
  60610. $2=$recv(stream)._atEnd();
  60611. $ctx1.sendIdx["atEnd"]=1;
  60612. $self._assert_($2);
  60613. $ctx1.sendIdx["assert:"]=2;
  60614. $recv(stream)._nextPutAll_($self._newCollection());
  60615. $3=$recv(stream)._atEnd();
  60616. $ctx1.sendIdx["atEnd"]=2;
  60617. $self._assert_($3);
  60618. $4=$recv(stream)._atStart();
  60619. $ctx1.sendIdx["atStart"]=2;
  60620. $self._deny_($4);
  60621. $ctx1.sendIdx["deny:"]=1;
  60622. $recv(stream)._position_((1));
  60623. $self._deny_($recv(stream)._atEnd());
  60624. $ctx1.sendIdx["deny:"]=2;
  60625. $self._deny_($recv(stream)._atStart());
  60626. return self;
  60627. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60628. },
  60629. args: [],
  60630. source: "testAtStartAtEnd\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream atStart.\x0a\x09self assert: stream atEnd.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self assert: stream atEnd.\x0a\x09self deny: stream atStart.\x0a\x09\x0a\x09stream position: 1.\x0a\x09self deny: stream atEnd.\x0a\x09self deny: stream atStart",
  60631. referencedClasses: [],
  60632. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60633. }),
  60634. $globals.StreamTest);
  60635. $core.addMethod(
  60636. $core.method({
  60637. selector: "testContents",
  60638. protocol: "tests",
  60639. fn: function (){
  60640. var self=this,$self=this;
  60641. var stream;
  60642. return $core.withContext(function($ctx1) {
  60643. var $1,$2;
  60644. stream=$self._newStream();
  60645. $1=stream;
  60646. $2=$self._newCollection();
  60647. $ctx1.sendIdx["newCollection"]=1;
  60648. $recv($1)._nextPutAll_($2);
  60649. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60650. return self;
  60651. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60652. },
  60653. args: [],
  60654. source: "testContents\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: self newCollection.\x0a\x09\x0a\x09self assert: stream contents equals: self newCollection",
  60655. referencedClasses: [],
  60656. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60657. }),
  60658. $globals.StreamTest);
  60659. $core.addMethod(
  60660. $core.method({
  60661. selector: "testIsEmpty",
  60662. protocol: "tests",
  60663. fn: function (){
  60664. var self=this,$self=this;
  60665. var stream;
  60666. return $core.withContext(function($ctx1) {
  60667. var $1;
  60668. stream=$self._newStream();
  60669. $1=$recv(stream)._isEmpty();
  60670. $ctx1.sendIdx["isEmpty"]=1;
  60671. $self._assert_($1);
  60672. $recv(stream)._nextPutAll_($self._newCollection());
  60673. $self._deny_($recv(stream)._isEmpty());
  60674. return self;
  60675. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60676. },
  60677. args: [],
  60678. source: "testIsEmpty\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream isEmpty.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self deny: stream isEmpty",
  60679. referencedClasses: [],
  60680. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60681. }),
  60682. $globals.StreamTest);
  60683. $core.addMethod(
  60684. $core.method({
  60685. selector: "testPosition",
  60686. protocol: "tests",
  60687. fn: function (){
  60688. var self=this,$self=this;
  60689. var collection,stream;
  60690. return $core.withContext(function($ctx1) {
  60691. var $1,$2,$3;
  60692. collection=$self._newCollection();
  60693. stream=$self._newStream();
  60694. $recv(stream)._nextPutAll_(collection);
  60695. $1=$recv(stream)._position();
  60696. $ctx1.sendIdx["position"]=1;
  60697. $self._assert_equals_($1,$recv(collection)._size());
  60698. $ctx1.sendIdx["assert:equals:"]=1;
  60699. $recv(stream)._position_((0));
  60700. $2=$recv(stream)._position();
  60701. $ctx1.sendIdx["position"]=2;
  60702. $self._assert_equals_($2,(0));
  60703. $ctx1.sendIdx["assert:equals:"]=2;
  60704. $recv(stream)._next();
  60705. $ctx1.sendIdx["next"]=1;
  60706. $3=$recv(stream)._position();
  60707. $ctx1.sendIdx["position"]=3;
  60708. $self._assert_equals_($3,(1));
  60709. $ctx1.sendIdx["assert:equals:"]=3;
  60710. $recv(stream)._next();
  60711. $self._assert_equals_($recv(stream)._position(),(2));
  60712. return self;
  60713. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60714. },
  60715. args: [],
  60716. source: "testPosition\x0a\x09| collection stream |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream position equals: collection size.\x0a\x09\x0a\x09stream position: 0.\x0a\x09self assert: stream position equals: 0.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 1.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 2",
  60717. referencedClasses: [],
  60718. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60719. }),
  60720. $globals.StreamTest);
  60721. $core.addMethod(
  60722. $core.method({
  60723. selector: "testReading",
  60724. protocol: "tests",
  60725. fn: function (){
  60726. var self=this,$self=this;
  60727. var stream,collection;
  60728. return $core.withContext(function($ctx1) {
  60729. var $1,$2;
  60730. collection=$self._newCollection();
  60731. stream=$self._newStream();
  60732. $1=stream;
  60733. $recv($1)._nextPutAll_(collection);
  60734. $recv($1)._position_((0));
  60735. $recv(collection)._do_((function(each){
  60736. return $core.withContext(function($ctx2) {
  60737. $2=$recv(stream)._next();
  60738. $ctx2.sendIdx["next"]=1;
  60739. return $self._assert_equals_($2,each);
  60740. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60741. }));
  60742. $self._assert_($recv($recv(stream)._next())._isNil());
  60743. return self;
  60744. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60745. },
  60746. args: [],
  60747. source: "testReading\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream \x0a\x09\x09nextPutAll: collection;\x0a\x09\x09position: 0.\x0a\x09\x0a\x09collection do: [ :each |\x0a\x09\x09self assert: stream next equals: each ].\x0a\x09\x09\x0a\x09self assert: stream next isNil",
  60748. referencedClasses: [],
  60749. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60750. }),
  60751. $globals.StreamTest);
  60752. $core.addMethod(
  60753. $core.method({
  60754. selector: "testStreamContents",
  60755. protocol: "tests",
  60756. fn: function (){
  60757. var self=this,$self=this;
  60758. return self;
  60759. },
  60760. args: [],
  60761. source: "testStreamContents",
  60762. referencedClasses: [],
  60763. messageSends: []
  60764. }),
  60765. $globals.StreamTest);
  60766. $core.addMethod(
  60767. $core.method({
  60768. selector: "testWrite",
  60769. protocol: "tests",
  60770. fn: function (){
  60771. var self=this,$self=this;
  60772. var stream,collection;
  60773. return $core.withContext(function($ctx1) {
  60774. collection=$self._newCollection();
  60775. stream=$self._newStream();
  60776. $recv(collection)._do_((function(each){
  60777. return $core.withContext(function($ctx2) {
  60778. return $recv(stream).__lt_lt(each);
  60779. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60780. }));
  60781. $self._assert_equals_($recv(stream)._contents(),collection);
  60782. return self;
  60783. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60784. },
  60785. args: [],
  60786. source: "testWrite\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream << each ].\x0a\x09self assert: stream contents equals: collection",
  60787. referencedClasses: [],
  60788. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60789. }),
  60790. $globals.StreamTest);
  60791. $core.addMethod(
  60792. $core.method({
  60793. selector: "testWriting",
  60794. protocol: "tests",
  60795. fn: function (){
  60796. var self=this,$self=this;
  60797. var stream,collection;
  60798. return $core.withContext(function($ctx1) {
  60799. var $1;
  60800. collection=$self._newCollection();
  60801. stream=$self._newStream();
  60802. $ctx1.sendIdx["newStream"]=1;
  60803. $recv(collection)._do_((function(each){
  60804. return $core.withContext(function($ctx2) {
  60805. return $recv(stream)._nextPut_(each);
  60806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60807. }));
  60808. $1=$recv(stream)._contents();
  60809. $ctx1.sendIdx["contents"]=1;
  60810. $self._assert_equals_($1,collection);
  60811. $ctx1.sendIdx["assert:equals:"]=1;
  60812. stream=$self._newStream();
  60813. $recv(stream)._nextPutAll_(collection);
  60814. $self._assert_equals_($recv(stream)._contents(),collection);
  60815. return self;
  60816. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60817. },
  60818. args: [],
  60819. source: "testWriting\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream nextPut: each ].\x0a\x09self assert: stream contents equals: collection.\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream contents equals: collection",
  60820. referencedClasses: [],
  60821. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60822. }),
  60823. $globals.StreamTest);
  60824. $core.addMethod(
  60825. $core.method({
  60826. selector: "collectionClass",
  60827. protocol: "accessing",
  60828. fn: function (){
  60829. var self=this,$self=this;
  60830. return nil;
  60831. },
  60832. args: [],
  60833. source: "collectionClass\x0a\x09^ nil",
  60834. referencedClasses: [],
  60835. messageSends: []
  60836. }),
  60837. $globals.StreamTest.a$cls);
  60838. $core.addMethod(
  60839. $core.method({
  60840. selector: "isAbstract",
  60841. protocol: "testing",
  60842. fn: function (){
  60843. var self=this,$self=this;
  60844. return $core.withContext(function($ctx1) {
  60845. return $recv($self._collectionClass())._isNil();
  60846. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  60847. },
  60848. args: [],
  60849. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  60850. referencedClasses: [],
  60851. messageSends: ["isNil", "collectionClass"]
  60852. }),
  60853. $globals.StreamTest.a$cls);
  60854. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60855. $core.addMethod(
  60856. $core.method({
  60857. selector: "newCollection",
  60858. protocol: "accessing",
  60859. fn: function (){
  60860. var self=this,$self=this;
  60861. return $core.withContext(function($ctx1) {
  60862. return [true,(1),(3).__at((4)),"foo"];
  60863. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  60864. },
  60865. args: [],
  60866. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  60867. referencedClasses: [],
  60868. messageSends: ["@"]
  60869. }),
  60870. $globals.ArrayStreamTest);
  60871. $core.addMethod(
  60872. $core.method({
  60873. selector: "collectionClass",
  60874. protocol: "accessing",
  60875. fn: function (){
  60876. var self=this,$self=this;
  60877. return $globals.Array;
  60878. },
  60879. args: [],
  60880. source: "collectionClass\x0a\x09^ Array",
  60881. referencedClasses: ["Array"],
  60882. messageSends: []
  60883. }),
  60884. $globals.ArrayStreamTest.a$cls);
  60885. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60886. $core.addMethod(
  60887. $core.method({
  60888. selector: "newCollection",
  60889. protocol: "accessing",
  60890. fn: function (){
  60891. var self=this,$self=this;
  60892. return "hello world";
  60893. },
  60894. args: [],
  60895. source: "newCollection\x0a\x09^ 'hello world'",
  60896. referencedClasses: [],
  60897. messageSends: []
  60898. }),
  60899. $globals.StringStreamTest);
  60900. $core.addMethod(
  60901. $core.method({
  60902. selector: "collectionClass",
  60903. protocol: "accessing",
  60904. fn: function (){
  60905. var self=this,$self=this;
  60906. return $globals.String;
  60907. },
  60908. args: [],
  60909. source: "collectionClass\x0a\x09^ String",
  60910. referencedClasses: ["String"],
  60911. messageSends: []
  60912. }),
  60913. $globals.StringStreamTest.a$cls);
  60914. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  60915. $core.addMethod(
  60916. $core.method({
  60917. selector: "testCopying",
  60918. protocol: "tests",
  60919. fn: function (){
  60920. var self=this,$self=this;
  60921. return $core.withContext(function($ctx1) {
  60922. $self._assert_equals_(nil._copy(),nil);
  60923. return self;
  60924. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  60925. },
  60926. args: [],
  60927. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  60928. referencedClasses: [],
  60929. messageSends: ["assert:equals:", "copy"]
  60930. }),
  60931. $globals.UndefinedTest);
  60932. $core.addMethod(
  60933. $core.method({
  60934. selector: "testDeepCopy",
  60935. protocol: "tests",
  60936. fn: function (){
  60937. var self=this,$self=this;
  60938. return $core.withContext(function($ctx1) {
  60939. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  60940. return self;
  60941. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  60942. },
  60943. args: [],
  60944. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  60945. referencedClasses: [],
  60946. messageSends: ["assert:", "=", "deepCopy"]
  60947. }),
  60948. $globals.UndefinedTest);
  60949. $core.addMethod(
  60950. $core.method({
  60951. selector: "testIfNil",
  60952. protocol: "tests",
  60953. fn: function (){
  60954. var self=this,$self=this;
  60955. return $core.withContext(function($ctx1) {
  60956. var $1,$3,$2,$4,$6,$5,$receiver;
  60957. if(($receiver = nil) == null || $receiver.a$nil){
  60958. $1=true;
  60959. } else {
  60960. $1=nil;
  60961. }
  60962. $self._assert_equals_($1,true);
  60963. $ctx1.sendIdx["assert:equals:"]=1;
  60964. if(($receiver = nil) == null || $receiver.a$nil){
  60965. $3=nil;
  60966. } else {
  60967. $3=true;
  60968. }
  60969. $2=$recv($3).__eq(true);
  60970. $ctx1.sendIdx["="]=1;
  60971. $self._deny_($2);
  60972. $ctx1.sendIdx["deny:"]=1;
  60973. if(($receiver = nil) == null || $receiver.a$nil){
  60974. $4=true;
  60975. } else {
  60976. $4=false;
  60977. }
  60978. $self._assert_equals_($4,true);
  60979. if(($receiver = nil) == null || $receiver.a$nil){
  60980. $6=false;
  60981. } else {
  60982. $6=true;
  60983. }
  60984. $5=$recv($6).__eq(true);
  60985. $self._deny_($5);
  60986. return self;
  60987. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  60988. },
  60989. args: [],
  60990. source: "testIfNil\x0a\x09self assert: (nil ifNil: [ true ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ]) = true.\x0a\x09self assert: (nil ifNil: [ true ] ifNotNil: [ false ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ] ifNil: [ false ]) = true",
  60991. referencedClasses: [],
  60992. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  60993. }),
  60994. $globals.UndefinedTest);
  60995. $core.addMethod(
  60996. $core.method({
  60997. selector: "testIsNil",
  60998. protocol: "tests",
  60999. fn: function (){
  61000. var self=this,$self=this;
  61001. return $core.withContext(function($ctx1) {
  61002. $self._assert_(nil._isNil());
  61003. $self._deny_(nil._notNil());
  61004. return self;
  61005. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  61006. },
  61007. args: [],
  61008. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61009. referencedClasses: [],
  61010. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61011. }),
  61012. $globals.UndefinedTest);
  61013. });
  61014. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61015. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61016. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61017. $core.addPackage("Platform-DOM-Tests");
  61018. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  61019. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61020. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  61021. $core.addMethod(
  61022. $core.method({
  61023. selector: "testEntityConversion",
  61024. protocol: "testing",
  61025. fn: function (){
  61026. var self=this,$self=this;
  61027. return $core.withContext(function($ctx1) {
  61028. var $1;
  61029. $1=$recv($globals.PlatformDom)._isFeasible();
  61030. if($core.assert($1)){
  61031. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  61032. }
  61033. return self;
  61034. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  61035. },
  61036. args: [],
  61037. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  61038. referencedClasses: ["PlatformDom"],
  61039. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  61040. }),
  61041. $globals.PlatformDomTest);
  61042. $core.addMethod(
  61043. $core.method({
  61044. selector: "testTextContentDoesNotRunScript",
  61045. protocol: "testing",
  61046. fn: function (){
  61047. var self=this,$self=this;
  61048. return $core.withContext(function($ctx1) {
  61049. var $1;
  61050. $1=$recv($globals.PlatformDom)._isFeasible();
  61051. if($core.assert($1)){
  61052. $self._shouldnt_raise_((function(){
  61053. return $core.withContext(function($ctx2) {
  61054. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  61055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61056. }),$globals.Error);
  61057. }
  61058. return self;
  61059. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  61060. },
  61061. args: [],
  61062. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  61063. referencedClasses: ["PlatformDom", "Error"],
  61064. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  61065. }),
  61066. $globals.PlatformDomTest);
  61067. });
  61068. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61069. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61070. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61071. $core.addPackage("SUnit-Tests");
  61072. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  61073. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61074. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  61075. $globals.ExampleSetTest.comment="ExampleSetTest is taken from Pharo 1.4.\x0a\x0aTHe purpose of this class is to demonstrate a simple use case of the test framework.";
  61076. $core.addMethod(
  61077. $core.method({
  61078. selector: "setUp",
  61079. protocol: "running",
  61080. fn: function (){
  61081. var self=this,$self=this;
  61082. return $core.withContext(function($ctx1) {
  61083. $self["@empty"]=$recv($globals.Set)._new();
  61084. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  61085. return self;
  61086. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  61087. },
  61088. args: [],
  61089. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  61090. referencedClasses: ["Set"],
  61091. messageSends: ["new", "with:with:"]
  61092. }),
  61093. $globals.ExampleSetTest);
  61094. $core.addMethod(
  61095. $core.method({
  61096. selector: "testAdd",
  61097. protocol: "tests",
  61098. fn: function (){
  61099. var self=this,$self=this;
  61100. return $core.withContext(function($ctx1) {
  61101. $recv($self["@empty"])._add_((5));
  61102. $self._assert_($recv($self["@empty"])._includes_((5)));
  61103. return self;
  61104. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  61105. },
  61106. args: [],
  61107. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  61108. referencedClasses: [],
  61109. messageSends: ["add:", "assert:", "includes:"]
  61110. }),
  61111. $globals.ExampleSetTest);
  61112. $core.addMethod(
  61113. $core.method({
  61114. selector: "testGrow",
  61115. protocol: "tests",
  61116. fn: function (){
  61117. var self=this,$self=this;
  61118. return $core.withContext(function($ctx1) {
  61119. $recv($self["@empty"])._addAll_((1)._to_((100)));
  61120. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  61121. return self;
  61122. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  61123. },
  61124. args: [],
  61125. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  61126. referencedClasses: [],
  61127. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  61128. }),
  61129. $globals.ExampleSetTest);
  61130. $core.addMethod(
  61131. $core.method({
  61132. selector: "testIllegal",
  61133. protocol: "tests",
  61134. fn: function (){
  61135. var self=this,$self=this;
  61136. return $core.withContext(function($ctx1) {
  61137. $self._should_raise_((function(){
  61138. return $core.withContext(function($ctx2) {
  61139. return $recv($self["@empty"])._at_((5));
  61140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61141. }),$globals.Error);
  61142. $ctx1.sendIdx["should:raise:"]=1;
  61143. $self._should_raise_((function(){
  61144. return $core.withContext(function($ctx2) {
  61145. return $recv($self["@empty"])._at_put_((5),"abc");
  61146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61147. }),$globals.Error);
  61148. return self;
  61149. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  61150. },
  61151. args: [],
  61152. source: "testIllegal\x0a\x09self\x0a\x09\x09should: [ empty at: 5 ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ empty at: 5 put: #abc ]\x0a\x09\x09raise: Error",
  61153. referencedClasses: ["Error"],
  61154. messageSends: ["should:raise:", "at:", "at:put:"]
  61155. }),
  61156. $globals.ExampleSetTest);
  61157. $core.addMethod(
  61158. $core.method({
  61159. selector: "testIncludes",
  61160. protocol: "tests",
  61161. fn: function (){
  61162. var self=this,$self=this;
  61163. return $core.withContext(function($ctx1) {
  61164. var $1;
  61165. $1=$recv($self["@full"])._includes_((5));
  61166. $ctx1.sendIdx["includes:"]=1;
  61167. $self._assert_($1);
  61168. $ctx1.sendIdx["assert:"]=1;
  61169. $self._assert_($recv($self["@full"])._includes_("abc"));
  61170. return self;
  61171. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  61172. },
  61173. args: [],
  61174. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  61175. referencedClasses: [],
  61176. messageSends: ["assert:", "includes:"]
  61177. }),
  61178. $globals.ExampleSetTest);
  61179. $core.addMethod(
  61180. $core.method({
  61181. selector: "testOccurrences",
  61182. protocol: "tests",
  61183. fn: function (){
  61184. var self=this,$self=this;
  61185. return $core.withContext(function($ctx1) {
  61186. var $1,$2;
  61187. $1=$recv($self["@empty"])._occurrencesOf_((0));
  61188. $ctx1.sendIdx["occurrencesOf:"]=1;
  61189. $self._assert_equals_($1,(0));
  61190. $ctx1.sendIdx["assert:equals:"]=1;
  61191. $2=$recv($self["@full"])._occurrencesOf_((5));
  61192. $ctx1.sendIdx["occurrencesOf:"]=2;
  61193. $self._assert_equals_($2,(1));
  61194. $ctx1.sendIdx["assert:equals:"]=2;
  61195. $recv($self["@full"])._add_((5));
  61196. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  61197. return self;
  61198. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61199. },
  61200. args: [],
  61201. source: "testOccurrences\x0a\x09self assert: (empty occurrencesOf: 0) equals: 0.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1.\x0a\x09full add: 5.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1",
  61202. referencedClasses: [],
  61203. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61204. }),
  61205. $globals.ExampleSetTest);
  61206. $core.addMethod(
  61207. $core.method({
  61208. selector: "testRemove",
  61209. protocol: "tests",
  61210. fn: function (){
  61211. var self=this,$self=this;
  61212. return $core.withContext(function($ctx1) {
  61213. var $1;
  61214. $recv($self["@full"])._remove_((5));
  61215. $1=$recv($self["@full"])._includes_("abc");
  61216. $ctx1.sendIdx["includes:"]=1;
  61217. $self._assert_($1);
  61218. $self._deny_($recv($self["@full"])._includes_((5)));
  61219. return self;
  61220. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61221. },
  61222. args: [],
  61223. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61224. referencedClasses: [],
  61225. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61226. }),
  61227. $globals.ExampleSetTest);
  61228. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61229. $core.addMethod(
  61230. $core.method({
  61231. selector: "fakeError",
  61232. protocol: "helpers",
  61233. fn: function (){
  61234. var self=this,$self=this;
  61235. return $core.withContext(function($ctx1) {
  61236. $self["@flag"]="bad";
  61237. $self._timeout_((30));
  61238. $self["@flag"]=$recv($self._async_((function(){
  61239. return $core.withContext(function($ctx2) {
  61240. $self["@flag"]="ok";
  61241. return $self._error_("Intentional");
  61242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61243. })))._valueWithTimeout_((20));
  61244. return self;
  61245. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61246. },
  61247. args: [],
  61248. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61249. referencedClasses: [],
  61250. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61251. }),
  61252. $globals.SUnitAsyncTest);
  61253. $core.addMethod(
  61254. $core.method({
  61255. selector: "fakeErrorFailingInTearDown",
  61256. protocol: "helpers",
  61257. fn: function (){
  61258. var self=this,$self=this;
  61259. return $core.withContext(function($ctx1) {
  61260. $self["@flag"]="bad";
  61261. $self._timeout_((30));
  61262. $self["@flag"]=$recv($self._async_((function(){
  61263. return $core.withContext(function($ctx2) {
  61264. return $self._error_("Intentional");
  61265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61266. })))._valueWithTimeout_((20));
  61267. return self;
  61268. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61269. },
  61270. args: [],
  61271. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61272. referencedClasses: [],
  61273. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61274. }),
  61275. $globals.SUnitAsyncTest);
  61276. $core.addMethod(
  61277. $core.method({
  61278. selector: "fakeFailure",
  61279. protocol: "helpers",
  61280. fn: function (){
  61281. var self=this,$self=this;
  61282. return $core.withContext(function($ctx1) {
  61283. $self["@flag"]="bad";
  61284. $self._timeout_((30));
  61285. $self["@flag"]=$recv($self._async_((function(){
  61286. return $core.withContext(function($ctx2) {
  61287. $self["@flag"]="ok";
  61288. return $self._assert_(false);
  61289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61290. })))._valueWithTimeout_((20));
  61291. return self;
  61292. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61293. },
  61294. args: [],
  61295. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61296. referencedClasses: [],
  61297. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61298. }),
  61299. $globals.SUnitAsyncTest);
  61300. $core.addMethod(
  61301. $core.method({
  61302. selector: "fakeMultipleTimeoutFailing",
  61303. protocol: "helpers",
  61304. fn: function (){
  61305. var self=this,$self=this;
  61306. return $core.withContext(function($ctx1) {
  61307. var $1;
  61308. $self._timeout_((100));
  61309. $ctx1.sendIdx["timeout:"]=1;
  61310. $1=$self._async_((function(){
  61311. return $core.withContext(function($ctx2) {
  61312. $self._timeout_((20));
  61313. return $recv($self._async_((function(){
  61314. return $core.withContext(function($ctx3) {
  61315. return $self._finished();
  61316. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61317. })))._valueWithTimeout_((30));
  61318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61319. }));
  61320. $ctx1.sendIdx["async:"]=1;
  61321. $recv($1)._valueWithTimeout_((20));
  61322. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61323. return self;
  61324. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61325. },
  61326. args: [],
  61327. source: "fakeMultipleTimeoutFailing\x0a\x09self timeout: 100.\x0a\x09(self async: [ \x0a\x09\x09self timeout: 20.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 30\x0a\x09]) valueWithTimeout: 20",
  61328. referencedClasses: [],
  61329. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61330. }),
  61331. $globals.SUnitAsyncTest);
  61332. $core.addMethod(
  61333. $core.method({
  61334. selector: "fakeMultipleTimeoutPassing",
  61335. protocol: "helpers",
  61336. fn: function (){
  61337. var self=this,$self=this;
  61338. return $core.withContext(function($ctx1) {
  61339. var $1;
  61340. $self._timeout_((20));
  61341. $ctx1.sendIdx["timeout:"]=1;
  61342. $1=$self._async_((function(){
  61343. return $core.withContext(function($ctx2) {
  61344. $self._timeout_((40));
  61345. return $recv($self._async_((function(){
  61346. return $core.withContext(function($ctx3) {
  61347. return $self._finished();
  61348. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61349. })))._valueWithTimeout_((20));
  61350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61351. }));
  61352. $ctx1.sendIdx["async:"]=1;
  61353. $recv($1)._valueWithTimeout_((10));
  61354. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61355. return self;
  61356. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61357. },
  61358. args: [],
  61359. source: "fakeMultipleTimeoutPassing\x0a\x09self timeout: 20.\x0a\x09(self async: [\x0a\x09\x09self timeout: 40.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 20\x0a\x09]) valueWithTimeout: 10",
  61360. referencedClasses: [],
  61361. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61362. }),
  61363. $globals.SUnitAsyncTest);
  61364. $core.addMethod(
  61365. $core.method({
  61366. selector: "fakeTimeout",
  61367. protocol: "helpers",
  61368. fn: function (){
  61369. var self=this,$self=this;
  61370. return $core.withContext(function($ctx1) {
  61371. $self._timeout_((10));
  61372. $recv($self._async_((function(){
  61373. return $core.withContext(function($ctx2) {
  61374. return $self._finished();
  61375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61376. })))._valueWithTimeout_((20));
  61377. return self;
  61378. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61379. },
  61380. args: [],
  61381. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61382. referencedClasses: [],
  61383. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61384. }),
  61385. $globals.SUnitAsyncTest);
  61386. $core.addMethod(
  61387. $core.method({
  61388. selector: "selectorSetOf:",
  61389. protocol: "private",
  61390. fn: function (aCollection){
  61391. var self=this,$self=this;
  61392. return $core.withContext(function($ctx1) {
  61393. return $recv($recv(aCollection)._collect_((function(each){
  61394. return $core.withContext(function($ctx2) {
  61395. return $recv(each)._selector();
  61396. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61397. })))._asSet();
  61398. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61399. },
  61400. args: ["aCollection"],
  61401. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61402. referencedClasses: [],
  61403. messageSends: ["asSet", "collect:", "selector"]
  61404. }),
  61405. $globals.SUnitAsyncTest);
  61406. $core.addMethod(
  61407. $core.method({
  61408. selector: "setUp",
  61409. protocol: "running",
  61410. fn: function (){
  61411. var self=this,$self=this;
  61412. $self["@flag"]="ok";
  61413. return self;
  61414. },
  61415. args: [],
  61416. source: "setUp\x0a\x09flag := 'ok'",
  61417. referencedClasses: [],
  61418. messageSends: []
  61419. }),
  61420. $globals.SUnitAsyncTest);
  61421. $core.addMethod(
  61422. $core.method({
  61423. selector: "tearDown",
  61424. protocol: "running",
  61425. fn: function (){
  61426. var self=this,$self=this;
  61427. return $core.withContext(function($ctx1) {
  61428. $self._assert_equals_("ok",$self["@flag"]);
  61429. return self;
  61430. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61431. },
  61432. args: [],
  61433. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61434. referencedClasses: [],
  61435. messageSends: ["assert:equals:"]
  61436. }),
  61437. $globals.SUnitAsyncTest);
  61438. $core.addMethod(
  61439. $core.method({
  61440. selector: "testAsyncErrorsAndFailures",
  61441. protocol: "tests",
  61442. fn: function (){
  61443. var self=this,$self=this;
  61444. var suite,runner,result,assertBlock;
  61445. return $core.withContext(function($ctx1) {
  61446. var $1,$2,$3,$4;
  61447. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61448. return $core.withContext(function($ctx2) {
  61449. return $recv($self._class())._selector_(each);
  61450. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61451. }));
  61452. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61453. $self._timeout_((200));
  61454. result=$recv(runner)._result();
  61455. $ctx1.sendIdx["result"]=1;
  61456. assertBlock=$self._async_((function(){
  61457. return $core.withContext(function($ctx2) {
  61458. $1=$self._selectorSetOf_($recv(result)._errors());
  61459. $ctx2.sendIdx["selectorSetOf:"]=1;
  61460. $2=["fakeError"]._asSet();
  61461. $ctx2.sendIdx["asSet"]=1;
  61462. $self._assert_equals_($1,$2);
  61463. $ctx2.sendIdx["assert:equals:"]=1;
  61464. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61465. return $self._finished();
  61466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61467. }));
  61468. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61469. return $core.withContext(function($ctx2) {
  61470. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61471. if($core.assert($3)){
  61472. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61473. return $recv($4)._ifTrue_(assertBlock);
  61474. }
  61475. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61476. }));
  61477. $recv(runner)._run();
  61478. return self;
  61479. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61480. },
  61481. args: [],
  61482. source: "testAsyncErrorsAndFailures\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: #('fakeError') asSet.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeErrorFailingInTearDown' 'fakeFailure') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  61483. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61484. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61485. }),
  61486. $globals.SUnitAsyncTest);
  61487. $core.addMethod(
  61488. $core.method({
  61489. selector: "testAsyncNeedsTimeout",
  61490. protocol: "tests",
  61491. fn: function (){
  61492. var self=this,$self=this;
  61493. return $core.withContext(function($ctx1) {
  61494. $self._should_raise_((function(){
  61495. return $core.withContext(function($ctx2) {
  61496. return $self._async_((function(){
  61497. }));
  61498. $ctx2.sendIdx["async:"]=1;
  61499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61500. }),$globals.Error);
  61501. $self._timeout_((0));
  61502. $self._shouldnt_raise_((function(){
  61503. return $core.withContext(function($ctx2) {
  61504. return $self._async_((function(){
  61505. }));
  61506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61507. }),$globals.Error);
  61508. $self._finished();
  61509. return self;
  61510. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61511. },
  61512. args: [],
  61513. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61514. referencedClasses: ["Error"],
  61515. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61516. }),
  61517. $globals.SUnitAsyncTest);
  61518. $core.addMethod(
  61519. $core.method({
  61520. selector: "testFinishedNeedsTimeout",
  61521. protocol: "tests",
  61522. fn: function (){
  61523. var self=this,$self=this;
  61524. return $core.withContext(function($ctx1) {
  61525. $self._should_raise_((function(){
  61526. return $core.withContext(function($ctx2) {
  61527. return $self._finished();
  61528. $ctx2.sendIdx["finished"]=1;
  61529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61530. }),$globals.Error);
  61531. $self._timeout_((0));
  61532. $self._shouldnt_raise_((function(){
  61533. return $core.withContext(function($ctx2) {
  61534. return $self._finished();
  61535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61536. }),$globals.Error);
  61537. return self;
  61538. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61539. },
  61540. args: [],
  61541. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61542. referencedClasses: ["Error"],
  61543. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61544. }),
  61545. $globals.SUnitAsyncTest);
  61546. $core.addMethod(
  61547. $core.method({
  61548. selector: "testIsAsyncReturnsCorrectValues",
  61549. protocol: "tests",
  61550. fn: function (){
  61551. var self=this,$self=this;
  61552. return $core.withContext(function($ctx1) {
  61553. var $1,$2;
  61554. $1=$self._isAsync();
  61555. $ctx1.sendIdx["isAsync"]=1;
  61556. $self._deny_($1);
  61557. $ctx1.sendIdx["deny:"]=1;
  61558. $self._timeout_((0));
  61559. $2=$self._isAsync();
  61560. $ctx1.sendIdx["isAsync"]=2;
  61561. $self._assert_($2);
  61562. $self._finished();
  61563. $self._deny_($self._isAsync());
  61564. return self;
  61565. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61566. },
  61567. args: [],
  61568. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61569. referencedClasses: [],
  61570. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61571. }),
  61572. $globals.SUnitAsyncTest);
  61573. $core.addMethod(
  61574. $core.method({
  61575. selector: "testPass",
  61576. protocol: "tests",
  61577. fn: function (){
  61578. var self=this,$self=this;
  61579. return $core.withContext(function($ctx1) {
  61580. $self["@flag"]="bad";
  61581. $self._timeout_((10));
  61582. $self["@flag"]=$recv($self._async_((function(){
  61583. return $core.withContext(function($ctx2) {
  61584. $self._assert_(true);
  61585. $self._finished();
  61586. $self["@flag"]="ok";
  61587. return $self["@flag"];
  61588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61589. })))._valueWithTimeout_((5));
  61590. return self;
  61591. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61592. },
  61593. args: [],
  61594. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61595. referencedClasses: [],
  61596. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61597. }),
  61598. $globals.SUnitAsyncTest);
  61599. $core.addMethod(
  61600. $core.method({
  61601. selector: "testTimeouts",
  61602. protocol: "tests",
  61603. fn: function (){
  61604. var self=this,$self=this;
  61605. var suite,runner,result,assertBlock;
  61606. return $core.withContext(function($ctx1) {
  61607. var $1,$2,$3;
  61608. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61609. return $core.withContext(function($ctx2) {
  61610. return $recv($self._class())._selector_(each);
  61611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61612. }));
  61613. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61614. $self._timeout_((200));
  61615. result=$recv(runner)._result();
  61616. $ctx1.sendIdx["result"]=1;
  61617. assertBlock=$self._async_((function(){
  61618. return $core.withContext(function($ctx2) {
  61619. $1=$self._selectorSetOf_($recv(result)._errors());
  61620. $ctx2.sendIdx["selectorSetOf:"]=1;
  61621. $self._assert_equals_($1,$recv($globals.Set)._new());
  61622. $ctx2.sendIdx["assert:equals:"]=1;
  61623. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61624. return $self._finished();
  61625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61626. }));
  61627. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61628. return $core.withContext(function($ctx2) {
  61629. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61630. if($core.assert($2)){
  61631. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61632. return $recv($3)._ifTrue_(assertBlock);
  61633. }
  61634. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61635. }));
  61636. $recv(runner)._run();
  61637. return self;
  61638. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61639. },
  61640. args: [],
  61641. source: "testTimeouts\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleTimeoutFailing' 'fakeMultipleTimeoutPassing' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: Set new.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeMultipleTimeoutFailing' 'fakeTimeout') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  61642. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61643. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61644. }),
  61645. $globals.SUnitAsyncTest);
  61646. $core.addMethod(
  61647. $core.method({
  61648. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61649. protocol: "tests",
  61650. fn: function (){
  61651. var self=this,$self=this;
  61652. var x;
  61653. return $core.withContext(function($ctx1) {
  61654. var $1;
  61655. $self["@flag"]="bad";
  61656. $self._timeout_((10));
  61657. x=(0);
  61658. $1=$self._async_((function(){
  61659. return $core.withContext(function($ctx2) {
  61660. $self._finished();
  61661. $ctx2.sendIdx["finished"]=1;
  61662. $self["@flag"]="ok";
  61663. x=$recv(x).__plus((1));
  61664. $ctx2.sendIdx["+"]=1;
  61665. return $self._assert_equals_(x,(1));
  61666. $ctx2.sendIdx["assert:equals:"]=1;
  61667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61668. }));
  61669. $ctx1.sendIdx["async:"]=1;
  61670. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61671. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61672. $self["@flag"]=$recv($self._async_((function(){
  61673. return $core.withContext(function($ctx2) {
  61674. $self._finished();
  61675. $self["@flag"]="ok";
  61676. x=$recv(x).__plus((1));
  61677. return $self._assert_equals_(x,(1));
  61678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61679. })))._valueWithTimeout_((0));
  61680. return self;
  61681. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61682. },
  61683. args: [],
  61684. source: "testTwoAsyncPassesWithFinishedOnlyOneIsRun\x0a\x09| x |\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09x := 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.",
  61685. referencedClasses: [],
  61686. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61687. }),
  61688. $globals.SUnitAsyncTest);
  61689. });
  61690. define('amber/devel',[
  61691. './lang',
  61692. './brikz', // pre-fetch, dep of ./boot
  61693. './kernel-checks', // pre-fetch, dep of ./boot
  61694. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61695. './kernel-language', // pre-fetch, dep of ./boot
  61696. './boot', // pre-fetch, class loader
  61697. './deploy', // pre-fetch, dep of ./lang
  61698. // --- packages of the development only Amber begin here ---
  61699. 'amber_core/Platform-DOM',
  61700. 'amber_core/SUnit',
  61701. 'amber_core/Compiler-Tests',
  61702. 'amber_core/Kernel-Tests',
  61703. 'amber_core/Platform-DOM-Tests',
  61704. 'amber_core/SUnit-Tests'
  61705. // --- packages of the development only Amber end here ---
  61706. ], function (amber) {
  61707. return amber;
  61708. });
  61709. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61710. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61711. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61712. $core.addPackage("Platform-Node");
  61713. ($core.packageDescriptors||$core.packages)["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  61714. ($core.packageDescriptors||$core.packages)["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61715. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61716. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61717. $core.addMethod(
  61718. $core.method({
  61719. selector: "globals",
  61720. protocol: "accessing",
  61721. fn: function (){
  61722. var self=this,$self=this;
  61723. return global;
  61724. },
  61725. args: [],
  61726. source: "globals\x0a\x09^ global",
  61727. referencedClasses: [],
  61728. messageSends: []
  61729. }),
  61730. $globals.NodePlatform);
  61731. $core.addMethod(
  61732. $core.method({
  61733. selector: "newXhr",
  61734. protocol: "accessing",
  61735. fn: function (){
  61736. var self=this,$self=this;
  61737. return $core.withContext(function($ctx1) {
  61738. var $receiver;
  61739. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61740. $self._error_("XMLHttpRequest not available.");
  61741. } else {
  61742. return $recv($globals.XMLHttpRequest)._new();
  61743. }
  61744. return self;
  61745. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61746. },
  61747. args: [],
  61748. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61749. referencedClasses: ["XMLHttpRequest"],
  61750. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61751. }),
  61752. $globals.NodePlatform);
  61753. $core.addMethod(
  61754. $core.method({
  61755. selector: "initialize",
  61756. protocol: "testing",
  61757. fn: function (){
  61758. var self=this,$self=this;
  61759. return $core.withContext(function($ctx1) {
  61760. var $1;
  61761. $1=$self._isFeasible();
  61762. if($core.assert($1)){
  61763. $recv($globals.Platform)._registerIfNone_($self._new());
  61764. }
  61765. return self;
  61766. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61767. },
  61768. args: [],
  61769. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61770. referencedClasses: ["Platform"],
  61771. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61772. }),
  61773. $globals.NodePlatform.a$cls);
  61774. $core.addMethod(
  61775. $core.method({
  61776. selector: "isFeasible",
  61777. protocol: "testing",
  61778. fn: function (){
  61779. var self=this,$self=this;
  61780. return $core.withContext(function($ctx1) {
  61781. return typeof global !== "undefined";
  61782. return self;
  61783. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61784. },
  61785. args: [],
  61786. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61787. referencedClasses: [],
  61788. messageSends: []
  61789. }),
  61790. $globals.NodePlatform.a$cls);
  61791. });
  61792. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61793. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61794. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61795. $core.addPackage("AmberCli");
  61796. ($core.packageDescriptors||$core.packages)["AmberCli"].innerEval = function (expr) { return eval(expr); };
  61797. ($core.packageDescriptors||$core.packages)["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  61798. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61799. $globals.AmberCli.comment="I am the Amber CLI (CommandLine Interface) tool which runs on Node.js.\x0a\x0aMy responsibility is to start different Amber programs like the FileServer or the Repl.\x0aWhich program to start is determined by the first commandline parameters passed to the AmberCli executable.\x0aUse `help` to get a list of all available options.\x0aAny further commandline parameters are passed to the specific program.\x0a\x0a## Commands\x0a\x0aNew commands can be added by creating a class side method in the `commands` protocol which takes one parameter.\x0aThis parameter is an array of all commandline options + values passed on to the program.\x0aAny `camelCaseCommand` is transformed into a commandline parameter of the form `camel-case-command` and vice versa.";
  61800. $core.addMethod(
  61801. $core.method({
  61802. selector: "commandLineSwitches",
  61803. protocol: "commandline",
  61804. fn: function (){
  61805. var self=this,$self=this;
  61806. var switches;
  61807. return $core.withContext(function($ctx1) {
  61808. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61809. return $core.withContext(function($ctx2) {
  61810. return $recv(each)._selector();
  61811. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61812. }));
  61813. $ctx1.sendIdx["collect:"]=1;
  61814. switches=$recv(switches)._select_((function(each){
  61815. return $core.withContext(function($ctx2) {
  61816. return $recv(each)._match_("^[^:]*:$");
  61817. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61818. }));
  61819. switches=$recv(switches)._collect_((function(each){
  61820. return $core.withContext(function($ctx2) {
  61821. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61823. }));
  61824. return switches;
  61825. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61826. },
  61827. args: [],
  61828. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'commands' protocol of the class\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self class methodsInProtocol: 'commands') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase].\x0a\x09^ switches",
  61829. referencedClasses: [],
  61830. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61831. }),
  61832. $globals.AmberCli.a$cls);
  61833. $core.addMethod(
  61834. $core.method({
  61835. selector: "config:",
  61836. protocol: "commands",
  61837. fn: function (args){
  61838. var self=this,$self=this;
  61839. return $core.withContext(function($ctx1) {
  61840. $recv($recv($globals.Configurator)._new())._start();
  61841. return self;
  61842. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  61843. },
  61844. args: ["args"],
  61845. source: "config: args\x0a\x09Configurator new start",
  61846. referencedClasses: ["Configurator"],
  61847. messageSends: ["start", "new"]
  61848. }),
  61849. $globals.AmberCli.a$cls);
  61850. $core.addMethod(
  61851. $core.method({
  61852. selector: "handleArguments:",
  61853. protocol: "commandline",
  61854. fn: function (args){
  61855. var self=this,$self=this;
  61856. var selector;
  61857. return $core.withContext(function($ctx1) {
  61858. var $1;
  61859. $1=$recv(args)._first();
  61860. $ctx1.sendIdx["first"]=1;
  61861. selector=$self._selectorForCommandLineSwitch_($1);
  61862. $recv(args)._remove_($recv(args)._first());
  61863. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  61864. return self;
  61865. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  61866. },
  61867. args: ["args"],
  61868. source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)",
  61869. referencedClasses: ["Array"],
  61870. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  61871. }),
  61872. $globals.AmberCli.a$cls);
  61873. $core.addMethod(
  61874. $core.method({
  61875. selector: "help:",
  61876. protocol: "commands",
  61877. fn: function (args){
  61878. var self=this,$self=this;
  61879. return $core.withContext(function($ctx1) {
  61880. $recv($globals.Transcript)._show_("Available commands");
  61881. $recv($self._commandLineSwitches())._do_((function(each){
  61882. return $core.withContext(function($ctx2) {
  61883. return $recv(console)._log_(each);
  61884. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61885. }));
  61886. return self;
  61887. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  61888. },
  61889. args: ["args"],
  61890. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  61891. referencedClasses: ["Transcript"],
  61892. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  61893. }),
  61894. $globals.AmberCli.a$cls);
  61895. $core.addMethod(
  61896. $core.method({
  61897. selector: "init:",
  61898. protocol: "commands",
  61899. fn: function (args){
  61900. var self=this,$self=this;
  61901. return $core.withContext(function($ctx1) {
  61902. $recv($recv($globals.Initer)._new())._start();
  61903. return self;
  61904. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  61905. },
  61906. args: ["args"],
  61907. source: "init: args\x0a\x09Initer new start",
  61908. referencedClasses: ["Initer"],
  61909. messageSends: ["start", "new"]
  61910. }),
  61911. $globals.AmberCli.a$cls);
  61912. $core.addMethod(
  61913. $core.method({
  61914. selector: "main",
  61915. protocol: "startup",
  61916. fn: function (){
  61917. var self=this,$self=this;
  61918. var args,packageJSON;
  61919. return $core.withContext(function($ctx1) {
  61920. var $7,$6,$5,$4,$3,$2,$1;
  61921. var $early={};
  61922. try {
  61923. packageJSON=$recv(require)._value_("../package.json");
  61924. $7=$recv(packageJSON)._version();
  61925. $ctx1.sendIdx["version"]=1;
  61926. $6="Welcome to Amber CLI version ".__comma($7);
  61927. $5=$recv($6).__comma(" (Amber ");
  61928. $ctx1.sendIdx[","]=5;
  61929. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  61930. $ctx1.sendIdx[","]=4;
  61931. $3=$recv($4).__comma(", NodeJS ");
  61932. $ctx1.sendIdx[","]=3;
  61933. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  61934. $ctx1.sendIdx[","]=2;
  61935. $1=$recv($2).__comma(").");
  61936. $ctx1.sendIdx[","]=1;
  61937. $recv($globals.Transcript)._show_($1);
  61938. args=$recv(process)._argv();
  61939. $recv(args)._removeFrom_to_((1),(2));
  61940. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  61941. return $core.withContext(function($ctx2) {
  61942. return $self._help_(nil);
  61943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61944. }),(function(){
  61945. return $core.withContext(function($ctx2) {
  61946. throw $early=[$self._handleArguments_(args)];
  61947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61948. }));
  61949. return self;
  61950. }
  61951. catch(e) {if(e===$early)return e[0]; throw e}
  61952. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  61953. },
  61954. args: [],
  61955. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args packageJSON |\x0a\x09\x0a\x09packageJSON := require value: '../package.json'.\x0a\x09Transcript show: 'Welcome to Amber CLI version ', packageJSON version, ' (Amber ', Smalltalk version, ', NodeJS ', process versions node, ').'.\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 2.\x0a\x09\x0a\x09args\x0a\x09\x09ifEmpty: [self help: nil]\x0a\x09\x09ifNotEmpty: [^self handleArguments: args]",
  61956. referencedClasses: ["Transcript", "Smalltalk"],
  61957. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  61958. }),
  61959. $globals.AmberCli.a$cls);
  61960. $core.addMethod(
  61961. $core.method({
  61962. selector: "repl:",
  61963. protocol: "commands",
  61964. fn: function (args){
  61965. var self=this,$self=this;
  61966. return $core.withContext(function($ctx1) {
  61967. return $recv($recv($globals.Repl)._new())._createInterface();
  61968. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  61969. },
  61970. args: ["args"],
  61971. source: "repl: args\x0a\x09^ Repl new createInterface",
  61972. referencedClasses: ["Repl"],
  61973. messageSends: ["createInterface", "new"]
  61974. }),
  61975. $globals.AmberCli.a$cls);
  61976. $core.addMethod(
  61977. $core.method({
  61978. selector: "selectorForCommandLineSwitch:",
  61979. protocol: "commandline",
  61980. fn: function (aSwitch){
  61981. var self=this,$self=this;
  61982. var command,selector;
  61983. return $core.withContext(function($ctx1) {
  61984. var $1;
  61985. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  61986. if($core.assert($1)){
  61987. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  61988. return $core.withContext(function($ctx2) {
  61989. return $recv($recv(each)._second())._asUppercase();
  61990. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61991. }))).__comma(":");
  61992. selector;
  61993. } else {
  61994. selector="help:";
  61995. selector;
  61996. }
  61997. return selector;
  61998. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  61999. },
  62000. args: ["aSwitch"],
  62001. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Add ':' at the end and replace all occurences of a lowercase letter preceded by a '-' with the Uppercase letter.\x0a\x09 Example: fallback-page becomes fallbackPage:.\x0a\x09 If no correct selector is found return 'help:'\x22\x0a\x09 | command selector |\x0a\x0a\x09 (self commandLineSwitches includes: aSwitch)\x0a\x09 ifTrue: [ selector := (aSwitch replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':']\x0a\x09 ifFalse: [ selector := 'help:' ].\x0a\x09^ selector",
  62002. referencedClasses: [],
  62003. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  62004. }),
  62005. $globals.AmberCli.a$cls);
  62006. $core.addMethod(
  62007. $core.method({
  62008. selector: "serve:",
  62009. protocol: "commands",
  62010. fn: function (args){
  62011. var self=this,$self=this;
  62012. return $core.withContext(function($ctx1) {
  62013. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  62014. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  62015. },
  62016. args: ["args"],
  62017. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  62018. referencedClasses: ["FileServer"],
  62019. messageSends: ["start", "createServerWithArguments:"]
  62020. }),
  62021. $globals.AmberCli.a$cls);
  62022. $core.addMethod(
  62023. $core.method({
  62024. selector: "version:",
  62025. protocol: "commands",
  62026. fn: function (arguments_){
  62027. var self=this,$self=this;
  62028. return self;
  62029. },
  62030. args: ["arguments"],
  62031. source: "version: arguments",
  62032. referencedClasses: [],
  62033. messageSends: []
  62034. }),
  62035. $globals.AmberCli.a$cls);
  62036. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  62037. $core.addMethod(
  62038. $core.method({
  62039. selector: "dirname",
  62040. protocol: "private",
  62041. fn: function (){
  62042. var self=this,$self=this;
  62043. return $core.withContext(function($ctx1) {
  62044. return __dirname;
  62045. return self;
  62046. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  62047. },
  62048. args: [],
  62049. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  62050. referencedClasses: [],
  62051. messageSends: []
  62052. }),
  62053. $globals.BaseFileManipulator);
  62054. $core.addMethod(
  62055. $core.method({
  62056. selector: "initialize",
  62057. protocol: "initialization",
  62058. fn: function (){
  62059. var self=this,$self=this;
  62060. return $core.withContext(function($ctx1) {
  62061. (
  62062. $ctx1.supercall = true,
  62063. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62064. $ctx1.supercall = false;
  62065. $self["@path"]=$recv(require)._value_("path");
  62066. $ctx1.sendIdx["value:"]=1;
  62067. $self["@fs"]=$recv(require)._value_("fs");
  62068. return self;
  62069. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  62070. },
  62071. args: [],
  62072. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  62073. referencedClasses: [],
  62074. messageSends: ["initialize", "value:"]
  62075. }),
  62076. $globals.BaseFileManipulator);
  62077. $core.addMethod(
  62078. $core.method({
  62079. selector: "rootDirname",
  62080. protocol: "private",
  62081. fn: function (){
  62082. var self=this,$self=this;
  62083. return $core.withContext(function($ctx1) {
  62084. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  62085. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  62086. },
  62087. args: [],
  62088. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  62089. referencedClasses: [],
  62090. messageSends: ["join:with:", "dirname"]
  62091. }),
  62092. $globals.BaseFileManipulator);
  62093. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  62094. $core.addMethod(
  62095. $core.method({
  62096. selector: "initialize",
  62097. protocol: "initialization",
  62098. fn: function (){
  62099. var self=this,$self=this;
  62100. return $core.withContext(function($ctx1) {
  62101. (
  62102. $ctx1.supercall = true,
  62103. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62104. $ctx1.supercall = false;
  62105. return self;
  62106. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  62107. },
  62108. args: [],
  62109. source: "initialize\x0a\x09super initialize",
  62110. referencedClasses: [],
  62111. messageSends: ["initialize"]
  62112. }),
  62113. $globals.Configurator);
  62114. $core.addMethod(
  62115. $core.method({
  62116. selector: "start",
  62117. protocol: "action",
  62118. fn: function (){
  62119. var self=this,$self=this;
  62120. return $core.withContext(function($ctx1) {
  62121. var $receiver;
  62122. $self._writeConfigThenDo_((function(err){
  62123. return $core.withContext(function($ctx2) {
  62124. if(($receiver = err) == null || $receiver.a$nil){
  62125. return $recv(process)._exit();
  62126. } else {
  62127. return $recv(process)._exit_((111));
  62128. }
  62129. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  62130. }));
  62131. return self;
  62132. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  62133. },
  62134. args: [],
  62135. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  62136. referencedClasses: [],
  62137. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  62138. }),
  62139. $globals.Configurator);
  62140. $core.addMethod(
  62141. $core.method({
  62142. selector: "writeConfigThenDo:",
  62143. protocol: "action",
  62144. fn: function (aBlock){
  62145. var self=this,$self=this;
  62146. return $core.withContext(function($ctx1) {
  62147. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  62148. return self;
  62149. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  62150. },
  62151. args: ["aBlock"],
  62152. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  62153. referencedClasses: [],
  62154. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  62155. }),
  62156. $globals.Configurator);
  62157. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  62158. $globals.FileServer.comment="I am the Amber Smalltalk FileServer.\x0aMy runtime requirement is a functional Node.js executable.\x0a\x0aTo start a FileServer instance on port `4000` use the following code:\x0a\x0a FileServer new start\x0a\x0aA parameterized instance can be created with the following code:\x0a\x0a FileServer createServerWithArguments: options\x0a\x0aHere, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.\x0aA list of all available parameters can be printed to the commandline by passing `--help` as parameter.\x0aSee the `Options` section for further details on how options are mapped to instance methods.\x0a\x0aAfter startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.\x0a\x0a\x0a## Options\x0a\x0aEach option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.\x0aThe trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.\x0aAfterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.\x0a\x0a## Adding new commandline parameters\x0a\x0aAdding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol.";
  62159. $core.addMethod(
  62160. $core.method({
  62161. selector: "base64Decode:",
  62162. protocol: "private",
  62163. fn: function (aString){
  62164. var self=this,$self=this;
  62165. return $core.withContext(function($ctx1) {
  62166. return (new Buffer(aString, "base64").toString());
  62167. return self;
  62168. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  62169. },
  62170. args: ["aString"],
  62171. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  62172. referencedClasses: [],
  62173. messageSends: []
  62174. }),
  62175. $globals.FileServer);
  62176. $core.addMethod(
  62177. $core.method({
  62178. selector: "basePath",
  62179. protocol: "accessing",
  62180. fn: function (){
  62181. var self=this,$self=this;
  62182. return $core.withContext(function($ctx1) {
  62183. var $1,$receiver;
  62184. $1=$self["@basePath"];
  62185. if(($receiver = $1) == null || $receiver.a$nil){
  62186. return $recv($self._class())._defaultBasePath();
  62187. } else {
  62188. return $1;
  62189. }
  62190. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62191. },
  62192. args: [],
  62193. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62194. referencedClasses: [],
  62195. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62196. }),
  62197. $globals.FileServer);
  62198. $core.addMethod(
  62199. $core.method({
  62200. selector: "basePath:",
  62201. protocol: "accessing",
  62202. fn: function (aString){
  62203. var self=this,$self=this;
  62204. return $core.withContext(function($ctx1) {
  62205. $self["@basePath"]=aString;
  62206. $self._validateBasePath();
  62207. return self;
  62208. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62209. },
  62210. args: ["aString"],
  62211. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62212. referencedClasses: [],
  62213. messageSends: ["validateBasePath"]
  62214. }),
  62215. $globals.FileServer);
  62216. $core.addMethod(
  62217. $core.method({
  62218. selector: "checkDirectoryLayout",
  62219. protocol: "initialization",
  62220. fn: function (){
  62221. var self=this,$self=this;
  62222. return $core.withContext(function($ctx1) {
  62223. var $1;
  62224. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  62225. if(!$core.assert($1)){
  62226. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62227. $ctx1.sendIdx["warn:"]=1;
  62228. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62229. $ctx1.sendIdx["warn:"]=2;
  62230. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62231. $ctx1.sendIdx["warn:"]=3;
  62232. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62233. }
  62234. return self;
  62235. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62236. },
  62237. args: [],
  62238. source: "checkDirectoryLayout\x0a\x09(fs existsSync:\x09(self withBasePath: 'index.html')) ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html.'.\x0a\x09\x09console warn: ' You can specify the directory containing index.html with --base-path.'.\x0a\x09\x09console warn: ' You can also specify a page to be served by default,'.\x0a\x09\x09console warn: ' for all paths that do not map to a file, with --fallback-page.'].",
  62239. referencedClasses: [],
  62240. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62241. }),
  62242. $globals.FileServer);
  62243. $core.addMethod(
  62244. $core.method({
  62245. selector: "fallbackPage",
  62246. protocol: "accessing",
  62247. fn: function (){
  62248. var self=this,$self=this;
  62249. return $self["@fallbackPage"];
  62250. },
  62251. args: [],
  62252. source: "fallbackPage\x0a\x09^ fallbackPage",
  62253. referencedClasses: [],
  62254. messageSends: []
  62255. }),
  62256. $globals.FileServer);
  62257. $core.addMethod(
  62258. $core.method({
  62259. selector: "fallbackPage:",
  62260. protocol: "accessing",
  62261. fn: function (aString){
  62262. var self=this,$self=this;
  62263. $self["@fallbackPage"]=aString;
  62264. return self;
  62265. },
  62266. args: ["aString"],
  62267. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62268. referencedClasses: [],
  62269. messageSends: []
  62270. }),
  62271. $globals.FileServer);
  62272. $core.addMethod(
  62273. $core.method({
  62274. selector: "handleGETRequest:respondTo:",
  62275. protocol: "request handling",
  62276. fn: function (aRequest,aResponse){
  62277. var self=this,$self=this;
  62278. var uri,filename;
  62279. return $core.withContext(function($ctx1) {
  62280. var $1;
  62281. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62282. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62283. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62284. return $core.withContext(function($ctx2) {
  62285. if($core.assert(aBoolean)){
  62286. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62287. if($core.assert($1)){
  62288. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62289. } else {
  62290. return $self._respondFileNamed_to_(filename,aResponse);
  62291. }
  62292. } else {
  62293. return $self._respondNotFoundTo_(aResponse);
  62294. }
  62295. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62296. }));
  62297. return self;
  62298. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62299. },
  62300. args: ["aRequest", "aResponse"],
  62301. source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := url parse: aRequest url.\x0a\x09filename := path join: self basePath with: uri pathname.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [(fs statSync: filename) isDirectory\x0a\x09\x09\x09\x09ifTrue: [self respondDirectoryNamed: filename from: uri to: aResponse]\x0a\x09\x09\x09\x09ifFalse: [self respondFileNamed: filename to: aResponse]]]",
  62302. referencedClasses: [],
  62303. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62304. }),
  62305. $globals.FileServer);
  62306. $core.addMethod(
  62307. $core.method({
  62308. selector: "handleOPTIONSRequest:respondTo:",
  62309. protocol: "request handling",
  62310. fn: function (aRequest,aResponse){
  62311. var self=this,$self=this;
  62312. return $core.withContext(function($ctx1) {
  62313. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Access-Control-Allow-Origin","*","Access-Control-Allow-Methods","GET, PUT, POST, DELETE, OPTIONS","Access-Control-Allow-Headers","Content-Type, Accept","Content-Length",(0),"Access-Control-Max-Age",(10)]));
  62314. $recv(aResponse)._end();
  62315. return self;
  62316. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62317. },
  62318. args: ["aRequest", "aResponse"],
  62319. source: "handleOPTIONSRequest: aRequest respondTo: aResponse\x0a\x09aResponse writeHead: 200 options: #{'Access-Control-Allow-Origin' -> '*'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Methods' -> 'GET, PUT, POST, DELETE, OPTIONS'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Headers' -> 'Content-Type, Accept'.\x0a\x09\x09\x09\x09\x09'Content-Length' -> 0.\x0a\x09\x09\x09\x09\x09'Access-Control-Max-Age' -> 10}.\x0a\x09aResponse end",
  62320. referencedClasses: [],
  62321. messageSends: ["writeHead:options:", "end"]
  62322. }),
  62323. $globals.FileServer);
  62324. $core.addMethod(
  62325. $core.method({
  62326. selector: "handlePUTRequest:respondTo:",
  62327. protocol: "request handling",
  62328. fn: function (aRequest,aResponse){
  62329. var self=this,$self=this;
  62330. var file,stream;
  62331. return $core.withContext(function($ctx1) {
  62332. var $1,$2,$3,$4;
  62333. $1=$self._isAuthenticated_(aRequest);
  62334. if(!$core.assert($1)){
  62335. $self._respondAuthenticationRequiredTo_(aResponse);
  62336. return nil;
  62337. }
  62338. file=".".__comma($recv(aRequest)._url());
  62339. $ctx1.sendIdx[","]=1;
  62340. stream=$recv($self["@fs"])._createWriteStream_(file);
  62341. $recv(stream)._on_do_("error",(function(error){
  62342. return $core.withContext(function($ctx2) {
  62343. $2=console;
  62344. $3="Error creating WriteStream for file ".__comma(file);
  62345. $ctx2.sendIdx[","]=2;
  62346. $recv($2)._warn_($3);
  62347. $ctx2.sendIdx["warn:"]=1;
  62348. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62349. $ctx2.sendIdx["warn:"]=2;
  62350. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62351. return $self._respondNotCreatedTo_(aResponse);
  62352. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62353. }));
  62354. $ctx1.sendIdx["on:do:"]=1;
  62355. $recv(stream)._on_do_("close",(function(){
  62356. return $core.withContext(function($ctx2) {
  62357. return $self._respondCreatedTo_(aResponse);
  62358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62359. }));
  62360. $ctx1.sendIdx["on:do:"]=2;
  62361. $recv(aRequest)._setEncoding_("utf8");
  62362. $recv(aRequest)._on_do_("data",(function(data){
  62363. return $core.withContext(function($ctx2) {
  62364. return $recv(stream)._write_(data);
  62365. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62366. }));
  62367. $ctx1.sendIdx["on:do:"]=3;
  62368. $recv(aRequest)._on_do_("end",(function(){
  62369. return $core.withContext(function($ctx2) {
  62370. $4=$recv(stream)._writable();
  62371. if($core.assert($4)){
  62372. return $recv(stream)._end();
  62373. }
  62374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62375. }));
  62376. return self;
  62377. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62378. },
  62379. args: ["aRequest", "aResponse"],
  62380. source: "handlePUTRequest: aRequest respondTo: aResponse\x0a\x09| file stream |\x0a\x09(self isAuthenticated: aRequest)\x0a\x09\x09ifFalse: [self respondAuthenticationRequiredTo: aResponse. ^ nil].\x0a\x0a\x09file := '.', aRequest url.\x0a\x09stream := fs createWriteStream: file.\x0a\x0a\x09stream on: 'error' do: [:error |\x0a\x09\x09console warn: 'Error creating WriteStream for file ', file.\x0a\x09\x09console warn: ' Did you forget to create the necessary directory in your project (often /src)?'.\x0a\x09\x09console warn: ' The exact error is: ', error.\x0a\x09\x09self respondNotCreatedTo: aResponse].\x0a\x0a\x09stream on: 'close' do: [\x0a\x09\x09self respondCreatedTo: aResponse].\x0a\x0a\x09aRequest setEncoding: 'utf8'.\x0a\x09aRequest on: 'data' do: [:data |\x0a\x09\x09stream write: data].\x0a\x0a\x09aRequest on: 'end' do: [\x0a\x09\x09stream writable ifTrue: [stream end]]",
  62381. referencedClasses: [],
  62382. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62383. }),
  62384. $globals.FileServer);
  62385. $core.addMethod(
  62386. $core.method({
  62387. selector: "handleRequest:respondTo:",
  62388. protocol: "request handling",
  62389. fn: function (aRequest,aResponse){
  62390. var self=this,$self=this;
  62391. return $core.withContext(function($ctx1) {
  62392. var $2,$1,$4,$3,$5;
  62393. $2=$recv(aRequest)._method();
  62394. $ctx1.sendIdx["method"]=1;
  62395. $1=$recv($2).__eq("PUT");
  62396. $ctx1.sendIdx["="]=1;
  62397. if($core.assert($1)){
  62398. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62399. }
  62400. $4=$recv(aRequest)._method();
  62401. $ctx1.sendIdx["method"]=2;
  62402. $3=$recv($4).__eq("GET");
  62403. $ctx1.sendIdx["="]=2;
  62404. if($core.assert($3)){
  62405. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62406. }
  62407. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62408. if($core.assert($5)){
  62409. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62410. }
  62411. return self;
  62412. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62413. },
  62414. args: ["aRequest", "aResponse"],
  62415. source: "handleRequest: aRequest respondTo: aResponse\x0a\x09aRequest method = 'PUT'\x0a\x09\x09ifTrue: [self handlePUTRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'GET'\x0a\x09\x09ifTrue:[self handleGETRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'OPTIONS'\x0a\x09\x09ifTrue:[self handleOPTIONSRequest: aRequest respondTo: aResponse]",
  62416. referencedClasses: [],
  62417. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62418. }),
  62419. $globals.FileServer);
  62420. $core.addMethod(
  62421. $core.method({
  62422. selector: "host",
  62423. protocol: "accessing",
  62424. fn: function (){
  62425. var self=this,$self=this;
  62426. return $self["@host"];
  62427. },
  62428. args: [],
  62429. source: "host\x0a\x09^ host",
  62430. referencedClasses: [],
  62431. messageSends: []
  62432. }),
  62433. $globals.FileServer);
  62434. $core.addMethod(
  62435. $core.method({
  62436. selector: "host:",
  62437. protocol: "accessing",
  62438. fn: function (hostname){
  62439. var self=this,$self=this;
  62440. $self["@host"]=hostname;
  62441. return self;
  62442. },
  62443. args: ["hostname"],
  62444. source: "host: hostname\x0a\x09host := hostname",
  62445. referencedClasses: [],
  62446. messageSends: []
  62447. }),
  62448. $globals.FileServer);
  62449. $core.addMethod(
  62450. $core.method({
  62451. selector: "initialize",
  62452. protocol: "initialization",
  62453. fn: function (){
  62454. var self=this,$self=this;
  62455. return $core.withContext(function($ctx1) {
  62456. var $1;
  62457. (
  62458. $ctx1.supercall = true,
  62459. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62460. $ctx1.supercall = false;
  62461. $self["@http"]=$self._require_("http");
  62462. $ctx1.sendIdx["require:"]=1;
  62463. $self["@util"]=$self._require_("util");
  62464. $ctx1.sendIdx["require:"]=2;
  62465. $self["@url"]=$self._require_("url");
  62466. $1=$self._class();
  62467. $ctx1.sendIdx["class"]=1;
  62468. $self["@host"]=$recv($1)._defaultHost();
  62469. $self["@port"]=$recv($self._class())._defaultPort();
  62470. $self["@username"]=nil;
  62471. $self["@password"]=nil;
  62472. $self["@fallbackPage"]=nil;
  62473. return self;
  62474. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62475. },
  62476. args: [],
  62477. source: "initialize\x0a\x09super initialize.\x0a\x09http := self require: 'http'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09host := self class defaultHost.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.\x0a\x09fallbackPage := nil.",
  62478. referencedClasses: [],
  62479. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62480. }),
  62481. $globals.FileServer);
  62482. $core.addMethod(
  62483. $core.method({
  62484. selector: "isAuthenticated:",
  62485. protocol: "private",
  62486. fn: function (aRequest){
  62487. var self=this,$self=this;
  62488. var header,token,auth,parts;
  62489. return $core.withContext(function($ctx1) {
  62490. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62491. var $early={};
  62492. try {
  62493. $2=$recv($self["@username"])._isNil();
  62494. $ctx1.sendIdx["isNil"]=1;
  62495. $1=$recv($2)._and_((function(){
  62496. return $core.withContext(function($ctx2) {
  62497. return $recv($self["@password"])._isNil();
  62498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62499. }));
  62500. $ctx1.sendIdx["and:"]=1;
  62501. if($core.assert($1)){
  62502. return true;
  62503. }
  62504. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62505. $ctx1.sendIdx["at:"]=1;
  62506. if(($receiver = $3) == null || $receiver.a$nil){
  62507. header="";
  62508. } else {
  62509. header=$3;
  62510. }
  62511. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62512. throw $early=[false];
  62513. }),(function(){
  62514. return $core.withContext(function($ctx2) {
  62515. $4=$recv(header)._tokenize_(" ");
  62516. $ctx2.sendIdx["tokenize:"]=1;
  62517. if(($receiver = $4) == null || $receiver.a$nil){
  62518. token="";
  62519. } else {
  62520. token=$4;
  62521. }
  62522. $5=$recv(token)._at_((2));
  62523. $ctx2.sendIdx["at:"]=2;
  62524. auth=$self._base64Decode_($5);
  62525. parts=$recv(auth)._tokenize_(":");
  62526. $8=$self["@username"];
  62527. $9=$recv(parts)._at_((1));
  62528. $ctx2.sendIdx["at:"]=3;
  62529. $7=$recv($8).__eq($9);
  62530. $ctx2.sendIdx["="]=1;
  62531. $6=$recv($7)._and_((function(){
  62532. return $core.withContext(function($ctx3) {
  62533. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62534. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62535. }));
  62536. if($core.assert($6)){
  62537. throw $early=[true];
  62538. } else {
  62539. throw $early=[false];
  62540. }
  62541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62542. }));
  62543. return self;
  62544. }
  62545. catch(e) {if(e===$early)return e[0]; throw e}
  62546. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62547. },
  62548. args: ["aRequest"],
  62549. source: "isAuthenticated: aRequest\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^ true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09header\x0a\x09ifEmpty: [^ false]\x0a\x09ifNotEmpty: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09auth := self base64Decode: (token at: 2).\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^ true]\x0a\x09\x09\x09ifFalse: [^ false]\x0a\x09].",
  62550. referencedClasses: [],
  62551. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62552. }),
  62553. $globals.FileServer);
  62554. $core.addMethod(
  62555. $core.method({
  62556. selector: "password:",
  62557. protocol: "accessing",
  62558. fn: function (aPassword){
  62559. var self=this,$self=this;
  62560. $self["@password"]=aPassword;
  62561. return self;
  62562. },
  62563. args: ["aPassword"],
  62564. source: "password: aPassword\x0a\x09password := aPassword.",
  62565. referencedClasses: [],
  62566. messageSends: []
  62567. }),
  62568. $globals.FileServer);
  62569. $core.addMethod(
  62570. $core.method({
  62571. selector: "port",
  62572. protocol: "accessing",
  62573. fn: function (){
  62574. var self=this,$self=this;
  62575. return $self["@port"];
  62576. },
  62577. args: [],
  62578. source: "port\x0a\x09^ port",
  62579. referencedClasses: [],
  62580. messageSends: []
  62581. }),
  62582. $globals.FileServer);
  62583. $core.addMethod(
  62584. $core.method({
  62585. selector: "port:",
  62586. protocol: "accessing",
  62587. fn: function (aNumber){
  62588. var self=this,$self=this;
  62589. $self["@port"]=aNumber;
  62590. return self;
  62591. },
  62592. args: ["aNumber"],
  62593. source: "port: aNumber\x0a\x09port := aNumber",
  62594. referencedClasses: [],
  62595. messageSends: []
  62596. }),
  62597. $globals.FileServer);
  62598. $core.addMethod(
  62599. $core.method({
  62600. selector: "require:",
  62601. protocol: "private",
  62602. fn: function (aModuleString){
  62603. var self=this,$self=this;
  62604. return $core.withContext(function($ctx1) {
  62605. return $recv(require)._value_(aModuleString);
  62606. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62607. },
  62608. args: ["aModuleString"],
  62609. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62610. referencedClasses: [],
  62611. messageSends: ["value:"]
  62612. }),
  62613. $globals.FileServer);
  62614. $core.addMethod(
  62615. $core.method({
  62616. selector: "respondAuthenticationRequiredTo:",
  62617. protocol: "request handling",
  62618. fn: function (aResponse){
  62619. var self=this,$self=this;
  62620. return $core.withContext(function($ctx1) {
  62621. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62622. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62623. $recv(aResponse)._end();
  62624. return self;
  62625. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62626. },
  62627. args: ["aResponse"],
  62628. source: "respondAuthenticationRequiredTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 401 options: #{'WWW-Authenticate' -> 'Basic realm=\x22Secured Developer Area\x22'};\x0a\x09\x09write: '<html><body>Authentication needed</body></html>';\x0a\x09\x09end.",
  62629. referencedClasses: [],
  62630. messageSends: ["writeHead:options:", "write:", "end"]
  62631. }),
  62632. $globals.FileServer);
  62633. $core.addMethod(
  62634. $core.method({
  62635. selector: "respondCreatedTo:",
  62636. protocol: "request handling",
  62637. fn: function (aResponse){
  62638. var self=this,$self=this;
  62639. return $core.withContext(function($ctx1) {
  62640. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62641. $recv(aResponse)._end();
  62642. return self;
  62643. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62644. },
  62645. args: ["aResponse"],
  62646. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62647. referencedClasses: [],
  62648. messageSends: ["writeHead:options:", "end"]
  62649. }),
  62650. $globals.FileServer);
  62651. $core.addMethod(
  62652. $core.method({
  62653. selector: "respondDirectoryNamed:from:to:",
  62654. protocol: "request handling",
  62655. fn: function (aDirname,aUrl,aResponse){
  62656. var self=this,$self=this;
  62657. return $core.withContext(function($ctx1) {
  62658. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62659. $2=$recv(aUrl)._pathname();
  62660. $ctx1.sendIdx["pathname"]=1;
  62661. $1=$recv($2)._endsWith_("/");
  62662. if($core.assert($1)){
  62663. $3=$recv(aDirname).__comma("index.html");
  62664. $ctx1.sendIdx[","]=1;
  62665. $self._respondFileNamed_to_($3,aResponse);
  62666. } else {
  62667. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62668. $7=$recv(aUrl)._search();
  62669. if(($receiver = $7) == null || $receiver.a$nil){
  62670. $6="";
  62671. } else {
  62672. $6=$7;
  62673. }
  62674. $4=$recv($5).__comma($6);
  62675. $ctx1.sendIdx[","]=2;
  62676. $self._respondRedirect_to_($4,aResponse);
  62677. }
  62678. return self;
  62679. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62680. },
  62681. args: ["aDirname", "aUrl", "aResponse"],
  62682. source: "respondDirectoryNamed: aDirname from: aUrl to: aResponse\x0a\x09(aUrl pathname endsWith: '/')\x0a\x09\x09ifTrue: [self respondFileNamed: aDirname, 'index.html' to: aResponse]\x0a\x09\x09ifFalse: [self respondRedirect: aUrl pathname, '/', (aUrl search ifNil: ['']) to: aResponse]",
  62683. referencedClasses: [],
  62684. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62685. }),
  62686. $globals.FileServer);
  62687. $core.addMethod(
  62688. $core.method({
  62689. selector: "respondFileNamed:to:",
  62690. protocol: "request handling",
  62691. fn: function (aFilename,aResponse){
  62692. var self=this,$self=this;
  62693. var type,filename;
  62694. return $core.withContext(function($ctx1) {
  62695. var $1,$2,$3,$4;
  62696. filename=aFilename;
  62697. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62698. return $core.withContext(function($ctx2) {
  62699. $1=$recv(ex)._notNil();
  62700. if($core.assert($1)){
  62701. $2=console;
  62702. $3=$recv(filename).__comma(" does not exist");
  62703. $ctx2.sendIdx[","]=1;
  62704. $recv($2)._log_($3);
  62705. return $self._respondNotFoundTo_(aResponse);
  62706. } else {
  62707. type=$recv($self._class())._mimeTypeFor_(filename);
  62708. $4=$recv(type).__eq("application/javascript");
  62709. if($core.assert($4)){
  62710. type=$recv(type).__comma(";charset=utf-8");
  62711. type;
  62712. }
  62713. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62714. $recv(aResponse)._write_encoding_(file,"binary");
  62715. return $recv(aResponse)._end();
  62716. }
  62717. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62718. }));
  62719. return self;
  62720. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62721. },
  62722. args: ["aFilename", "aResponse"],
  62723. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x0a\x09fs readFile: filename do: [:ex :file |\x0a\x09\x09ex notNil \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09console log: filename, ' does not exist'.\x0a\x09\x09\x09\x09self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09type := self class mimeTypeFor: filename.\x0a\x09\x09\x09\x09type = 'application/javascript'\x0a\x09\x09\x09\x09\x09ifTrue: [ type:=type,';charset=utf-8' ].\x0a\x09\x09\x09\x09aResponse \x0a\x09\x09\x09\x09\x09writeHead: 200 options: #{'Content-Type' -> type};\x0a\x09\x09\x09\x09\x09write: file encoding: 'binary';\x0a\x09\x09\x09\x09\x09end]]",
  62724. referencedClasses: [],
  62725. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62726. }),
  62727. $globals.FileServer);
  62728. $core.addMethod(
  62729. $core.method({
  62730. selector: "respondInternalErrorTo:",
  62731. protocol: "request handling",
  62732. fn: function (aResponse){
  62733. var self=this,$self=this;
  62734. return $core.withContext(function($ctx1) {
  62735. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62736. $recv(aResponse)._write_("500 Internal server error");
  62737. $recv(aResponse)._end();
  62738. return self;
  62739. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62740. },
  62741. args: ["aResponse"],
  62742. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62743. referencedClasses: [],
  62744. messageSends: ["writeHead:options:", "write:", "end"]
  62745. }),
  62746. $globals.FileServer);
  62747. $core.addMethod(
  62748. $core.method({
  62749. selector: "respondNotCreatedTo:",
  62750. protocol: "request handling",
  62751. fn: function (aResponse){
  62752. var self=this,$self=this;
  62753. return $core.withContext(function($ctx1) {
  62754. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62755. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62756. $recv(aResponse)._end();
  62757. return self;
  62758. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62759. },
  62760. args: ["aResponse"],
  62761. source: "respondNotCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 400 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: 'File could not be created. Did you forget to create the src directory on the server?';\x0a\x09\x09end.",
  62762. referencedClasses: [],
  62763. messageSends: ["writeHead:options:", "write:", "end"]
  62764. }),
  62765. $globals.FileServer);
  62766. $core.addMethod(
  62767. $core.method({
  62768. selector: "respondNotFoundTo:",
  62769. protocol: "request handling",
  62770. fn: function (aResponse){
  62771. var self=this,$self=this;
  62772. return $core.withContext(function($ctx1) {
  62773. var $2,$1;
  62774. $2=$self._fallbackPage();
  62775. $ctx1.sendIdx["fallbackPage"]=1;
  62776. $1=$recv($2)._isNil();
  62777. if(!$core.assert($1)){
  62778. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62779. }
  62780. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62781. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62782. $ctx1.sendIdx["write:"]=1;
  62783. $recv(aResponse)._write_("<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>");
  62784. $ctx1.sendIdx["write:"]=2;
  62785. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62786. $ctx1.sendIdx["write:"]=3;
  62787. $recv(aResponse)._write_("<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>");
  62788. $ctx1.sendIdx["write:"]=4;
  62789. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62790. $ctx1.sendIdx["write:"]=5;
  62791. $recv(aResponse)._write_("</ul></p></body></html>");
  62792. $recv(aResponse)._end();
  62793. return self;
  62794. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62795. },
  62796. args: ["aResponse"],
  62797. source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/html'};\x0a\x09\x09write: '<html><body><p>404 Not found</p>';\x0a\x09\x09write: '<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>';\x0a\x09\x09write: '<li>create an index.html in the served directory.</li>';\x0a\x09\x09write: '<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>';\x0a\x09\x09write: '<li>change the directory to be served with the \x22--base-path\x22 option.</li>';\x0a\x09\x09write: '</ul></p></body></html>';\x0a\x09\x09end",
  62798. referencedClasses: [],
  62799. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62800. }),
  62801. $globals.FileServer);
  62802. $core.addMethod(
  62803. $core.method({
  62804. selector: "respondOKTo:",
  62805. protocol: "request handling",
  62806. fn: function (aResponse){
  62807. var self=this,$self=this;
  62808. return $core.withContext(function($ctx1) {
  62809. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62810. $recv(aResponse)._end();
  62811. return self;
  62812. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62813. },
  62814. args: ["aResponse"],
  62815. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62816. referencedClasses: [],
  62817. messageSends: ["writeHead:options:", "end"]
  62818. }),
  62819. $globals.FileServer);
  62820. $core.addMethod(
  62821. $core.method({
  62822. selector: "respondRedirect:to:",
  62823. protocol: "request handling",
  62824. fn: function (aString,aResponse){
  62825. var self=this,$self=this;
  62826. return $core.withContext(function($ctx1) {
  62827. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62828. $recv(aResponse)._end();
  62829. return self;
  62830. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62831. },
  62832. args: ["aString", "aResponse"],
  62833. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62834. referencedClasses: [],
  62835. messageSends: ["writeHead:options:", "end"]
  62836. }),
  62837. $globals.FileServer);
  62838. $core.addMethod(
  62839. $core.method({
  62840. selector: "start",
  62841. protocol: "starting",
  62842. fn: function (){
  62843. var self=this,$self=this;
  62844. return $core.withContext(function($ctx1) {
  62845. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  62846. $self._checkDirectoryLayout();
  62847. $1=$recv($self["@http"])._createServer_((function(request,response){
  62848. return $core.withContext(function($ctx2) {
  62849. return $self._handleRequest_respondTo_(request,response);
  62850. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  62851. }));
  62852. $recv($1)._on_do_("error",(function(error){
  62853. return $core.withContext(function($ctx2) {
  62854. $2=console;
  62855. $3="Error starting server: ".__comma(error);
  62856. $ctx2.sendIdx[","]=1;
  62857. return $recv($2)._log_($3);
  62858. $ctx2.sendIdx["log:"]=1;
  62859. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62860. }));
  62861. $ctx1.sendIdx["on:do:"]=1;
  62862. $recv($1)._on_do_("listening",(function(){
  62863. return $core.withContext(function($ctx2) {
  62864. $4=console;
  62865. $8=$self._host();
  62866. $ctx2.sendIdx["host"]=1;
  62867. $7="Starting file server on http://".__comma($8);
  62868. $6=$recv($7).__comma(":");
  62869. $ctx2.sendIdx[","]=3;
  62870. $10=$self._port();
  62871. $ctx2.sendIdx["port"]=1;
  62872. $9=$recv($10)._asString();
  62873. $5=$recv($6).__comma($9);
  62874. $ctx2.sendIdx[","]=2;
  62875. return $recv($4)._log_($5);
  62876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62877. }));
  62878. $recv($1)._listen_host_($self._port(),$self._host());
  62879. return self;
  62880. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  62881. },
  62882. args: [],
  62883. source: "start\x0a\x09\x22Checks if required directory layout is present (issue warning if not).\x0a\x09 Afterwards start the server.\x22\x0a\x09self checkDirectoryLayout.\x0a\x09(http createServer: [:request :response |\x0a\x09 self handleRequest: request respondTo: response])\x0a\x09 on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09 on: 'listening' do: [console log: 'Starting file server on http://', self host, ':', self port asString];\x0a\x09 listen: self port host: self host.",
  62884. referencedClasses: [],
  62885. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  62886. }),
  62887. $globals.FileServer);
  62888. $core.addMethod(
  62889. $core.method({
  62890. selector: "startOn:",
  62891. protocol: "starting",
  62892. fn: function (aPort){
  62893. var self=this,$self=this;
  62894. return $core.withContext(function($ctx1) {
  62895. $self._port_(aPort);
  62896. $self._start();
  62897. return self;
  62898. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  62899. },
  62900. args: ["aPort"],
  62901. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  62902. referencedClasses: [],
  62903. messageSends: ["port:", "start"]
  62904. }),
  62905. $globals.FileServer);
  62906. $core.addMethod(
  62907. $core.method({
  62908. selector: "username:",
  62909. protocol: "accessing",
  62910. fn: function (aUsername){
  62911. var self=this,$self=this;
  62912. $self["@username"]=aUsername;
  62913. return self;
  62914. },
  62915. args: ["aUsername"],
  62916. source: "username: aUsername\x0a\x09username := aUsername.",
  62917. referencedClasses: [],
  62918. messageSends: []
  62919. }),
  62920. $globals.FileServer);
  62921. $core.addMethod(
  62922. $core.method({
  62923. selector: "validateBasePath",
  62924. protocol: "private",
  62925. fn: function (){
  62926. var self=this,$self=this;
  62927. return $core.withContext(function($ctx1) {
  62928. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  62929. $1=$self["@fs"];
  62930. $2=$self._basePath();
  62931. $ctx1.sendIdx["basePath"]=1;
  62932. $recv($1)._stat_then_($2,(function(err,stat){
  62933. return $core.withContext(function($ctx2) {
  62934. if(($receiver = err) == null || $receiver.a$nil){
  62935. $3=$recv(stat)._isDirectory();
  62936. if(!$core.assert($3)){
  62937. $4=console;
  62938. $7=$self._basePath();
  62939. $ctx2.sendIdx["basePath"]=2;
  62940. $6="Warning: --base-path parameter ".__comma($7);
  62941. $ctx2.sendIdx[","]=2;
  62942. $5=$recv($6).__comma(" is not a directory.");
  62943. $ctx2.sendIdx[","]=1;
  62944. return $recv($4)._warn_($5);
  62945. $ctx2.sendIdx["warn:"]=1;
  62946. }
  62947. } else {
  62948. $8=console;
  62949. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  62950. $ctx2.sendIdx[","]=3;
  62951. return $recv($8)._warn_($9);
  62952. }
  62953. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  62954. }));
  62955. return self;
  62956. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  62957. },
  62958. args: [],
  62959. source: "validateBasePath\x0a\x09\x22The basePath must be an existing directory. \x22\x0a\x09fs stat: self basePath then: [ :err :stat | err\x0a\x09\x09ifNil: [ stat isDirectory ifFalse: [ console warn: 'Warning: --base-path parameter ' , self basePath , ' is not a directory.' ]]\x0a\x09\x09ifNotNil: [ console warn: 'Warning: path at --base-path parameter ' , self basePath , ' does not exist.' ]].",
  62960. referencedClasses: [],
  62961. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  62962. }),
  62963. $globals.FileServer);
  62964. $core.addMethod(
  62965. $core.method({
  62966. selector: "withBasePath:",
  62967. protocol: "private",
  62968. fn: function (aBaseRelativePath){
  62969. var self=this,$self=this;
  62970. return $core.withContext(function($ctx1) {
  62971. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  62972. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  62973. },
  62974. args: ["aBaseRelativePath"],
  62975. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  62976. referencedClasses: [],
  62977. messageSends: ["join:with:", "basePath"]
  62978. }),
  62979. $globals.FileServer);
  62980. $core.addMethod(
  62981. $core.method({
  62982. selector: "writeData:toFileNamed:",
  62983. protocol: "private",
  62984. fn: function (data,aFilename){
  62985. var self=this,$self=this;
  62986. return $core.withContext(function($ctx1) {
  62987. $recv(console)._log_(aFilename);
  62988. return self;
  62989. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  62990. },
  62991. args: ["data", "aFilename"],
  62992. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  62993. referencedClasses: [],
  62994. messageSends: ["log:"]
  62995. }),
  62996. $globals.FileServer);
  62997. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  62998. $core.addMethod(
  62999. $core.method({
  63000. selector: "commandLineSwitches",
  63001. protocol: "accessing",
  63002. fn: function (){
  63003. var self=this,$self=this;
  63004. var switches;
  63005. return $core.withContext(function($ctx1) {
  63006. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  63007. return $core.withContext(function($ctx2) {
  63008. return $recv(each)._selector();
  63009. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63010. }));
  63011. $ctx1.sendIdx["collect:"]=1;
  63012. switches=$recv(switches)._select_((function(each){
  63013. return $core.withContext(function($ctx2) {
  63014. return $recv(each)._match_("^[^:]*:$");
  63015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  63016. }));
  63017. switches=$recv(switches)._collect_((function(each){
  63018. return $core.withContext(function($ctx2) {
  63019. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  63020. $ctx2.sendIdx["replace:with:"]=1;
  63021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  63022. }));
  63023. return switches;
  63024. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  63025. },
  63026. args: [],
  63027. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'accessing' protocol\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name\x0a\x09 and add a '--' at the beginning.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self methodsInProtocol: 'accessing') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase replace: '^([a-z])' with: '--$1' ].\x0a\x09^ switches",
  63028. referencedClasses: [],
  63029. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  63030. }),
  63031. $globals.FileServer.a$cls);
  63032. $core.addMethod(
  63033. $core.method({
  63034. selector: "createServerWithArguments:",
  63035. protocol: "initialization",
  63036. fn: function (options){
  63037. var self=this,$self=this;
  63038. var server,popFront,front,optionName,optionValue,switches;
  63039. return $core.withContext(function($ctx1) {
  63040. var $1,$2,$3,$4,$5,$6,$7,$8;
  63041. var $early={};
  63042. try {
  63043. switches=$self._commandLineSwitches();
  63044. server=$self._new();
  63045. $recv(options)._ifEmpty_((function(){
  63046. throw $early=[server];
  63047. }));
  63048. $1=$recv($recv(options)._size())._even();
  63049. if(!$core.assert($1)){
  63050. $recv(console)._log_("Using default parameters.");
  63051. $ctx1.sendIdx["log:"]=1;
  63052. $2=console;
  63053. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  63054. $ctx1.sendIdx[","]=1;
  63055. $recv($2)._log_($3);
  63056. $ctx1.sendIdx["log:"]=2;
  63057. $4=console;
  63058. $5="Use any of the following ones: ".__comma(switches);
  63059. $ctx1.sendIdx[","]=2;
  63060. $recv($4)._log_($5);
  63061. $ctx1.sendIdx["log:"]=3;
  63062. return server;
  63063. }
  63064. popFront=(function(args){
  63065. return $core.withContext(function($ctx2) {
  63066. front=$recv(args)._first();
  63067. $recv(args)._remove_(front);
  63068. return front;
  63069. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  63070. });
  63071. $recv((function(){
  63072. return $core.withContext(function($ctx2) {
  63073. return $recv(options)._notEmpty();
  63074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  63075. }))._whileTrue_((function(){
  63076. return $core.withContext(function($ctx2) {
  63077. optionName=$recv(popFront)._value_(options);
  63078. $ctx2.sendIdx["value:"]=1;
  63079. optionValue=$recv(popFront)._value_(options);
  63080. $6=$recv(switches)._includes_(optionName);
  63081. if($core.assert($6)){
  63082. optionName=$self._selectorForCommandLineSwitch_(optionName);
  63083. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  63084. } else {
  63085. $7=console;
  63086. $8=$recv(optionName).__comma(" is not a valid commandline option");
  63087. $ctx2.sendIdx[","]=3;
  63088. $recv($7)._log_($8);
  63089. $ctx2.sendIdx["log:"]=4;
  63090. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  63091. }
  63092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63093. }));
  63094. return server;
  63095. }
  63096. catch(e) {if(e===$early)return e[0]; throw e}
  63097. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  63098. },
  63099. args: ["options"],
  63100. source: "createServerWithArguments: options\x0a\x09\x22If options are empty return a default FileServer instance.\x0a\x09 If options are given loop through them and set the passed in values\x0a\x09 on the FileServer instance.\x0a\x09 \x0a\x09 Commanline options map directly to methods in the 'accessing' protocol\x0a\x09 taking one parameter.\x0a\x09 Adding a method to this protocol makes it directly settable through\x0a\x09 command line options.\x0a\x09 \x22\x0a\x09| server popFront front optionName optionValue switches |\x0a\x0a\x09switches := self commandLineSwitches.\x0a\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x0a\x09(options size even) ifFalse: [\x0a\x09\x09console log: 'Using default parameters.'.\x0a\x09\x09console log: 'Wrong commandline options or not enough arguments for: ' , options.\x0a\x09\x09console log: 'Use any of the following ones: ', switches.\x0a\x09\x09^server].\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x0a\x09\x09(switches includes: optionName) ifTrue: [\x0a\x09\x09\x09optionName := self selectorForCommandLineSwitch: optionName.\x0a\x09\x09\x09server perform: optionName withArguments: (Array with: optionValue)]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09console log: optionName, ' is not a valid commandline option'.\x0a\x09\x09\x09\x09console log: 'Use any of the following ones: ', switches ]].\x0a\x09^ server.",
  63101. referencedClasses: ["Array"],
  63102. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  63103. }),
  63104. $globals.FileServer.a$cls);
  63105. $core.addMethod(
  63106. $core.method({
  63107. selector: "defaultBasePath",
  63108. protocol: "accessing",
  63109. fn: function (){
  63110. var self=this,$self=this;
  63111. return "./";
  63112. },
  63113. args: [],
  63114. source: "defaultBasePath\x0a\x09^ './'",
  63115. referencedClasses: [],
  63116. messageSends: []
  63117. }),
  63118. $globals.FileServer.a$cls);
  63119. $core.addMethod(
  63120. $core.method({
  63121. selector: "defaultHost",
  63122. protocol: "accessing",
  63123. fn: function (){
  63124. var self=this,$self=this;
  63125. return "127.0.0.1";
  63126. },
  63127. args: [],
  63128. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  63129. referencedClasses: [],
  63130. messageSends: []
  63131. }),
  63132. $globals.FileServer.a$cls);
  63133. $core.addMethod(
  63134. $core.method({
  63135. selector: "defaultMimeTypes",
  63136. protocol: "accessing",
  63137. fn: function (){
  63138. var self=this,$self=this;
  63139. return $globals.HashedCollection._newFromPairs_(["%","application/x-trash","323","text/h323","abw","application/x-abiword","ai","application/postscript","aif","audio/x-aiff","aifc","audio/x-aiff","aiff","audio/x-aiff","alc","chemical/x-alchemy","art","image/x-jg","asc","text/plain","asf","video/x-ms-asf","asn","chemical/x-ncbi-asn1-spec","aso","chemical/x-ncbi-asn1-binary","asx","video/x-ms-asf","au","audio/basic","avi","video/x-msvideo","b","chemical/x-molconn-Z","bak","application/x-trash","bat","application/x-msdos-program","bcpio","application/x-bcpio","bib","text/x-bibtex","bin","application/octet-stream","bmp","image/x-ms-bmp","book","application/x-maker","bsd","chemical/x-crossfire","c","text/x-csrc","c++","text/x-c++src","c3d","chemical/x-chem3d","cac","chemical/x-cache","cache","chemical/x-cache","cascii","chemical/x-cactvs-binary","cat","application/vnd.ms-pki.seccat","cbin","chemical/x-cactvs-binary","cc","text/x-c++src","cdf","application/x-cdf","cdr","image/x-coreldraw","cdt","image/x-coreldrawtemplate","cdx","chemical/x-cdx","cdy","application/vnd.cinderella","cef","chemical/x-cxf","cer","chemical/x-cerius","chm","chemical/x-chemdraw","chrt","application/x-kchart","cif","chemical/x-cif","class","application/java-vm","cls","text/x-tex","cmdf","chemical/x-cmdf","cml","chemical/x-cml","cod","application/vnd.rim.cod","com","application/x-msdos-program","cpa","chemical/x-compass","cpio","application/x-cpio","cpp","text/x-c++src","cpt","image/x-corelphotopaint","crl","application/x-pkcs7-crl","crt","application/x-x509-ca-cert","csf","chemical/x-cache-csf","csh","text/x-csh","csm","chemical/x-csml","csml","chemical/x-csml","css","text/css","csv","text/comma-separated-values","ctab","chemical/x-cactvs-binary","ctx","chemical/x-ctx","cu","application/cu-seeme","cub","chemical/x-gaussian-cube","cxf","chemical/x-cxf","cxx","text/x-c++src","dat","chemical/x-mopac-input","dcr","application/x-director","deb","application/x-debian-package","dif","video/dv","diff","text/plain","dir","application/x-director","djv","image/vnd.djvu","djvu","image/vnd.djvu","dl","video/dl","dll","application/x-msdos-program","dmg","application/x-apple-diskimage","dms","application/x-dms","doc","application/msword","dot","application/msword","dv","video/dv","dvi","application/x-dvi","dx","chemical/x-jcamp-dx","dxr","application/x-director","emb","chemical/x-embl-dl-nucleotide","embl","chemical/x-embl-dl-nucleotide","ent","chemical/x-pdb","eps","application/postscript","etx","text/x-setext","exe","application/x-msdos-program","ez","application/andrew-inset","fb","application/x-maker","fbdoc","application/x-maker","fch","chemical/x-gaussian-checkpoint","fchk","chemical/x-gaussian-checkpoint","fig","application/x-xfig","flac","application/x-flac","fli","video/fli","fm","application/x-maker","frame","application/x-maker","frm","application/x-maker","gal","chemical/x-gaussian-log","gam","chemical/x-gamess-input","gamin","chemical/x-gamess-input","gau","chemical/x-gaussian-input","gcd","text/x-pcs-gcd","gcf","application/x-graphing-calculator","gcg","chemical/x-gcg8-sequence","gen","chemical/x-genbank","gf","application/x-tex-gf","gif","image/gif","gjc","chemical/x-gaussian-input","gjf","chemical/x-gaussian-input","gl","video/gl","gnumeric","application/x-gnumeric","gpt","chemical/x-mopac-graph","gsf","application/x-font","gsm","audio/x-gsm","gtar","application/x-gtar","h","text/x-chdr","h++","text/x-c++hdr","hdf","application/x-hdf","hh","text/x-c++hdr","hin","chemical/x-hin","hpp","text/x-c++hdr","hqx","application/mac-binhex40","hs","text/x-haskell","hta","application/hta","htc","text/x-component","htm","text/html","html","text/html","hxx","text/x-c++hdr","ica","application/x-ica","ice","x-conference/x-cooltalk","ico","image/x-icon","ics","text/calendar","icz","text/calendar","ief","image/ief","iges","model/iges","igs","model/iges","iii","application/x-iphone","inp","chemical/x-gamess-input","ins","application/x-internet-signup","iso","application/x-iso9660-image","isp","application/x-internet-signup","ist","chemical/x-isostar","istr","chemical/x-isostar","jad","text/vnd.sun.j2me.app-descriptor","jar","application/java-archive","java","text/x-java","jdx","chemical/x-jcamp-dx","jmz","application/x-jmol","jng","image/x-jng","jnlp","application/x-java-jnlp-file","jpe","image/jpeg","jpeg","image/jpeg","jpg","image/jpeg","js","application/javascript","kar","audio/midi","key","application/pgp-keys","kil","application/x-killustrator","kin","chemical/x-kinemage","kpr","application/x-kpresenter","kpt","application/x-kpresenter","ksp","application/x-kspread","kwd","application/x-kword","kwt","application/x-kword","latex","application/x-latex","lha","application/x-lha","lhs","text/x-literate-haskell","lsf","video/x-la-asf","lsx","video/x-la-asf","ltx","text/x-tex","lzh","application/x-lzh","lzx","application/x-lzx","m3u","audio/x-mpegurl","m4a","audio/mpeg","maker","application/x-maker","man","application/x-troff-man","mcif","chemical/x-mmcif","mcm","chemical/x-macmolecule","mdb","application/msaccess","me","application/x-troff-me","mesh","model/mesh","mid","audio/midi","midi","audio/midi","mif","application/x-mif","mm","application/x-freemind","mmd","chemical/x-macromodel-input","mmf","application/vnd.smaf","mml","text/mathml","mmod","chemical/x-macromodel-input","mng","video/x-mng","moc","text/x-moc","mol","chemical/x-mdl-molfile","mol2","chemical/x-mol2","moo","chemical/x-mopac-out","mop","chemical/x-mopac-input","mopcrt","chemical/x-mopac-input","mov","video/quicktime","movie","video/x-sgi-movie","mp2","audio/mpeg","mp3","audio/mpeg","mp4","video/mp4","mpc","chemical/x-mopac-input","mpe","video/mpeg","mpeg","video/mpeg","mpega","audio/mpeg","mpg","video/mpeg","mpga","audio/mpeg","ms","application/x-troff-ms","msh","model/mesh","msi","application/x-msi","mvb","chemical/x-mopac-vib","mxu","video/vnd.mpegurl","nb","application/mathematica","nc","application/x-netcdf","nwc","application/x-nwc","o","application/x-object","oda","application/oda","odb","application/vnd.oasis.opendocument.database","odc","application/vnd.oasis.opendocument.chart","odf","application/vnd.oasis.opendocument.formula","odg","application/vnd.oasis.opendocument.graphics","odi","application/vnd.oasis.opendocument.image","odm","application/vnd.oasis.opendocument.text-master","odp","application/vnd.oasis.opendocument.presentation","ods","application/vnd.oasis.opendocument.spreadsheet","odt","application/vnd.oasis.opendocument.text","ogg","application/ogg","old","application/x-trash","oth","application/vnd.oasis.opendocument.text-web","oza","application/x-oz-application","p","text/x-pascal","p7r","application/x-pkcs7-certreqresp","pac","application/x-ns-proxy-autoconfig","pas","text/x-pascal","pat","image/x-coreldrawpattern","pbm","image/x-portable-bitmap","pcf","application/x-font","pcf.Z","application/x-font","pcx","image/pcx","pdb","chemical/x-pdb","pdf","application/pdf","pfa","application/x-font","pfb","application/x-font","pgm","image/x-portable-graymap","pgn","application/x-chess-pgn","pgp","application/pgp-signature","pk","application/x-tex-pk","pl","text/x-perl","pls","audio/x-scpls","pm","text/x-perl","png","image/png","pnm","image/x-portable-anymap","pot","text/plain","ppm","image/x-portable-pixmap","pps","application/vnd.ms-powerpoint","ppt","application/vnd.ms-powerpoint","prf","application/pics-rules","prt","chemical/x-ncbi-asn1-ascii","ps","application/postscript","psd","image/x-photoshop","psp","text/x-psp","py","text/x-python","pyc","application/x-python-code","pyo","application/x-python-code","qt","video/quicktime","qtl","application/x-quicktimeplayer","ra","audio/x-realaudio","ram","audio/x-pn-realaudio","rar","application/rar","ras","image/x-cmu-raster","rd","chemical/x-mdl-rdfile","rdf","application/rdf+xml","rgb","image/x-rgb","rm","audio/x-pn-realaudio","roff","application/x-troff","ros","chemical/x-rosdal","rpm","application/x-redhat-package-manager","rss","application/rss+xml","rtf","text/rtf","rtx","text/richtext","rxn","chemical/x-mdl-rxnfile","sct","text/scriptlet","sd","chemical/x-mdl-sdfile","sd2","audio/x-sd2","sda","application/vnd.stardivision.draw","sdc","application/vnd.stardivision.calc","sdd","application/vnd.stardivision.impress","sdf","chemical/x-mdl-sdfile","sdp","application/vnd.stardivision.impress","sdw","application/vnd.stardivision.writer","ser","application/java-serialized-object","sgf","application/x-go-sgf","sgl","application/vnd.stardivision.writer-global","sh","text/x-sh","shar","application/x-shar","shtml","text/html","sid","audio/prs.sid","sik","application/x-trash","silo","model/mesh","sis","application/vnd.symbian.install","sit","application/x-stuffit","skd","application/x-koan","skm","application/x-koan","skp","application/x-koan","skt","application/x-koan","smf","application/vnd.stardivision.math","smi","application/smil","smil","application/smil","snd","audio/basic","spc","chemical/x-galactic-spc","spl","application/x-futuresplash","src","application/x-wais-source","stc","application/vnd.sun.xml.calc.template","std","application/vnd.sun.xml.draw.template","sti","application/vnd.sun.xml.impress.template","stl","application/vnd.ms-pki.stl","stw","application/vnd.sun.xml.writer.template","sty","text/x-tex","sv4cpio","application/x-sv4cpio","sv4crc","application/x-sv4crc","svg","image/svg+xml","svgz","image/svg+xml","sw","chemical/x-swissprot","swf","application/x-shockwave-flash","swfl","application/x-shockwave-flash","sxc","application/vnd.sun.xml.calc","sxd","application/vnd.sun.xml.draw","sxg","application/vnd.sun.xml.writer.global","sxi","application/vnd.sun.xml.impress","sxm","application/vnd.sun.xml.math","sxw","application/vnd.sun.xml.writer","t","application/x-troff","tar","application/x-tar","taz","application/x-gtar","tcl","text/x-tcl","tex","text/x-tex","texi","application/x-texinfo","texinfo","application/x-texinfo","text","text/plain","tgf","chemical/x-mdl-tgf","tgz","application/x-gtar","tif","image/tiff","tiff","image/tiff","tk","text/x-tcl","tm","text/texmacs","torrent","application/x-bittorrent","tr","application/x-troff","ts","text/texmacs","tsp","application/dsptype","tsv","text/tab-separated-values","txt","text/plain","udeb","application/x-debian-package","uls","text/iuls","ustar","application/x-ustar","val","chemical/x-ncbi-asn1-binary","vcd","application/x-cdlink","vcf","text/x-vcard","vcs","text/x-vcalendar","vmd","chemical/x-vmd","vms","chemical/x-vamas-iso14976","vor","application/vnd.stardivision.writer","vrm","x-world/x-vrml","vrml","x-world/x-vrml","vsd","application/vnd.visio","wad","application/x-doom","wav","audio/x-wav","wax","audio/x-ms-wax","wbmp","image/vnd.wap.wbmp","wbxml","application/vnd.wap.wbxml","wk","application/x-123","wm","video/x-ms-wm","wma","audio/x-ms-wma","wmd","application/x-ms-wmd","wml","text/vnd.wap.wml","wmlc","application/vnd.wap.wmlc","wmls","text/vnd.wap.wmlscript","wmlsc","application/vnd.wap.wmlscriptc","wmv","video/x-ms-wmv","wmx","video/x-ms-wmx","wmz","application/x-ms-wmz","wp5","application/wordperfect5.1","wpd","application/wordperfect","wrl","x-world/x-vrml","wsc","text/scriptlet","wvx","video/x-ms-wvx","wz","application/x-wingz","xbm","image/x-xbitmap","xcf","application/x-xcf","xht","application/xhtml+xml","xhtml","application/xhtml+xml","xlb","application/vnd.ms-excel","xls","application/vnd.ms-excel","xlt","application/vnd.ms-excel","xml","application/xml","xpi","application/x-xpinstall","xpm","image/x-xpixmap","xsl","application/xml","xtel","chemical/x-xtel","xul","application/vnd.mozilla.xul+xml","xwd","image/x-xwindowdump","xyz","chemical/x-xyz","zip","application/zip","zmt","chemical/x-mopac-input","~","application/x-trash"]);
  63140. },
  63141. args: [],
  63142. source: "defaultMimeTypes\x0a\x09^ #{\x0a\x09\x09'%' -> 'application/x-trash'.\x0a\x09\x09'323' -> 'text/h323'.\x0a\x09\x09'abw' -> 'application/x-abiword'.\x0a\x09\x09'ai' -> 'application/postscript'.\x0a\x09\x09'aif' -> 'audio/x-aiff'.\x0a\x09\x09'aifc' -> 'audio/x-aiff'.\x0a\x09\x09'aiff' -> 'audio/x-aiff'.\x0a\x09\x09'alc' -> 'chemical/x-alchemy'.\x0a\x09\x09'art' -> 'image/x-jg'.\x0a\x09\x09'asc' -> 'text/plain'.\x0a\x09\x09'asf' -> 'video/x-ms-asf'.\x0a\x09\x09'asn' -> 'chemical/x-ncbi-asn1-spec'.\x0a\x09\x09'aso' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'asx' -> 'video/x-ms-asf'.\x0a\x09\x09'au' -> 'audio/basic'.\x0a\x09\x09'avi' -> 'video/x-msvideo'.\x0a\x09\x09'b' -> 'chemical/x-molconn-Z'.\x0a\x09\x09'bak' -> 'application/x-trash'.\x0a\x09\x09'bat' -> 'application/x-msdos-program'.\x0a\x09\x09'bcpio' -> 'application/x-bcpio'.\x0a\x09\x09'bib' -> 'text/x-bibtex'.\x0a\x09\x09'bin' -> 'application/octet-stream'.\x0a\x09\x09'bmp' -> 'image/x-ms-bmp'.\x0a\x09\x09'book' -> 'application/x-maker'.\x0a\x09\x09'bsd' -> 'chemical/x-crossfire'.\x0a\x09\x09'c' -> 'text/x-csrc'.\x0a\x09\x09'c++' -> 'text/x-c++src'.\x0a\x09\x09'c3d' -> 'chemical/x-chem3d'.\x0a\x09\x09'cac' -> 'chemical/x-cache'.\x0a\x09\x09'cache' -> 'chemical/x-cache'.\x0a\x09\x09'cascii' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cat' -> 'application/vnd.ms-pki.seccat'.\x0a\x09\x09'cbin' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cc' -> 'text/x-c++src'.\x0a\x09\x09'cdf' -> 'application/x-cdf'.\x0a\x09\x09'cdr' -> 'image/x-coreldraw'.\x0a\x09\x09'cdt' -> 'image/x-coreldrawtemplate'.\x0a\x09\x09'cdx' -> 'chemical/x-cdx'.\x0a\x09\x09'cdy' -> 'application/vnd.cinderella'.\x0a\x09\x09'cef' -> 'chemical/x-cxf'.\x0a\x09\x09'cer' -> 'chemical/x-cerius'.\x0a\x09\x09'chm' -> 'chemical/x-chemdraw'.\x0a\x09\x09'chrt' -> 'application/x-kchart'.\x0a\x09\x09'cif' -> 'chemical/x-cif'.\x0a\x09\x09'class' -> 'application/java-vm'.\x0a\x09\x09'cls' -> 'text/x-tex'.\x0a\x09\x09'cmdf' -> 'chemical/x-cmdf'.\x0a\x09\x09'cml' -> 'chemical/x-cml'.\x0a\x09\x09'cod' -> 'application/vnd.rim.cod'.\x0a\x09\x09'com' -> 'application/x-msdos-program'.\x0a\x09\x09'cpa' -> 'chemical/x-compass'.\x0a\x09\x09'cpio' -> 'application/x-cpio'.\x0a\x09\x09'cpp' -> 'text/x-c++src'.\x0a\x09\x09'cpt' -> 'image/x-corelphotopaint'.\x0a\x09\x09'crl' -> 'application/x-pkcs7-crl'.\x0a\x09\x09'crt' -> 'application/x-x509-ca-cert'.\x0a\x09\x09'csf' -> 'chemical/x-cache-csf'.\x0a\x09\x09'csh' -> 'text/x-csh'.\x0a\x09\x09'csm' -> 'chemical/x-csml'.\x0a\x09\x09'csml' -> 'chemical/x-csml'.\x0a\x09\x09'css' -> 'text/css'.\x0a\x09\x09'csv' -> 'text/comma-separated-values'.\x0a\x09\x09'ctab' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'ctx' -> 'chemical/x-ctx'.\x0a\x09\x09'cu' -> 'application/cu-seeme'.\x0a\x09\x09'cub' -> 'chemical/x-gaussian-cube'.\x0a\x09\x09'cxf' -> 'chemical/x-cxf'.\x0a\x09\x09'cxx' -> 'text/x-c++src'.\x0a\x09\x09'dat' -> 'chemical/x-mopac-input'.\x0a\x09\x09'dcr' -> 'application/x-director'.\x0a\x09\x09'deb' -> 'application/x-debian-package'.\x0a\x09\x09'dif' -> 'video/dv'.\x0a\x09\x09'diff' -> 'text/plain'.\x0a\x09\x09'dir' -> 'application/x-director'.\x0a\x09\x09'djv' -> 'image/vnd.djvu'.\x0a\x09\x09'djvu' -> 'image/vnd.djvu'.\x0a\x09\x09'dl' -> 'video/dl'.\x0a\x09\x09'dll' -> 'application/x-msdos-program'.\x0a\x09\x09'dmg' -> 'application/x-apple-diskimage'.\x0a\x09\x09'dms' -> 'application/x-dms'.\x0a\x09\x09'doc' -> 'application/msword'.\x0a\x09\x09'dot' -> 'application/msword'.\x0a\x09\x09'dv' -> 'video/dv'.\x0a\x09\x09'dvi' -> 'application/x-dvi'.\x0a\x09\x09'dx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'dxr' -> 'application/x-director'.\x0a\x09\x09'emb' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'embl' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'ent' -> 'chemical/x-pdb'.\x0a\x09\x09'eps' -> 'application/postscript'.\x0a\x09\x09'etx' -> 'text/x-setext'.\x0a\x09\x09'exe' -> 'application/x-msdos-program'.\x0a\x09\x09'ez' -> 'application/andrew-inset'.\x0a\x09\x09'fb' -> 'application/x-maker'.\x0a\x09\x09'fbdoc' -> 'application/x-maker'.\x0a\x09\x09'fch' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fchk' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fig' -> 'application/x-xfig'.\x0a\x09\x09'flac' -> 'application/x-flac'.\x0a\x09\x09'fli' -> 'video/fli'.\x0a\x09\x09'fm' -> 'application/x-maker'.\x0a\x09\x09'frame' -> 'application/x-maker'.\x0a\x09\x09'frm' -> 'application/x-maker'.\x0a\x09\x09'gal' -> 'chemical/x-gaussian-log'.\x0a\x09\x09'gam' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gamin' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gau' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gcd' -> 'text/x-pcs-gcd'.\x0a\x09\x09'gcf' -> 'application/x-graphing-calculator'.\x0a\x09\x09'gcg' -> 'chemical/x-gcg8-sequence'.\x0a\x09\x09'gen' -> 'chemical/x-genbank'.\x0a\x09\x09'gf' -> 'application/x-tex-gf'.\x0a\x09\x09'gif' -> 'image/gif'.\x0a\x09\x09'gjc' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gjf' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gl' -> 'video/gl'.\x0a\x09\x09'gnumeric' -> 'application/x-gnumeric'.\x0a\x09\x09'gpt' -> 'chemical/x-mopac-graph'.\x0a\x09\x09'gsf' -> 'application/x-font'.\x0a\x09\x09'gsm' -> 'audio/x-gsm'.\x0a\x09\x09'gtar' -> 'application/x-gtar'.\x0a\x09\x09'h' -> 'text/x-chdr'.\x0a\x09\x09'h++' -> 'text/x-c++hdr'.\x0a\x09\x09'hdf' -> 'application/x-hdf'.\x0a\x09\x09'hh' -> 'text/x-c++hdr'.\x0a\x09\x09'hin' -> 'chemical/x-hin'.\x0a\x09\x09'hpp' -> 'text/x-c++hdr'.\x0a\x09\x09'hqx' -> 'application/mac-binhex40'.\x0a\x09\x09'hs' -> 'text/x-haskell'.\x0a\x09\x09'hta' -> 'application/hta'.\x0a\x09\x09'htc' -> 'text/x-component'.\x0a\x09\x09'htm' -> 'text/html'.\x0a\x09\x09'html' -> 'text/html'.\x0a\x09\x09'hxx' -> 'text/x-c++hdr'.\x0a\x09\x09'ica' -> 'application/x-ica'.\x0a\x09\x09'ice' -> 'x-conference/x-cooltalk'.\x0a\x09\x09'ico' -> 'image/x-icon'.\x0a\x09\x09'ics' -> 'text/calendar'.\x0a\x09\x09'icz' -> 'text/calendar'.\x0a\x09\x09'ief' -> 'image/ief'.\x0a\x09\x09'iges' -> 'model/iges'.\x0a\x09\x09'igs' -> 'model/iges'.\x0a\x09\x09'iii' -> 'application/x-iphone'.\x0a\x09\x09'inp' -> 'chemical/x-gamess-input'.\x0a\x09\x09'ins' -> 'application/x-internet-signup'.\x0a\x09\x09'iso' -> 'application/x-iso9660-image'.\x0a\x09\x09'isp' -> 'application/x-internet-signup'.\x0a\x09\x09'ist' -> 'chemical/x-isostar'.\x0a\x09\x09'istr' -> 'chemical/x-isostar'.\x0a\x09\x09'jad' -> 'text/vnd.sun.j2me.app-descriptor'.\x0a\x09\x09'jar' -> 'application/java-archive'.\x0a\x09\x09'java' -> 'text/x-java'.\x0a\x09\x09'jdx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'jmz' -> 'application/x-jmol'.\x0a\x09\x09'jng' -> 'image/x-jng'.\x0a\x09\x09'jnlp' -> 'application/x-java-jnlp-file'.\x0a\x09\x09'jpe' -> 'image/jpeg'.\x0a\x09\x09'jpeg' -> 'image/jpeg'.\x0a\x09\x09'jpg' -> 'image/jpeg'.\x0a\x09\x09'js' -> 'application/javascript'.\x0a\x09\x09'kar' -> 'audio/midi'.\x0a\x09\x09'key' -> 'application/pgp-keys'.\x0a\x09\x09'kil' -> 'application/x-killustrator'.\x0a\x09\x09'kin' -> 'chemical/x-kinemage'.\x0a\x09\x09'kpr' -> 'application/x-kpresenter'.\x0a\x09\x09'kpt' -> 'application/x-kpresenter'.\x0a\x09\x09'ksp' -> 'application/x-kspread'.\x0a\x09\x09'kwd' -> 'application/x-kword'.\x0a\x09\x09'kwt' -> 'application/x-kword'.\x0a\x09\x09'latex' -> 'application/x-latex'.\x0a\x09\x09'lha' -> 'application/x-lha'.\x0a\x09\x09'lhs' -> 'text/x-literate-haskell'.\x0a\x09\x09'lsf' -> 'video/x-la-asf'.\x0a\x09\x09'lsx' -> 'video/x-la-asf'.\x0a\x09\x09'ltx' -> 'text/x-tex'.\x0a\x09\x09'lzh' -> 'application/x-lzh'.\x0a\x09\x09'lzx' -> 'application/x-lzx'.\x0a\x09\x09'm3u' -> 'audio/x-mpegurl'.\x0a\x09\x09'm4a' -> 'audio/mpeg'.\x0a\x09\x09'maker' -> 'application/x-maker'.\x0a\x09\x09'man' -> 'application/x-troff-man'.\x0a\x09\x09'mcif' -> 'chemical/x-mmcif'.\x0a\x09\x09'mcm' -> 'chemical/x-macmolecule'.\x0a\x09\x09'mdb' -> 'application/msaccess'.\x0a\x09\x09'me' -> 'application/x-troff-me'.\x0a\x09\x09'mesh' -> 'model/mesh'.\x0a\x09\x09'mid' -> 'audio/midi'.\x0a\x09\x09'midi' -> 'audio/midi'.\x0a\x09\x09'mif' -> 'application/x-mif'.\x0a\x09\x09'mm' -> 'application/x-freemind'.\x0a\x09\x09'mmd' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mmf' -> 'application/vnd.smaf'.\x0a\x09\x09'mml' -> 'text/mathml'.\x0a\x09\x09'mmod' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mng' -> 'video/x-mng'.\x0a\x09\x09'moc' -> 'text/x-moc'.\x0a\x09\x09'mol' -> 'chemical/x-mdl-molfile'.\x0a\x09\x09'mol2' -> 'chemical/x-mol2'.\x0a\x09\x09'moo' -> 'chemical/x-mopac-out'.\x0a\x09\x09'mop' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mopcrt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mov' -> 'video/quicktime'.\x0a\x09\x09'movie' -> 'video/x-sgi-movie'.\x0a\x09\x09'mp2' -> 'audio/mpeg'.\x0a\x09\x09'mp3' -> 'audio/mpeg'.\x0a\x09\x09'mp4' -> 'video/mp4'.\x0a\x09\x09'mpc' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mpe' -> 'video/mpeg'.\x0a\x09\x09'mpeg' -> 'video/mpeg'.\x0a\x09\x09'mpega' -> 'audio/mpeg'.\x0a\x09\x09'mpg' -> 'video/mpeg'.\x0a\x09\x09'mpga' -> 'audio/mpeg'.\x0a\x09\x09'ms' -> 'application/x-troff-ms'.\x0a\x09\x09'msh' -> 'model/mesh'.\x0a\x09\x09'msi' -> 'application/x-msi'.\x0a\x09\x09'mvb' -> 'chemical/x-mopac-vib'.\x0a\x09\x09'mxu' -> 'video/vnd.mpegurl'.\x0a\x09\x09'nb' -> 'application/mathematica'.\x0a\x09\x09'nc' -> 'application/x-netcdf'.\x0a\x09\x09'nwc' -> 'application/x-nwc'.\x0a\x09\x09'o' -> 'application/x-object'.\x0a\x09\x09'oda' -> 'application/oda'.\x0a\x09\x09'odb' -> 'application/vnd.oasis.opendocument.database'.\x0a\x09\x09'odc' -> 'application/vnd.oasis.opendocument.chart'.\x0a\x09\x09'odf' -> 'application/vnd.oasis.opendocument.formula'.\x0a\x09\x09'odg' -> 'application/vnd.oasis.opendocument.graphics'.\x0a\x09\x09'odi' -> 'application/vnd.oasis.opendocument.image'.\x0a\x09\x09'odm' -> 'application/vnd.oasis.opendocument.text-master'.\x0a\x09\x09'odp' -> 'application/vnd.oasis.opendocument.presentation'.\x0a\x09\x09'ods' -> 'application/vnd.oasis.opendocument.spreadsheet'.\x0a\x09\x09'odt' -> 'application/vnd.oasis.opendocument.text'.\x0a\x09\x09'ogg' -> 'application/ogg'.\x0a\x09\x09'old' -> 'application/x-trash'.\x0a\x09\x09'oth' -> 'application/vnd.oasis.opendocument.text-web'.\x0a\x09\x09'oza' -> 'application/x-oz-application'.\x0a\x09\x09'p' -> 'text/x-pascal'.\x0a\x09\x09'p7r' -> 'application/x-pkcs7-certreqresp'.\x0a\x09\x09'pac' -> 'application/x-ns-proxy-autoconfig'.\x0a\x09\x09'pas' -> 'text/x-pascal'.\x0a\x09\x09'pat' -> 'image/x-coreldrawpattern'.\x0a\x09\x09'pbm' -> 'image/x-portable-bitmap'.\x0a\x09\x09'pcf' -> 'application/x-font'.\x0a\x09\x09'pcf.Z' -> 'application/x-font'.\x0a\x09\x09'pcx' -> 'image/pcx'.\x0a\x09\x09'pdb' -> 'chemical/x-pdb'.\x0a\x09\x09'pdf' -> 'application/pdf'.\x0a\x09\x09'pfa' -> 'application/x-font'.\x0a\x09\x09'pfb' -> 'application/x-font'.\x0a\x09\x09'pgm' -> 'image/x-portable-graymap'.\x0a\x09\x09'pgn' -> 'application/x-chess-pgn'.\x0a\x09\x09'pgp' -> 'application/pgp-signature'.\x0a\x09\x09'pk' -> 'application/x-tex-pk'.\x0a\x09\x09'pl' -> 'text/x-perl'.\x0a\x09\x09'pls' -> 'audio/x-scpls'.\x0a\x09\x09'pm' -> 'text/x-perl'.\x0a\x09\x09'png' -> 'image/png'.\x0a\x09\x09'pnm' -> 'image/x-portable-anymap'.\x0a\x09\x09'pot' -> 'text/plain'.\x0a\x09\x09'ppm' -> 'image/x-portable-pixmap'.\x0a\x09\x09'pps' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'ppt' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'prf' -> 'application/pics-rules'.\x0a\x09\x09'prt' -> 'chemical/x-ncbi-asn1-ascii'.\x0a\x09\x09'ps' -> 'application/postscript'.\x0a\x09\x09'psd' -> 'image/x-photoshop'.\x0a\x09\x09'psp' -> 'text/x-psp'.\x0a\x09\x09'py' -> 'text/x-python'.\x0a\x09\x09'pyc' -> 'application/x-python-code'.\x0a\x09\x09'pyo' -> 'application/x-python-code'.\x0a\x09\x09'qt' -> 'video/quicktime'.\x0a\x09\x09'qtl' -> 'application/x-quicktimeplayer'.\x0a\x09\x09'ra' -> 'audio/x-realaudio'.\x0a\x09\x09'ram' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'rar' -> 'application/rar'.\x0a\x09\x09'ras' -> 'image/x-cmu-raster'.\x0a\x09\x09'rd' -> 'chemical/x-mdl-rdfile'.\x0a\x09\x09'rdf' -> 'application/rdf+xml'.\x0a\x09\x09'rgb' -> 'image/x-rgb'.\x0a\x09\x09'rm' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'roff' -> 'application/x-troff'.\x0a\x09\x09'ros' -> 'chemical/x-rosdal'.\x0a\x09\x09'rpm' -> 'application/x-redhat-package-manager'.\x0a\x09\x09'rss' -> 'application/rss+xml'.\x0a\x09\x09'rtf' -> 'text/rtf'.\x0a\x09\x09'rtx' -> 'text/richtext'.\x0a\x09\x09'rxn' -> 'chemical/x-mdl-rxnfile'.\x0a\x09\x09'sct' -> 'text/scriptlet'.\x0a\x09\x09'sd' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sd2' -> 'audio/x-sd2'.\x0a\x09\x09'sda' -> 'application/vnd.stardivision.draw'.\x0a\x09\x09'sdc' -> 'application/vnd.stardivision.calc'.\x0a\x09\x09'sdd' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdf' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sdp' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdw' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'ser' -> 'application/java-serialized-object'.\x0a\x09\x09'sgf' -> 'application/x-go-sgf'.\x0a\x09\x09'sgl' -> 'application/vnd.stardivision.writer-global'.\x0a\x09\x09'sh' -> 'text/x-sh'.\x0a\x09\x09'shar' -> 'application/x-shar'.\x0a\x09\x09'shtml' -> 'text/html'.\x0a\x09\x09'sid' -> 'audio/prs.sid'.\x0a\x09\x09'sik' -> 'application/x-trash'.\x0a\x09\x09'silo' -> 'model/mesh'.\x0a\x09\x09'sis' -> 'application/vnd.symbian.install'.\x0a\x09\x09'sit' -> 'application/x-stuffit'.\x0a\x09\x09'skd' -> 'application/x-koan'.\x0a\x09\x09'skm' -> 'application/x-koan'.\x0a\x09\x09'skp' -> 'application/x-koan'.\x0a\x09\x09'skt' -> 'application/x-koan'.\x0a\x09\x09'smf' -> 'application/vnd.stardivision.math'.\x0a\x09\x09'smi' -> 'application/smil'.\x0a\x09\x09'smil' -> 'application/smil'.\x0a\x09\x09'snd' -> 'audio/basic'.\x0a\x09\x09'spc' -> 'chemical/x-galactic-spc'.\x0a\x09\x09'spl' -> 'application/x-futuresplash'.\x0a\x09\x09'src' -> 'application/x-wais-source'.\x0a\x09\x09'stc' -> 'application/vnd.sun.xml.calc.template'.\x0a\x09\x09'std' -> 'application/vnd.sun.xml.draw.template'.\x0a\x09\x09'sti' -> 'application/vnd.sun.xml.impress.template'.\x0a\x09\x09'stl' -> 'application/vnd.ms-pki.stl'.\x0a\x09\x09'stw' -> 'application/vnd.sun.xml.writer.template'.\x0a\x09\x09'sty' -> 'text/x-tex'.\x0a\x09\x09'sv4cpio' -> 'application/x-sv4cpio'.\x0a\x09\x09'sv4crc' -> 'application/x-sv4crc'.\x0a\x09\x09'svg' -> 'image/svg+xml'.\x0a\x09\x09'svgz' -> 'image/svg+xml'.\x0a\x09\x09'sw' -> 'chemical/x-swissprot'.\x0a\x09\x09'swf' -> 'application/x-shockwave-flash'.\x0a\x09\x09'swfl' -> 'application/x-shockwave-flash'.\x0a\x09\x09'sxc' -> 'application/vnd.sun.xml.calc'.\x0a\x09\x09'sxd' -> 'application/vnd.sun.xml.draw'.\x0a\x09\x09'sxg' -> 'application/vnd.sun.xml.writer.global'.\x0a\x09\x09'sxi' -> 'application/vnd.sun.xml.impress'.\x0a\x09\x09'sxm' -> 'application/vnd.sun.xml.math'.\x0a\x09\x09'sxw' -> 'application/vnd.sun.xml.writer'.\x0a\x09\x09't' -> 'application/x-troff'.\x0a\x09\x09'tar' -> 'application/x-tar'.\x0a\x09\x09'taz' -> 'application/x-gtar'.\x0a\x09\x09'tcl' -> 'text/x-tcl'.\x0a\x09\x09'tex' -> 'text/x-tex'.\x0a\x09\x09'texi' -> 'application/x-texinfo'.\x0a\x09\x09'texinfo' -> 'application/x-texinfo'.\x0a\x09\x09'text' -> 'text/plain'.\x0a\x09\x09'tgf' -> 'chemical/x-mdl-tgf'.\x0a\x09\x09'tgz' -> 'application/x-gtar'.\x0a\x09\x09'tif' -> 'image/tiff'.\x0a\x09\x09'tiff' -> 'image/tiff'.\x0a\x09\x09'tk' -> 'text/x-tcl'.\x0a\x09\x09'tm' -> 'text/texmacs'.\x0a\x09\x09'torrent' -> 'application/x-bittorrent'.\x0a\x09\x09'tr' -> 'application/x-troff'.\x0a\x09\x09'ts' -> 'text/texmacs'.\x0a\x09\x09'tsp' -> 'application/dsptype'.\x0a\x09\x09'tsv' -> 'text/tab-separated-values'.\x0a\x09\x09'txt' -> 'text/plain'.\x0a\x09\x09'udeb' -> 'application/x-debian-package'.\x0a\x09\x09'uls' -> 'text/iuls'.\x0a\x09\x09'ustar' -> 'application/x-ustar'.\x0a\x09\x09'val' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'vcd' -> 'application/x-cdlink'.\x0a\x09\x09'vcf' -> 'text/x-vcard'.\x0a\x09\x09'vcs' -> 'text/x-vcalendar'.\x0a\x09\x09'vmd' -> 'chemical/x-vmd'.\x0a\x09\x09'vms' -> 'chemical/x-vamas-iso14976'.\x0a\x09\x09'vor' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'vrm' -> 'x-world/x-vrml'.\x0a\x09\x09'vrml' -> 'x-world/x-vrml'.\x0a\x09\x09'vsd' -> 'application/vnd.visio'.\x0a\x09\x09'wad' -> 'application/x-doom'.\x0a\x09\x09'wav' -> 'audio/x-wav'.\x0a\x09\x09'wax' -> 'audio/x-ms-wax'.\x0a\x09\x09'wbmp' -> 'image/vnd.wap.wbmp'.\x0a\x09\x09'wbxml' -> 'application/vnd.wap.wbxml'.\x0a\x09\x09'wk' -> 'application/x-123'.\x0a\x09\x09'wm' -> 'video/x-ms-wm'.\x0a\x09\x09'wma' -> 'audio/x-ms-wma'.\x0a\x09\x09'wmd' -> 'application/x-ms-wmd'.\x0a\x09\x09'wml' -> 'text/vnd.wap.wml'.\x0a\x09\x09'wmlc' -> 'application/vnd.wap.wmlc'.\x0a\x09\x09'wmls' -> 'text/vnd.wap.wmlscript'.\x0a\x09\x09'wmlsc' -> 'application/vnd.wap.wmlscriptc'.\x0a\x09\x09'wmv' -> 'video/x-ms-wmv'.\x0a\x09\x09'wmx' -> 'video/x-ms-wmx'.\x0a\x09\x09'wmz' -> 'application/x-ms-wmz'.\x0a\x09\x09'wp5' -> 'application/wordperfect5.1'.\x0a\x09\x09'wpd' -> 'application/wordperfect'.\x0a\x09\x09'wrl' -> 'x-world/x-vrml'.\x0a\x09\x09'wsc' -> 'text/scriptlet'.\x0a\x09\x09'wvx' -> 'video/x-ms-wvx'.\x0a\x09\x09'wz' -> 'application/x-wingz'.\x0a\x09\x09'xbm' -> 'image/x-xbitmap'.\x0a\x09\x09'xcf' -> 'application/x-xcf'.\x0a\x09\x09'xht' -> 'application/xhtml+xml'.\x0a\x09\x09'xhtml' -> 'application/xhtml+xml'.\x0a\x09\x09'xlb' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xls' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xlt' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xml' -> 'application/xml'.\x0a\x09\x09'xpi' -> 'application/x-xpinstall'.\x0a\x09\x09'xpm' -> 'image/x-xpixmap'.\x0a\x09\x09'xsl' -> 'application/xml'.\x0a\x09\x09'xtel' -> 'chemical/x-xtel'.\x0a\x09\x09'xul' -> 'application/vnd.mozilla.xul+xml'.\x0a\x09\x09'xwd' -> 'image/x-xwindowdump'.\x0a\x09\x09'xyz' -> 'chemical/x-xyz'.\x0a\x09\x09'zip' -> 'application/zip'.\x0a\x09\x09'zmt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'~' -> 'application/x-trash'\x0a\x09}",
  63143. referencedClasses: [],
  63144. messageSends: []
  63145. }),
  63146. $globals.FileServer.a$cls);
  63147. $core.addMethod(
  63148. $core.method({
  63149. selector: "defaultPort",
  63150. protocol: "accessing",
  63151. fn: function (){
  63152. var self=this,$self=this;
  63153. return (4000);
  63154. },
  63155. args: [],
  63156. source: "defaultPort\x0a\x09^ 4000",
  63157. referencedClasses: [],
  63158. messageSends: []
  63159. }),
  63160. $globals.FileServer.a$cls);
  63161. $core.addMethod(
  63162. $core.method({
  63163. selector: "main",
  63164. protocol: "initialization",
  63165. fn: function (){
  63166. var self=this,$self=this;
  63167. var fileServer,args;
  63168. return $core.withContext(function($ctx1) {
  63169. var $1;
  63170. var $early={};
  63171. try {
  63172. args=$recv(process)._argv();
  63173. $recv(args)._removeFrom_to_((1),(3));
  63174. $recv(args)._detect_ifNone_((function(each){
  63175. return $core.withContext(function($ctx2) {
  63176. $1=$recv(each).__eq("--help");
  63177. if($core.assert($1)){
  63178. return $recv($globals.FileServer)._printHelp();
  63179. }
  63180. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63181. }),(function(){
  63182. return $core.withContext(function($ctx2) {
  63183. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63184. throw $early=[$recv(fileServer)._start()];
  63185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63186. }));
  63187. return self;
  63188. }
  63189. catch(e) {if(e===$early)return e[0]; throw e}
  63190. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63191. },
  63192. args: [],
  63193. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09 Creates and starts a FileServer instance.\x22\x0a\x09| fileServer args |\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 3.\x0a\x0a\x09args detect: [ :each |\x0a\x09\x09(each = '--help') ifTrue: [FileServer printHelp]]\x0a\x09ifNone: [\x0a\x09\x09fileServer := FileServer createServerWithArguments: args.\x0a\x09\x09^ fileServer start]",
  63194. referencedClasses: ["FileServer"],
  63195. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63196. }),
  63197. $globals.FileServer.a$cls);
  63198. $core.addMethod(
  63199. $core.method({
  63200. selector: "mimeTypeFor:",
  63201. protocol: "accessing",
  63202. fn: function (aString){
  63203. var self=this,$self=this;
  63204. return $core.withContext(function($ctx1) {
  63205. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63206. return "text/plain";
  63207. }));
  63208. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63209. },
  63210. args: ["aString"],
  63211. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63212. referencedClasses: [],
  63213. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63214. }),
  63215. $globals.FileServer.a$cls);
  63216. $core.addMethod(
  63217. $core.method({
  63218. selector: "mimeTypes",
  63219. protocol: "accessing",
  63220. fn: function (){
  63221. var self=this,$self=this;
  63222. return $core.withContext(function($ctx1) {
  63223. var $1,$receiver;
  63224. $1=$self["@mimeTypes"];
  63225. if(($receiver = $1) == null || $receiver.a$nil){
  63226. $self["@mimeTypes"]=$self._defaultMimeTypes();
  63227. return $self["@mimeTypes"];
  63228. } else {
  63229. return $1;
  63230. }
  63231. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63232. },
  63233. args: [],
  63234. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63235. referencedClasses: [],
  63236. messageSends: ["ifNil:", "defaultMimeTypes"]
  63237. }),
  63238. $globals.FileServer.a$cls);
  63239. $core.addMethod(
  63240. $core.method({
  63241. selector: "printHelp",
  63242. protocol: "accessing",
  63243. fn: function (){
  63244. var self=this,$self=this;
  63245. return $core.withContext(function($ctx1) {
  63246. $recv(console)._log_("Available commandline options are:");
  63247. $ctx1.sendIdx["log:"]=1;
  63248. $recv(console)._log_("--help");
  63249. $ctx1.sendIdx["log:"]=2;
  63250. $recv($self._commandLineSwitches())._do_((function(each){
  63251. return $core.withContext(function($ctx2) {
  63252. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63253. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63254. }));
  63255. return self;
  63256. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63257. },
  63258. args: [],
  63259. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63260. referencedClasses: [],
  63261. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63262. }),
  63263. $globals.FileServer.a$cls);
  63264. $core.addMethod(
  63265. $core.method({
  63266. selector: "selectorForCommandLineSwitch:",
  63267. protocol: "accessing",
  63268. fn: function (aSwitch){
  63269. var self=this,$self=this;
  63270. return $core.withContext(function($ctx1) {
  63271. var $1;
  63272. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63273. return $core.withContext(function($ctx2) {
  63274. return $recv($recv(each)._second())._asUppercase();
  63275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63276. }));
  63277. $ctx1.sendIdx["replace:with:"]=1;
  63278. return $recv($1).__comma(":");
  63279. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63280. },
  63281. args: ["aSwitch"],
  63282. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Remove the trailing '--', add ':' at the end\x0a\x09 and replace all occurences of a lowercase letter preceded by a '-' with\x0a\x09 the Uppercase letter.\x0a\x09 Example: --fallback-page becomes fallbackPage:\x22\x0a\x09^ ((aSwitch replace: '^--' with: '')\x0a\x09\x09replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':'",
  63283. referencedClasses: [],
  63284. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63285. }),
  63286. $globals.FileServer.a$cls);
  63287. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63288. $core.addMethod(
  63289. $core.method({
  63290. selector: "bowerInstallThenDo:",
  63291. protocol: "action",
  63292. fn: function (aBlock){
  63293. var self=this,$self=this;
  63294. var child;
  63295. return $core.withContext(function($ctx1) {
  63296. var $1,$3,$2;
  63297. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("bower","bower"),["install"]);
  63298. $1=child;
  63299. $recv($1)._on_do_("error",aBlock);
  63300. $ctx1.sendIdx["on:do:"]=1;
  63301. $recv($1)._on_do_("close",(function(code){
  63302. return $core.withContext(function($ctx2) {
  63303. $3=$recv(code).__eq((0));
  63304. if($core.assert($3)){
  63305. $2=nil;
  63306. } else {
  63307. $2=code;
  63308. }
  63309. return $recv(aBlock)._value_($2);
  63310. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63311. }));
  63312. return self;
  63313. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63314. },
  63315. args: ["aBlock"],
  63316. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'bower' named: 'bower')\x0a\x09\x09args: #('install').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  63317. referencedClasses: [],
  63318. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63319. }),
  63320. $globals.Initer);
  63321. $core.addMethod(
  63322. $core.method({
  63323. selector: "finishMessage",
  63324. protocol: "action",
  63325. fn: function (){
  63326. var self=this,$self=this;
  63327. return $core.withContext(function($ctx1) {
  63328. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63329. $recv((function(){
  63330. }))._valueWithTimeout_((600));
  63331. return self;
  63332. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63333. },
  63334. args: [],
  63335. source: "finishMessage\x0a\x09console log: (#(\x0a\x09\x09' '\x0a\x09\x09'The project should now be set up.'\x0a\x09\x09' '\x0a\x09\x09' '\x0a\x09) join: String lf).\x0a\x09[] valueWithTimeout: 600",
  63336. referencedClasses: ["String"],
  63337. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63338. }),
  63339. $globals.Initer);
  63340. $core.addMethod(
  63341. $core.method({
  63342. selector: "gruntInitThenDo:",
  63343. protocol: "action",
  63344. fn: function (aBlock){
  63345. var self=this,$self=this;
  63346. var child,sanitizedTemplatePath;
  63347. return $core.withContext(function($ctx1) {
  63348. var $1,$3,$2;
  63349. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63350. $ctx1.sendIdx["replace:with:"]=1;
  63351. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63352. $1=child;
  63353. $recv($1)._on_do_("error",aBlock);
  63354. $ctx1.sendIdx["on:do:"]=1;
  63355. $recv($1)._on_do_("close",(function(code){
  63356. return $core.withContext(function($ctx2) {
  63357. $3=$recv(code).__eq((0));
  63358. if($core.assert($3)){
  63359. $2=nil;
  63360. } else {
  63361. $2=code;
  63362. }
  63363. return $recv(aBlock)._value_($2);
  63364. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63365. }));
  63366. return self;
  63367. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63368. },
  63369. args: ["aBlock"],
  63370. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: '@ambers/grunt-init-amber-project')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  63371. referencedClasses: [],
  63372. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63373. }),
  63374. $globals.Initer);
  63375. $core.addMethod(
  63376. $core.method({
  63377. selector: "gruntThenDo:",
  63378. protocol: "action",
  63379. fn: function (aBlock){
  63380. var self=this,$self=this;
  63381. var child;
  63382. return $core.withContext(function($ctx1) {
  63383. var $1,$3,$2;
  63384. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  63385. $1=child;
  63386. $recv($1)._on_do_("error",aBlock);
  63387. $ctx1.sendIdx["on:do:"]=1;
  63388. $recv($1)._on_do_("close",(function(code){
  63389. return $core.withContext(function($ctx2) {
  63390. $3=$recv(code).__eq((0));
  63391. if($core.assert($3)){
  63392. $2=nil;
  63393. } else {
  63394. $2=code;
  63395. }
  63396. return $recv(aBlock)._value_($2);
  63397. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63398. }));
  63399. return self;
  63400. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63401. },
  63402. args: ["aBlock"],
  63403. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-cli' named: 'grunt')\x0a\x09\x09args: #('default' 'devel').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  63404. referencedClasses: [],
  63405. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63406. }),
  63407. $globals.Initer);
  63408. $core.addMethod(
  63409. $core.method({
  63410. selector: "initialize",
  63411. protocol: "initialization",
  63412. fn: function (){
  63413. var self=this,$self=this;
  63414. return $core.withContext(function($ctx1) {
  63415. (
  63416. $ctx1.supercall = true,
  63417. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63418. $ctx1.supercall = false;
  63419. $self["@childProcess"]=$recv(require)._value_("child_process");
  63420. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63421. return self;
  63422. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63423. },
  63424. args: [],
  63425. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63426. referencedClasses: [],
  63427. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63428. }),
  63429. $globals.Initer);
  63430. $core.addMethod(
  63431. $core.method({
  63432. selector: "npmInstallThenDo:",
  63433. protocol: "action",
  63434. fn: function (aBlock){
  63435. var self=this,$self=this;
  63436. var child;
  63437. return $core.withContext(function($ctx1) {
  63438. var $1;
  63439. child=$recv($self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  63440. $1=$recv(child)._stdout();
  63441. $ctx1.sendIdx["stdout"]=1;
  63442. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63443. return self;
  63444. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63445. },
  63446. args: ["aBlock"],
  63447. source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  63448. referencedClasses: [],
  63449. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63450. }),
  63451. $globals.Initer);
  63452. $core.addMethod(
  63453. $core.method({
  63454. selector: "npmScriptForModule:named:",
  63455. protocol: "npm",
  63456. fn: function (aString,anotherString){
  63457. var self=this,$self=this;
  63458. var modulePath,packageJson,binSection,scriptPath;
  63459. return $core.withContext(function($ctx1) {
  63460. var $1,$3,$4,$2,$5;
  63461. $1=$self["@path"];
  63462. $3=$recv($globals.JSObjectProxy)._on_(require);
  63463. $4=$recv(aString).__comma("/package.json");
  63464. $ctx1.sendIdx[","]=1;
  63465. $2=$recv($3)._resolve_($4);
  63466. modulePath=$recv($1)._dirname_($2);
  63467. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63468. binSection=$recv(packageJson)._at_("bin");
  63469. $ctx1.sendIdx["at:"]=1;
  63470. $5=$recv(binSection)._isString();
  63471. if($core.assert($5)){
  63472. scriptPath=binSection;
  63473. } else {
  63474. scriptPath=$recv(binSection)._at_(anotherString);
  63475. }
  63476. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63477. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63478. },
  63479. args: ["aString", "anotherString"],
  63480. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  63481. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  63482. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63483. }),
  63484. $globals.Initer);
  63485. $core.addMethod(
  63486. $core.method({
  63487. selector: "start",
  63488. protocol: "action",
  63489. fn: function (){
  63490. var self=this,$self=this;
  63491. return $core.withContext(function($ctx1) {
  63492. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  63493. $self._gruntInitThenDo_((function(error){
  63494. return $core.withContext(function($ctx2) {
  63495. if(($receiver = error) == null || $receiver.a$nil){
  63496. return $self._bowerInstallThenDo_((function(error2){
  63497. return $core.withContext(function($ctx3) {
  63498. if(($receiver = error2) == null || $receiver.a$nil){
  63499. return $self._npmInstallThenDo_((function(error3){
  63500. return $core.withContext(function($ctx4) {
  63501. if(($receiver = error3) == null || $receiver.a$nil){
  63502. return $self._gruntThenDo_((function(error4){
  63503. return $core.withContext(function($ctx5) {
  63504. if(($receiver = error4) == null || $receiver.a$nil){
  63505. $self._finishMessage();
  63506. return $recv(process)._exit();
  63507. } else {
  63508. $7=console;
  63509. $recv($7)._log_("grunt exec error:");
  63510. $ctx5.sendIdx["log:"]=7;
  63511. $recv($7)._log_(error4);
  63512. return $recv(process)._exit_((104));
  63513. }
  63514. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  63515. }));
  63516. } else {
  63517. $5=console;
  63518. $recv($5)._log_("npm install exec error:");
  63519. $ctx4.sendIdx["log:"]=5;
  63520. $6=$recv($5)._log_(error3);
  63521. $ctx4.sendIdx["log:"]=6;
  63522. return $recv(process)._exit_((103));
  63523. $ctx4.sendIdx["exit:"]=3;
  63524. }
  63525. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  63526. }));
  63527. } else {
  63528. $3=console;
  63529. $recv($3)._log_("bower install exec error:");
  63530. $ctx3.sendIdx["log:"]=3;
  63531. $4=$recv($3)._log_(error2);
  63532. $ctx3.sendIdx["log:"]=4;
  63533. return $recv(process)._exit_((102));
  63534. $ctx3.sendIdx["exit:"]=2;
  63535. }
  63536. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63537. }));
  63538. } else {
  63539. $1=console;
  63540. $recv($1)._log_("grunt-init exec error:");
  63541. $ctx2.sendIdx["log:"]=1;
  63542. $2=$recv($1)._log_(error);
  63543. $ctx2.sendIdx["log:"]=2;
  63544. return $recv(process)._exit_((101));
  63545. $ctx2.sendIdx["exit:"]=1;
  63546. }
  63547. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63548. }));
  63549. return self;
  63550. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63551. },
  63552. args: [],
  63553. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit: 102 ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit: 103 ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit: 104 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]",
  63554. referencedClasses: [],
  63555. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  63556. }),
  63557. $globals.Initer);
  63558. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63559. $globals.Repl.comment="I am a class representing a REPL (Read Evaluate Print Loop) and provide a command line interface to Amber Smalltalk.\x0aOn the prompt you can type Amber statements which will be evaluated after pressing <Enter>.\x0aThe evaluation is comparable with executing a 'DoIt' in a workspace.\x0a\x0aMy runtime requirement is a functional Node.js executable with working Readline support.";
  63560. $core.addMethod(
  63561. $core.method({
  63562. selector: "addVariableNamed:to:",
  63563. protocol: "private",
  63564. fn: function (aString,anObject){
  63565. var self=this,$self=this;
  63566. var newClass,newObject;
  63567. return $core.withContext(function($ctx1) {
  63568. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63569. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63570. newObject=$recv(newClass)._new();
  63571. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63572. return newObject;
  63573. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63574. },
  63575. args: ["aString", "anObject"],
  63576. source: "addVariableNamed: aString to: anObject\x0a\x09| newClass newObject |\x0a\x09newClass := self subclass: anObject class withVariable: aString.\x0a\x09self encapsulateVariable: aString withValue: anObject in: newClass.\x0a\x09newObject := newClass new.\x0a\x09self setPreviousVariablesFor: newObject from: anObject.\x0a\x09^ newObject",
  63577. referencedClasses: [],
  63578. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63579. }),
  63580. $globals.Repl);
  63581. $core.addMethod(
  63582. $core.method({
  63583. selector: "assignNewVariable:do:",
  63584. protocol: "private",
  63585. fn: function (buffer,aBlock){
  63586. var self=this,$self=this;
  63587. return $core.withContext(function($ctx1) {
  63588. var $2,$3,$1,$receiver;
  63589. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63590. var varName,value;
  63591. return $core.withContext(function($ctx2) {
  63592. if(($receiver = name) == null || $receiver.a$nil){
  63593. varName=$self._nextResultName();
  63594. } else {
  63595. varName=name;
  63596. }
  63597. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63598. $recv((function(){
  63599. return $core.withContext(function($ctx3) {
  63600. $2=$recv(varName).__comma(" := ");
  63601. if(($receiver = expr) == null || $receiver.a$nil){
  63602. $3=buffer;
  63603. } else {
  63604. $3=expr;
  63605. }
  63606. $1=$recv($2).__comma($3);
  63607. $ctx3.sendIdx[","]=1;
  63608. value=$self._eval_on_($1,$self["@session"]);
  63609. return value;
  63610. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63611. }))._on_do_($globals.Error,(function(e){
  63612. return $core.withContext(function($ctx3) {
  63613. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63614. value=nil;
  63615. return value;
  63616. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63617. }));
  63618. return $recv(aBlock)._value_value_(varName,value);
  63619. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63620. }));
  63621. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63622. },
  63623. args: ["buffer", "aBlock"],
  63624. source: "assignNewVariable: buffer do: aBlock\x0a\x09\x22Assigns a new variable and calls the given block with the variable's name and value\x0a\x09 if buffer contains an assignment expression. If it doesn't the block is called with nil for\x0a\x09 both arguments.\x22\x0a\x09^ self parseAssignment: buffer do: [ :name :expr || varName value |\x0a\x09\x09varName := name ifNil: [self nextResultName].\x0a\x09\x09session := self addVariableNamed: varName to: session.\x0a\x09\x09[ value := self eval: varName, ' := ', (expr ifNil: [buffer]) on: session ]\x0a\x09\x09\x09on: Error\x0a\x09\x09\x09do: [ :e | ConsoleErrorHandler new logError: e. value := nil].\x0a\x09\x09aBlock value: varName value: value]",
  63625. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63626. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63627. }),
  63628. $globals.Repl);
  63629. $core.addMethod(
  63630. $core.method({
  63631. selector: "clearScreen",
  63632. protocol: "actions",
  63633. fn: function (){
  63634. var self=this,$self=this;
  63635. var esc,cls;
  63636. return $core.withContext(function($ctx1) {
  63637. var $1;
  63638. esc=$recv($globals.String)._fromCharCode_((27));
  63639. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63640. $ctx1.sendIdx[","]=2;
  63641. cls=$recv($1).__comma("[0;0f");
  63642. $ctx1.sendIdx[","]=1;
  63643. $recv($recv(process)._stdout())._write_(cls);
  63644. $recv($self["@interface"])._prompt();
  63645. return self;
  63646. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63647. },
  63648. args: [],
  63649. source: "clearScreen\x0a\x09| esc cls |\x0a\x09esc := String fromCharCode: 27.\x0a\x09cls := esc, '[2J', esc, '[0;0f'.\x0a\x09process stdout write: cls.\x0a\x09interface prompt",
  63650. referencedClasses: ["String"],
  63651. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63652. }),
  63653. $globals.Repl);
  63654. $core.addMethod(
  63655. $core.method({
  63656. selector: "close",
  63657. protocol: "actions",
  63658. fn: function (){
  63659. var self=this,$self=this;
  63660. return $core.withContext(function($ctx1) {
  63661. $recv($recv(process)._stdin())._destroy();
  63662. return self;
  63663. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63664. },
  63665. args: [],
  63666. source: "close\x0a\x09process stdin destroy",
  63667. referencedClasses: [],
  63668. messageSends: ["destroy", "stdin"]
  63669. }),
  63670. $globals.Repl);
  63671. $core.addMethod(
  63672. $core.method({
  63673. selector: "commands",
  63674. protocol: "accessing",
  63675. fn: function (){
  63676. var self=this,$self=this;
  63677. return $self["@commands"];
  63678. },
  63679. args: [],
  63680. source: "commands\x0a\x09^ commands",
  63681. referencedClasses: [],
  63682. messageSends: []
  63683. }),
  63684. $globals.Repl);
  63685. $core.addMethod(
  63686. $core.method({
  63687. selector: "createInterface",
  63688. protocol: "actions",
  63689. fn: function (){
  63690. var self=this,$self=this;
  63691. return $core.withContext(function($ctx1) {
  63692. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63693. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63694. return $core.withContext(function($ctx2) {
  63695. return $self._processLine_(buffer);
  63696. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63697. }));
  63698. $ctx1.sendIdx["on:do:"]=1;
  63699. $recv($self["@interface"])._on_do_("close",(function(){
  63700. return $core.withContext(function($ctx2) {
  63701. return $self._close();
  63702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63703. }));
  63704. $self._printWelcome();
  63705. $self._setupHotkeys();
  63706. $self._setPrompt();
  63707. $recv($self["@interface"])._prompt();
  63708. return self;
  63709. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63710. },
  63711. args: [],
  63712. source: "createInterface\x0a\x09interface := readline createInterface: process stdin stdout: process stdout.\x0a\x09interface on: 'line' do: [:buffer | self processLine: buffer].\x0a\x09interface on: 'close' do: [self close].\x0a\x09self printWelcome; setupHotkeys; setPrompt.\x0a\x09interface prompt",
  63713. referencedClasses: [],
  63714. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63715. }),
  63716. $globals.Repl);
  63717. $core.addMethod(
  63718. $core.method({
  63719. selector: "encapsulateVariable:withValue:in:",
  63720. protocol: "private",
  63721. fn: function (aString,anObject,aClass){
  63722. var self=this,$self=this;
  63723. var compiler;
  63724. return $core.withContext(function($ctx1) {
  63725. var $1,$4,$3,$2,$5,$6;
  63726. compiler=$recv($globals.Compiler)._new();
  63727. $1=compiler;
  63728. $4=$recv(aString).__comma(": anObject ^ ");
  63729. $ctx1.sendIdx[","]=3;
  63730. $3=$recv($4).__comma(aString);
  63731. $ctx1.sendIdx[","]=2;
  63732. $2=$recv($3).__comma(" := anObject");
  63733. $ctx1.sendIdx[","]=1;
  63734. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63735. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63736. $5=compiler;
  63737. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63738. $ctx1.sendIdx[","]=4;
  63739. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63740. return self;
  63741. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63742. },
  63743. args: ["aString", "anObject", "aClass"],
  63744. source: "encapsulateVariable: aString withValue: anObject in: aClass\x0a\x09\x22Add getter and setter for given variable to session.\x22\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09compiler install: aString, ': anObject ^ ', aString, ' := anObject' forClass: aClass protocol: 'session'.\x0a\x09compiler install: aString, ' ^ ', aString forClass: aClass protocol: 'session'.",
  63745. referencedClasses: ["Compiler"],
  63746. messageSends: ["new", "install:forClass:protocol:", ","]
  63747. }),
  63748. $globals.Repl);
  63749. $core.addMethod(
  63750. $core.method({
  63751. selector: "eval:",
  63752. protocol: "actions",
  63753. fn: function (buffer){
  63754. var self=this,$self=this;
  63755. return $core.withContext(function($ctx1) {
  63756. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63757. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63758. },
  63759. args: ["buffer"],
  63760. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63761. referencedClasses: ["DoIt"],
  63762. messageSends: ["eval:on:", "new"]
  63763. }),
  63764. $globals.Repl);
  63765. $core.addMethod(
  63766. $core.method({
  63767. selector: "eval:on:",
  63768. protocol: "actions",
  63769. fn: function (buffer,anObject){
  63770. var self=this,$self=this;
  63771. var result;
  63772. return $core.withContext(function($ctx1) {
  63773. var $1;
  63774. $recv(buffer)._ifNotEmpty_((function(){
  63775. return $core.withContext(function($ctx2) {
  63776. return $recv((function(){
  63777. return $core.withContext(function($ctx3) {
  63778. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63779. return result;
  63780. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63781. }))._tryCatch_((function(e){
  63782. return $core.withContext(function($ctx3) {
  63783. $1=$recv(e)._isSmalltalkError();
  63784. if($core.assert($1)){
  63785. return $recv(e)._resignal();
  63786. } else {
  63787. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63788. }
  63789. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63790. }));
  63791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63792. }));
  63793. return result;
  63794. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63795. },
  63796. args: ["buffer", "anObject"],
  63797. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer ifNotEmpty: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09\x09ifTrue: [ e resignal ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  63798. referencedClasses: ["Compiler"],
  63799. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  63800. }),
  63801. $globals.Repl);
  63802. $core.addMethod(
  63803. $core.method({
  63804. selector: "executeCommand:",
  63805. protocol: "private",
  63806. fn: function (aString){
  63807. var self=this,$self=this;
  63808. return $core.withContext(function($ctx1) {
  63809. var $1;
  63810. var $early={};
  63811. try {
  63812. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63813. return $core.withContext(function($ctx2) {
  63814. $1=$recv(names)._includes_(aString);
  63815. if($core.assert($1)){
  63816. $recv(cmd)._value();
  63817. throw $early=[true];
  63818. }
  63819. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63820. }));
  63821. return false;
  63822. }
  63823. catch(e) {if(e===$early)return e[0]; throw e}
  63824. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63825. },
  63826. args: ["aString"],
  63827. source: "executeCommand: aString\x0a\x09\x22Tries to process the given string as a command. Returns true if it was a command, false if not.\x22\x0a\x09self commands keysAndValuesDo: [:names :cmd |\x0a\x09\x09(names includes: aString) ifTrue: [\x0a\x09\x09\x09cmd value.\x0a\x09\x09\x09^ true]].\x0a\x09^ false",
  63828. referencedClasses: [],
  63829. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63830. }),
  63831. $globals.Repl);
  63832. $core.addMethod(
  63833. $core.method({
  63834. selector: "initialize",
  63835. protocol: "initialization",
  63836. fn: function (){
  63837. var self=this,$self=this;
  63838. return $core.withContext(function($ctx1) {
  63839. (
  63840. $ctx1.supercall = true,
  63841. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63842. $ctx1.supercall = false;
  63843. $self["@session"]=$recv($globals.DoIt)._new();
  63844. $self["@readline"]=$recv(require)._value_("readline");
  63845. $ctx1.sendIdx["value:"]=1;
  63846. $self["@util"]=$recv(require)._value_("util");
  63847. $self._setupCommands();
  63848. return self;
  63849. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63850. },
  63851. args: [],
  63852. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63853. referencedClasses: ["DoIt"],
  63854. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63855. }),
  63856. $globals.Repl);
  63857. $core.addMethod(
  63858. $core.method({
  63859. selector: "instanceVariableNamesFor:",
  63860. protocol: "private",
  63861. fn: function (aClass){
  63862. var self=this,$self=this;
  63863. return $core.withContext(function($ctx1) {
  63864. var $1,$2,$receiver;
  63865. $1=$recv(aClass)._superclass();
  63866. $ctx1.sendIdx["superclass"]=1;
  63867. if(($receiver = $1) == null || $receiver.a$nil){
  63868. return $recv(aClass)._instanceVariableNames();
  63869. } else {
  63870. $2=$recv(aClass)._instanceVariableNames();
  63871. $ctx1.sendIdx["instanceVariableNames"]=1;
  63872. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  63873. }
  63874. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  63875. },
  63876. args: ["aClass"],
  63877. source: "instanceVariableNamesFor: aClass\x0a\x09\x22Yields all instance variable names for the given class, including inherited ones.\x22\x0a\x09^ aClass superclass\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09aClass instanceVariableNames copyWithAll: (self instanceVariableNamesFor: aClass superclass)]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass instanceVariableNames]",
  63878. referencedClasses: [],
  63879. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  63880. }),
  63881. $globals.Repl);
  63882. $core.addMethod(
  63883. $core.method({
  63884. selector: "isIdentifier:",
  63885. protocol: "private",
  63886. fn: function (aString){
  63887. var self=this,$self=this;
  63888. return $core.withContext(function($ctx1) {
  63889. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  63890. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  63891. },
  63892. args: ["aString"],
  63893. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  63894. referencedClasses: [],
  63895. messageSends: ["match:", "asRegexp"]
  63896. }),
  63897. $globals.Repl);
  63898. $core.addMethod(
  63899. $core.method({
  63900. selector: "isVariableDefined:",
  63901. protocol: "private",
  63902. fn: function (aString){
  63903. var self=this,$self=this;
  63904. return $core.withContext(function($ctx1) {
  63905. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  63906. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  63907. },
  63908. args: ["aString"],
  63909. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  63910. referencedClasses: [],
  63911. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  63912. }),
  63913. $globals.Repl);
  63914. $core.addMethod(
  63915. $core.method({
  63916. selector: "nextResultName",
  63917. protocol: "private",
  63918. fn: function (){
  63919. var self=this,$self=this;
  63920. return $core.withContext(function($ctx1) {
  63921. var $1,$receiver;
  63922. $1=$self["@resultCount"];
  63923. if(($receiver = $1) == null || $receiver.a$nil){
  63924. $self["@resultCount"]=(1);
  63925. } else {
  63926. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  63927. }
  63928. return "res".__comma($recv($self["@resultCount"])._asString());
  63929. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  63930. },
  63931. args: [],
  63932. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  63933. referencedClasses: [],
  63934. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  63935. }),
  63936. $globals.Repl);
  63937. $core.addMethod(
  63938. $core.method({
  63939. selector: "onKeyPress:",
  63940. protocol: "private",
  63941. fn: function (key){
  63942. var self=this,$self=this;
  63943. return $core.withContext(function($ctx1) {
  63944. var $1;
  63945. $1=$recv($recv(key)._ctrl())._and_((function(){
  63946. return $core.withContext(function($ctx2) {
  63947. return $recv($recv(key)._name()).__eq("l");
  63948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63949. }));
  63950. if($core.assert($1)){
  63951. $self._clearScreen();
  63952. }
  63953. return self;
  63954. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  63955. },
  63956. args: ["key"],
  63957. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  63958. referencedClasses: [],
  63959. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  63960. }),
  63961. $globals.Repl);
  63962. $core.addMethod(
  63963. $core.method({
  63964. selector: "parseAssignment:do:",
  63965. protocol: "private",
  63966. fn: function (aString,aBlock){
  63967. var self=this,$self=this;
  63968. var assignment;
  63969. return $core.withContext(function($ctx1) {
  63970. var $2,$1;
  63971. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  63972. return $core.withContext(function($ctx2) {
  63973. return $recv(s)._trimBoth();
  63974. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  63975. }));
  63976. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  63977. return $core.withContext(function($ctx2) {
  63978. $2=$recv(assignment)._first();
  63979. $ctx2.sendIdx["first"]=1;
  63980. return $self._isIdentifier_($2);
  63981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63982. }));
  63983. if($core.assert($1)){
  63984. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  63985. $ctx1.sendIdx["value:value:"]=1;
  63986. } else {
  63987. return $recv(aBlock)._value_value_(nil,nil);
  63988. }
  63989. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  63990. },
  63991. args: ["aString", "aBlock"],
  63992. source: "parseAssignment: aString do: aBlock\x0a\x09\x22Assigns a new variable if the given string is an assignment expression. Calls the given block with name and value.\x0a\x09 If the string is not one no variable will be assigned and the block will be called with nil for both arguments.\x22\x0a\x09| assignment |\x0a\x09assignment := (aString tokenize: ':=') collect: [:s | s trimBoth].\x0a\x09^ (assignment size = 2 and: [self isIdentifier: assignment first])\x0a\x09\x09ifTrue: [ aBlock value: assignment first value: assignment last ]\x0a\x09\x09ifFalse: [ aBlock value: nil value: nil ]",
  63993. referencedClasses: [],
  63994. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  63995. }),
  63996. $globals.Repl);
  63997. $core.addMethod(
  63998. $core.method({
  63999. selector: "presentResultNamed:withValue:",
  64000. protocol: "private",
  64001. fn: function (varName,value){
  64002. var self=this,$self=this;
  64003. return $core.withContext(function($ctx1) {
  64004. var $3,$2,$1;
  64005. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  64006. $ctx1.sendIdx[","]=3;
  64007. $2=$recv($3).__comma(" = ");
  64008. $ctx1.sendIdx[","]=2;
  64009. $1=$recv($2).__comma($recv(value)._asString());
  64010. $ctx1.sendIdx[","]=1;
  64011. $recv($globals.Transcript)._show_($1);
  64012. $recv($globals.Transcript)._cr();
  64013. $recv($self["@interface"])._prompt();
  64014. return self;
  64015. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  64016. },
  64017. args: ["varName", "value"],
  64018. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  64019. referencedClasses: ["Transcript"],
  64020. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  64021. }),
  64022. $globals.Repl);
  64023. $core.addMethod(
  64024. $core.method({
  64025. selector: "printWelcome",
  64026. protocol: "actions",
  64027. fn: function (){
  64028. var self=this,$self=this;
  64029. return $core.withContext(function($ctx1) {
  64030. $recv($globals.Transcript)._show_("Type :q to exit.");
  64031. $recv($globals.Transcript)._cr();
  64032. return self;
  64033. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  64034. },
  64035. args: [],
  64036. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  64037. referencedClasses: ["Transcript"],
  64038. messageSends: ["show:", "cr"]
  64039. }),
  64040. $globals.Repl);
  64041. $core.addMethod(
  64042. $core.method({
  64043. selector: "processLine:",
  64044. protocol: "private",
  64045. fn: function (buffer){
  64046. var self=this,$self=this;
  64047. var show;
  64048. return $core.withContext(function($ctx1) {
  64049. var $1,$2;
  64050. show=(function(varName,value){
  64051. return $core.withContext(function($ctx2) {
  64052. return $self._presentResultNamed_withValue_(varName,value);
  64053. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  64054. });
  64055. $1=$self._executeCommand_(buffer);
  64056. if(!$core.assert($1)){
  64057. $2=$self._isVariableDefined_(buffer);
  64058. if($core.assert($2)){
  64059. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  64060. } else {
  64061. $self._assignNewVariable_do_(buffer,show);
  64062. }
  64063. }
  64064. return self;
  64065. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  64066. },
  64067. args: ["buffer"],
  64068. source: "processLine: buffer\x0a\x09\x22Processes lines entered through the readline interface.\x22\x0a\x09| show |\x0a\x09show := [:varName :value | self presentResultNamed: varName withValue: value].\x0a\x09(self executeCommand: buffer) ifFalse: [\x0a\x09\x09(self isVariableDefined: buffer)\x0a\x09\x09\x09ifTrue: [show value: buffer value: (session perform: buffer)]\x0a\x09\x09\x09ifFalse: [self assignNewVariable: buffer do: show]]",
  64069. referencedClasses: [],
  64070. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  64071. }),
  64072. $globals.Repl);
  64073. $core.addMethod(
  64074. $core.method({
  64075. selector: "prompt",
  64076. protocol: "accessing",
  64077. fn: function (){
  64078. var self=this,$self=this;
  64079. return "amber >> ";
  64080. },
  64081. args: [],
  64082. source: "prompt\x0a\x09^ 'amber >> '",
  64083. referencedClasses: [],
  64084. messageSends: []
  64085. }),
  64086. $globals.Repl);
  64087. $core.addMethod(
  64088. $core.method({
  64089. selector: "setPreviousVariablesFor:from:",
  64090. protocol: "private",
  64091. fn: function (newObject,oldObject){
  64092. var self=this,$self=this;
  64093. return $core.withContext(function($ctx1) {
  64094. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  64095. return $core.withContext(function($ctx2) {
  64096. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  64097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64098. }));
  64099. return self;
  64100. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  64101. },
  64102. args: ["newObject", "oldObject"],
  64103. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  64104. referencedClasses: [],
  64105. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  64106. }),
  64107. $globals.Repl);
  64108. $core.addMethod(
  64109. $core.method({
  64110. selector: "setPrompt",
  64111. protocol: "actions",
  64112. fn: function (){
  64113. var self=this,$self=this;
  64114. return $core.withContext(function($ctx1) {
  64115. $recv($self["@interface"])._setPrompt_($self._prompt());
  64116. return self;
  64117. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  64118. },
  64119. args: [],
  64120. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  64121. referencedClasses: [],
  64122. messageSends: ["setPrompt:", "prompt"]
  64123. }),
  64124. $globals.Repl);
  64125. $core.addMethod(
  64126. $core.method({
  64127. selector: "setupCommands",
  64128. protocol: "initialization",
  64129. fn: function (){
  64130. var self=this,$self=this;
  64131. return $core.withContext(function($ctx1) {
  64132. var $2,$1;
  64133. $2=$recv([":q"]).__minus_gt((function(){
  64134. return $core.withContext(function($ctx2) {
  64135. return $recv(process)._exit();
  64136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64137. }));
  64138. $ctx1.sendIdx["->"]=1;
  64139. $1=[$2,$recv([""]).__minus_gt((function(){
  64140. return $core.withContext(function($ctx2) {
  64141. return $recv($self["@interface"])._prompt();
  64142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64143. }))];
  64144. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  64145. return self;
  64146. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  64147. },
  64148. args: [],
  64149. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  64150. referencedClasses: ["Dictionary"],
  64151. messageSends: ["from:", "->", "exit", "prompt"]
  64152. }),
  64153. $globals.Repl);
  64154. $core.addMethod(
  64155. $core.method({
  64156. selector: "setupHotkeys",
  64157. protocol: "initialization",
  64158. fn: function (){
  64159. var self=this,$self=this;
  64160. return $core.withContext(function($ctx1) {
  64161. var $receiver;
  64162. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  64163. return $core.withContext(function($ctx2) {
  64164. if(($receiver = key) == null || $receiver.a$nil){
  64165. return key;
  64166. } else {
  64167. return $self._onKeyPress_(key);
  64168. }
  64169. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64170. }));
  64171. return self;
  64172. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64173. },
  64174. args: [],
  64175. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64176. referencedClasses: [],
  64177. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64178. }),
  64179. $globals.Repl);
  64180. $core.addMethod(
  64181. $core.method({
  64182. selector: "subclass:withVariable:",
  64183. protocol: "private",
  64184. fn: function (aClass,varName){
  64185. var self=this,$self=this;
  64186. return $core.withContext(function($ctx1) {
  64187. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64188. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64189. },
  64190. args: ["aClass", "varName"],
  64191. source: "subclass: aClass withVariable: varName\x0a\x09\x22Create subclass with new variable.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: (self subclassNameFor: aClass) asSymbol\x0a\x09\x09instanceVariableNames: {varName}\x0a\x09\x09package: 'Compiler-Core'",
  64192. referencedClasses: ["ClassBuilder"],
  64193. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64194. }),
  64195. $globals.Repl);
  64196. $core.addMethod(
  64197. $core.method({
  64198. selector: "subclassNameFor:",
  64199. protocol: "private",
  64200. fn: function (aClass){
  64201. var self=this,$self=this;
  64202. return $core.withContext(function($ctx1) {
  64203. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64204. $2=$recv(aClass)._name();
  64205. $ctx1.sendIdx["name"]=1;
  64206. $1=$recv($2)._matchesOf_("\x5cd+$");
  64207. $ctx1.sendIdx["matchesOf:"]=1;
  64208. if(($receiver = $1) == null || $receiver.a$nil){
  64209. return $recv($recv(aClass)._name()).__comma("2");
  64210. } else {
  64211. var counter;
  64212. $6=$recv(aClass)._name();
  64213. $ctx1.sendIdx["name"]=2;
  64214. $5=$recv($6)._matchesOf_("\x5cd+$");
  64215. $4=$recv($5)._first();
  64216. $3=$recv($4)._asNumber();
  64217. counter=$recv($3).__plus((1));
  64218. $7=$recv(aClass)._name();
  64219. $ctx1.sendIdx["name"]=3;
  64220. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64221. }
  64222. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64223. },
  64224. args: ["aClass"],
  64225. source: "subclassNameFor: aClass\x0a\x09^ (aClass name matchesOf: '\x5cd+$')\x0a\x09\x09ifNotNil: [ | counter |\x0a\x09\x09\x09counter := (aClass name matchesOf: '\x5cd+$') first asNumber + 1.\x0a\x09\x09\x09aClass name replaceRegexp: '\x5cd+$' asRegexp with: counter asString]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass name, '2'].",
  64226. referencedClasses: [],
  64227. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64228. }),
  64229. $globals.Repl);
  64230. $core.addMethod(
  64231. $core.method({
  64232. selector: "main",
  64233. protocol: "initialization",
  64234. fn: function (){
  64235. var self=this,$self=this;
  64236. return $core.withContext(function($ctx1) {
  64237. $recv($self._new())._createInterface();
  64238. return self;
  64239. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64240. },
  64241. args: [],
  64242. source: "main\x0a\x09self new createInterface",
  64243. referencedClasses: [],
  64244. messageSends: ["createInterface", "new"]
  64245. }),
  64246. $globals.Repl.a$cls);
  64247. });
  64248. (function () {
  64249. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64250. amber.initialize().then(function () {
  64251. amber.globals.AmberCli._main();
  64252. });
  64253. });
  64254. }());
  64255. require(["app"]);
  64256. });
  64257. define.require('__wrap__');
  64258. }((function amdefine(module, requireFn) {
  64259. 'use strict';
  64260. var defineCache = {},
  64261. loaderCache = {},
  64262. alreadyCalled = false,
  64263. path = require('path'),
  64264. makeRequire, stringRequire;
  64265. /**
  64266. * Trims the . and .. from an array of path segments.
  64267. * It will keep a leading path segment if a .. will become
  64268. * the first path segment, to help with module name lookups,
  64269. * which act like paths, but can be remapped. But the end result,
  64270. * all paths that use this function should look normalized.
  64271. * NOTE: this method MODIFIES the input array.
  64272. * @param {Array} ary the array of path segments.
  64273. */
  64274. function trimDots(ary) {
  64275. var i, part;
  64276. for (i = 0; ary[i]; i+= 1) {
  64277. part = ary[i];
  64278. if (part === '.') {
  64279. ary.splice(i, 1);
  64280. i -= 1;
  64281. } else if (part === '..') {
  64282. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64283. //End of the line. Keep at least one non-dot
  64284. //path segment at the front so it can be mapped
  64285. //correctly to disk. Otherwise, there is likely
  64286. //no path mapping for a path starting with '..'.
  64287. //This can still fail, but catches the most reasonable
  64288. //uses of ..
  64289. break;
  64290. } else if (i > 0) {
  64291. ary.splice(i - 1, 2);
  64292. i -= 2;
  64293. }
  64294. }
  64295. }
  64296. }
  64297. function normalize(name, baseName) {
  64298. var baseParts;
  64299. //Adjust any relative paths.
  64300. if (name && name.charAt(0) === '.') {
  64301. //If have a base name, try to normalize against it,
  64302. //otherwise, assume it is a top-level require that will
  64303. //be relative to baseUrl in the end.
  64304. if (baseName) {
  64305. baseParts = baseName.split('/');
  64306. baseParts = baseParts.slice(0, baseParts.length - 1);
  64307. baseParts = baseParts.concat(name.split('/'));
  64308. trimDots(baseParts);
  64309. name = baseParts.join('/');
  64310. }
  64311. }
  64312. return name;
  64313. }
  64314. /**
  64315. * Create the normalize() function passed to a loader plugin's
  64316. * normalize method.
  64317. */
  64318. function makeNormalize(relName) {
  64319. return function (name) {
  64320. return normalize(name, relName);
  64321. };
  64322. }
  64323. function makeLoad(id) {
  64324. function load(value) {
  64325. loaderCache[id] = value;
  64326. }
  64327. load.fromText = function (id, text) {
  64328. //This one is difficult because the text can/probably uses
  64329. //define, and any relative paths and requires should be relative
  64330. //to that id was it would be found on disk. But this would require
  64331. //bootstrapping a module/require fairly deeply from node core.
  64332. //Not sure how best to go about that yet.
  64333. throw new Error('amdefine does not implement load.fromText');
  64334. };
  64335. return load;
  64336. }
  64337. makeRequire = function (systemRequire, exports, module, relId) {
  64338. function amdRequire(deps, callback) {
  64339. if (typeof deps === 'string') {
  64340. //Synchronous, single module require('')
  64341. return stringRequire(systemRequire, exports, module, deps, relId);
  64342. } else {
  64343. //Array of dependencies with a callback.
  64344. //Convert the dependencies to modules.
  64345. deps = deps.map(function (depName) {
  64346. return stringRequire(systemRequire, exports, module, depName, relId);
  64347. });
  64348. //Wait for next tick to call back the require call.
  64349. if (callback) {
  64350. process.nextTick(function () {
  64351. callback.apply(null, deps);
  64352. });
  64353. }
  64354. }
  64355. }
  64356. amdRequire.toUrl = function (filePath) {
  64357. if (filePath.indexOf('.') === 0) {
  64358. return normalize(filePath, path.dirname(module.filename));
  64359. } else {
  64360. return filePath;
  64361. }
  64362. };
  64363. return amdRequire;
  64364. };
  64365. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64366. requireFn = requireFn || function req() {
  64367. return module.require.apply(module, arguments);
  64368. };
  64369. function runFactory(id, deps, factory) {
  64370. var r, e, m, result;
  64371. if (id) {
  64372. e = loaderCache[id] = {};
  64373. m = {
  64374. id: id,
  64375. uri: __filename,
  64376. exports: e
  64377. };
  64378. r = makeRequire(requireFn, e, m, id);
  64379. } else {
  64380. //Only support one define call per file
  64381. if (alreadyCalled) {
  64382. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64383. }
  64384. alreadyCalled = true;
  64385. //Use the real variables from node
  64386. //Use module.exports for exports, since
  64387. //the exports in here is amdefine exports.
  64388. e = module.exports;
  64389. m = module;
  64390. r = makeRequire(requireFn, e, m, module.id);
  64391. }
  64392. //If there are dependencies, they are strings, so need
  64393. //to convert them to dependency values.
  64394. if (deps) {
  64395. deps = deps.map(function (depName) {
  64396. return r(depName);
  64397. });
  64398. }
  64399. //Call the factory with the right dependencies.
  64400. if (typeof factory === 'function') {
  64401. result = factory.apply(m.exports, deps);
  64402. } else {
  64403. result = factory;
  64404. }
  64405. if (result !== undefined) {
  64406. m.exports = result;
  64407. if (id) {
  64408. loaderCache[id] = m.exports;
  64409. }
  64410. }
  64411. }
  64412. stringRequire = function (systemRequire, exports, module, id, relId) {
  64413. //Split the ID by a ! so that
  64414. var index = id.indexOf('!'),
  64415. originalId = id,
  64416. prefix, plugin;
  64417. if (index === -1) {
  64418. id = normalize(id, relId);
  64419. //Straight module lookup. If it is one of the special dependencies,
  64420. //deal with it, otherwise, delegate to node.
  64421. if (id === 'require') {
  64422. return makeRequire(systemRequire, exports, module, relId);
  64423. } else if (id === 'exports') {
  64424. return exports;
  64425. } else if (id === 'module') {
  64426. return module;
  64427. } else if (loaderCache.hasOwnProperty(id)) {
  64428. return loaderCache[id];
  64429. } else if (defineCache[id]) {
  64430. runFactory.apply(null, defineCache[id]);
  64431. return loaderCache[id];
  64432. } else {
  64433. if(systemRequire) {
  64434. return systemRequire(originalId);
  64435. } else {
  64436. throw new Error('No module with ID: ' + id);
  64437. }
  64438. }
  64439. } else {
  64440. //There is a plugin in play.
  64441. prefix = id.substring(0, index);
  64442. id = id.substring(index + 1, id.length);
  64443. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64444. if (plugin.normalize) {
  64445. id = plugin.normalize(id, makeNormalize(relId));
  64446. } else {
  64447. //Normalize the ID normally.
  64448. id = normalize(id, relId);
  64449. }
  64450. if (loaderCache[id]) {
  64451. return loaderCache[id];
  64452. } else {
  64453. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64454. return loaderCache[id];
  64455. }
  64456. }
  64457. };
  64458. //Create a define function specific to the module asking for amdefine.
  64459. function define(id, deps, factory) {
  64460. if (Array.isArray(id)) {
  64461. factory = deps;
  64462. deps = id;
  64463. id = undefined;
  64464. } else if (typeof id !== 'string') {
  64465. factory = id;
  64466. id = deps = undefined;
  64467. }
  64468. if (deps && !Array.isArray(deps)) {
  64469. factory = deps;
  64470. deps = undefined;
  64471. }
  64472. if (!deps) {
  64473. deps = ['require', 'exports', 'module'];
  64474. }
  64475. //Set up properties for this module. If an ID, then use
  64476. //internal cache. If no ID, then use the external variables
  64477. //for this node module.
  64478. if (id) {
  64479. //Put the module in deep freeze until there is a
  64480. //require call for it.
  64481. defineCache[id] = [id, deps, factory];
  64482. } else {
  64483. runFactory(id, deps, factory);
  64484. }
  64485. }
  64486. //define.require, which has access to all the values in the
  64487. //cache. Useful for AMD modules that all have IDs in the file,
  64488. //but need to finally export a value to node based on one of those
  64489. //IDs.
  64490. define.require = function (id) {
  64491. if (loaderCache[id]) {
  64492. return loaderCache[id];
  64493. }
  64494. if (defineCache[id]) {
  64495. runFactory.apply(null, defineCache[id]);
  64496. return loaderCache[id];
  64497. }
  64498. };
  64499. define.amd = {};
  64500. return define;
  64501. }(module)), require));