1
0

amber-cli.js 2.2 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237
  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. var oid = 0;
  1137. /* Unique ID number generator */
  1138. st.nextId = function () {
  1139. console.warn("$core.nextId() deprecated. Use your own unique counter.");
  1140. oid += 1;
  1141. return oid;
  1142. };
  1143. /* Converts a JavaScript object to valid Smalltalk Object */
  1144. st.readJSObject = function (js) {
  1145. if (js == null) return null;
  1146. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1147. else if (js.constructor !== Object) return js;
  1148. var pairs = [];
  1149. for (var i in js) {
  1150. pairs.push(i, st.readJSObject(js[i]));
  1151. }
  1152. return globals.Dictionary._newFromPairs_(pairs);
  1153. };
  1154. /* Boolean assertion */
  1155. st.assert = function (shouldBeBoolean) {
  1156. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1157. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1158. shouldBeBoolean = shouldBeBoolean.valueOf();
  1159. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1160. }
  1161. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1162. };
  1163. }
  1164. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1165. function RuntimeBrik (brikz, st) {
  1166. var globals = brikz.smalltalkGlobals.globals;
  1167. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1168. function SmalltalkMethodContext (home, setup) {
  1169. // TODO lazy fill of .sendIdx
  1170. this.sendIdx = {};
  1171. // TODO very likely .senderContext, not .homeContext here
  1172. this.homeContext = home;
  1173. this.setup = setup;
  1174. }
  1175. // Fallbacks
  1176. SmalltalkMethodContext.prototype.supercall = false;
  1177. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1178. SmalltalkMethodContext.prototype.receiver = null;
  1179. SmalltalkMethodContext.prototype.selector = null;
  1180. SmalltalkMethodContext.prototype.lookupClass = null;
  1181. SmalltalkMethodContext.prototype.outerContext = null;
  1182. SmalltalkMethodContext.prototype.index = 0;
  1183. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1184. this.receiver = receiver;
  1185. this.selector = selector;
  1186. if (locals != null) this.locals = locals;
  1187. this.lookupClass = lookupClass;
  1188. if (this.homeContext) {
  1189. this.homeContext.evaluatedSelector = selector;
  1190. }
  1191. });
  1192. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1193. if (locals != null) this.locals = locals;
  1194. this.outerContext = ctx;
  1195. if (index) this.index = index;
  1196. });
  1197. defineMethod(SmalltalkMethodContext, "method", function () {
  1198. var method;
  1199. var lookup = this.lookupClass || this.receiver.a$cls;
  1200. while (!method && lookup) {
  1201. method = lookup.methods[st.js2st(this.selector)];
  1202. lookup = lookup.superclass;
  1203. }
  1204. return method;
  1205. });
  1206. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1207. /* This is the current call context object.
  1208. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1209. In JS code, use api.getThisContext() (see below).
  1210. */
  1211. var thisContext = null;
  1212. /*
  1213. Runs worker function so that error handler is not set up
  1214. if there isn't one. This is accomplished by unconditional
  1215. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1216. which then stops error handler setup (see st.withContext above).
  1217. The effect is, $core.seamless(fn)'s exceptions are not
  1218. handed into ST error handler and caller should process them.
  1219. */
  1220. st.seamless = function (worker) {
  1221. var oldContext = thisContext;
  1222. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1223. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1224. });
  1225. var result = worker(thisContext);
  1226. thisContext = oldContext;
  1227. return result;
  1228. };
  1229. function resultWithErrorHandling (worker) {
  1230. try {
  1231. return worker(thisContext);
  1232. } catch (error) {
  1233. globals.ErrorHandler._handleError_(error);
  1234. thisContext = null;
  1235. // Rethrow the error in any case.
  1236. throw error;
  1237. }
  1238. }
  1239. /*
  1240. Standard way to run within context.
  1241. Sets up error handler if entering first ST context in a stack.
  1242. */
  1243. st.withContext = function (worker, setup) {
  1244. var oldContext = thisContext;
  1245. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1246. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1247. thisContext = oldContext;
  1248. return result;
  1249. };
  1250. /* Handle thisContext pseudo variable */
  1251. st.getThisContext = function () {
  1252. if (!thisContext) return null;
  1253. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1254. frame.setup(frame);
  1255. }
  1256. return thisContext;
  1257. };
  1258. }
  1259. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1260. function MessageSendBrik (brikz, st) {
  1261. var globals = brikz.smalltalkGlobals.globals;
  1262. var nilAsReceiver = brikz.root.nilAsReceiver;
  1263. /* Send message programmatically. Used to implement #perform: & Co. */
  1264. st.send2 = function (self, selector, args, klass) {
  1265. if (self == null) {
  1266. self = nilAsReceiver;
  1267. }
  1268. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1269. return method != null ?
  1270. method.apply(self, args || []) :
  1271. globals.Message._selector_arguments_notUnderstoodBy_(
  1272. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1273. );
  1274. };
  1275. function wrapJavaScript (o) {
  1276. return globals.JSObjectProxy._on_(o);
  1277. }
  1278. st.wrapJavaScript = wrapJavaScript;
  1279. /* If the object property is a function, then call it, except if it starts with
  1280. an uppercase character (we probably want to answer the function itself in this
  1281. case and send it #new from Amber).
  1282. */
  1283. st.accessJavaScript = function (self, propertyName, args) {
  1284. var propertyValue = self[propertyName];
  1285. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1286. return propertyValue.apply(self, args || []);
  1287. } else if (args.length === 0) {
  1288. return propertyValue;
  1289. } else {
  1290. self[propertyName] = args[0];
  1291. return self;
  1292. }
  1293. };
  1294. }
  1295. StartImageBrik.deps = ["smalltalkGlobals"];
  1296. function StartImageBrik (brikz, st) {
  1297. var globals = brikz.smalltalkGlobals.globals;
  1298. this.run = function () {
  1299. globals.AmberBootstrapInitialization._run();
  1300. };
  1301. }
  1302. /* Making smalltalk that can run */
  1303. function configureWithRuntime (brikz) {
  1304. brikz.dnu = DNUBrik;
  1305. brikz.runtimeClasses = RuntimeClassesBrik;
  1306. brikz.frameBinding = FrameBindingBrik;
  1307. brikz.runtimeMethods = RuntimeMethodsBrik;
  1308. brikz.messageSend = MessageSendBrik;
  1309. brikz.runtime = RuntimeBrik;
  1310. brikz.primitives = PrimitivesBrik;
  1311. brikz.startImage = StartImageBrik;
  1312. brikz.rebuild();
  1313. }
  1314. return configureWithRuntime;
  1315. });
  1316. // Depend on each module that is loaded lazily.
  1317. // Add to packager tasks as dependency,
  1318. // so the lazy-loaded modules are included.
  1319. define('amber/lazypack',['./kernel-runtime'], {});
  1320. //jshint eqnull:true
  1321. define('amber/kernel-checks',[],function () {
  1322. "use strict";
  1323. function assert (fn) {
  1324. try {
  1325. if (fn()) return;
  1326. } catch (ex) {
  1327. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1328. }
  1329. throw new Error("Assertion failed:\n" + fn);
  1330. }
  1331. assert(function () {
  1332. return !("hasOwnProperty" in Object.create(null));
  1333. });
  1334. assert(function () {
  1335. return Object.getPrototypeOf(Object.create(null)) === null;
  1336. });
  1337. assert(function () {
  1338. var p = {};
  1339. return Object.getPrototypeOf(Object.create(p)) === p;
  1340. });
  1341. // assert(function () {
  1342. // return new Function("return this")().Object === Object;
  1343. // });
  1344. // assert(function () {
  1345. // return Object.create(new Function("return this")()).Object === Object;
  1346. // });
  1347. assert(function () {
  1348. return typeof global !== "undefined";
  1349. });
  1350. assert(function () {
  1351. return global.Object === Object;
  1352. });
  1353. assert(function () {
  1354. return Object.create(global).Object === Object;
  1355. });
  1356. assert(function () {
  1357. return (function () {
  1358. return this;
  1359. }).apply(void 0) === void 0;
  1360. });
  1361. assert(function () {
  1362. return (function () {
  1363. return this;
  1364. }).apply(null) === null;
  1365. });
  1366. assert(function () {
  1367. return (function () {
  1368. return this;
  1369. }).apply(3) === 3;
  1370. });
  1371. assert(function () {
  1372. return (function () {
  1373. return this;
  1374. }).apply("foo") === "foo";
  1375. });
  1376. assert(function () {
  1377. return (function () {
  1378. return this;
  1379. }).apply(true) === true;
  1380. });
  1381. assert(function () {
  1382. var o = Object.freeze({});
  1383. try {
  1384. o.foo = "bar";
  1385. } catch (ex) {
  1386. }
  1387. return o.foo == null;
  1388. });
  1389. assert(function () {
  1390. return typeof Promise === "function";
  1391. });
  1392. assert(function () {
  1393. return typeof Promise.resolve === "function";
  1394. });
  1395. assert(function () {
  1396. return typeof Promise.reject === "function";
  1397. });
  1398. assert(function () {
  1399. return typeof new Promise(function () {
  1400. }).then === "function";
  1401. });
  1402. });
  1403. define('amber/brikz',[], function () {
  1404. return function Brikz(api, apiKey, initKey) {
  1405. "use strict";
  1406. //jshint eqnull:true
  1407. var brikz = this,
  1408. backup = {};
  1409. apiKey = apiKey || 'exports';
  1410. initKey = initKey || '__init__';
  1411. function mixin(src, target, what) {
  1412. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1413. if (src == null) {
  1414. target[keys[i]] = undefined;
  1415. } else {
  1416. var value = src[keys[i]];
  1417. if (typeof value !== "undefined") {
  1418. target[keys[i]] = value;
  1419. }
  1420. }
  1421. }
  1422. return target;
  1423. }
  1424. Object.defineProperties(this, {
  1425. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1426. });
  1427. var exclude = mixin(this, {});
  1428. this.rebuild = function () {
  1429. Object.keys(backup).forEach(function (key) {
  1430. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1431. });
  1432. var oapi = mixin(api, {}),
  1433. order = [],
  1434. chk = {};
  1435. function ensure(key) {
  1436. if (key in exclude) {
  1437. return null;
  1438. }
  1439. var b = brikz[key],
  1440. bak = backup[key];
  1441. mixin(null, api, api);
  1442. while (typeof b === "function") {
  1443. (b.deps || []).forEach(ensure);
  1444. b = new b(brikz, api, bak);
  1445. }
  1446. brikz[key] = b;
  1447. if (b && !chk[key]) {
  1448. chk[key] = true;
  1449. order.push(b);
  1450. }
  1451. if (b && !b[apiKey]) {
  1452. b[apiKey] = mixin(api, {});
  1453. }
  1454. }
  1455. Object.keys(brikz).forEach(ensure);
  1456. mixin(oapi, mixin(null, api, api));
  1457. order.forEach(function (brik) {
  1458. mixin(brik[apiKey] || {}, api);
  1459. });
  1460. order.forEach(function (brik) {
  1461. if (brik[initKey]) {
  1462. brik[initKey]();
  1463. if (brik[initKey].once) {
  1464. delete brik[initKey];
  1465. }
  1466. }
  1467. });
  1468. backup = mixin(brikz, {});
  1469. };
  1470. };
  1471. });
  1472. /* ====================================================================
  1473. |
  1474. | Amber Smalltalk
  1475. | http://amber-lang.net
  1476. |
  1477. ======================================================================
  1478. ======================================================================
  1479. |
  1480. | Copyright (c) 2010-2014
  1481. | Nicolas Petton <petton.nicolas@gmail.com>
  1482. |
  1483. | Copyright (c) 2012-2017
  1484. | The Amber team https://lolg.it/org/amber/members
  1485. | Amber contributors (see /CONTRIBUTORS)
  1486. |
  1487. | Amber is released under the MIT license
  1488. |
  1489. | Permission is hereby granted, free of charge, to any person obtaining
  1490. | a copy of this software and associated documentation files (the
  1491. | 'Software'), to deal in the Software without restriction, including
  1492. | without limitation the rights to use, copy, modify, merge, publish,
  1493. | distribute, sublicense, and/or sell copies of the Software, and to
  1494. | permit persons to whom the Software is furnished to do so, subject to
  1495. | the following conditions:
  1496. |
  1497. | The above copyright notice and this permission notice shall be
  1498. | included in all copies or substantial portions of the Software.
  1499. |
  1500. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1501. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1502. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1503. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1504. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1505. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1506. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1507. |
  1508. ==================================================================== */
  1509. //jshint eqnull:true
  1510. define('amber/kernel-fundamentals',[],function () {
  1511. "use strict";
  1512. function inherits (child, parent) {
  1513. child.prototype = Object.create(parent.prototype, {
  1514. constructor: {
  1515. value: child,
  1516. enumerable: false, configurable: true, writable: true
  1517. }
  1518. });
  1519. return child;
  1520. }
  1521. function SmalltalkGlobalsBrik (brikz, st) {
  1522. var globals = Object.create(global);
  1523. globals.SmalltalkSettings = {};
  1524. this.globals = globals;
  1525. }
  1526. function EventBrik (brikz, st) {
  1527. var emit = {};
  1528. this.emit = emit;
  1529. this.declareEvent = function (event) {
  1530. if (!emit[event]) emit[event] = function () {
  1531. };
  1532. }
  1533. }
  1534. function RootBrik (brikz, st) {
  1535. /* Smalltalk foundational objects */
  1536. var coreFns = this.coreFns = {};
  1537. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1538. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1539. Detached roots (eg. wrapped JS classes like Number or Date)
  1540. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1541. function SmalltalkRoot () {
  1542. }
  1543. function SmalltalkProtoObject () {
  1544. }
  1545. function SmalltalkObject () {
  1546. }
  1547. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1548. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1549. this.Root = SmalltalkRoot;
  1550. this.Object = SmalltalkObject;
  1551. }
  1552. SelectorsBrik.deps = ["selectorConversion"];
  1553. function SelectorsBrik (brikz, st) {
  1554. var selectorSet = Object.create(null);
  1555. var selectors = this.selectors = [];
  1556. var selectorPairs = this.selectorPairs = [];
  1557. this.registerSelector = function (stSelector) {
  1558. if (selectorSet[stSelector]) return null;
  1559. var jsSelector = st.st2js(stSelector);
  1560. selectorSet[stSelector] = true;
  1561. selectors.push(stSelector);
  1562. var pair = {st: stSelector, js: jsSelector};
  1563. selectorPairs.push(pair);
  1564. return pair;
  1565. };
  1566. st.allSelectors = function () {
  1567. return selectors;
  1568. };
  1569. }
  1570. function PackagesBrik (brikz, st) {
  1571. st.packages = st.packageDescriptors = {};
  1572. /* Add a package load descriptor to the system */
  1573. st.addPackage = function (name, properties) {
  1574. if (!name) return null;
  1575. return st.packageDescriptors[name] = {properties: properties};
  1576. };
  1577. }
  1578. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1579. function BehaviorsBrik (brikz, st) {
  1580. var globals = brikz.smalltalkGlobals.globals;
  1581. var addElement = brikz.arraySet.addElement;
  1582. var removeElement = brikz.arraySet.removeElement;
  1583. /* Smalltalk classes and traits */
  1584. var traitsOrClasses = [];
  1585. this.buildTraitOrClass = function (category, builder) {
  1586. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1587. if (traitOrClass) {
  1588. builder.updateExisting(traitOrClass);
  1589. } else {
  1590. traitOrClass = builder.make();
  1591. traitOrClass.category = category;
  1592. addTraitOrClass(traitOrClass);
  1593. }
  1594. return traitOrClass;
  1595. };
  1596. function addTraitOrClass (traitOrClass) {
  1597. globals[traitOrClass.name] = traitOrClass;
  1598. addElement(traitsOrClasses, traitOrClass);
  1599. traitOrClass.added();
  1600. }
  1601. function removeTraitOrClass (traitOrClass) {
  1602. traitOrClass.removed();
  1603. removeElement(traitsOrClasses, traitOrClass);
  1604. delete globals[traitOrClass.name];
  1605. }
  1606. this.removeTraitOrClass = removeTraitOrClass;
  1607. /* Create an alias for an existing class */
  1608. st.alias = function (traitOrClass, alias) {
  1609. globals[alias] = traitOrClass;
  1610. };
  1611. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1612. }
  1613. MethodsBrik.deps = ["event", "selectors", "root", "selectorConversion"];
  1614. function MethodsBrik (brikz, st) {
  1615. var registerSelector = brikz.selectors.registerSelector;
  1616. var SmalltalkObject = brikz.root.Object;
  1617. var coreFns = brikz.root.coreFns;
  1618. var emit = brikz.event.emit;
  1619. var declareEvent = brikz.event.declareEvent;
  1620. function SmalltalkMethod () {
  1621. }
  1622. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1623. /* Smalltalk method object. To add a method to a class,
  1624. use api.addMethod() */
  1625. st.method = function (spec) {
  1626. var that = new SmalltalkMethod();
  1627. var selector = spec.selector;
  1628. that.selector = selector;
  1629. that.jsSelector = st.st2js(selector);
  1630. that.args = spec.args || {};
  1631. that.protocol = spec.protocol;
  1632. that.source = spec.source;
  1633. that.messageSends = spec.messageSends || [];
  1634. // TODO remove .referencedClasses, have .referencedGlobals
  1635. that.referencedClasses = spec.referencedClasses || [];
  1636. that.fn = spec.fn;
  1637. return that;
  1638. };
  1639. /* Add/remove a method to/from a class */
  1640. st.addMethod = function (method, traitOrBehavior) {
  1641. if (method.owner != null) {
  1642. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1643. }
  1644. method.owner = traitOrBehavior;
  1645. // TODO deprecation helper; remove
  1646. Object.defineProperty(method, "methodClass", {
  1647. get: function () {
  1648. console.warn("Use of .methodClass deprecated, use .owner");
  1649. return method.owner;
  1650. },
  1651. set: function (v) {
  1652. console.warn("Use of .methodClass= deprecated, use .owner=");
  1653. method.owner = v;
  1654. }
  1655. });
  1656. registerNewSelectors(method);
  1657. traitOrBehavior.localMethods[method.selector] = method;
  1658. updateMethod(method.selector, traitOrBehavior);
  1659. };
  1660. declareEvent("selectorsAdded");
  1661. function registerNewSelectors (method) {
  1662. var newSelectors = [];
  1663. function selectorInUse (stSelector) {
  1664. var pair = registerSelector(stSelector);
  1665. if (pair) {
  1666. newSelectors.push(pair);
  1667. }
  1668. }
  1669. selectorInUse(method.selector);
  1670. method.messageSends.forEach(selectorInUse);
  1671. emit.selectorsAdded(newSelectors);
  1672. }
  1673. st.removeMethod = function (method, traitOrBehavior) {
  1674. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1675. delete traitOrBehavior.localMethods[method.selector];
  1676. updateMethod(method.selector, traitOrBehavior);
  1677. };
  1678. this.setupMethods = function (traitOrBehavior) {
  1679. traitOrBehavior.localMethods = Object.create(null);
  1680. traitOrBehavior.methods = Object.create(null);
  1681. };
  1682. declareEvent("methodReplaced");
  1683. function updateMethod (selector, traitOrBehavior) {
  1684. var oldMethod = traitOrBehavior.methods[selector],
  1685. newMethod = traitOrBehavior.localMethods[selector];
  1686. if (oldMethod == null && newMethod == null) {
  1687. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1688. return;
  1689. }
  1690. if (newMethod === oldMethod) return;
  1691. if (newMethod != null) {
  1692. traitOrBehavior.methods[selector] = newMethod;
  1693. traitOrBehavior.methodAdded(newMethod);
  1694. } else {
  1695. delete traitOrBehavior.methods[selector];
  1696. traitOrBehavior.methodRemoved(oldMethod);
  1697. }
  1698. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1699. }
  1700. this.updateMethod = updateMethod;
  1701. }
  1702. function ArraySetBrik (brikz, st) {
  1703. st.addElement = this.addElement = function (array, el) {
  1704. if (typeof el === 'undefined') {
  1705. return;
  1706. }
  1707. if (array.indexOf(el) === -1) {
  1708. array.push(el);
  1709. }
  1710. };
  1711. st.removeElement = this.removeElement = function (array, el) {
  1712. var i = array.indexOf(el);
  1713. if (i !== -1) {
  1714. array.splice(i, 1);
  1715. }
  1716. };
  1717. }
  1718. function SelectorConversionBrik (brikz, st) {
  1719. /* Convert a Smalltalk selector into a JS selector */
  1720. st.st2js = function (string) {
  1721. return '_' + string
  1722. .replace(/:/g, '_')
  1723. .replace(/[\&]/g, '_and')
  1724. .replace(/[\|]/g, '_or')
  1725. .replace(/[+]/g, '_plus')
  1726. .replace(/-/g, '_minus')
  1727. .replace(/[*]/g, '_star')
  1728. .replace(/[\/]/g, '_slash')
  1729. .replace(/[\\]/g, '_backslash')
  1730. .replace(/[\~]/g, '_tild')
  1731. .replace(/%/g, '_percent')
  1732. .replace(/>/g, '_gt')
  1733. .replace(/</g, '_lt')
  1734. .replace(/=/g, '_eq')
  1735. .replace(/,/g, '_comma')
  1736. .replace(/[@]/g, '_at');
  1737. };
  1738. /* Convert a string to a valid smalltalk selector.
  1739. if you modify the following functions, also change st2js
  1740. accordingly */
  1741. st.js2st = function (selector) {
  1742. if (selector.match(/^__/)) {
  1743. return binaryJsToSt(selector);
  1744. } else {
  1745. return keywordJsToSt(selector);
  1746. }
  1747. };
  1748. function keywordJsToSt (selector) {
  1749. return selector.replace(/^_/, '').replace(/_/g, ':');
  1750. }
  1751. function binaryJsToSt (selector) {
  1752. return selector
  1753. .replace(/^_/, '')
  1754. .replace(/_and/g, '&')
  1755. .replace(/_or/g, '|')
  1756. .replace(/_plus/g, '+')
  1757. .replace(/_minus/g, '-')
  1758. .replace(/_star/g, '*')
  1759. .replace(/_slash/g, '/')
  1760. .replace(/_backslash/g, '\\')
  1761. .replace(/_tild/g, '~')
  1762. .replace(/_percent/g, '%')
  1763. .replace(/_gt/g, '>')
  1764. .replace(/_lt/g, '<')
  1765. .replace(/_eq/g, '=')
  1766. .replace(/_comma/g, ',')
  1767. .replace(/_at/g, '@');
  1768. }
  1769. st.st2prop = function (stSelector) {
  1770. var colonPosition = stSelector.indexOf(':');
  1771. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1772. };
  1773. }
  1774. NilBrik.deps = ["root"];
  1775. function NilBrik (brikz, st) {
  1776. var SmalltalkObject = brikz.root.Object;
  1777. var coreFns = brikz.root.coreFns;
  1778. function SmalltalkNil () {
  1779. }
  1780. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1781. this.nilAsReceiver = new SmalltalkNil();
  1782. this.nilAsValue = this.nilAsReceiver; // TODO null
  1783. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1784. // nil objects from one environment to another, doing
  1785. // `anObject == nil` (in JavaScript) does not always answer
  1786. // true as the referenced nil object might come from the other
  1787. // environment.
  1788. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1789. value: true,
  1790. enumerable: false, configurable: false, writable: false
  1791. });
  1792. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1793. value: true,
  1794. enumerable: false, configurable: false, writable: false
  1795. });
  1796. }
  1797. /* Making smalltalk that has basic building blocks */
  1798. function configureWithFundamentals (brikz) {
  1799. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1800. brikz.root = RootBrik;
  1801. brikz.nil = NilBrik;
  1802. brikz.event = EventBrik;
  1803. brikz.arraySet = ArraySetBrik;
  1804. brikz.selectorConversion = SelectorConversionBrik;
  1805. brikz.selectors = SelectorsBrik;
  1806. brikz.packages = PackagesBrik;
  1807. brikz.behaviors = BehaviorsBrik;
  1808. brikz.methods = MethodsBrik;
  1809. brikz.rebuild();
  1810. }
  1811. return configureWithFundamentals;
  1812. });
  1813. /* ====================================================================
  1814. |
  1815. | Amber Smalltalk
  1816. | http://amber-lang.net
  1817. |
  1818. ======================================================================
  1819. ======================================================================
  1820. |
  1821. | Copyright (c) 2010-2014
  1822. | Nicolas Petton <petton.nicolas@gmail.com>
  1823. |
  1824. | Copyright (c) 2012-2017
  1825. | The Amber team https://lolg.it/org/amber/members
  1826. | Amber contributors (see /CONTRIBUTORS)
  1827. |
  1828. | Amber is released under the MIT license
  1829. |
  1830. | Permission is hereby granted, free of charge, to any person obtaining
  1831. | a copy of this software and associated documentation files (the
  1832. | 'Software'), to deal in the Software without restriction, including
  1833. | without limitation the rights to use, copy, modify, merge, publish,
  1834. | distribute, sublicense, and/or sell copies of the Software, and to
  1835. | permit persons to whom the Software is furnished to do so, subject to
  1836. | the following conditions:
  1837. |
  1838. | The above copyright notice and this permission notice shall be
  1839. | included in all copies or substantial portions of the Software.
  1840. |
  1841. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1842. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1843. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1844. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1845. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1846. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1847. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1848. |
  1849. ==================================================================== */
  1850. //jshint eqnull:true
  1851. define('amber/kernel-language',[],function () {
  1852. "use strict";
  1853. function inherits (child, parent) {
  1854. child.prototype = Object.create(parent.prototype, {
  1855. constructor: {
  1856. value: child,
  1857. enumerable: false, configurable: true, writable: true
  1858. }
  1859. });
  1860. return child;
  1861. }
  1862. function defineMethod (klass, name, method) {
  1863. Object.defineProperty(klass.prototype, name, {
  1864. value: method,
  1865. enumerable: false, configurable: true, writable: true
  1866. });
  1867. }
  1868. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1869. function TraitsBrik (brikz, st) {
  1870. var coreFns = brikz.root.coreFns;
  1871. var SmalltalkObject = brikz.root.Object;
  1872. var setupMethods = brikz.methods.setupMethods;
  1873. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1874. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1875. var emit = brikz.event.emit;
  1876. var declareEvent = brikz.event.declareEvent;
  1877. function SmalltalkTrait () {
  1878. }
  1879. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1880. SmalltalkTrait.prototype.trait = true;
  1881. defineMethod(SmalltalkTrait, "toString", function () {
  1882. return 'Smalltalk Trait ' + this.name;
  1883. });
  1884. declareEvent("traitAdded");
  1885. defineMethod(SmalltalkTrait, "added", function () {
  1886. emit.traitAdded(this);
  1887. });
  1888. declareEvent("traitRemoved");
  1889. defineMethod(SmalltalkTrait, "removed", function () {
  1890. emit.traitRemoved(this);
  1891. });
  1892. declareEvent("traitMethodAdded");
  1893. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1894. var self = this;
  1895. this.traitUsers.forEach(function (each) {
  1896. traitMethodChanged(method.selector, method, self, each);
  1897. });
  1898. emit.traitMethodAdded(method, this);
  1899. });
  1900. declareEvent("traitMethodRemoved");
  1901. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1902. var self = this;
  1903. this.traitUsers.forEach(function (each) {
  1904. traitMethodChanged(method.selector, null, self, each);
  1905. });
  1906. emit.traitMethodRemoved(method, this);
  1907. });
  1908. function traitBuilder (traitName) {
  1909. return {
  1910. name: traitName,
  1911. make: function () {
  1912. var that = new SmalltalkTrait();
  1913. // TODO deprecation helper; remove
  1914. Object.defineProperty(that, "className", {
  1915. get: function () {
  1916. console.warn("Use of .className deprecated, use .name");
  1917. return that.name;
  1918. },
  1919. set: function (v) {
  1920. console.warn("Use of .className= deprecated, use .name=");
  1921. that.name = v;
  1922. }
  1923. });
  1924. that.name = traitName;
  1925. that.traitUsers = [];
  1926. setupMethods(that);
  1927. return that;
  1928. },
  1929. updateExisting: function (trait) {
  1930. }
  1931. };
  1932. }
  1933. st.addTrait = function (className, category) {
  1934. return buildTraitOrClass(category, traitBuilder(className));
  1935. };
  1936. }
  1937. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1938. function MethodCompositionBrik (brikz, st) {
  1939. var updateMethod = brikz.methods.updateMethod;
  1940. var addElement = brikz.arraySet.addElement;
  1941. var removeElement = brikz.arraySet.removeElement;
  1942. function aliased (selector, method) {
  1943. if (method.selector === selector) return method;
  1944. var result = st.method({
  1945. selector: selector,
  1946. args: method.args,
  1947. protocol: method.protocol,
  1948. source: '"Aliased as ' + selector + '"\n' + method.source,
  1949. messageSends: method.messageSends,
  1950. referencesClasses: method.referencedClasses,
  1951. fn: method.fn
  1952. });
  1953. result.owner = method.owner;
  1954. return result;
  1955. }
  1956. function deleteKeysFrom (keys, obj) {
  1957. keys.forEach(function (each) {
  1958. delete obj[each];
  1959. });
  1960. }
  1961. function fillTraitTransformation (traitTransformation, obj) {
  1962. // assert(Object.getOwnProperties(obj).length === 0)
  1963. var traitMethods = traitTransformation.trait.methods;
  1964. Object.keys(traitMethods).forEach(function (selector) {
  1965. obj[selector] = traitMethods[selector];
  1966. });
  1967. var traitAliases = traitTransformation.aliases;
  1968. if (traitAliases) {
  1969. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1970. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1971. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1972. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1973. });
  1974. }
  1975. var traitExclusions = traitTransformation.exclusions;
  1976. if (traitExclusions) {
  1977. deleteKeysFrom(traitExclusions, obj);
  1978. }
  1979. return obj;
  1980. }
  1981. function buildCompositionChain (traitComposition) {
  1982. return traitComposition.reduce(function (soFar, each) {
  1983. return fillTraitTransformation(each, Object.create(soFar));
  1984. }, null);
  1985. }
  1986. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1987. var oldLocalMethods = traitOrBehavior.localMethods,
  1988. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1989. Object.keys(oldLocalMethods).forEach(function (selector) {
  1990. newLocalMethods[selector] = oldLocalMethods[selector];
  1991. });
  1992. var selector;
  1993. traitOrBehavior.localMethods = newLocalMethods;
  1994. for (selector in newLocalMethods) {
  1995. updateMethod(selector, traitOrBehavior);
  1996. }
  1997. for (selector in oldLocalMethods) {
  1998. updateMethod(selector, traitOrBehavior);
  1999. }
  2000. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2001. removeElement(each.trait.traitUsers, traitOrBehavior);
  2002. });
  2003. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  2004. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  2005. addElement(each.trait.traitUsers, traitOrBehavior);
  2006. });
  2007. };
  2008. function aliasesOfSelector (selector, traitAliases) {
  2009. if (!traitAliases) return [selector];
  2010. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  2011. return traitAliases[aliasSelector] === selector
  2012. });
  2013. if (!traitAliases[selector]) result.push(selector);
  2014. return result;
  2015. }
  2016. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2017. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2018. changes.forEach(function (aliasSelector) {
  2019. obj[aliasSelector] = aliased(aliasSelector, method);
  2020. });
  2021. var traitExclusions = traitTransformation.exclusions;
  2022. if (traitExclusions) {
  2023. deleteKeysFrom(traitExclusions, obj);
  2024. }
  2025. return changes;
  2026. }
  2027. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2028. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2029. deleteKeysFrom(changes, obj);
  2030. return changes;
  2031. }
  2032. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2033. var traitComposition = traitOrBehavior.traitComposition,
  2034. chain = traitOrBehavior.localMethods,
  2035. changes = [];
  2036. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2037. chain = Object.getPrototypeOf(chain);
  2038. var traitTransformation = traitComposition[i];
  2039. if (traitTransformation.trait !== trait) continue;
  2040. changes.push.apply(changes, method ?
  2041. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2042. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2043. }
  2044. // assert(chain === null);
  2045. changes.forEach(function (each) {
  2046. updateMethod(each, traitOrBehavior);
  2047. });
  2048. }
  2049. this.traitMethodChanged = traitMethodChanged;
  2050. }
  2051. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2052. function ClassesBrik (brikz, st) {
  2053. var SmalltalkRoot = brikz.root.Root;
  2054. var coreFns = brikz.root.coreFns;
  2055. var globals = brikz.smalltalkGlobals.globals;
  2056. var SmalltalkObject = brikz.root.Object;
  2057. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2058. var setupMethods = brikz.methods.setupMethods;
  2059. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2060. var addElement = brikz.arraySet.addElement;
  2061. var removeElement = brikz.arraySet.removeElement;
  2062. var emit = brikz.event.emit;
  2063. var declareEvent = brikz.event.declareEvent;
  2064. function SmalltalkBehavior () {
  2065. }
  2066. function SmalltalkClass () {
  2067. }
  2068. function SmalltalkMetaclass () {
  2069. }
  2070. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2071. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2072. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2073. // Fake root class of the system.
  2074. // Effective superclass of all classes created with `nil subclass: ...`.
  2075. var nilAsClass = this.nilAsClass = {
  2076. fn: SmalltalkRoot,
  2077. a$cls: {fn: SmalltalkClass},
  2078. klass: {fn: SmalltalkClass}
  2079. };
  2080. SmalltalkMetaclass.prototype.meta = true;
  2081. defineMethod(SmalltalkClass, "toString", function () {
  2082. return 'Smalltalk ' + this.name;
  2083. });
  2084. defineMethod(SmalltalkMetaclass, "toString", function () {
  2085. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2086. });
  2087. declareEvent("classAdded");
  2088. defineMethod(SmalltalkClass, "added", function () {
  2089. addSubclass(this);
  2090. emit.classAdded(this);
  2091. });
  2092. declareEvent("classRemoved");
  2093. defineMethod(SmalltalkClass, "removed", function () {
  2094. emit.classRemoved(this);
  2095. removeSubclass(this);
  2096. });
  2097. declareEvent("behaviorMethodAdded");
  2098. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2099. emit.behaviorMethodAdded(method, this);
  2100. });
  2101. declareEvent("behaviorMethodRemove");
  2102. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2103. emit.behaviorMethodRemoved(method, this);
  2104. });
  2105. this.bootstrapHierarchy = function () {
  2106. var nilSubclasses = [globals.ProtoObject];
  2107. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2108. nilSubclasses.forEach(function (each) {
  2109. each.a$cls.superclass = globals.Class;
  2110. addSubclass(each.a$cls);
  2111. });
  2112. };
  2113. /* Smalltalk class creation. A class is an instance of an automatically
  2114. created metaclass object. Newly created classes (not their metaclass)
  2115. should be added to the system, see smalltalk.addClass().
  2116. Superclass linking is *not* handled here, see api.initialize() */
  2117. function classBuilder (className, superclass, iVarNames, fn) {
  2118. var logicalSuperclass = superclass;
  2119. if (superclass == null || superclass.a$nil) {
  2120. superclass = nilAsClass;
  2121. logicalSuperclass = null;
  2122. }
  2123. function klass () {
  2124. var that = metaclass().instanceClass;
  2125. that.superclass = logicalSuperclass;
  2126. that.fn = fn || inherits(function () {
  2127. }, superclass.fn);
  2128. that.iVarNames = iVarNames || [];
  2129. // TODO deprecation helper; remove
  2130. Object.defineProperty(that, "className", {
  2131. get: function () {
  2132. console.warn("Use of .className deprecated, use .name");
  2133. return that.name;
  2134. },
  2135. set: function (v) {
  2136. console.warn("Use of .className= deprecated, use .name=");
  2137. that.name = v;
  2138. }
  2139. });
  2140. that.name = className;
  2141. that.subclasses = [];
  2142. setupMethods(that);
  2143. return that;
  2144. }
  2145. function metaclass () {
  2146. var that = new SmalltalkMetaclass();
  2147. that.superclass = superclass.a$cls;
  2148. that.fn = inherits(function () {
  2149. }, that.superclass.fn);
  2150. that.iVarNames = [];
  2151. that.instanceClass = new that.fn();
  2152. wireKlass(that);
  2153. setupMethods(that);
  2154. return that;
  2155. }
  2156. return {
  2157. name: className,
  2158. make: klass,
  2159. updateExisting: function (klass) {
  2160. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2161. if (iVarNames) klass.iVarNames = iVarNames;
  2162. } else throw new Error("Incompatible change of class: " + klass.name);
  2163. }
  2164. };
  2165. }
  2166. function wireKlass (klass) {
  2167. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2168. value: klass,
  2169. enumerable: false, configurable: true, writable: true
  2170. });
  2171. Object.defineProperty(klass.fn.prototype, "klass", {
  2172. value: klass,
  2173. enumerable: false, configurable: true, writable: true
  2174. });
  2175. }
  2176. this.wireKlass = wireKlass;
  2177. /* Add a class to the system, creating a new one if needed.
  2178. A Package is lazily created if one with given name does not exist. */
  2179. st.addClass = function (className, superclass, iVarNames, category) {
  2180. // While subclassing nil is allowed, it might be an error, so
  2181. // warn about it.
  2182. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2183. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2184. }
  2185. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2186. };
  2187. st.removeClass = removeTraitOrClass;
  2188. function addSubclass (klass) {
  2189. if (klass.superclass) {
  2190. addElement(klass.superclass.subclasses, klass);
  2191. }
  2192. }
  2193. function removeSubclass (klass) {
  2194. if (klass.superclass) {
  2195. removeElement(klass.superclass.subclasses, klass);
  2196. }
  2197. }
  2198. function metaSubclasses (metaclass) {
  2199. return metaclass.instanceClass.subclasses
  2200. .filter(function (each) {
  2201. return !each.meta;
  2202. })
  2203. .map(function (each) {
  2204. return each.a$cls;
  2205. });
  2206. }
  2207. st.metaSubclasses = metaSubclasses;
  2208. st.traverseClassTree = function (klass, fn) {
  2209. var queue = [klass], sentinel = {};
  2210. for (var i = 0; i < queue.length; ++i) {
  2211. var item = queue[i];
  2212. if (fn(item, sentinel) === sentinel) continue;
  2213. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2214. queue.push.apply(queue, subclasses);
  2215. }
  2216. };
  2217. }
  2218. /* Making smalltalk that can load */
  2219. function configureWithHierarchy (brikz) {
  2220. brikz.traits = TraitsBrik;
  2221. brikz.composition = MethodCompositionBrik;
  2222. brikz.classes = ClassesBrik;
  2223. brikz.rebuild();
  2224. }
  2225. return configureWithHierarchy;
  2226. });
  2227. /* ====================================================================
  2228. |
  2229. | Amber Smalltalk
  2230. | http://amber-lang.net
  2231. |
  2232. ======================================================================
  2233. ======================================================================
  2234. |
  2235. | Copyright (c) 2010-2014
  2236. | Nicolas Petton <petton.nicolas@gmail.com>
  2237. |
  2238. | Copyright (c) 2012-2017
  2239. | The Amber team https://lolg.it/org/amber/members
  2240. | Amber contributors (see /CONTRIBUTORS)
  2241. |
  2242. | Amber is released under the MIT license
  2243. |
  2244. | Permission is hereby granted, free of charge, to any person obtaining
  2245. | a copy of this software and associated documentation files (the
  2246. | 'Software'), to deal in the Software without restriction, including
  2247. | without limitation the rights to use, copy, modify, merge, publish,
  2248. | distribute, sublicense, and/or sell copies of the Software, and to
  2249. | permit persons to whom the Software is furnished to do so, subject to
  2250. | the following conditions:
  2251. |
  2252. | The above copyright notice and this permission notice shall be
  2253. | included in all copies or substantial portions of the Software.
  2254. |
  2255. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2256. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2257. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2258. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2259. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2260. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2261. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2262. |
  2263. ==================================================================== */
  2264. //jshint eqnull:true
  2265. define('amber/boot',[
  2266. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2267. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2268. "use strict";
  2269. require(['./kernel-runtime']); // preload
  2270. function SmalltalkInitBrik (brikz, st) {
  2271. var initialized = false;
  2272. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2273. require(['./kernel-runtime'], resolve, reject);
  2274. });
  2275. /* Smalltalk initialization. Called on page load */
  2276. st.initialize = function () {
  2277. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2278. if (initialized) return;
  2279. brikz.classes.bootstrapHierarchy();
  2280. configureWithRuntime(brikz);
  2281. // TODO deprecation helper; remove
  2282. Object.defineProperty(st, "packages", {
  2283. get: function () {
  2284. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2285. return st.packageDescriptors;
  2286. },
  2287. set: function (v) {
  2288. console.trace();
  2289. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2290. }
  2291. });
  2292. brikz.startImage.run();
  2293. initialized = true;
  2294. });
  2295. };
  2296. }
  2297. /* Adds AMD and requirejs related methods to the api */
  2298. function AMDBrik (brikz, st) {
  2299. st.amdRequire = require;
  2300. st.defaultTransportType = st.defaultTransportType || "amd";
  2301. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2302. }
  2303. /* Defines asReceiver to be present at load time */
  2304. /* (logically it belongs more to PrimitiveBrik) */
  2305. AsReceiverBrik.deps = ["nil"];
  2306. function AsReceiverBrik (brikz, st) {
  2307. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2308. /**
  2309. * This function is used all over the compiled amber code.
  2310. * It takes any value (JavaScript or Smalltalk)
  2311. * and returns a proper Amber Smalltalk receiver.
  2312. *
  2313. * null or undefined -> nilAsReceiver,
  2314. * object having Smalltalk signature -> unchanged,
  2315. * otherwise wrapped foreign (JS) object
  2316. */
  2317. this.asReceiver = function (o) {
  2318. if (o == null) return nilAsReceiver;
  2319. else if (o.a$cls != null) return o;
  2320. else return st.wrapJavaScript(o);
  2321. };
  2322. }
  2323. var api = {};
  2324. var brikz = new Brikz(api);
  2325. configureWithFundamentals(brikz);
  2326. configureWithHierarchy(brikz);
  2327. brikz.asReceiver = AsReceiverBrik;
  2328. brikz.stInit = SmalltalkInitBrik;
  2329. brikz.amd = AMDBrik;
  2330. brikz.rebuild();
  2331. return {
  2332. api: api,
  2333. nilAsReceiver: brikz.nil.nilAsReceiver,
  2334. nilAsValue: brikz.nil.nilAsValue,
  2335. nilAsClass: brikz.classes.nilAsClass,
  2336. globals: brikz.smalltalkGlobals.globals,
  2337. asReceiver: brikz.asReceiver.asReceiver
  2338. };
  2339. });
  2340. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2341. var globals = boot.globals,
  2342. exports = {},
  2343. api = boot.api,
  2344. nil = boot.nilAsReceiver;
  2345. // API
  2346. exports.popupHelios = function () {
  2347. require(['helios/index'], function (helios) {
  2348. helios.popup();
  2349. }, function (err) {
  2350. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2351. });
  2352. };
  2353. Object.defineProperty(exports, "api", {
  2354. value: api,
  2355. enumerable: true, configurable: true, writable: false
  2356. });
  2357. Object.defineProperty(exports, "globals", {
  2358. value: globals,
  2359. enumerable: true, configurable: true, writable: false
  2360. });
  2361. Object.defineProperty(exports, "nil", {
  2362. value: nil,
  2363. enumerable: true, configurable: true, writable: false
  2364. });
  2365. function mixinToSettings (source) {
  2366. var settings = globals.SmalltalkSettings;
  2367. Object.keys(source).forEach(function (key) {
  2368. settings[key] = source[key];
  2369. });
  2370. }
  2371. function settingsInLocalStorage () {
  2372. //jshint evil:true
  2373. var storage = 'localStorage' in global && global.localStorage;
  2374. if (storage) {
  2375. var fromStorage;
  2376. try {
  2377. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2378. } catch (ex) {
  2379. // pass
  2380. }
  2381. mixinToSettings(fromStorage || {});
  2382. // TODO find less hackish way to store settings back to storage.
  2383. if (typeof window !== "undefined") {
  2384. requirejs(['jquery'], function ($) {
  2385. $(window).on('beforeunload', function () {
  2386. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2387. });
  2388. });
  2389. }
  2390. }
  2391. }
  2392. exports.initialize = function (options) {
  2393. return Promise.resolve()
  2394. .then(function () {
  2395. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2396. })
  2397. .then(settingsInLocalStorage)
  2398. .then(function () {
  2399. return options || {};
  2400. })
  2401. .then(mixinToSettings)
  2402. .then(function () {
  2403. return api.initialize();
  2404. });
  2405. };
  2406. // Exports
  2407. return exports;
  2408. });
  2409. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2410. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2411. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2412. $core.addPackage("Kernel-Helpers");
  2413. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  2414. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2415. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2416. $core.addMethod(
  2417. $core.method({
  2418. selector: "subclass:",
  2419. protocol: "class creation",
  2420. fn: function (aString){
  2421. var self=this,$self=this;
  2422. return $core.withContext(function($ctx1) {
  2423. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2424. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2425. },
  2426. args: ["aString"],
  2427. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2428. referencedClasses: [],
  2429. messageSends: ["subclass:instanceVariableNames:package:"]
  2430. }),
  2431. $globals.TSubclassable);
  2432. $core.addMethod(
  2433. $core.method({
  2434. selector: "subclass:instanceVariableNames:",
  2435. protocol: "class creation",
  2436. fn: function (aString,anotherString){
  2437. var self=this,$self=this;
  2438. return $core.withContext(function($ctx1) {
  2439. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2440. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2441. },
  2442. args: ["aString", "anotherString"],
  2443. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2444. referencedClasses: [],
  2445. messageSends: ["subclass:instanceVariableNames:package:"]
  2446. }),
  2447. $globals.TSubclassable);
  2448. $core.addMethod(
  2449. $core.method({
  2450. selector: "subclass:instanceVariableNames:category:",
  2451. protocol: "class creation",
  2452. fn: function (aString,aString2,aString3){
  2453. var self=this,$self=this;
  2454. return $core.withContext(function($ctx1) {
  2455. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2456. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2457. },
  2458. args: ["aString", "aString2", "aString3"],
  2459. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2460. referencedClasses: [],
  2461. messageSends: ["subclass:instanceVariableNames:package:"]
  2462. }),
  2463. $globals.TSubclassable);
  2464. $core.addMethod(
  2465. $core.method({
  2466. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2467. protocol: "class creation",
  2468. fn: function (aString,aString2,classVars,pools,aString3){
  2469. var self=this,$self=this;
  2470. return $core.withContext(function($ctx1) {
  2471. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2472. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2473. },
  2474. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2475. 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",
  2476. referencedClasses: [],
  2477. messageSends: ["subclass:instanceVariableNames:package:"]
  2478. }),
  2479. $globals.TSubclassable);
  2480. $core.addMethod(
  2481. $core.method({
  2482. selector: "subclass:instanceVariableNames:package:",
  2483. protocol: "class creation",
  2484. fn: function (aString,aString2,aString3){
  2485. var self=this,$self=this;
  2486. return $core.withContext(function($ctx1) {
  2487. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2488. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2489. },
  2490. args: ["aString", "aString2", "aString3"],
  2491. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2492. referencedClasses: ["ClassBuilder"],
  2493. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2494. }),
  2495. $globals.TSubclassable);
  2496. $core.addMethod(
  2497. $core.method({
  2498. selector: "subclass:uses:",
  2499. protocol: "class creation",
  2500. fn: function (aString,aTraitCompositionDescription){
  2501. var self=this,$self=this;
  2502. return $core.withContext(function($ctx1) {
  2503. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2504. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2505. },
  2506. args: ["aString", "aTraitCompositionDescription"],
  2507. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2508. referencedClasses: [],
  2509. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2510. }),
  2511. $globals.TSubclassable);
  2512. $core.addMethod(
  2513. $core.method({
  2514. selector: "subclass:uses:instanceVariableNames:",
  2515. protocol: "class creation",
  2516. fn: function (aString,aTraitCompositionDescription,anotherString){
  2517. var self=this,$self=this;
  2518. return $core.withContext(function($ctx1) {
  2519. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2520. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2521. },
  2522. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2523. 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",
  2524. referencedClasses: [],
  2525. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2526. }),
  2527. $globals.TSubclassable);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "subclass:uses:instanceVariableNames:category:",
  2531. protocol: "class creation",
  2532. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2533. var self=this,$self=this;
  2534. return $core.withContext(function($ctx1) {
  2535. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2536. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2537. },
  2538. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2539. 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",
  2540. referencedClasses: [],
  2541. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2542. }),
  2543. $globals.TSubclassable);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2547. protocol: "class creation",
  2548. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2549. var self=this,$self=this;
  2550. return $core.withContext(function($ctx1) {
  2551. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2552. }, 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)});
  2553. },
  2554. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2555. 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",
  2556. referencedClasses: [],
  2557. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2558. }),
  2559. $globals.TSubclassable);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "subclass:uses:instanceVariableNames:package:",
  2563. protocol: "class creation",
  2564. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2565. var self=this,$self=this;
  2566. var cls;
  2567. return $core.withContext(function($ctx1) {
  2568. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2569. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2570. return cls;
  2571. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2572. },
  2573. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2574. 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",
  2575. referencedClasses: [],
  2576. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2577. }),
  2578. $globals.TSubclassable);
  2579. });
  2580. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2581. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2582. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2583. $core.addPackage("Kernel-Objects");
  2584. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2585. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2586. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2587. $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.";
  2588. $core.addMethod(
  2589. $core.method({
  2590. selector: "=",
  2591. protocol: "comparing",
  2592. fn: function (anObject){
  2593. var self=this,$self=this;
  2594. return $core.withContext(function($ctx1) {
  2595. return $self.__eq_eq(anObject);
  2596. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2597. },
  2598. args: ["anObject"],
  2599. source: "= anObject\x0a\x09^ self == anObject",
  2600. referencedClasses: [],
  2601. messageSends: ["=="]
  2602. }),
  2603. $globals.ProtoObject);
  2604. $core.addMethod(
  2605. $core.method({
  2606. selector: "==",
  2607. protocol: "comparing",
  2608. fn: function (anObject){
  2609. var self=this,$self=this;
  2610. return $core.withContext(function($ctx1) {
  2611. return self === anObject;
  2612. return self;
  2613. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2614. },
  2615. args: ["anObject"],
  2616. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2617. referencedClasses: [],
  2618. messageSends: []
  2619. }),
  2620. $globals.ProtoObject);
  2621. $core.addMethod(
  2622. $core.method({
  2623. selector: "asJSON",
  2624. protocol: "converting",
  2625. fn: function (){
  2626. var self=this,$self=this;
  2627. return $core.withContext(function($ctx1) {
  2628. $self._deprecatedAPI_("Use #asJavaScriptObject instead.");
  2629. return $self._asJavaScriptObject();
  2630. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.ProtoObject)});
  2631. },
  2632. args: [],
  2633. source: "asJSON\x0a\x09self deprecatedAPI: 'Use #asJavaScriptObject instead.'.\x0a\x09^ self asJavaScriptObject",
  2634. referencedClasses: [],
  2635. messageSends: ["deprecatedAPI:", "asJavaScriptObject"]
  2636. }),
  2637. $globals.ProtoObject);
  2638. $core.addMethod(
  2639. $core.method({
  2640. selector: "asJavascript",
  2641. protocol: "converting",
  2642. fn: function (){
  2643. var self=this,$self=this;
  2644. return $core.withContext(function($ctx1) {
  2645. $self._deprecatedAPI_("Use #asJavaScriptSource instead.");
  2646. return $self._asJavaScriptSource();
  2647. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.ProtoObject)});
  2648. },
  2649. args: [],
  2650. source: "asJavascript\x0a\x09self deprecatedAPI: 'Use #asJavaScriptSource instead.'.\x0a\x09^ self asJavaScriptSource",
  2651. referencedClasses: [],
  2652. messageSends: ["deprecatedAPI:", "asJavaScriptSource"]
  2653. }),
  2654. $globals.ProtoObject);
  2655. $core.addMethod(
  2656. $core.method({
  2657. selector: "asString",
  2658. protocol: "converting",
  2659. fn: function (){
  2660. var self=this,$self=this;
  2661. return $core.withContext(function($ctx1) {
  2662. return $self._printString();
  2663. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2664. },
  2665. args: [],
  2666. source: "asString\x0a\x09^ self printString",
  2667. referencedClasses: [],
  2668. messageSends: ["printString"]
  2669. }),
  2670. $globals.ProtoObject);
  2671. $core.addMethod(
  2672. $core.method({
  2673. selector: "class",
  2674. protocol: "accessing",
  2675. fn: function (){
  2676. var self=this,$self=this;
  2677. return $core.withContext(function($ctx1) {
  2678. return $self.a$cls;
  2679. return self;
  2680. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2681. },
  2682. args: [],
  2683. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2684. referencedClasses: [],
  2685. messageSends: []
  2686. }),
  2687. $globals.ProtoObject);
  2688. $core.addMethod(
  2689. $core.method({
  2690. selector: "doesNotUnderstand:",
  2691. protocol: "error handling",
  2692. fn: function (aMessage){
  2693. var self=this,$self=this;
  2694. return $core.withContext(function($ctx1) {
  2695. var $1;
  2696. $1=$recv($globals.MessageNotUnderstood)._new();
  2697. $recv($1)._receiver_(self);
  2698. $recv($1)._message_(aMessage);
  2699. $recv($1)._signal();
  2700. return self;
  2701. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2702. },
  2703. args: ["aMessage"],
  2704. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2705. referencedClasses: ["MessageNotUnderstood"],
  2706. messageSends: ["receiver:", "new", "message:", "signal"]
  2707. }),
  2708. $globals.ProtoObject);
  2709. $core.addMethod(
  2710. $core.method({
  2711. selector: "evaluate:on:",
  2712. protocol: "evaluating",
  2713. fn: function (aString,anEvaluator){
  2714. var self=this,$self=this;
  2715. return $core.withContext(function($ctx1) {
  2716. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2717. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2718. },
  2719. args: ["aString", "anEvaluator"],
  2720. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2721. referencedClasses: [],
  2722. messageSends: ["evaluate:receiver:"]
  2723. }),
  2724. $globals.ProtoObject);
  2725. $core.addMethod(
  2726. $core.method({
  2727. selector: "identityHash",
  2728. protocol: "accessing",
  2729. fn: function (){
  2730. var self=this,$self=this;
  2731. return $core.withContext(function($ctx1) {
  2732. self._deprecatedAPI();
  2733. var hash=self.identityHash;
  2734. if (hash) return hash;
  2735. hash=$core.nextId();
  2736. Object.defineProperty(self, 'identityHash', {value:hash});
  2737. return hash;
  2738. ;
  2739. return self;
  2740. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2741. },
  2742. args: [],
  2743. 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'>",
  2744. referencedClasses: [],
  2745. messageSends: []
  2746. }),
  2747. $globals.ProtoObject);
  2748. $core.addMethod(
  2749. $core.method({
  2750. selector: "ifNil:",
  2751. protocol: "testing",
  2752. fn: function (aBlock){
  2753. var self=this,$self=this;
  2754. return self;
  2755. },
  2756. args: ["aBlock"],
  2757. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2758. referencedClasses: [],
  2759. messageSends: []
  2760. }),
  2761. $globals.ProtoObject);
  2762. $core.addMethod(
  2763. $core.method({
  2764. selector: "ifNil:ifNotNil:",
  2765. protocol: "testing",
  2766. fn: function (aBlock,anotherBlock){
  2767. var self=this,$self=this;
  2768. return $core.withContext(function($ctx1) {
  2769. return $recv(anotherBlock)._value_(self);
  2770. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2771. },
  2772. args: ["aBlock", "anotherBlock"],
  2773. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2774. referencedClasses: [],
  2775. messageSends: ["value:"]
  2776. }),
  2777. $globals.ProtoObject);
  2778. $core.addMethod(
  2779. $core.method({
  2780. selector: "ifNotNil:",
  2781. protocol: "testing",
  2782. fn: function (aBlock){
  2783. var self=this,$self=this;
  2784. return $core.withContext(function($ctx1) {
  2785. return $recv(aBlock)._value_(self);
  2786. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2787. },
  2788. args: ["aBlock"],
  2789. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2790. referencedClasses: [],
  2791. messageSends: ["value:"]
  2792. }),
  2793. $globals.ProtoObject);
  2794. $core.addMethod(
  2795. $core.method({
  2796. selector: "ifNotNil:ifNil:",
  2797. protocol: "testing",
  2798. fn: function (aBlock,anotherBlock){
  2799. var self=this,$self=this;
  2800. return $core.withContext(function($ctx1) {
  2801. return $recv(aBlock)._value_(self);
  2802. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2803. },
  2804. args: ["aBlock", "anotherBlock"],
  2805. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2806. referencedClasses: [],
  2807. messageSends: ["value:"]
  2808. }),
  2809. $globals.ProtoObject);
  2810. $core.addMethod(
  2811. $core.method({
  2812. selector: "initialize",
  2813. protocol: "initialization",
  2814. fn: function (){
  2815. var self=this,$self=this;
  2816. return self;
  2817. },
  2818. args: [],
  2819. source: "initialize",
  2820. referencedClasses: [],
  2821. messageSends: []
  2822. }),
  2823. $globals.ProtoObject);
  2824. $core.addMethod(
  2825. $core.method({
  2826. selector: "inspect",
  2827. protocol: "inspecting",
  2828. fn: function (){
  2829. var self=this,$self=this;
  2830. return $core.withContext(function($ctx1) {
  2831. $recv($globals.Inspector)._inspect_(self);
  2832. return self;
  2833. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2834. },
  2835. args: [],
  2836. source: "inspect\x0a\x09Inspector inspect: self",
  2837. referencedClasses: ["Inspector"],
  2838. messageSends: ["inspect:"]
  2839. }),
  2840. $globals.ProtoObject);
  2841. $core.addMethod(
  2842. $core.method({
  2843. selector: "inspectOn:",
  2844. protocol: "inspecting",
  2845. fn: function (anInspector){
  2846. var self=this,$self=this;
  2847. return self;
  2848. },
  2849. args: ["anInspector"],
  2850. source: "inspectOn: anInspector",
  2851. referencedClasses: [],
  2852. messageSends: []
  2853. }),
  2854. $globals.ProtoObject);
  2855. $core.addMethod(
  2856. $core.method({
  2857. selector: "instVarAt:",
  2858. protocol: "accessing",
  2859. fn: function (aString){
  2860. var self=this,$self=this;
  2861. return $core.withContext(function($ctx1) {
  2862. return $self['@'+aString];
  2863. return self;
  2864. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2865. },
  2866. args: ["aString"],
  2867. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2868. referencedClasses: [],
  2869. messageSends: []
  2870. }),
  2871. $globals.ProtoObject);
  2872. $core.addMethod(
  2873. $core.method({
  2874. selector: "instVarAt:put:",
  2875. protocol: "accessing",
  2876. fn: function (aString,anObject){
  2877. var self=this,$self=this;
  2878. return $core.withContext(function($ctx1) {
  2879. $self['@' + aString] = anObject;
  2880. return self;
  2881. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2882. },
  2883. args: ["aString", "anObject"],
  2884. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2885. referencedClasses: [],
  2886. messageSends: []
  2887. }),
  2888. $globals.ProtoObject);
  2889. $core.addMethod(
  2890. $core.method({
  2891. selector: "isKindOf:",
  2892. protocol: "testing",
  2893. fn: function (aClass){
  2894. var self=this,$self=this;
  2895. return $core.withContext(function($ctx1) {
  2896. var $1;
  2897. $1=$self._isMemberOf_(aClass);
  2898. if($core.assert($1)){
  2899. return true;
  2900. } else {
  2901. return $recv($self._class())._inheritsFrom_(aClass);
  2902. }
  2903. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2904. },
  2905. args: ["aClass"],
  2906. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2907. referencedClasses: [],
  2908. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2909. }),
  2910. $globals.ProtoObject);
  2911. $core.addMethod(
  2912. $core.method({
  2913. selector: "isNil",
  2914. protocol: "testing",
  2915. fn: function (){
  2916. var self=this,$self=this;
  2917. return false;
  2918. },
  2919. args: [],
  2920. source: "isNil\x0a\x09^ false",
  2921. referencedClasses: [],
  2922. messageSends: []
  2923. }),
  2924. $globals.ProtoObject);
  2925. $core.addMethod(
  2926. $core.method({
  2927. selector: "notNil",
  2928. protocol: "testing",
  2929. fn: function (){
  2930. var self=this,$self=this;
  2931. return $core.withContext(function($ctx1) {
  2932. return $recv($self._isNil())._not();
  2933. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2934. },
  2935. args: [],
  2936. source: "notNil\x0a\x09^ self isNil not",
  2937. referencedClasses: [],
  2938. messageSends: ["not", "isNil"]
  2939. }),
  2940. $globals.ProtoObject);
  2941. $core.addMethod(
  2942. $core.method({
  2943. selector: "perform:",
  2944. protocol: "message handling",
  2945. fn: function (aString){
  2946. var self=this,$self=this;
  2947. return $core.withContext(function($ctx1) {
  2948. return $self._perform_withArguments_(aString,[]);
  2949. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2950. },
  2951. args: ["aString"],
  2952. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2953. referencedClasses: [],
  2954. messageSends: ["perform:withArguments:"]
  2955. }),
  2956. $globals.ProtoObject);
  2957. $core.addMethod(
  2958. $core.method({
  2959. selector: "perform:withArguments:",
  2960. protocol: "message handling",
  2961. fn: function (aString,aCollection){
  2962. var self=this,$self=this;
  2963. return $core.withContext(function($ctx1) {
  2964. return $core.send2(self, aString, aCollection);
  2965. return self;
  2966. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2967. },
  2968. args: ["aString", "aCollection"],
  2969. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2970. referencedClasses: [],
  2971. messageSends: []
  2972. }),
  2973. $globals.ProtoObject);
  2974. $core.addMethod(
  2975. $core.method({
  2976. selector: "printOn:",
  2977. protocol: "printing",
  2978. fn: function (aStream){
  2979. var self=this,$self=this;
  2980. return $core.withContext(function($ctx1) {
  2981. var $5,$4,$3,$2,$1;
  2982. $5=$self._class();
  2983. $ctx1.sendIdx["class"]=1;
  2984. $4=$recv($5)._name();
  2985. $ctx1.sendIdx["name"]=1;
  2986. $3=$recv($4)._first();
  2987. $2=$recv($3)._isVowel();
  2988. if($core.assert($2)){
  2989. $1="an ";
  2990. } else {
  2991. $1="a ";
  2992. }
  2993. $recv(aStream)._nextPutAll_($1);
  2994. $ctx1.sendIdx["nextPutAll:"]=1;
  2995. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  2996. return self;
  2997. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2998. },
  2999. args: ["aStream"],
  3000. 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",
  3001. referencedClasses: [],
  3002. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  3003. }),
  3004. $globals.ProtoObject);
  3005. $core.addMethod(
  3006. $core.method({
  3007. selector: "printString",
  3008. protocol: "printing",
  3009. fn: function (){
  3010. var self=this,$self=this;
  3011. return $core.withContext(function($ctx1) {
  3012. return $recv($globals.String)._streamContents_((function(str){
  3013. return $core.withContext(function($ctx2) {
  3014. return $self._printOn_(str);
  3015. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3016. }));
  3017. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  3018. },
  3019. args: [],
  3020. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  3021. referencedClasses: ["String"],
  3022. messageSends: ["streamContents:", "printOn:"]
  3023. }),
  3024. $globals.ProtoObject);
  3025. $core.addMethod(
  3026. $core.method({
  3027. selector: "yourself",
  3028. protocol: "accessing",
  3029. fn: function (){
  3030. var self=this,$self=this;
  3031. return self;
  3032. },
  3033. args: [],
  3034. source: "yourself\x0a\x09^ self",
  3035. referencedClasses: [],
  3036. messageSends: []
  3037. }),
  3038. $globals.ProtoObject);
  3039. $core.addMethod(
  3040. $core.method({
  3041. selector: "~=",
  3042. protocol: "comparing",
  3043. fn: function (anObject){
  3044. var self=this,$self=this;
  3045. return $core.withContext(function($ctx1) {
  3046. var $1;
  3047. $1=$recv($self.__eq(anObject)).__eq(false);
  3048. $ctx1.sendIdx["="]=1;
  3049. return $1;
  3050. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3051. },
  3052. args: ["anObject"],
  3053. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3054. referencedClasses: [],
  3055. messageSends: ["="]
  3056. }),
  3057. $globals.ProtoObject);
  3058. $core.addMethod(
  3059. $core.method({
  3060. selector: "~~",
  3061. protocol: "comparing",
  3062. fn: function (anObject){
  3063. var self=this,$self=this;
  3064. return $core.withContext(function($ctx1) {
  3065. return $recv($self.__eq_eq(anObject)).__eq(false);
  3066. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3067. },
  3068. args: ["anObject"],
  3069. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3070. referencedClasses: [],
  3071. messageSends: ["=", "=="]
  3072. }),
  3073. $globals.ProtoObject);
  3074. $core.addMethod(
  3075. $core.method({
  3076. selector: "initialize",
  3077. protocol: "initialization",
  3078. fn: function (){
  3079. var self=this,$self=this;
  3080. return self;
  3081. },
  3082. args: [],
  3083. source: "initialize",
  3084. referencedClasses: [],
  3085. messageSends: []
  3086. }),
  3087. $globals.ProtoObject.a$cls);
  3088. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3089. $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.";
  3090. $core.addMethod(
  3091. $core.method({
  3092. selector: "->",
  3093. protocol: "converting",
  3094. fn: function (anObject){
  3095. var self=this,$self=this;
  3096. return $core.withContext(function($ctx1) {
  3097. return $recv($globals.Association)._key_value_(self,anObject);
  3098. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3099. },
  3100. args: ["anObject"],
  3101. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3102. referencedClasses: ["Association"],
  3103. messageSends: ["key:value:"]
  3104. }),
  3105. $globals.Object);
  3106. $core.addMethod(
  3107. $core.method({
  3108. selector: "asJSONString",
  3109. protocol: "converting",
  3110. fn: function (){
  3111. var self=this,$self=this;
  3112. return $core.withContext(function($ctx1) {
  3113. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3114. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3115. },
  3116. args: [],
  3117. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3118. referencedClasses: ["JSON"],
  3119. messageSends: ["stringify:", "asJavaScriptObject"]
  3120. }),
  3121. $globals.Object);
  3122. $core.addMethod(
  3123. $core.method({
  3124. selector: "asJavaScriptObject",
  3125. protocol: "converting",
  3126. fn: function (){
  3127. var self=this,$self=this;
  3128. var variables;
  3129. return $core.withContext(function($ctx1) {
  3130. variables=$recv($globals.HashedCollection)._new();
  3131. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3132. return $core.withContext(function($ctx2) {
  3133. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3135. }));
  3136. return variables;
  3137. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3138. },
  3139. args: [],
  3140. 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",
  3141. referencedClasses: ["HashedCollection"],
  3142. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3143. }),
  3144. $globals.Object);
  3145. $core.addMethod(
  3146. $core.method({
  3147. selector: "asJavaScriptSource",
  3148. protocol: "converting",
  3149. fn: function (){
  3150. var self=this,$self=this;
  3151. return $core.withContext(function($ctx1) {
  3152. return $self._asString();
  3153. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3154. },
  3155. args: [],
  3156. source: "asJavaScriptSource\x0a\x09^ self asString",
  3157. referencedClasses: [],
  3158. messageSends: ["asString"]
  3159. }),
  3160. $globals.Object);
  3161. $core.addMethod(
  3162. $core.method({
  3163. selector: "basicAt:",
  3164. protocol: "accessing",
  3165. fn: function (aString){
  3166. var self=this,$self=this;
  3167. return $core.withContext(function($ctx1) {
  3168. return self[aString];
  3169. return self;
  3170. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3171. },
  3172. args: ["aString"],
  3173. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3174. referencedClasses: [],
  3175. messageSends: []
  3176. }),
  3177. $globals.Object);
  3178. $core.addMethod(
  3179. $core.method({
  3180. selector: "basicAt:put:",
  3181. protocol: "accessing",
  3182. fn: function (aString,anObject){
  3183. var self=this,$self=this;
  3184. return $core.withContext(function($ctx1) {
  3185. return self[aString] = anObject;
  3186. return self;
  3187. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3188. },
  3189. args: ["aString", "anObject"],
  3190. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3191. referencedClasses: [],
  3192. messageSends: []
  3193. }),
  3194. $globals.Object);
  3195. $core.addMethod(
  3196. $core.method({
  3197. selector: "basicDelete:",
  3198. protocol: "accessing",
  3199. fn: function (aString){
  3200. var self=this,$self=this;
  3201. return $core.withContext(function($ctx1) {
  3202. delete self[aString]; return aString;
  3203. return self;
  3204. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3205. },
  3206. args: ["aString"],
  3207. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3208. referencedClasses: [],
  3209. messageSends: []
  3210. }),
  3211. $globals.Object);
  3212. $core.addMethod(
  3213. $core.method({
  3214. selector: "basicPerform:",
  3215. protocol: "message handling",
  3216. fn: function (aString){
  3217. var self=this,$self=this;
  3218. return $core.withContext(function($ctx1) {
  3219. return $self._basicPerform_withArguments_(aString,[]);
  3220. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3221. },
  3222. args: ["aString"],
  3223. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3224. referencedClasses: [],
  3225. messageSends: ["basicPerform:withArguments:"]
  3226. }),
  3227. $globals.Object);
  3228. $core.addMethod(
  3229. $core.method({
  3230. selector: "basicPerform:withArguments:",
  3231. protocol: "message handling",
  3232. fn: function (aString,aCollection){
  3233. var self=this,$self=this;
  3234. return $core.withContext(function($ctx1) {
  3235. return self[aString].apply(self, aCollection);;
  3236. return self;
  3237. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3238. },
  3239. args: ["aString", "aCollection"],
  3240. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3241. referencedClasses: [],
  3242. messageSends: []
  3243. }),
  3244. $globals.Object);
  3245. $core.addMethod(
  3246. $core.method({
  3247. selector: "browse",
  3248. protocol: "browsing",
  3249. fn: function (){
  3250. var self=this,$self=this;
  3251. return $core.withContext(function($ctx1) {
  3252. $recv($globals.Finder)._findClass_($self._class());
  3253. return self;
  3254. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3255. },
  3256. args: [],
  3257. source: "browse\x0a\x09Finder findClass: self class",
  3258. referencedClasses: ["Finder"],
  3259. messageSends: ["findClass:", "class"]
  3260. }),
  3261. $globals.Object);
  3262. $core.addMethod(
  3263. $core.method({
  3264. selector: "copy",
  3265. protocol: "copying",
  3266. fn: function (){
  3267. var self=this,$self=this;
  3268. return $core.withContext(function($ctx1) {
  3269. return $recv($self._shallowCopy())._postCopy();
  3270. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3271. },
  3272. args: [],
  3273. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3274. referencedClasses: [],
  3275. messageSends: ["postCopy", "shallowCopy"]
  3276. }),
  3277. $globals.Object);
  3278. $core.addMethod(
  3279. $core.method({
  3280. selector: "deepCopy",
  3281. protocol: "copying",
  3282. fn: function (){
  3283. var self=this,$self=this;
  3284. return $core.withContext(function($ctx1) {
  3285. var copy = self.a$cls._new();
  3286. Object.keys(self).forEach(function (i) {
  3287. if(/^@.+/.test(i)) {
  3288. copy[i] = $recv(self[i])._deepCopy();
  3289. }
  3290. });
  3291. return copy;
  3292. ;
  3293. return self;
  3294. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3295. },
  3296. args: [],
  3297. 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'>",
  3298. referencedClasses: [],
  3299. messageSends: []
  3300. }),
  3301. $globals.Object);
  3302. $core.addMethod(
  3303. $core.method({
  3304. selector: "deprecatedAPI",
  3305. protocol: "error handling",
  3306. fn: function (){
  3307. var self=this,$self=this;
  3308. return $core.withContext(function($ctx1) {
  3309. var $1,$6,$5,$4,$8,$7,$3,$2;
  3310. $1=console;
  3311. $6=$core.getThisContext()._home();
  3312. $ctx1.sendIdx["home"]=1;
  3313. $5=$recv($6)._asString();
  3314. $ctx1.sendIdx["asString"]=1;
  3315. $4=$recv($5).__comma(" is deprecated! (in ");
  3316. $8=$recv($core.getThisContext()._home())._home();
  3317. $ctx1.sendIdx["home"]=2;
  3318. $7=$recv($8)._asString();
  3319. $3=$recv($4).__comma($7);
  3320. $ctx1.sendIdx[","]=2;
  3321. $2=$recv($3).__comma(")");
  3322. $ctx1.sendIdx[","]=1;
  3323. $recv($1)._warn_($2);
  3324. return self;
  3325. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3326. },
  3327. args: [],
  3328. 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, ')'.",
  3329. referencedClasses: [],
  3330. messageSends: ["warn:", ",", "asString", "home"]
  3331. }),
  3332. $globals.Object);
  3333. $core.addMethod(
  3334. $core.method({
  3335. selector: "deprecatedAPI:",
  3336. protocol: "error handling",
  3337. fn: function (aString){
  3338. var self=this,$self=this;
  3339. return $core.withContext(function($ctx1) {
  3340. var $1,$6,$5,$4,$8,$7,$3,$2;
  3341. $1=console;
  3342. $6=$core.getThisContext()._home();
  3343. $ctx1.sendIdx["home"]=1;
  3344. $5=$recv($6)._asString();
  3345. $ctx1.sendIdx["asString"]=1;
  3346. $4=$recv($5).__comma(" is deprecated! (in ");
  3347. $8=$recv($core.getThisContext()._home())._home();
  3348. $ctx1.sendIdx["home"]=2;
  3349. $7=$recv($8)._asString();
  3350. $3=$recv($4).__comma($7);
  3351. $ctx1.sendIdx[","]=2;
  3352. $2=$recv($3).__comma(")");
  3353. $ctx1.sendIdx[","]=1;
  3354. $recv($1)._warn_($2);
  3355. $ctx1.sendIdx["warn:"]=1;
  3356. $recv(console)._warn_(aString);
  3357. return self;
  3358. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3359. },
  3360. args: ["aString"],
  3361. 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",
  3362. referencedClasses: [],
  3363. messageSends: ["warn:", ",", "asString", "home"]
  3364. }),
  3365. $globals.Object);
  3366. $core.addMethod(
  3367. $core.method({
  3368. selector: "error:",
  3369. protocol: "error handling",
  3370. fn: function (aString){
  3371. var self=this,$self=this;
  3372. return $core.withContext(function($ctx1) {
  3373. $recv($globals.Error)._signal_(aString);
  3374. return self;
  3375. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3376. },
  3377. args: ["aString"],
  3378. source: "error: aString\x0a\x09Error signal: aString",
  3379. referencedClasses: ["Error"],
  3380. messageSends: ["signal:"]
  3381. }),
  3382. $globals.Object);
  3383. $core.addMethod(
  3384. $core.method({
  3385. selector: "halt",
  3386. protocol: "error handling",
  3387. fn: function (){
  3388. var self=this,$self=this;
  3389. return $core.withContext(function($ctx1) {
  3390. $recv($globals.Halt)._signal();
  3391. return self;
  3392. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3393. },
  3394. args: [],
  3395. source: "halt\x0a\x09Halt signal",
  3396. referencedClasses: ["Halt"],
  3397. messageSends: ["signal"]
  3398. }),
  3399. $globals.Object);
  3400. $core.addMethod(
  3401. $core.method({
  3402. selector: "in:",
  3403. protocol: "evaluating",
  3404. fn: function (aValuable){
  3405. var self=this,$self=this;
  3406. return $core.withContext(function($ctx1) {
  3407. return $recv(aValuable)._value_(self);
  3408. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3409. },
  3410. args: ["aValuable"],
  3411. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3412. referencedClasses: [],
  3413. messageSends: ["value:"]
  3414. }),
  3415. $globals.Object);
  3416. $core.addMethod(
  3417. $core.method({
  3418. selector: "isBehavior",
  3419. protocol: "testing",
  3420. fn: function (){
  3421. var self=this,$self=this;
  3422. return false;
  3423. },
  3424. args: [],
  3425. source: "isBehavior\x0a\x09^ false",
  3426. referencedClasses: [],
  3427. messageSends: []
  3428. }),
  3429. $globals.Object);
  3430. $core.addMethod(
  3431. $core.method({
  3432. selector: "isBoolean",
  3433. protocol: "testing",
  3434. fn: function (){
  3435. var self=this,$self=this;
  3436. return false;
  3437. },
  3438. args: [],
  3439. source: "isBoolean\x0a\x09^ false",
  3440. referencedClasses: [],
  3441. messageSends: []
  3442. }),
  3443. $globals.Object);
  3444. $core.addMethod(
  3445. $core.method({
  3446. selector: "isClass",
  3447. protocol: "testing",
  3448. fn: function (){
  3449. var self=this,$self=this;
  3450. return false;
  3451. },
  3452. args: [],
  3453. source: "isClass\x0a\x09^ false",
  3454. referencedClasses: [],
  3455. messageSends: []
  3456. }),
  3457. $globals.Object);
  3458. $core.addMethod(
  3459. $core.method({
  3460. selector: "isCompiledMethod",
  3461. protocol: "testing",
  3462. fn: function (){
  3463. var self=this,$self=this;
  3464. return false;
  3465. },
  3466. args: [],
  3467. source: "isCompiledMethod\x0a\x09^ false",
  3468. referencedClasses: [],
  3469. messageSends: []
  3470. }),
  3471. $globals.Object);
  3472. $core.addMethod(
  3473. $core.method({
  3474. selector: "isImmutable",
  3475. protocol: "testing",
  3476. fn: function (){
  3477. var self=this,$self=this;
  3478. return false;
  3479. },
  3480. args: [],
  3481. source: "isImmutable\x0a\x09^ false",
  3482. referencedClasses: [],
  3483. messageSends: []
  3484. }),
  3485. $globals.Object);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "isMemberOf:",
  3489. protocol: "testing",
  3490. fn: function (aClass){
  3491. var self=this,$self=this;
  3492. return $core.withContext(function($ctx1) {
  3493. return $recv($self._class()).__eq(aClass);
  3494. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3495. },
  3496. args: ["aClass"],
  3497. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3498. referencedClasses: [],
  3499. messageSends: ["=", "class"]
  3500. }),
  3501. $globals.Object);
  3502. $core.addMethod(
  3503. $core.method({
  3504. selector: "isMetaclass",
  3505. protocol: "testing",
  3506. fn: function (){
  3507. var self=this,$self=this;
  3508. return false;
  3509. },
  3510. args: [],
  3511. source: "isMetaclass\x0a\x09^ false",
  3512. referencedClasses: [],
  3513. messageSends: []
  3514. }),
  3515. $globals.Object);
  3516. $core.addMethod(
  3517. $core.method({
  3518. selector: "isNumber",
  3519. protocol: "testing",
  3520. fn: function (){
  3521. var self=this,$self=this;
  3522. return false;
  3523. },
  3524. args: [],
  3525. source: "isNumber\x0a\x09^ false",
  3526. referencedClasses: [],
  3527. messageSends: []
  3528. }),
  3529. $globals.Object);
  3530. $core.addMethod(
  3531. $core.method({
  3532. selector: "isPackage",
  3533. protocol: "testing",
  3534. fn: function (){
  3535. var self=this,$self=this;
  3536. return false;
  3537. },
  3538. args: [],
  3539. source: "isPackage\x0a\x09^ false",
  3540. referencedClasses: [],
  3541. messageSends: []
  3542. }),
  3543. $globals.Object);
  3544. $core.addMethod(
  3545. $core.method({
  3546. selector: "isParseFailure",
  3547. protocol: "testing",
  3548. fn: function (){
  3549. var self=this,$self=this;
  3550. return false;
  3551. },
  3552. args: [],
  3553. source: "isParseFailure\x0a\x09^ false",
  3554. referencedClasses: [],
  3555. messageSends: []
  3556. }),
  3557. $globals.Object);
  3558. $core.addMethod(
  3559. $core.method({
  3560. selector: "isString",
  3561. protocol: "testing",
  3562. fn: function (){
  3563. var self=this,$self=this;
  3564. return false;
  3565. },
  3566. args: [],
  3567. source: "isString\x0a\x09^ false",
  3568. referencedClasses: [],
  3569. messageSends: []
  3570. }),
  3571. $globals.Object);
  3572. $core.addMethod(
  3573. $core.method({
  3574. selector: "isSymbol",
  3575. protocol: "testing",
  3576. fn: function (){
  3577. var self=this,$self=this;
  3578. return false;
  3579. },
  3580. args: [],
  3581. source: "isSymbol\x0a\x09^ false",
  3582. referencedClasses: [],
  3583. messageSends: []
  3584. }),
  3585. $globals.Object);
  3586. $core.addMethod(
  3587. $core.method({
  3588. selector: "postCopy",
  3589. protocol: "copying",
  3590. fn: function (){
  3591. var self=this,$self=this;
  3592. return self;
  3593. },
  3594. args: [],
  3595. source: "postCopy",
  3596. referencedClasses: [],
  3597. messageSends: []
  3598. }),
  3599. $globals.Object);
  3600. $core.addMethod(
  3601. $core.method({
  3602. selector: "putOn:",
  3603. protocol: "streaming",
  3604. fn: function (aStream){
  3605. var self=this,$self=this;
  3606. return $core.withContext(function($ctx1) {
  3607. $recv(aStream)._nextPut_(self);
  3608. return self;
  3609. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3610. },
  3611. args: ["aStream"],
  3612. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3613. referencedClasses: [],
  3614. messageSends: ["nextPut:"]
  3615. }),
  3616. $globals.Object);
  3617. $core.addMethod(
  3618. $core.method({
  3619. selector: "respondsTo:",
  3620. protocol: "testing",
  3621. fn: function (aSelector){
  3622. var self=this,$self=this;
  3623. return $core.withContext(function($ctx1) {
  3624. return $recv($self._class())._canUnderstand_(aSelector);
  3625. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3626. },
  3627. args: ["aSelector"],
  3628. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3629. referencedClasses: [],
  3630. messageSends: ["canUnderstand:", "class"]
  3631. }),
  3632. $globals.Object);
  3633. $core.addMethod(
  3634. $core.method({
  3635. selector: "shallowCopy",
  3636. protocol: "copying",
  3637. fn: function (){
  3638. var self=this,$self=this;
  3639. return $core.withContext(function($ctx1) {
  3640. var copy = self.a$cls._new();
  3641. Object.keys(self).forEach(function(i) {
  3642. if(/^@.+/.test(i)) {
  3643. copy[i] = self[i];
  3644. }
  3645. });
  3646. return copy;
  3647. ;
  3648. return self;
  3649. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3650. },
  3651. args: [],
  3652. 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'>",
  3653. referencedClasses: [],
  3654. messageSends: []
  3655. }),
  3656. $globals.Object);
  3657. $core.addMethod(
  3658. $core.method({
  3659. selector: "shouldNotImplement",
  3660. protocol: "error handling",
  3661. fn: function (){
  3662. var self=this,$self=this;
  3663. return $core.withContext(function($ctx1) {
  3664. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3665. return self;
  3666. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3667. },
  3668. args: [],
  3669. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3670. referencedClasses: [],
  3671. messageSends: ["error:", ",", "name", "class"]
  3672. }),
  3673. $globals.Object);
  3674. $core.addMethod(
  3675. $core.method({
  3676. selector: "size",
  3677. protocol: "accessing",
  3678. fn: function (){
  3679. var self=this,$self=this;
  3680. return $core.withContext(function($ctx1) {
  3681. $self._error_("Object not indexable");
  3682. return self;
  3683. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3684. },
  3685. args: [],
  3686. source: "size\x0a\x09self error: 'Object not indexable'",
  3687. referencedClasses: [],
  3688. messageSends: ["error:"]
  3689. }),
  3690. $globals.Object);
  3691. $core.addMethod(
  3692. $core.method({
  3693. selector: "subclassResponsibility",
  3694. protocol: "error handling",
  3695. fn: function (){
  3696. var self=this,$self=this;
  3697. return $core.withContext(function($ctx1) {
  3698. $self._error_("This method is a responsibility of a subclass");
  3699. return self;
  3700. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3701. },
  3702. args: [],
  3703. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3704. referencedClasses: [],
  3705. messageSends: ["error:"]
  3706. }),
  3707. $globals.Object);
  3708. $core.addMethod(
  3709. $core.method({
  3710. selector: "value",
  3711. protocol: "evaluating",
  3712. fn: function (){
  3713. var self=this,$self=this;
  3714. return $core.withContext(function($ctx1) {
  3715. return self.valueOf();
  3716. return self;
  3717. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3718. },
  3719. args: [],
  3720. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3721. referencedClasses: [],
  3722. messageSends: []
  3723. }),
  3724. $globals.Object);
  3725. $core.addMethod(
  3726. $core.method({
  3727. selector: "accessorProtocolWith:",
  3728. protocol: "helios",
  3729. fn: function (aGenerator){
  3730. var self=this,$self=this;
  3731. return $core.withContext(function($ctx1) {
  3732. $recv(aGenerator)._accessorProtocolForObject();
  3733. return self;
  3734. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3735. },
  3736. args: ["aGenerator"],
  3737. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3738. referencedClasses: [],
  3739. messageSends: ["accessorProtocolForObject"]
  3740. }),
  3741. $globals.Object.a$cls);
  3742. $core.addMethod(
  3743. $core.method({
  3744. selector: "accessorsSourceCodesWith:",
  3745. protocol: "helios",
  3746. fn: function (aGenerator){
  3747. var self=this,$self=this;
  3748. return $core.withContext(function($ctx1) {
  3749. $recv(aGenerator)._accessorsForObject();
  3750. return self;
  3751. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3752. },
  3753. args: ["aGenerator"],
  3754. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3755. referencedClasses: [],
  3756. messageSends: ["accessorsForObject"]
  3757. }),
  3758. $globals.Object.a$cls);
  3759. $core.addMethod(
  3760. $core.method({
  3761. selector: "initialize",
  3762. protocol: "initialization",
  3763. fn: function (){
  3764. var self=this,$self=this;
  3765. return self;
  3766. },
  3767. args: [],
  3768. source: "initialize\x0a\x09\x22no op\x22",
  3769. referencedClasses: [],
  3770. messageSends: []
  3771. }),
  3772. $globals.Object.a$cls);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "initializeProtocolWith:",
  3776. protocol: "helios",
  3777. fn: function (aGenerator){
  3778. var self=this,$self=this;
  3779. return $core.withContext(function($ctx1) {
  3780. $recv(aGenerator)._initializeProtocolForObject();
  3781. return self;
  3782. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3783. },
  3784. args: ["aGenerator"],
  3785. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3786. referencedClasses: [],
  3787. messageSends: ["initializeProtocolForObject"]
  3788. }),
  3789. $globals.Object.a$cls);
  3790. $core.addMethod(
  3791. $core.method({
  3792. selector: "initializeSourceCodesWith:",
  3793. protocol: "helios",
  3794. fn: function (aGenerator){
  3795. var self=this,$self=this;
  3796. return $core.withContext(function($ctx1) {
  3797. $recv(aGenerator)._initializeForObject();
  3798. return self;
  3799. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3800. },
  3801. args: ["aGenerator"],
  3802. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3803. referencedClasses: [],
  3804. messageSends: ["initializeForObject"]
  3805. }),
  3806. $globals.Object.a$cls);
  3807. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3808. $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: [ ... ]";
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "&",
  3812. protocol: "controlling",
  3813. fn: function (aBoolean){
  3814. var self=this,$self=this;
  3815. return $core.withContext(function($ctx1) {
  3816. if(self == true) {
  3817. return aBoolean;
  3818. } else {
  3819. return false;
  3820. }
  3821. ;
  3822. return self;
  3823. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3824. },
  3825. args: ["aBoolean"],
  3826. 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'>",
  3827. referencedClasses: [],
  3828. messageSends: []
  3829. }),
  3830. $globals.Boolean);
  3831. $core.addMethod(
  3832. $core.method({
  3833. selector: "==",
  3834. protocol: "comparing",
  3835. fn: function (aBoolean){
  3836. var self=this,$self=this;
  3837. return $core.withContext(function($ctx1) {
  3838. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3839. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3840. else return false;;
  3841. return self;
  3842. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3843. },
  3844. args: ["aBoolean"],
  3845. 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'>",
  3846. referencedClasses: [],
  3847. messageSends: []
  3848. }),
  3849. $globals.Boolean);
  3850. $core.addMethod(
  3851. $core.method({
  3852. selector: "and:",
  3853. protocol: "controlling",
  3854. fn: function (aBlock){
  3855. var self=this,$self=this;
  3856. return $core.withContext(function($ctx1) {
  3857. if($core.assert(self)){
  3858. return $recv(aBlock)._value();
  3859. } else {
  3860. return false;
  3861. }
  3862. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3863. },
  3864. args: ["aBlock"],
  3865. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3866. referencedClasses: [],
  3867. messageSends: ["ifTrue:ifFalse:", "value"]
  3868. }),
  3869. $globals.Boolean);
  3870. $core.addMethod(
  3871. $core.method({
  3872. selector: "asBit",
  3873. protocol: "converting",
  3874. fn: function (){
  3875. var self=this,$self=this;
  3876. return $core.withContext(function($ctx1) {
  3877. if($core.assert(self)){
  3878. return (1);
  3879. } else {
  3880. return (0);
  3881. }
  3882. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3883. },
  3884. args: [],
  3885. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3886. referencedClasses: [],
  3887. messageSends: ["ifTrue:ifFalse:"]
  3888. }),
  3889. $globals.Boolean);
  3890. $core.addMethod(
  3891. $core.method({
  3892. selector: "asJavaScriptObject",
  3893. protocol: "converting",
  3894. fn: function (){
  3895. var self=this,$self=this;
  3896. return self;
  3897. },
  3898. args: [],
  3899. source: "asJavaScriptObject\x0a\x09^ self",
  3900. referencedClasses: [],
  3901. messageSends: []
  3902. }),
  3903. $globals.Boolean);
  3904. $core.addMethod(
  3905. $core.method({
  3906. selector: "asString",
  3907. protocol: "converting",
  3908. fn: function (){
  3909. var self=this,$self=this;
  3910. return $core.withContext(function($ctx1) {
  3911. return self.toString();
  3912. return self;
  3913. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3914. },
  3915. args: [],
  3916. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3917. referencedClasses: [],
  3918. messageSends: []
  3919. }),
  3920. $globals.Boolean);
  3921. $core.addMethod(
  3922. $core.method({
  3923. selector: "deepCopy",
  3924. protocol: "copying",
  3925. fn: function (){
  3926. var self=this,$self=this;
  3927. return self;
  3928. },
  3929. args: [],
  3930. source: "deepCopy\x0a\x09^ self",
  3931. referencedClasses: [],
  3932. messageSends: []
  3933. }),
  3934. $globals.Boolean);
  3935. $core.addMethod(
  3936. $core.method({
  3937. selector: "ifFalse:",
  3938. protocol: "controlling",
  3939. fn: function (aBlock){
  3940. var self=this,$self=this;
  3941. return $core.withContext(function($ctx1) {
  3942. return $self._ifTrue_ifFalse_((function(){
  3943. }),aBlock);
  3944. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3945. },
  3946. args: ["aBlock"],
  3947. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3948. referencedClasses: [],
  3949. messageSends: ["ifTrue:ifFalse:"]
  3950. }),
  3951. $globals.Boolean);
  3952. $core.addMethod(
  3953. $core.method({
  3954. selector: "ifFalse:ifTrue:",
  3955. protocol: "controlling",
  3956. fn: function (aBlock,anotherBlock){
  3957. var self=this,$self=this;
  3958. return $core.withContext(function($ctx1) {
  3959. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3960. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3961. },
  3962. args: ["aBlock", "anotherBlock"],
  3963. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3964. referencedClasses: [],
  3965. messageSends: ["ifTrue:ifFalse:"]
  3966. }),
  3967. $globals.Boolean);
  3968. $core.addMethod(
  3969. $core.method({
  3970. selector: "ifTrue:",
  3971. protocol: "controlling",
  3972. fn: function (aBlock){
  3973. var self=this,$self=this;
  3974. return $core.withContext(function($ctx1) {
  3975. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3976. }));
  3977. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3978. },
  3979. args: ["aBlock"],
  3980. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3981. referencedClasses: [],
  3982. messageSends: ["ifTrue:ifFalse:"]
  3983. }),
  3984. $globals.Boolean);
  3985. $core.addMethod(
  3986. $core.method({
  3987. selector: "ifTrue:ifFalse:",
  3988. protocol: "controlling",
  3989. fn: function (aBlock,anotherBlock){
  3990. var self=this,$self=this;
  3991. return $core.withContext(function($ctx1) {
  3992. if(self == true) {
  3993. return aBlock._value();
  3994. } else {
  3995. return anotherBlock._value();
  3996. }
  3997. ;
  3998. return self;
  3999. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  4000. },
  4001. args: ["aBlock", "anotherBlock"],
  4002. 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'>",
  4003. referencedClasses: [],
  4004. messageSends: []
  4005. }),
  4006. $globals.Boolean);
  4007. $core.addMethod(
  4008. $core.method({
  4009. selector: "isBoolean",
  4010. protocol: "testing",
  4011. fn: function (){
  4012. var self=this,$self=this;
  4013. return true;
  4014. },
  4015. args: [],
  4016. source: "isBoolean\x0a\x09^ true",
  4017. referencedClasses: [],
  4018. messageSends: []
  4019. }),
  4020. $globals.Boolean);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "isImmutable",
  4024. protocol: "testing",
  4025. fn: function (){
  4026. var self=this,$self=this;
  4027. return true;
  4028. },
  4029. args: [],
  4030. source: "isImmutable\x0a\x09^ true",
  4031. referencedClasses: [],
  4032. messageSends: []
  4033. }),
  4034. $globals.Boolean);
  4035. $core.addMethod(
  4036. $core.method({
  4037. selector: "not",
  4038. protocol: "controlling",
  4039. fn: function (){
  4040. var self=this,$self=this;
  4041. return $core.withContext(function($ctx1) {
  4042. return $self.__eq(false);
  4043. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  4044. },
  4045. args: [],
  4046. source: "not\x0a\x09^ self = false",
  4047. referencedClasses: [],
  4048. messageSends: ["="]
  4049. }),
  4050. $globals.Boolean);
  4051. $core.addMethod(
  4052. $core.method({
  4053. selector: "or:",
  4054. protocol: "controlling",
  4055. fn: function (aBlock){
  4056. var self=this,$self=this;
  4057. return $core.withContext(function($ctx1) {
  4058. if($core.assert(self)){
  4059. return true;
  4060. } else {
  4061. return $recv(aBlock)._value();
  4062. }
  4063. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4064. },
  4065. args: ["aBlock"],
  4066. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4067. referencedClasses: [],
  4068. messageSends: ["ifTrue:ifFalse:", "value"]
  4069. }),
  4070. $globals.Boolean);
  4071. $core.addMethod(
  4072. $core.method({
  4073. selector: "printOn:",
  4074. protocol: "printing",
  4075. fn: function (aStream){
  4076. var self=this,$self=this;
  4077. return $core.withContext(function($ctx1) {
  4078. $recv(aStream)._nextPutAll_($self._asString());
  4079. return self;
  4080. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4081. },
  4082. args: ["aStream"],
  4083. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4084. referencedClasses: [],
  4085. messageSends: ["nextPutAll:", "asString"]
  4086. }),
  4087. $globals.Boolean);
  4088. $core.addMethod(
  4089. $core.method({
  4090. selector: "shallowCopy",
  4091. protocol: "copying",
  4092. fn: function (){
  4093. var self=this,$self=this;
  4094. return self;
  4095. },
  4096. args: [],
  4097. source: "shallowCopy\x0a\x09^ self",
  4098. referencedClasses: [],
  4099. messageSends: []
  4100. }),
  4101. $globals.Boolean);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "|",
  4105. protocol: "controlling",
  4106. fn: function (aBoolean){
  4107. var self=this,$self=this;
  4108. return $core.withContext(function($ctx1) {
  4109. if(self == true) {
  4110. return true;
  4111. } else {
  4112. return aBoolean;
  4113. }
  4114. ;
  4115. return self;
  4116. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4117. },
  4118. args: ["aBoolean"],
  4119. 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'>",
  4120. referencedClasses: [],
  4121. messageSends: []
  4122. }),
  4123. $globals.Boolean);
  4124. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4125. $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.).";
  4126. $core.addMethod(
  4127. $core.method({
  4128. selector: "+",
  4129. protocol: "arithmetic",
  4130. fn: function (aDate){
  4131. var self=this,$self=this;
  4132. return $core.withContext(function($ctx1) {
  4133. return self + aDate;
  4134. return self;
  4135. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4136. },
  4137. args: ["aDate"],
  4138. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4139. referencedClasses: [],
  4140. messageSends: []
  4141. }),
  4142. $globals.Date);
  4143. $core.addMethod(
  4144. $core.method({
  4145. selector: "-",
  4146. protocol: "arithmetic",
  4147. fn: function (aDate){
  4148. var self=this,$self=this;
  4149. return $core.withContext(function($ctx1) {
  4150. return self - aDate;
  4151. return self;
  4152. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4153. },
  4154. args: ["aDate"],
  4155. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4156. referencedClasses: [],
  4157. messageSends: []
  4158. }),
  4159. $globals.Date);
  4160. $core.addMethod(
  4161. $core.method({
  4162. selector: "<",
  4163. protocol: "comparing",
  4164. fn: function (aDate){
  4165. var self=this,$self=this;
  4166. return $core.withContext(function($ctx1) {
  4167. return self < aDate;
  4168. return self;
  4169. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4170. },
  4171. args: ["aDate"],
  4172. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4173. referencedClasses: [],
  4174. messageSends: []
  4175. }),
  4176. $globals.Date);
  4177. $core.addMethod(
  4178. $core.method({
  4179. selector: "<=",
  4180. protocol: "comparing",
  4181. fn: function (aDate){
  4182. var self=this,$self=this;
  4183. return $core.withContext(function($ctx1) {
  4184. return self <= aDate;
  4185. return self;
  4186. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4187. },
  4188. args: ["aDate"],
  4189. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4190. referencedClasses: [],
  4191. messageSends: []
  4192. }),
  4193. $globals.Date);
  4194. $core.addMethod(
  4195. $core.method({
  4196. selector: "=",
  4197. protocol: "comparing",
  4198. fn: function (aDate){
  4199. var self=this,$self=this;
  4200. return $core.withContext(function($ctx1) {
  4201. var $2,$1,$3;
  4202. $2=$recv(aDate)._class();
  4203. $ctx1.sendIdx["class"]=1;
  4204. $1=$recv($2).__eq_eq($self._class());
  4205. $ctx1.sendIdx["=="]=1;
  4206. return $recv($1)._and_((function(){
  4207. return $core.withContext(function($ctx2) {
  4208. $3=$self._asMilliseconds();
  4209. $ctx2.sendIdx["asMilliseconds"]=1;
  4210. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4212. }));
  4213. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4214. },
  4215. args: ["aDate"],
  4216. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4217. referencedClasses: [],
  4218. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4219. }),
  4220. $globals.Date);
  4221. $core.addMethod(
  4222. $core.method({
  4223. selector: ">",
  4224. protocol: "comparing",
  4225. fn: function (aDate){
  4226. var self=this,$self=this;
  4227. return $core.withContext(function($ctx1) {
  4228. return self > aDate;
  4229. return self;
  4230. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4231. },
  4232. args: ["aDate"],
  4233. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4234. referencedClasses: [],
  4235. messageSends: []
  4236. }),
  4237. $globals.Date);
  4238. $core.addMethod(
  4239. $core.method({
  4240. selector: ">=",
  4241. protocol: "comparing",
  4242. fn: function (aDate){
  4243. var self=this,$self=this;
  4244. return $core.withContext(function($ctx1) {
  4245. return self >= aDate;
  4246. return self;
  4247. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4248. },
  4249. args: ["aDate"],
  4250. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4251. referencedClasses: [],
  4252. messageSends: []
  4253. }),
  4254. $globals.Date);
  4255. $core.addMethod(
  4256. $core.method({
  4257. selector: "asDateString",
  4258. protocol: "converting",
  4259. fn: function (){
  4260. var self=this,$self=this;
  4261. return $core.withContext(function($ctx1) {
  4262. return self.toDateString();
  4263. return self;
  4264. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4265. },
  4266. args: [],
  4267. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4268. referencedClasses: [],
  4269. messageSends: []
  4270. }),
  4271. $globals.Date);
  4272. $core.addMethod(
  4273. $core.method({
  4274. selector: "asLocaleString",
  4275. protocol: "converting",
  4276. fn: function (){
  4277. var self=this,$self=this;
  4278. return $core.withContext(function($ctx1) {
  4279. return self.toLocaleString();
  4280. return self;
  4281. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4282. },
  4283. args: [],
  4284. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4285. referencedClasses: [],
  4286. messageSends: []
  4287. }),
  4288. $globals.Date);
  4289. $core.addMethod(
  4290. $core.method({
  4291. selector: "asMilliseconds",
  4292. protocol: "converting",
  4293. fn: function (){
  4294. var self=this,$self=this;
  4295. return $core.withContext(function($ctx1) {
  4296. return $self._time();
  4297. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4298. },
  4299. args: [],
  4300. source: "asMilliseconds\x0a\x09^ self time",
  4301. referencedClasses: [],
  4302. messageSends: ["time"]
  4303. }),
  4304. $globals.Date);
  4305. $core.addMethod(
  4306. $core.method({
  4307. selector: "asNumber",
  4308. protocol: "converting",
  4309. fn: function (){
  4310. var self=this,$self=this;
  4311. return $core.withContext(function($ctx1) {
  4312. return $self._asMilliseconds();
  4313. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4314. },
  4315. args: [],
  4316. source: "asNumber\x0a\x09^ self asMilliseconds",
  4317. referencedClasses: [],
  4318. messageSends: ["asMilliseconds"]
  4319. }),
  4320. $globals.Date);
  4321. $core.addMethod(
  4322. $core.method({
  4323. selector: "asString",
  4324. protocol: "converting",
  4325. fn: function (){
  4326. var self=this,$self=this;
  4327. return $core.withContext(function($ctx1) {
  4328. return self.toString();
  4329. return self;
  4330. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4331. },
  4332. args: [],
  4333. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4334. referencedClasses: [],
  4335. messageSends: []
  4336. }),
  4337. $globals.Date);
  4338. $core.addMethod(
  4339. $core.method({
  4340. selector: "asTimeString",
  4341. protocol: "converting",
  4342. fn: function (){
  4343. var self=this,$self=this;
  4344. return $core.withContext(function($ctx1) {
  4345. return self.toTimeString();
  4346. return self;
  4347. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4348. },
  4349. args: [],
  4350. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4351. referencedClasses: [],
  4352. messageSends: []
  4353. }),
  4354. $globals.Date);
  4355. $core.addMethod(
  4356. $core.method({
  4357. selector: "day",
  4358. protocol: "accessing",
  4359. fn: function (){
  4360. var self=this,$self=this;
  4361. return $core.withContext(function($ctx1) {
  4362. return $self._dayOfWeek();
  4363. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4364. },
  4365. args: [],
  4366. source: "day\x0a\x09^ self dayOfWeek",
  4367. referencedClasses: [],
  4368. messageSends: ["dayOfWeek"]
  4369. }),
  4370. $globals.Date);
  4371. $core.addMethod(
  4372. $core.method({
  4373. selector: "day:",
  4374. protocol: "accessing",
  4375. fn: function (aNumber){
  4376. var self=this,$self=this;
  4377. return $core.withContext(function($ctx1) {
  4378. $self._dayOfWeek_(aNumber);
  4379. return self;
  4380. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4381. },
  4382. args: ["aNumber"],
  4383. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4384. referencedClasses: [],
  4385. messageSends: ["dayOfWeek:"]
  4386. }),
  4387. $globals.Date);
  4388. $core.addMethod(
  4389. $core.method({
  4390. selector: "dayOfMonth",
  4391. protocol: "accessing",
  4392. fn: function (){
  4393. var self=this,$self=this;
  4394. return $core.withContext(function($ctx1) {
  4395. return self.getDate();
  4396. return self;
  4397. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4398. },
  4399. args: [],
  4400. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4401. referencedClasses: [],
  4402. messageSends: []
  4403. }),
  4404. $globals.Date);
  4405. $core.addMethod(
  4406. $core.method({
  4407. selector: "dayOfMonth:",
  4408. protocol: "accessing",
  4409. fn: function (aNumber){
  4410. var self=this,$self=this;
  4411. return $core.withContext(function($ctx1) {
  4412. self.setDate(aNumber);
  4413. return self;
  4414. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4415. },
  4416. args: ["aNumber"],
  4417. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4418. referencedClasses: [],
  4419. messageSends: []
  4420. }),
  4421. $globals.Date);
  4422. $core.addMethod(
  4423. $core.method({
  4424. selector: "dayOfWeek",
  4425. protocol: "accessing",
  4426. fn: function (){
  4427. var self=this,$self=this;
  4428. return $core.withContext(function($ctx1) {
  4429. return self.getDay() + 1;
  4430. return self;
  4431. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4432. },
  4433. args: [],
  4434. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4435. referencedClasses: [],
  4436. messageSends: []
  4437. }),
  4438. $globals.Date);
  4439. $core.addMethod(
  4440. $core.method({
  4441. selector: "dayOfWeek:",
  4442. protocol: "accessing",
  4443. fn: function (aNumber){
  4444. var self=this,$self=this;
  4445. return $core.withContext(function($ctx1) {
  4446. return self.setDay(aNumber - 1);
  4447. return self;
  4448. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4449. },
  4450. args: ["aNumber"],
  4451. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4452. referencedClasses: [],
  4453. messageSends: []
  4454. }),
  4455. $globals.Date);
  4456. $core.addMethod(
  4457. $core.method({
  4458. selector: "hours",
  4459. protocol: "accessing",
  4460. fn: function (){
  4461. var self=this,$self=this;
  4462. return $core.withContext(function($ctx1) {
  4463. return self.getHours();
  4464. return self;
  4465. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4466. },
  4467. args: [],
  4468. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4469. referencedClasses: [],
  4470. messageSends: []
  4471. }),
  4472. $globals.Date);
  4473. $core.addMethod(
  4474. $core.method({
  4475. selector: "hours:",
  4476. protocol: "accessing",
  4477. fn: function (aNumber){
  4478. var self=this,$self=this;
  4479. return $core.withContext(function($ctx1) {
  4480. self.setHours(aNumber);
  4481. return self;
  4482. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4483. },
  4484. args: ["aNumber"],
  4485. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4486. referencedClasses: [],
  4487. messageSends: []
  4488. }),
  4489. $globals.Date);
  4490. $core.addMethod(
  4491. $core.method({
  4492. selector: "milliseconds",
  4493. protocol: "accessing",
  4494. fn: function (){
  4495. var self=this,$self=this;
  4496. return $core.withContext(function($ctx1) {
  4497. return self.getMilliseconds();
  4498. return self;
  4499. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4500. },
  4501. args: [],
  4502. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4503. referencedClasses: [],
  4504. messageSends: []
  4505. }),
  4506. $globals.Date);
  4507. $core.addMethod(
  4508. $core.method({
  4509. selector: "milliseconds:",
  4510. protocol: "accessing",
  4511. fn: function (aNumber){
  4512. var self=this,$self=this;
  4513. return $core.withContext(function($ctx1) {
  4514. self.setMilliseconds(aNumber);
  4515. return self;
  4516. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4517. },
  4518. args: ["aNumber"],
  4519. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4520. referencedClasses: [],
  4521. messageSends: []
  4522. }),
  4523. $globals.Date);
  4524. $core.addMethod(
  4525. $core.method({
  4526. selector: "minutes",
  4527. protocol: "accessing",
  4528. fn: function (){
  4529. var self=this,$self=this;
  4530. return $core.withContext(function($ctx1) {
  4531. return self.getMinutes();
  4532. return self;
  4533. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4534. },
  4535. args: [],
  4536. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4537. referencedClasses: [],
  4538. messageSends: []
  4539. }),
  4540. $globals.Date);
  4541. $core.addMethod(
  4542. $core.method({
  4543. selector: "minutes:",
  4544. protocol: "accessing",
  4545. fn: function (aNumber){
  4546. var self=this,$self=this;
  4547. return $core.withContext(function($ctx1) {
  4548. self.setMinutes(aNumber);
  4549. return self;
  4550. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4551. },
  4552. args: ["aNumber"],
  4553. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4554. referencedClasses: [],
  4555. messageSends: []
  4556. }),
  4557. $globals.Date);
  4558. $core.addMethod(
  4559. $core.method({
  4560. selector: "month",
  4561. protocol: "accessing",
  4562. fn: function (){
  4563. var self=this,$self=this;
  4564. return $core.withContext(function($ctx1) {
  4565. return self.getMonth() + 1;
  4566. return self;
  4567. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4568. },
  4569. args: [],
  4570. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4571. referencedClasses: [],
  4572. messageSends: []
  4573. }),
  4574. $globals.Date);
  4575. $core.addMethod(
  4576. $core.method({
  4577. selector: "month:",
  4578. protocol: "accessing",
  4579. fn: function (aNumber){
  4580. var self=this,$self=this;
  4581. return $core.withContext(function($ctx1) {
  4582. self.setMonth(aNumber - 1);
  4583. return self;
  4584. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4585. },
  4586. args: ["aNumber"],
  4587. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4588. referencedClasses: [],
  4589. messageSends: []
  4590. }),
  4591. $globals.Date);
  4592. $core.addMethod(
  4593. $core.method({
  4594. selector: "printOn:",
  4595. protocol: "printing",
  4596. fn: function (aStream){
  4597. var self=this,$self=this;
  4598. return $core.withContext(function($ctx1) {
  4599. $recv(aStream)._nextPutAll_($self._asString());
  4600. return self;
  4601. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4602. },
  4603. args: ["aStream"],
  4604. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4605. referencedClasses: [],
  4606. messageSends: ["nextPutAll:", "asString"]
  4607. }),
  4608. $globals.Date);
  4609. $core.addMethod(
  4610. $core.method({
  4611. selector: "seconds",
  4612. protocol: "accessing",
  4613. fn: function (){
  4614. var self=this,$self=this;
  4615. return $core.withContext(function($ctx1) {
  4616. return self.getSeconds();
  4617. return self;
  4618. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4619. },
  4620. args: [],
  4621. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4622. referencedClasses: [],
  4623. messageSends: []
  4624. }),
  4625. $globals.Date);
  4626. $core.addMethod(
  4627. $core.method({
  4628. selector: "seconds:",
  4629. protocol: "accessing",
  4630. fn: function (aNumber){
  4631. var self=this,$self=this;
  4632. return $core.withContext(function($ctx1) {
  4633. self.setSeconds(aNumber);
  4634. return self;
  4635. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4636. },
  4637. args: ["aNumber"],
  4638. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4639. referencedClasses: [],
  4640. messageSends: []
  4641. }),
  4642. $globals.Date);
  4643. $core.addMethod(
  4644. $core.method({
  4645. selector: "time",
  4646. protocol: "accessing",
  4647. fn: function (){
  4648. var self=this,$self=this;
  4649. return $core.withContext(function($ctx1) {
  4650. return self.getTime();
  4651. return self;
  4652. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4653. },
  4654. args: [],
  4655. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4656. referencedClasses: [],
  4657. messageSends: []
  4658. }),
  4659. $globals.Date);
  4660. $core.addMethod(
  4661. $core.method({
  4662. selector: "time:",
  4663. protocol: "accessing",
  4664. fn: function (aNumber){
  4665. var self=this,$self=this;
  4666. return $core.withContext(function($ctx1) {
  4667. self.setTime(aNumber);
  4668. return self;
  4669. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4670. },
  4671. args: ["aNumber"],
  4672. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4673. referencedClasses: [],
  4674. messageSends: []
  4675. }),
  4676. $globals.Date);
  4677. $core.addMethod(
  4678. $core.method({
  4679. selector: "year",
  4680. protocol: "accessing",
  4681. fn: function (){
  4682. var self=this,$self=this;
  4683. return $core.withContext(function($ctx1) {
  4684. return self.getFullYear();
  4685. return self;
  4686. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4687. },
  4688. args: [],
  4689. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4690. referencedClasses: [],
  4691. messageSends: []
  4692. }),
  4693. $globals.Date);
  4694. $core.addMethod(
  4695. $core.method({
  4696. selector: "year:",
  4697. protocol: "accessing",
  4698. fn: function (aNumber){
  4699. var self=this,$self=this;
  4700. return $core.withContext(function($ctx1) {
  4701. self.setFullYear(aNumber);
  4702. return self;
  4703. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4704. },
  4705. args: ["aNumber"],
  4706. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4707. referencedClasses: [],
  4708. messageSends: []
  4709. }),
  4710. $globals.Date);
  4711. $core.addMethod(
  4712. $core.method({
  4713. selector: "classTag",
  4714. protocol: "accessing",
  4715. fn: function (){
  4716. var self=this,$self=this;
  4717. return "magnitude";
  4718. },
  4719. args: [],
  4720. 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'",
  4721. referencedClasses: [],
  4722. messageSends: []
  4723. }),
  4724. $globals.Date.a$cls);
  4725. $core.addMethod(
  4726. $core.method({
  4727. selector: "fromMilliseconds:",
  4728. protocol: "instance creation",
  4729. fn: function (aNumber){
  4730. var self=this,$self=this;
  4731. return $core.withContext(function($ctx1) {
  4732. return $self._new_(aNumber);
  4733. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4734. },
  4735. args: ["aNumber"],
  4736. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4737. referencedClasses: [],
  4738. messageSends: ["new:"]
  4739. }),
  4740. $globals.Date.a$cls);
  4741. $core.addMethod(
  4742. $core.method({
  4743. selector: "fromSeconds:",
  4744. protocol: "instance creation",
  4745. fn: function (aNumber){
  4746. var self=this,$self=this;
  4747. return $core.withContext(function($ctx1) {
  4748. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4749. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4750. },
  4751. args: ["aNumber"],
  4752. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4753. referencedClasses: [],
  4754. messageSends: ["fromMilliseconds:", "*"]
  4755. }),
  4756. $globals.Date.a$cls);
  4757. $core.addMethod(
  4758. $core.method({
  4759. selector: "fromString:",
  4760. protocol: "instance creation",
  4761. fn: function (aString){
  4762. var self=this,$self=this;
  4763. return $core.withContext(function($ctx1) {
  4764. return $self._new_(aString);
  4765. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4766. },
  4767. args: ["aString"],
  4768. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4769. referencedClasses: [],
  4770. messageSends: ["new:"]
  4771. }),
  4772. $globals.Date.a$cls);
  4773. $core.addMethod(
  4774. $core.method({
  4775. selector: "millisecondsToRun:",
  4776. protocol: "instance creation",
  4777. fn: function (aBlock){
  4778. var self=this,$self=this;
  4779. var t;
  4780. return $core.withContext(function($ctx1) {
  4781. t=$recv($globals.Date)._now();
  4782. $ctx1.sendIdx["now"]=1;
  4783. $recv(aBlock)._value();
  4784. return $recv($recv($globals.Date)._now()).__minus(t);
  4785. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4786. },
  4787. args: ["aBlock"],
  4788. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4789. referencedClasses: ["Date"],
  4790. messageSends: ["now", "value", "-"]
  4791. }),
  4792. $globals.Date.a$cls);
  4793. $core.addMethod(
  4794. $core.method({
  4795. selector: "new:",
  4796. protocol: "instance creation",
  4797. fn: function (anObject){
  4798. var self=this,$self=this;
  4799. return $core.withContext(function($ctx1) {
  4800. return new Date(anObject);
  4801. return self;
  4802. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4803. },
  4804. args: ["anObject"],
  4805. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4806. referencedClasses: [],
  4807. messageSends: []
  4808. }),
  4809. $globals.Date.a$cls);
  4810. $core.addMethod(
  4811. $core.method({
  4812. selector: "now",
  4813. protocol: "instance creation",
  4814. fn: function (){
  4815. var self=this,$self=this;
  4816. return $core.withContext(function($ctx1) {
  4817. return $self._today();
  4818. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4819. },
  4820. args: [],
  4821. source: "now\x0a\x09^ self today",
  4822. referencedClasses: [],
  4823. messageSends: ["today"]
  4824. }),
  4825. $globals.Date.a$cls);
  4826. $core.addMethod(
  4827. $core.method({
  4828. selector: "today",
  4829. protocol: "instance creation",
  4830. fn: function (){
  4831. var self=this,$self=this;
  4832. return $core.withContext(function($ctx1) {
  4833. return $self._new();
  4834. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4835. },
  4836. args: [],
  4837. source: "today\x0a\x09^ self new",
  4838. referencedClasses: [],
  4839. messageSends: ["new"]
  4840. }),
  4841. $globals.Date.a$cls);
  4842. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4843. $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 ].";
  4844. $core.addMethod(
  4845. $core.method({
  4846. selector: "&",
  4847. protocol: "converting",
  4848. fn: function (aNumber){
  4849. var self=this,$self=this;
  4850. return $core.withContext(function($ctx1) {
  4851. return self & aNumber;
  4852. return self;
  4853. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4854. },
  4855. args: ["aNumber"],
  4856. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4857. referencedClasses: [],
  4858. messageSends: []
  4859. }),
  4860. $globals.Number);
  4861. $core.addMethod(
  4862. $core.method({
  4863. selector: "*",
  4864. protocol: "arithmetic",
  4865. fn: function (aNumber){
  4866. var self=this,$self=this;
  4867. return $core.withContext(function($ctx1) {
  4868. return self * aNumber;
  4869. return self;
  4870. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4871. },
  4872. args: ["aNumber"],
  4873. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4874. referencedClasses: [],
  4875. messageSends: []
  4876. }),
  4877. $globals.Number);
  4878. $core.addMethod(
  4879. $core.method({
  4880. selector: "**",
  4881. protocol: "mathematical functions",
  4882. fn: function (exponent){
  4883. var self=this,$self=this;
  4884. return $core.withContext(function($ctx1) {
  4885. return $self._raisedTo_(exponent);
  4886. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4887. },
  4888. args: ["exponent"],
  4889. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4890. referencedClasses: [],
  4891. messageSends: ["raisedTo:"]
  4892. }),
  4893. $globals.Number);
  4894. $core.addMethod(
  4895. $core.method({
  4896. selector: "+",
  4897. protocol: "arithmetic",
  4898. fn: function (aNumber){
  4899. var self=this,$self=this;
  4900. return $core.withContext(function($ctx1) {
  4901. return self + aNumber;
  4902. return self;
  4903. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4904. },
  4905. args: ["aNumber"],
  4906. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4907. referencedClasses: [],
  4908. messageSends: []
  4909. }),
  4910. $globals.Number);
  4911. $core.addMethod(
  4912. $core.method({
  4913. selector: "-",
  4914. protocol: "arithmetic",
  4915. fn: function (aNumber){
  4916. var self=this,$self=this;
  4917. return $core.withContext(function($ctx1) {
  4918. return self - aNumber;
  4919. return self;
  4920. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4921. },
  4922. args: ["aNumber"],
  4923. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4924. referencedClasses: [],
  4925. messageSends: []
  4926. }),
  4927. $globals.Number);
  4928. $core.addMethod(
  4929. $core.method({
  4930. selector: "/",
  4931. protocol: "arithmetic",
  4932. fn: function (aNumber){
  4933. var self=this,$self=this;
  4934. return $core.withContext(function($ctx1) {
  4935. return self / aNumber;
  4936. return self;
  4937. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4938. },
  4939. args: ["aNumber"],
  4940. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4941. referencedClasses: [],
  4942. messageSends: []
  4943. }),
  4944. $globals.Number);
  4945. $core.addMethod(
  4946. $core.method({
  4947. selector: "//",
  4948. protocol: "arithmetic",
  4949. fn: function (aNumber){
  4950. var self=this,$self=this;
  4951. return $core.withContext(function($ctx1) {
  4952. return $recv($self.__slash(aNumber))._floor();
  4953. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4954. },
  4955. args: ["aNumber"],
  4956. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4957. referencedClasses: [],
  4958. messageSends: ["floor", "/"]
  4959. }),
  4960. $globals.Number);
  4961. $core.addMethod(
  4962. $core.method({
  4963. selector: "<",
  4964. protocol: "comparing",
  4965. fn: function (aNumber){
  4966. var self=this,$self=this;
  4967. return $core.withContext(function($ctx1) {
  4968. return self < aNumber;
  4969. return self;
  4970. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4971. },
  4972. args: ["aNumber"],
  4973. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4974. referencedClasses: [],
  4975. messageSends: []
  4976. }),
  4977. $globals.Number);
  4978. $core.addMethod(
  4979. $core.method({
  4980. selector: "<=",
  4981. protocol: "comparing",
  4982. fn: function (aNumber){
  4983. var self=this,$self=this;
  4984. return $core.withContext(function($ctx1) {
  4985. return self <= aNumber;
  4986. return self;
  4987. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4988. },
  4989. args: ["aNumber"],
  4990. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4991. referencedClasses: [],
  4992. messageSends: []
  4993. }),
  4994. $globals.Number);
  4995. $core.addMethod(
  4996. $core.method({
  4997. selector: "==",
  4998. protocol: "comparing",
  4999. fn: function (aNumber){
  5000. var self=this,$self=this;
  5001. return $core.withContext(function($ctx1) {
  5002. if (typeof aNumber === "number") return Number(self) === aNumber;
  5003. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  5004. else return false;;
  5005. return self;
  5006. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  5007. },
  5008. args: ["aNumber"],
  5009. 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'>",
  5010. referencedClasses: [],
  5011. messageSends: []
  5012. }),
  5013. $globals.Number);
  5014. $core.addMethod(
  5015. $core.method({
  5016. selector: ">",
  5017. protocol: "comparing",
  5018. fn: function (aNumber){
  5019. var self=this,$self=this;
  5020. return $core.withContext(function($ctx1) {
  5021. return self > aNumber;
  5022. return self;
  5023. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  5024. },
  5025. args: ["aNumber"],
  5026. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  5027. referencedClasses: [],
  5028. messageSends: []
  5029. }),
  5030. $globals.Number);
  5031. $core.addMethod(
  5032. $core.method({
  5033. selector: ">=",
  5034. protocol: "comparing",
  5035. fn: function (aNumber){
  5036. var self=this,$self=this;
  5037. return $core.withContext(function($ctx1) {
  5038. return self >= aNumber;
  5039. return self;
  5040. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  5041. },
  5042. args: ["aNumber"],
  5043. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  5044. referencedClasses: [],
  5045. messageSends: []
  5046. }),
  5047. $globals.Number);
  5048. $core.addMethod(
  5049. $core.method({
  5050. selector: "@",
  5051. protocol: "converting",
  5052. fn: function (aNumber){
  5053. var self=this,$self=this;
  5054. return $core.withContext(function($ctx1) {
  5055. return $recv($globals.Point)._x_y_(self,aNumber);
  5056. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5057. },
  5058. args: ["aNumber"],
  5059. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5060. referencedClasses: ["Point"],
  5061. messageSends: ["x:y:"]
  5062. }),
  5063. $globals.Number);
  5064. $core.addMethod(
  5065. $core.method({
  5066. selector: "\x5c\x5c",
  5067. protocol: "arithmetic",
  5068. fn: function (aNumber){
  5069. var self=this,$self=this;
  5070. return $core.withContext(function($ctx1) {
  5071. return self % aNumber;
  5072. return self;
  5073. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5074. },
  5075. args: ["aNumber"],
  5076. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5077. referencedClasses: [],
  5078. messageSends: []
  5079. }),
  5080. $globals.Number);
  5081. $core.addMethod(
  5082. $core.method({
  5083. selector: "abs",
  5084. protocol: "arithmetic",
  5085. fn: function (){
  5086. var self=this,$self=this;
  5087. return $core.withContext(function($ctx1) {
  5088. return Math.abs(self);;
  5089. return self;
  5090. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5091. },
  5092. args: [],
  5093. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5094. referencedClasses: [],
  5095. messageSends: []
  5096. }),
  5097. $globals.Number);
  5098. $core.addMethod(
  5099. $core.method({
  5100. selector: "arcCos",
  5101. protocol: "mathematical functions",
  5102. fn: function (){
  5103. var self=this,$self=this;
  5104. return $core.withContext(function($ctx1) {
  5105. return Math.acos(self);;
  5106. return self;
  5107. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5108. },
  5109. args: [],
  5110. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5111. referencedClasses: [],
  5112. messageSends: []
  5113. }),
  5114. $globals.Number);
  5115. $core.addMethod(
  5116. $core.method({
  5117. selector: "arcSin",
  5118. protocol: "mathematical functions",
  5119. fn: function (){
  5120. var self=this,$self=this;
  5121. return $core.withContext(function($ctx1) {
  5122. return Math.asin(self);;
  5123. return self;
  5124. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5125. },
  5126. args: [],
  5127. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5128. referencedClasses: [],
  5129. messageSends: []
  5130. }),
  5131. $globals.Number);
  5132. $core.addMethod(
  5133. $core.method({
  5134. selector: "arcTan",
  5135. protocol: "mathematical functions",
  5136. fn: function (){
  5137. var self=this,$self=this;
  5138. return $core.withContext(function($ctx1) {
  5139. return Math.atan(self);;
  5140. return self;
  5141. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5142. },
  5143. args: [],
  5144. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5145. referencedClasses: [],
  5146. messageSends: []
  5147. }),
  5148. $globals.Number);
  5149. $core.addMethod(
  5150. $core.method({
  5151. selector: "arcTan:",
  5152. protocol: "mathematical functions",
  5153. fn: function (aNumber){
  5154. var self=this,$self=this;
  5155. return $core.withContext(function($ctx1) {
  5156. return Math.atan2(self, aNumber);;
  5157. return self;
  5158. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5159. },
  5160. args: ["aNumber"],
  5161. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5162. referencedClasses: [],
  5163. messageSends: []
  5164. }),
  5165. $globals.Number);
  5166. $core.addMethod(
  5167. $core.method({
  5168. selector: "asJavaScriptObject",
  5169. protocol: "converting",
  5170. fn: function (){
  5171. var self=this,$self=this;
  5172. return self;
  5173. },
  5174. args: [],
  5175. source: "asJavaScriptObject\x0a\x09^ self",
  5176. referencedClasses: [],
  5177. messageSends: []
  5178. }),
  5179. $globals.Number);
  5180. $core.addMethod(
  5181. $core.method({
  5182. selector: "asJavaScriptSource",
  5183. protocol: "converting",
  5184. fn: function (){
  5185. var self=this,$self=this;
  5186. return $core.withContext(function($ctx1) {
  5187. var $1;
  5188. $1=$recv("(".__comma($self._printString())).__comma(")");
  5189. $ctx1.sendIdx[","]=1;
  5190. return $1;
  5191. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5192. },
  5193. args: [],
  5194. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5195. referencedClasses: [],
  5196. messageSends: [",", "printString"]
  5197. }),
  5198. $globals.Number);
  5199. $core.addMethod(
  5200. $core.method({
  5201. selector: "asNumber",
  5202. protocol: "converting",
  5203. fn: function (){
  5204. var self=this,$self=this;
  5205. return self;
  5206. },
  5207. args: [],
  5208. source: "asNumber\x0a\x09^ self",
  5209. referencedClasses: [],
  5210. messageSends: []
  5211. }),
  5212. $globals.Number);
  5213. $core.addMethod(
  5214. $core.method({
  5215. selector: "asPoint",
  5216. protocol: "converting",
  5217. fn: function (){
  5218. var self=this,$self=this;
  5219. return $core.withContext(function($ctx1) {
  5220. return $recv($globals.Point)._x_y_(self,self);
  5221. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5222. },
  5223. args: [],
  5224. source: "asPoint\x0a\x09^ Point x: self y: self",
  5225. referencedClasses: ["Point"],
  5226. messageSends: ["x:y:"]
  5227. }),
  5228. $globals.Number);
  5229. $core.addMethod(
  5230. $core.method({
  5231. selector: "asString",
  5232. protocol: "converting",
  5233. fn: function (){
  5234. var self=this,$self=this;
  5235. return $core.withContext(function($ctx1) {
  5236. return String(self);
  5237. return self;
  5238. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5239. },
  5240. args: [],
  5241. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5242. referencedClasses: [],
  5243. messageSends: []
  5244. }),
  5245. $globals.Number);
  5246. $core.addMethod(
  5247. $core.method({
  5248. selector: "atRandom",
  5249. protocol: "converting",
  5250. fn: function (){
  5251. var self=this,$self=this;
  5252. return $core.withContext(function($ctx1) {
  5253. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5254. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5255. },
  5256. args: [],
  5257. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5258. referencedClasses: ["Random"],
  5259. messageSends: ["+", "truncated", "*", "next", "new"]
  5260. }),
  5261. $globals.Number);
  5262. $core.addMethod(
  5263. $core.method({
  5264. selector: "between:and:",
  5265. protocol: "testing",
  5266. fn: function (min,max){
  5267. var self=this,$self=this;
  5268. return $core.withContext(function($ctx1) {
  5269. return $recv($self.__gt_eq(min))._and_((function(){
  5270. return $core.withContext(function($ctx2) {
  5271. return $self.__lt_eq(max);
  5272. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5273. }));
  5274. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5275. },
  5276. args: ["min", "max"],
  5277. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5278. referencedClasses: [],
  5279. messageSends: ["and:", ">=", "<="]
  5280. }),
  5281. $globals.Number);
  5282. $core.addMethod(
  5283. $core.method({
  5284. selector: "bitAnd:",
  5285. protocol: "converting",
  5286. fn: function (aNumber){
  5287. var self=this,$self=this;
  5288. return $core.withContext(function($ctx1) {
  5289. return self & aNumber;
  5290. return self;
  5291. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5292. },
  5293. args: ["aNumber"],
  5294. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5295. referencedClasses: [],
  5296. messageSends: []
  5297. }),
  5298. $globals.Number);
  5299. $core.addMethod(
  5300. $core.method({
  5301. selector: "bitNot",
  5302. protocol: "converting",
  5303. fn: function (){
  5304. var self=this,$self=this;
  5305. return $core.withContext(function($ctx1) {
  5306. return ~self;
  5307. return self;
  5308. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5309. },
  5310. args: [],
  5311. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5312. referencedClasses: [],
  5313. messageSends: []
  5314. }),
  5315. $globals.Number);
  5316. $core.addMethod(
  5317. $core.method({
  5318. selector: "bitOr:",
  5319. protocol: "converting",
  5320. fn: function (aNumber){
  5321. var self=this,$self=this;
  5322. return $core.withContext(function($ctx1) {
  5323. return self | aNumber;
  5324. return self;
  5325. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5326. },
  5327. args: ["aNumber"],
  5328. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5329. referencedClasses: [],
  5330. messageSends: []
  5331. }),
  5332. $globals.Number);
  5333. $core.addMethod(
  5334. $core.method({
  5335. selector: "bitXor:",
  5336. protocol: "converting",
  5337. fn: function (aNumber){
  5338. var self=this,$self=this;
  5339. return $core.withContext(function($ctx1) {
  5340. return self ^ aNumber;
  5341. return self;
  5342. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5343. },
  5344. args: ["aNumber"],
  5345. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5346. referencedClasses: [],
  5347. messageSends: []
  5348. }),
  5349. $globals.Number);
  5350. $core.addMethod(
  5351. $core.method({
  5352. selector: "ceiling",
  5353. protocol: "converting",
  5354. fn: function (){
  5355. var self=this,$self=this;
  5356. return $core.withContext(function($ctx1) {
  5357. return Math.ceil(self);;
  5358. return self;
  5359. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5360. },
  5361. args: [],
  5362. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5363. referencedClasses: [],
  5364. messageSends: []
  5365. }),
  5366. $globals.Number);
  5367. $core.addMethod(
  5368. $core.method({
  5369. selector: "copy",
  5370. protocol: "copying",
  5371. fn: function (){
  5372. var self=this,$self=this;
  5373. return self;
  5374. },
  5375. args: [],
  5376. source: "copy\x0a\x09^ self",
  5377. referencedClasses: [],
  5378. messageSends: []
  5379. }),
  5380. $globals.Number);
  5381. $core.addMethod(
  5382. $core.method({
  5383. selector: "cos",
  5384. protocol: "mathematical functions",
  5385. fn: function (){
  5386. var self=this,$self=this;
  5387. return $core.withContext(function($ctx1) {
  5388. return Math.cos(self);;
  5389. return self;
  5390. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5391. },
  5392. args: [],
  5393. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5394. referencedClasses: [],
  5395. messageSends: []
  5396. }),
  5397. $globals.Number);
  5398. $core.addMethod(
  5399. $core.method({
  5400. selector: "deepCopy",
  5401. protocol: "copying",
  5402. fn: function (){
  5403. var self=this,$self=this;
  5404. return $core.withContext(function($ctx1) {
  5405. return $self._copy();
  5406. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5407. },
  5408. args: [],
  5409. source: "deepCopy\x0a\x09^ self copy",
  5410. referencedClasses: [],
  5411. messageSends: ["copy"]
  5412. }),
  5413. $globals.Number);
  5414. $core.addMethod(
  5415. $core.method({
  5416. selector: "degreesToRadians",
  5417. protocol: "converting",
  5418. fn: function (){
  5419. var self=this,$self=this;
  5420. return $core.withContext(function($ctx1) {
  5421. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5422. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5423. },
  5424. args: [],
  5425. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5426. referencedClasses: ["Number"],
  5427. messageSends: ["*", "radiansPerDegree"]
  5428. }),
  5429. $globals.Number);
  5430. $core.addMethod(
  5431. $core.method({
  5432. selector: "even",
  5433. protocol: "testing",
  5434. fn: function (){
  5435. var self=this,$self=this;
  5436. return $core.withContext(function($ctx1) {
  5437. return (0).__eq($self.__backslash_backslash((2)));
  5438. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5439. },
  5440. args: [],
  5441. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5442. referencedClasses: [],
  5443. messageSends: ["=", "\x5c\x5c"]
  5444. }),
  5445. $globals.Number);
  5446. $core.addMethod(
  5447. $core.method({
  5448. selector: "floor",
  5449. protocol: "converting",
  5450. fn: function (){
  5451. var self=this,$self=this;
  5452. return $core.withContext(function($ctx1) {
  5453. return Math.floor(self);;
  5454. return self;
  5455. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5456. },
  5457. args: [],
  5458. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5459. referencedClasses: [],
  5460. messageSends: []
  5461. }),
  5462. $globals.Number);
  5463. $core.addMethod(
  5464. $core.method({
  5465. selector: "isImmutable",
  5466. protocol: "testing",
  5467. fn: function (){
  5468. var self=this,$self=this;
  5469. return true;
  5470. },
  5471. args: [],
  5472. source: "isImmutable\x0a\x09^ true",
  5473. referencedClasses: [],
  5474. messageSends: []
  5475. }),
  5476. $globals.Number);
  5477. $core.addMethod(
  5478. $core.method({
  5479. selector: "isNumber",
  5480. protocol: "testing",
  5481. fn: function (){
  5482. var self=this,$self=this;
  5483. return true;
  5484. },
  5485. args: [],
  5486. source: "isNumber\x0a\x09^ true",
  5487. referencedClasses: [],
  5488. messageSends: []
  5489. }),
  5490. $globals.Number);
  5491. $core.addMethod(
  5492. $core.method({
  5493. selector: "isZero",
  5494. protocol: "testing",
  5495. fn: function (){
  5496. var self=this,$self=this;
  5497. return $core.withContext(function($ctx1) {
  5498. return $self.__eq((0));
  5499. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5500. },
  5501. args: [],
  5502. source: "isZero\x0a\x09^ self = 0",
  5503. referencedClasses: [],
  5504. messageSends: ["="]
  5505. }),
  5506. $globals.Number);
  5507. $core.addMethod(
  5508. $core.method({
  5509. selector: "ln",
  5510. protocol: "mathematical functions",
  5511. fn: function (){
  5512. var self=this,$self=this;
  5513. return $core.withContext(function($ctx1) {
  5514. return Math.log(self);;
  5515. return self;
  5516. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5517. },
  5518. args: [],
  5519. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5520. referencedClasses: [],
  5521. messageSends: []
  5522. }),
  5523. $globals.Number);
  5524. $core.addMethod(
  5525. $core.method({
  5526. selector: "log",
  5527. protocol: "mathematical functions",
  5528. fn: function (){
  5529. var self=this,$self=this;
  5530. return $core.withContext(function($ctx1) {
  5531. return Math.log(self) / Math.LN10;;
  5532. return self;
  5533. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5534. },
  5535. args: [],
  5536. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5537. referencedClasses: [],
  5538. messageSends: []
  5539. }),
  5540. $globals.Number);
  5541. $core.addMethod(
  5542. $core.method({
  5543. selector: "log:",
  5544. protocol: "mathematical functions",
  5545. fn: function (aNumber){
  5546. var self=this,$self=this;
  5547. return $core.withContext(function($ctx1) {
  5548. return Math.log(self) / Math.log(aNumber);;
  5549. return self;
  5550. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5551. },
  5552. args: ["aNumber"],
  5553. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5554. referencedClasses: [],
  5555. messageSends: []
  5556. }),
  5557. $globals.Number);
  5558. $core.addMethod(
  5559. $core.method({
  5560. selector: "max:",
  5561. protocol: "arithmetic",
  5562. fn: function (aNumber){
  5563. var self=this,$self=this;
  5564. return $core.withContext(function($ctx1) {
  5565. return Math.max(self, aNumber);;
  5566. return self;
  5567. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5568. },
  5569. args: ["aNumber"],
  5570. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5571. referencedClasses: [],
  5572. messageSends: []
  5573. }),
  5574. $globals.Number);
  5575. $core.addMethod(
  5576. $core.method({
  5577. selector: "min:",
  5578. protocol: "arithmetic",
  5579. fn: function (aNumber){
  5580. var self=this,$self=this;
  5581. return $core.withContext(function($ctx1) {
  5582. return Math.min(self, aNumber);;
  5583. return self;
  5584. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5585. },
  5586. args: ["aNumber"],
  5587. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5588. referencedClasses: [],
  5589. messageSends: []
  5590. }),
  5591. $globals.Number);
  5592. $core.addMethod(
  5593. $core.method({
  5594. selector: "min:max:",
  5595. protocol: "arithmetic",
  5596. fn: function (aMin,aMax){
  5597. var self=this,$self=this;
  5598. return $core.withContext(function($ctx1) {
  5599. return $recv($self._min_(aMin))._max_(aMax);
  5600. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5601. },
  5602. args: ["aMin", "aMax"],
  5603. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5604. referencedClasses: [],
  5605. messageSends: ["max:", "min:"]
  5606. }),
  5607. $globals.Number);
  5608. $core.addMethod(
  5609. $core.method({
  5610. selector: "negated",
  5611. protocol: "arithmetic",
  5612. fn: function (){
  5613. var self=this,$self=this;
  5614. return $core.withContext(function($ctx1) {
  5615. return (0).__minus(self);
  5616. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5617. },
  5618. args: [],
  5619. source: "negated\x0a\x09^ 0 - self",
  5620. referencedClasses: [],
  5621. messageSends: ["-"]
  5622. }),
  5623. $globals.Number);
  5624. $core.addMethod(
  5625. $core.method({
  5626. selector: "negative",
  5627. protocol: "testing",
  5628. fn: function (){
  5629. var self=this,$self=this;
  5630. return $core.withContext(function($ctx1) {
  5631. return $self.__lt((0));
  5632. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5633. },
  5634. args: [],
  5635. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5636. referencedClasses: [],
  5637. messageSends: ["<"]
  5638. }),
  5639. $globals.Number);
  5640. $core.addMethod(
  5641. $core.method({
  5642. selector: "odd",
  5643. protocol: "testing",
  5644. fn: function (){
  5645. var self=this,$self=this;
  5646. return $core.withContext(function($ctx1) {
  5647. return $recv($self._even())._not();
  5648. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5649. },
  5650. args: [],
  5651. source: "odd\x0a\x09^ self even not",
  5652. referencedClasses: [],
  5653. messageSends: ["not", "even"]
  5654. }),
  5655. $globals.Number);
  5656. $core.addMethod(
  5657. $core.method({
  5658. selector: "positive",
  5659. protocol: "testing",
  5660. fn: function (){
  5661. var self=this,$self=this;
  5662. return $core.withContext(function($ctx1) {
  5663. return $self.__gt_eq((0));
  5664. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5665. },
  5666. args: [],
  5667. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5668. referencedClasses: [],
  5669. messageSends: [">="]
  5670. }),
  5671. $globals.Number);
  5672. $core.addMethod(
  5673. $core.method({
  5674. selector: "printOn:",
  5675. protocol: "printing",
  5676. fn: function (aStream){
  5677. var self=this,$self=this;
  5678. return $core.withContext(function($ctx1) {
  5679. $recv(aStream)._nextPutAll_($self._asString());
  5680. return self;
  5681. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5682. },
  5683. args: ["aStream"],
  5684. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5685. referencedClasses: [],
  5686. messageSends: ["nextPutAll:", "asString"]
  5687. }),
  5688. $globals.Number);
  5689. $core.addMethod(
  5690. $core.method({
  5691. selector: "printShowingDecimalPlaces:",
  5692. protocol: "printing",
  5693. fn: function (placesDesired){
  5694. var self=this,$self=this;
  5695. return $core.withContext(function($ctx1) {
  5696. return self.toFixed(placesDesired);
  5697. return self;
  5698. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5699. },
  5700. args: ["placesDesired"],
  5701. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5702. referencedClasses: [],
  5703. messageSends: []
  5704. }),
  5705. $globals.Number);
  5706. $core.addMethod(
  5707. $core.method({
  5708. selector: "printStringBase:",
  5709. protocol: "converting",
  5710. fn: function (aBase){
  5711. var self=this,$self=this;
  5712. return $core.withContext(function($ctx1) {
  5713. return self.toString(aBase);
  5714. return self;
  5715. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5716. },
  5717. args: ["aBase"],
  5718. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5719. referencedClasses: [],
  5720. messageSends: []
  5721. }),
  5722. $globals.Number);
  5723. $core.addMethod(
  5724. $core.method({
  5725. selector: "radiansToDegrees",
  5726. protocol: "converting",
  5727. fn: function (){
  5728. var self=this,$self=this;
  5729. return $core.withContext(function($ctx1) {
  5730. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5731. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5732. },
  5733. args: [],
  5734. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5735. referencedClasses: ["Number"],
  5736. messageSends: ["/", "radiansPerDegree"]
  5737. }),
  5738. $globals.Number);
  5739. $core.addMethod(
  5740. $core.method({
  5741. selector: "raisedTo:",
  5742. protocol: "mathematical functions",
  5743. fn: function (exponent){
  5744. var self=this,$self=this;
  5745. return $core.withContext(function($ctx1) {
  5746. return Math.pow(self, exponent);;
  5747. return self;
  5748. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5749. },
  5750. args: ["exponent"],
  5751. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5752. referencedClasses: [],
  5753. messageSends: []
  5754. }),
  5755. $globals.Number);
  5756. $core.addMethod(
  5757. $core.method({
  5758. selector: "rounded",
  5759. protocol: "converting",
  5760. fn: function (){
  5761. var self=this,$self=this;
  5762. return $core.withContext(function($ctx1) {
  5763. return Math.round(self);;
  5764. return self;
  5765. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5766. },
  5767. args: [],
  5768. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5769. referencedClasses: [],
  5770. messageSends: []
  5771. }),
  5772. $globals.Number);
  5773. $core.addMethod(
  5774. $core.method({
  5775. selector: "sign",
  5776. protocol: "mathematical functions",
  5777. fn: function (){
  5778. var self=this,$self=this;
  5779. return $core.withContext(function($ctx1) {
  5780. var $1,$2;
  5781. $1=$self._isZero();
  5782. if($core.assert($1)){
  5783. return (0);
  5784. }
  5785. $2=$self._positive();
  5786. if($core.assert($2)){
  5787. return (1);
  5788. } else {
  5789. return (-1);
  5790. }
  5791. return self;
  5792. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5793. },
  5794. args: [],
  5795. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5796. referencedClasses: [],
  5797. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5798. }),
  5799. $globals.Number);
  5800. $core.addMethod(
  5801. $core.method({
  5802. selector: "sin",
  5803. protocol: "mathematical functions",
  5804. fn: function (){
  5805. var self=this,$self=this;
  5806. return $core.withContext(function($ctx1) {
  5807. return Math.sin(self);;
  5808. return self;
  5809. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5810. },
  5811. args: [],
  5812. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5813. referencedClasses: [],
  5814. messageSends: []
  5815. }),
  5816. $globals.Number);
  5817. $core.addMethod(
  5818. $core.method({
  5819. selector: "sqrt",
  5820. protocol: "mathematical functions",
  5821. fn: function (){
  5822. var self=this,$self=this;
  5823. return $core.withContext(function($ctx1) {
  5824. return Math.sqrt(self);
  5825. return self;
  5826. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5827. },
  5828. args: [],
  5829. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5830. referencedClasses: [],
  5831. messageSends: []
  5832. }),
  5833. $globals.Number);
  5834. $core.addMethod(
  5835. $core.method({
  5836. selector: "squared",
  5837. protocol: "mathematical functions",
  5838. fn: function (){
  5839. var self=this,$self=this;
  5840. return $core.withContext(function($ctx1) {
  5841. return $self.__star(self);
  5842. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5843. },
  5844. args: [],
  5845. source: "squared\x0a\x09^ self * self",
  5846. referencedClasses: [],
  5847. messageSends: ["*"]
  5848. }),
  5849. $globals.Number);
  5850. $core.addMethod(
  5851. $core.method({
  5852. selector: "tan",
  5853. protocol: "mathematical functions",
  5854. fn: function (){
  5855. var self=this,$self=this;
  5856. return $core.withContext(function($ctx1) {
  5857. return Math.tan(self);;
  5858. return self;
  5859. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5860. },
  5861. args: [],
  5862. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5863. referencedClasses: [],
  5864. messageSends: []
  5865. }),
  5866. $globals.Number);
  5867. $core.addMethod(
  5868. $core.method({
  5869. selector: "timesRepeat:",
  5870. protocol: "enumerating",
  5871. fn: function (aBlock){
  5872. var self=this,$self=this;
  5873. var count;
  5874. return $core.withContext(function($ctx1) {
  5875. count=(1);
  5876. $recv((function(){
  5877. return $core.withContext(function($ctx2) {
  5878. return $recv(count).__gt(self);
  5879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5880. }))._whileFalse_((function(){
  5881. return $core.withContext(function($ctx2) {
  5882. $recv(aBlock)._value();
  5883. count=$recv(count).__plus((1));
  5884. return count;
  5885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5886. }));
  5887. return self;
  5888. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5889. },
  5890. args: ["aBlock"],
  5891. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5892. referencedClasses: [],
  5893. messageSends: ["whileFalse:", ">", "value", "+"]
  5894. }),
  5895. $globals.Number);
  5896. $core.addMethod(
  5897. $core.method({
  5898. selector: "to:",
  5899. protocol: "converting",
  5900. fn: function (aNumber){
  5901. var self=this,$self=this;
  5902. var array,first,last,count;
  5903. return $core.withContext(function($ctx1) {
  5904. first=$self._truncated();
  5905. $ctx1.sendIdx["truncated"]=1;
  5906. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5907. $ctx1.sendIdx["+"]=1;
  5908. count=(1);
  5909. array=$recv($globals.Array)._new();
  5910. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5911. return $core.withContext(function($ctx2) {
  5912. $recv(array)._at_put_(count,first);
  5913. count=$recv(count).__plus((1));
  5914. $ctx2.sendIdx["+"]=2;
  5915. count;
  5916. first=$recv(first).__plus((1));
  5917. return first;
  5918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5919. }));
  5920. return array;
  5921. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5922. },
  5923. args: ["aNumber"],
  5924. 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",
  5925. referencedClasses: ["Array"],
  5926. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5927. }),
  5928. $globals.Number);
  5929. $core.addMethod(
  5930. $core.method({
  5931. selector: "to:by:",
  5932. protocol: "converting",
  5933. fn: function (stop,step){
  5934. var self=this,$self=this;
  5935. var array,value,pos;
  5936. return $core.withContext(function($ctx1) {
  5937. var $1,$2;
  5938. value=self;
  5939. array=$recv($globals.Array)._new();
  5940. pos=(1);
  5941. $1=$recv(step).__eq((0));
  5942. if($core.assert($1)){
  5943. $self._error_("step must be non-zero");
  5944. }
  5945. $2=$recv(step).__lt((0));
  5946. if($core.assert($2)){
  5947. $recv((function(){
  5948. return $core.withContext(function($ctx2) {
  5949. return $recv(value).__gt_eq(stop);
  5950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5951. }))._whileTrue_((function(){
  5952. return $core.withContext(function($ctx2) {
  5953. $recv(array)._at_put_(pos,value);
  5954. $ctx2.sendIdx["at:put:"]=1;
  5955. pos=$recv(pos).__plus((1));
  5956. $ctx2.sendIdx["+"]=1;
  5957. pos;
  5958. value=$recv(value).__plus(step);
  5959. $ctx2.sendIdx["+"]=2;
  5960. return value;
  5961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5962. }));
  5963. $ctx1.sendIdx["whileTrue:"]=1;
  5964. } else {
  5965. $recv((function(){
  5966. return $core.withContext(function($ctx2) {
  5967. return $recv(value).__lt_eq(stop);
  5968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5969. }))._whileTrue_((function(){
  5970. return $core.withContext(function($ctx2) {
  5971. $recv(array)._at_put_(pos,value);
  5972. pos=$recv(pos).__plus((1));
  5973. $ctx2.sendIdx["+"]=3;
  5974. pos;
  5975. value=$recv(value).__plus(step);
  5976. return value;
  5977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5978. }));
  5979. }
  5980. return array;
  5981. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5982. },
  5983. args: ["stop", "step"],
  5984. 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",
  5985. referencedClasses: ["Array"],
  5986. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5987. }),
  5988. $globals.Number);
  5989. $core.addMethod(
  5990. $core.method({
  5991. selector: "to:by:do:",
  5992. protocol: "enumerating",
  5993. fn: function (stop,step,aBlock){
  5994. var self=this,$self=this;
  5995. var value;
  5996. return $core.withContext(function($ctx1) {
  5997. var $1,$2;
  5998. value=self;
  5999. $1=$recv(step).__eq((0));
  6000. if($core.assert($1)){
  6001. $self._error_("step must be non-zero");
  6002. }
  6003. $2=$recv(step).__lt((0));
  6004. if($core.assert($2)){
  6005. $recv((function(){
  6006. return $core.withContext(function($ctx2) {
  6007. return $recv(value).__gt_eq(stop);
  6008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  6009. }))._whileTrue_((function(){
  6010. return $core.withContext(function($ctx2) {
  6011. $recv(aBlock)._value_(value);
  6012. $ctx2.sendIdx["value:"]=1;
  6013. value=$recv(value).__plus(step);
  6014. $ctx2.sendIdx["+"]=1;
  6015. return value;
  6016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  6017. }));
  6018. $ctx1.sendIdx["whileTrue:"]=1;
  6019. } else {
  6020. $recv((function(){
  6021. return $core.withContext(function($ctx2) {
  6022. return $recv(value).__lt_eq(stop);
  6023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  6024. }))._whileTrue_((function(){
  6025. return $core.withContext(function($ctx2) {
  6026. $recv(aBlock)._value_(value);
  6027. value=$recv(value).__plus(step);
  6028. return value;
  6029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  6030. }));
  6031. }
  6032. return self;
  6033. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6034. },
  6035. args: ["stop", "step", "aBlock"],
  6036. 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 ]]",
  6037. referencedClasses: [],
  6038. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6039. }),
  6040. $globals.Number);
  6041. $core.addMethod(
  6042. $core.method({
  6043. selector: "to:do:",
  6044. protocol: "enumerating",
  6045. fn: function (stop,aBlock){
  6046. var self=this,$self=this;
  6047. var nextValue;
  6048. return $core.withContext(function($ctx1) {
  6049. nextValue=self;
  6050. $recv((function(){
  6051. return $core.withContext(function($ctx2) {
  6052. return $recv(nextValue).__lt_eq(stop);
  6053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6054. }))._whileTrue_((function(){
  6055. return $core.withContext(function($ctx2) {
  6056. $recv(aBlock)._value_(nextValue);
  6057. nextValue=$recv(nextValue).__plus((1));
  6058. return nextValue;
  6059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6060. }));
  6061. return self;
  6062. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6063. },
  6064. args: ["stop", "aBlock"],
  6065. 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 ]",
  6066. referencedClasses: [],
  6067. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6068. }),
  6069. $globals.Number);
  6070. $core.addMethod(
  6071. $core.method({
  6072. selector: "truncated",
  6073. protocol: "converting",
  6074. fn: function (){
  6075. var self=this,$self=this;
  6076. return $core.withContext(function($ctx1) {
  6077. if(self >= 0) {
  6078. return Math.floor(self);
  6079. } else {
  6080. return Math.floor(self * (-1)) * (-1);
  6081. };
  6082. ;
  6083. return self;
  6084. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6085. },
  6086. args: [],
  6087. 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'>",
  6088. referencedClasses: [],
  6089. messageSends: []
  6090. }),
  6091. $globals.Number);
  6092. $core.addMethod(
  6093. $core.method({
  6094. selector: "|",
  6095. protocol: "converting",
  6096. fn: function (aNumber){
  6097. var self=this,$self=this;
  6098. return $core.withContext(function($ctx1) {
  6099. return self | aNumber;
  6100. return self;
  6101. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6102. },
  6103. args: ["aNumber"],
  6104. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6105. referencedClasses: [],
  6106. messageSends: []
  6107. }),
  6108. $globals.Number);
  6109. $core.addMethod(
  6110. $core.method({
  6111. selector: "classTag",
  6112. protocol: "accessing",
  6113. fn: function (){
  6114. var self=this,$self=this;
  6115. return "magnitude";
  6116. },
  6117. args: [],
  6118. 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'",
  6119. referencedClasses: [],
  6120. messageSends: []
  6121. }),
  6122. $globals.Number.a$cls);
  6123. $core.addMethod(
  6124. $core.method({
  6125. selector: "e",
  6126. protocol: "instance creation",
  6127. fn: function (){
  6128. var self=this,$self=this;
  6129. return $core.withContext(function($ctx1) {
  6130. return Math.E;;
  6131. return self;
  6132. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6133. },
  6134. args: [],
  6135. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6136. referencedClasses: [],
  6137. messageSends: []
  6138. }),
  6139. $globals.Number.a$cls);
  6140. $core.addMethod(
  6141. $core.method({
  6142. selector: "pi",
  6143. protocol: "instance creation",
  6144. fn: function (){
  6145. var self=this,$self=this;
  6146. return $core.withContext(function($ctx1) {
  6147. return Math.PI;
  6148. return self;
  6149. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6150. },
  6151. args: [],
  6152. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6153. referencedClasses: [],
  6154. messageSends: []
  6155. }),
  6156. $globals.Number.a$cls);
  6157. $core.addMethod(
  6158. $core.method({
  6159. selector: "radiansPerDegree",
  6160. protocol: "instance creation",
  6161. fn: function (){
  6162. var self=this,$self=this;
  6163. return $core.withContext(function($ctx1) {
  6164. return $recv($self._pi()).__slash((180));
  6165. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6166. },
  6167. args: [],
  6168. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6169. referencedClasses: [],
  6170. messageSends: ["/", "pi"]
  6171. }),
  6172. $globals.Number.a$cls);
  6173. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6174. $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";
  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).__star($3);
  6189. $ctx1.sendIdx["*"]=1;
  6190. $6=$self._y();
  6191. $ctx1.sendIdx["y"]=1;
  6192. $5=$recv($6).__star($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).__plus($3);
  6216. $ctx1.sendIdx["+"]=1;
  6217. $6=$self._y();
  6218. $ctx1.sendIdx["y"]=1;
  6219. $5=$recv($6).__plus($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).__minus($3);
  6243. $ctx1.sendIdx["-"]=1;
  6244. $6=$self._y();
  6245. $ctx1.sendIdx["y"]=1;
  6246. $5=$recv($6).__minus($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: "arithmetic",
  6260. fn: function (aPoint){
  6261. var self=this,$self=this;
  6262. return $core.withContext(function($ctx1) {
  6263. var $2,$4,$3,$1,$6,$5;
  6264. $2=$self._x();
  6265. $ctx1.sendIdx["x"]=1;
  6266. $4=$recv(aPoint)._asPoint();
  6267. $ctx1.sendIdx["asPoint"]=1;
  6268. $3=$recv($4)._x();
  6269. $1=$recv($2).__slash($3);
  6270. $ctx1.sendIdx["/"]=1;
  6271. $6=$self._y();
  6272. $ctx1.sendIdx["y"]=1;
  6273. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6274. return $recv($globals.Point)._x_y_($1,$5);
  6275. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6276. },
  6277. args: ["aPoint"],
  6278. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6279. referencedClasses: ["Point"],
  6280. messageSends: ["x:y:", "/", "x", "asPoint", "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($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($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,$3;
  6318. $2=$self._x();
  6319. $ctx1.sendIdx["x"]=1;
  6320. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6321. $ctx1.sendIdx["<="]=1;
  6322. return $recv($1)._and_((function(){
  6323. return $core.withContext(function($ctx2) {
  6324. $3=$self._y();
  6325. $ctx2.sendIdx["y"]=1;
  6326. return $recv($3).__lt_eq($recv(aPoint)._y());
  6327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6328. }));
  6329. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6330. },
  6331. args: ["aPoint"],
  6332. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6333. referencedClasses: [],
  6334. messageSends: ["and:", "<=", "x", "y"]
  6335. }),
  6336. $globals.Point);
  6337. $core.addMethod(
  6338. $core.method({
  6339. selector: "=",
  6340. protocol: "comparing",
  6341. fn: function (aPoint){
  6342. var self=this,$self=this;
  6343. return $core.withContext(function($ctx1) {
  6344. var $2,$1,$4,$3,$6,$5;
  6345. $2=$recv(aPoint)._class();
  6346. $ctx1.sendIdx["class"]=1;
  6347. $1=$recv($2).__eq($self._class());
  6348. $ctx1.sendIdx["="]=1;
  6349. return $recv($1)._and_((function(){
  6350. return $core.withContext(function($ctx2) {
  6351. $4=$recv(aPoint)._x();
  6352. $ctx2.sendIdx["x"]=1;
  6353. $3=$recv($4).__eq($self._x());
  6354. $ctx2.sendIdx["="]=2;
  6355. $6=$recv(aPoint)._y();
  6356. $ctx2.sendIdx["y"]=1;
  6357. $5=$recv($6).__eq($self._y());
  6358. return $recv($3).__and($5);
  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^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6365. referencedClasses: [],
  6366. messageSends: ["and:", "=", "class", "&", "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($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($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: ">=",
  6399. protocol: "comparing",
  6400. fn: function (aPoint){
  6401. var self=this,$self=this;
  6402. return $core.withContext(function($ctx1) {
  6403. var $2,$1,$3;
  6404. $2=$self._x();
  6405. $ctx1.sendIdx["x"]=1;
  6406. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6407. $ctx1.sendIdx[">="]=1;
  6408. return $recv($1)._and_((function(){
  6409. return $core.withContext(function($ctx2) {
  6410. $3=$self._y();
  6411. $ctx2.sendIdx["y"]=1;
  6412. return $recv($3).__gt_eq($recv(aPoint)._y());
  6413. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6414. }));
  6415. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6416. },
  6417. args: ["aPoint"],
  6418. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6419. referencedClasses: [],
  6420. messageSends: ["and:", ">=", "x", "y"]
  6421. }),
  6422. $globals.Point);
  6423. $core.addMethod(
  6424. $core.method({
  6425. selector: "angle",
  6426. protocol: "geometry",
  6427. fn: function (){
  6428. var self=this,$self=this;
  6429. return $core.withContext(function($ctx1) {
  6430. return $recv($self._y())._arcTan_($self._x());
  6431. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6432. },
  6433. args: [],
  6434. source: "angle\x0a\x09^ self y arcTan: self x",
  6435. referencedClasses: [],
  6436. messageSends: ["arcTan:", "y", "x"]
  6437. }),
  6438. $globals.Point);
  6439. $core.addMethod(
  6440. $core.method({
  6441. selector: "asPoint",
  6442. protocol: "converting",
  6443. fn: function (){
  6444. var self=this,$self=this;
  6445. return self;
  6446. },
  6447. args: [],
  6448. source: "asPoint\x0a\x09^ self",
  6449. referencedClasses: [],
  6450. messageSends: []
  6451. }),
  6452. $globals.Point);
  6453. $core.addMethod(
  6454. $core.method({
  6455. selector: "corner:",
  6456. protocol: "rectangle creation",
  6457. fn: function (aPoint){
  6458. var self=this,$self=this;
  6459. return $core.withContext(function($ctx1) {
  6460. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6461. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6462. },
  6463. args: ["aPoint"],
  6464. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6465. referencedClasses: ["Rectangle"],
  6466. messageSends: ["origin:corner:"]
  6467. }),
  6468. $globals.Point);
  6469. $core.addMethod(
  6470. $core.method({
  6471. selector: "dist:",
  6472. protocol: "transforming",
  6473. fn: function (aPoint){
  6474. var self=this,$self=this;
  6475. var dx,dy;
  6476. return $core.withContext(function($ctx1) {
  6477. var $2,$1;
  6478. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6479. $ctx1.sendIdx["-"]=1;
  6480. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6481. $2=$recv(dx).__star(dx);
  6482. $ctx1.sendIdx["*"]=1;
  6483. $1=$recv($2).__plus($recv(dy).__star(dy));
  6484. return $recv($1)._sqrt();
  6485. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6486. },
  6487. args: ["aPoint"],
  6488. 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",
  6489. referencedClasses: [],
  6490. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6491. }),
  6492. $globals.Point);
  6493. $core.addMethod(
  6494. $core.method({
  6495. selector: "dotProduct:",
  6496. protocol: "point functions",
  6497. fn: function (aPoint){
  6498. var self=this,$self=this;
  6499. return $core.withContext(function($ctx1) {
  6500. var $1;
  6501. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6502. $ctx1.sendIdx["*"]=1;
  6503. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6504. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6505. },
  6506. args: ["aPoint"],
  6507. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6508. referencedClasses: [],
  6509. messageSends: ["+", "*", "x", "y"]
  6510. }),
  6511. $globals.Point);
  6512. $core.addMethod(
  6513. $core.method({
  6514. selector: "extent:",
  6515. protocol: "rectangle creation",
  6516. fn: function (aPoint){
  6517. var self=this,$self=this;
  6518. return $core.withContext(function($ctx1) {
  6519. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6520. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6521. },
  6522. args: ["aPoint"],
  6523. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6524. referencedClasses: ["Rectangle"],
  6525. messageSends: ["origin:extent:"]
  6526. }),
  6527. $globals.Point);
  6528. $core.addMethod(
  6529. $core.method({
  6530. selector: "normal",
  6531. protocol: "point functions",
  6532. fn: function (){
  6533. var self=this,$self=this;
  6534. var n,d;
  6535. return $core.withContext(function($ctx1) {
  6536. var $4,$3,$6,$5,$2,$1;
  6537. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6538. $ctx1.sendIdx["@"]=1;
  6539. $4=$recv(n)._x();
  6540. $ctx1.sendIdx["x"]=1;
  6541. $3=$recv($4).__star($recv(n)._x());
  6542. $ctx1.sendIdx["*"]=1;
  6543. $6=$recv(n)._y();
  6544. $ctx1.sendIdx["y"]=1;
  6545. $5=$recv($6).__star($recv(n)._y());
  6546. d=$recv($3).__plus($5);
  6547. $2=d;
  6548. $1=$recv($2).__eq((0));
  6549. if($core.assert($1)){
  6550. return (-1).__at((0));
  6551. }
  6552. return $recv(n).__slash($recv(d)._sqrt());
  6553. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6554. },
  6555. args: [],
  6556. 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",
  6557. referencedClasses: [],
  6558. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6559. }),
  6560. $globals.Point);
  6561. $core.addMethod(
  6562. $core.method({
  6563. selector: "normalized",
  6564. protocol: "point functions",
  6565. fn: function (){
  6566. var self=this,$self=this;
  6567. var r;
  6568. return $core.withContext(function($ctx1) {
  6569. var $1,$2,$3;
  6570. r=$self._r();
  6571. $1=$recv(r).__eq((0));
  6572. if($core.assert($1)){
  6573. $2=$recv($globals.Point)._x_y_((0),(0));
  6574. $ctx1.sendIdx["x:y:"]=1;
  6575. return $2;
  6576. } else {
  6577. $3=$recv($self["@x"]).__slash(r);
  6578. $ctx1.sendIdx["/"]=1;
  6579. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6580. }
  6581. return self;
  6582. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6583. },
  6584. args: [],
  6585. 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 ]",
  6586. referencedClasses: ["Point"],
  6587. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6588. }),
  6589. $globals.Point);
  6590. $core.addMethod(
  6591. $core.method({
  6592. selector: "printOn:",
  6593. protocol: "printing",
  6594. fn: function (aStream){
  6595. var self=this,$self=this;
  6596. return $core.withContext(function($ctx1) {
  6597. var $1;
  6598. $recv($self["@x"])._printOn_(aStream);
  6599. $ctx1.sendIdx["printOn:"]=1;
  6600. $recv(aStream)._nextPutAll_("@");
  6601. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6602. return $core.withContext(function($ctx2) {
  6603. return $recv($self["@y"])._negative();
  6604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6605. }));
  6606. if($core.assert($1)){
  6607. $recv(aStream)._space();
  6608. }
  6609. $recv($self["@y"])._printOn_(aStream);
  6610. return self;
  6611. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6612. },
  6613. args: ["aStream"],
  6614. 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",
  6615. referencedClasses: [],
  6616. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6617. }),
  6618. $globals.Point);
  6619. $core.addMethod(
  6620. $core.method({
  6621. selector: "r",
  6622. protocol: "polar coordinates",
  6623. fn: function (){
  6624. var self=this,$self=this;
  6625. return $core.withContext(function($ctx1) {
  6626. var $2,$1;
  6627. $2=$recv($self["@x"]).__star($self["@x"]);
  6628. $ctx1.sendIdx["*"]=1;
  6629. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6630. return $recv($1)._sqrt();
  6631. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6632. },
  6633. args: [],
  6634. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6635. referencedClasses: [],
  6636. messageSends: ["sqrt", "+", "*"]
  6637. }),
  6638. $globals.Point);
  6639. $core.addMethod(
  6640. $core.method({
  6641. selector: "rectangle:",
  6642. protocol: "rectangle creation",
  6643. fn: function (aPoint){
  6644. var self=this,$self=this;
  6645. return $core.withContext(function($ctx1) {
  6646. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6647. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6648. },
  6649. args: ["aPoint"],
  6650. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6651. referencedClasses: ["Rectangle"],
  6652. messageSends: ["point:point:"]
  6653. }),
  6654. $globals.Point);
  6655. $core.addMethod(
  6656. $core.method({
  6657. selector: "translateBy:",
  6658. protocol: "transforming",
  6659. fn: function (delta){
  6660. var self=this,$self=this;
  6661. return $core.withContext(function($ctx1) {
  6662. var $1;
  6663. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6664. $ctx1.sendIdx["+"]=1;
  6665. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6666. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6667. },
  6668. args: ["delta"],
  6669. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6670. referencedClasses: [],
  6671. messageSends: ["@", "+", "x", "y"]
  6672. }),
  6673. $globals.Point);
  6674. $core.addMethod(
  6675. $core.method({
  6676. selector: "x",
  6677. protocol: "accessing",
  6678. fn: function (){
  6679. var self=this,$self=this;
  6680. return $self["@x"];
  6681. },
  6682. args: [],
  6683. source: "x\x0a\x09^ x",
  6684. referencedClasses: [],
  6685. messageSends: []
  6686. }),
  6687. $globals.Point);
  6688. $core.addMethod(
  6689. $core.method({
  6690. selector: "x:",
  6691. protocol: "accessing",
  6692. fn: function (aNumber){
  6693. var self=this,$self=this;
  6694. $self["@x"]=aNumber;
  6695. return self;
  6696. },
  6697. args: ["aNumber"],
  6698. source: "x: aNumber\x0a\x09x := aNumber",
  6699. referencedClasses: [],
  6700. messageSends: []
  6701. }),
  6702. $globals.Point);
  6703. $core.addMethod(
  6704. $core.method({
  6705. selector: "y",
  6706. protocol: "accessing",
  6707. fn: function (){
  6708. var self=this,$self=this;
  6709. return $self["@y"];
  6710. },
  6711. args: [],
  6712. source: "y\x0a\x09^ y",
  6713. referencedClasses: [],
  6714. messageSends: []
  6715. }),
  6716. $globals.Point);
  6717. $core.addMethod(
  6718. $core.method({
  6719. selector: "y:",
  6720. protocol: "accessing",
  6721. fn: function (aNumber){
  6722. var self=this,$self=this;
  6723. $self["@y"]=aNumber;
  6724. return self;
  6725. },
  6726. args: ["aNumber"],
  6727. source: "y: aNumber\x0a\x09y := aNumber",
  6728. referencedClasses: [],
  6729. messageSends: []
  6730. }),
  6731. $globals.Point);
  6732. $core.addMethod(
  6733. $core.method({
  6734. selector: "classTag",
  6735. protocol: "accessing",
  6736. fn: function (){
  6737. var self=this,$self=this;
  6738. return "magnitude";
  6739. },
  6740. args: [],
  6741. 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'",
  6742. referencedClasses: [],
  6743. messageSends: []
  6744. }),
  6745. $globals.Point.a$cls);
  6746. $core.addMethod(
  6747. $core.method({
  6748. selector: "x:y:",
  6749. protocol: "instance creation",
  6750. fn: function (aNumber,anotherNumber){
  6751. var self=this,$self=this;
  6752. return $core.withContext(function($ctx1) {
  6753. var $1;
  6754. $1=$self._new();
  6755. $recv($1)._x_(aNumber);
  6756. $recv($1)._y_(anotherNumber);
  6757. return $recv($1)._yourself();
  6758. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6759. },
  6760. args: ["aNumber", "anotherNumber"],
  6761. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6762. referencedClasses: [],
  6763. messageSends: ["x:", "new", "y:", "yourself"]
  6764. }),
  6765. $globals.Point.a$cls);
  6766. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6767. $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'`.";
  6768. $core.addMethod(
  6769. $core.method({
  6770. selector: "next",
  6771. protocol: "accessing",
  6772. fn: function (){
  6773. var self=this,$self=this;
  6774. return $core.withContext(function($ctx1) {
  6775. return Math.random();
  6776. return self;
  6777. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6778. },
  6779. args: [],
  6780. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6781. referencedClasses: [],
  6782. messageSends: []
  6783. }),
  6784. $globals.Random);
  6785. $core.addMethod(
  6786. $core.method({
  6787. selector: "next:",
  6788. protocol: "accessing",
  6789. fn: function (anInteger){
  6790. var self=this,$self=this;
  6791. return $core.withContext(function($ctx1) {
  6792. return $recv((1)._to_(anInteger))._collect_((function(each){
  6793. return $core.withContext(function($ctx2) {
  6794. return $self._next();
  6795. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6796. }));
  6797. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6798. },
  6799. args: ["anInteger"],
  6800. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6801. referencedClasses: [],
  6802. messageSends: ["collect:", "to:", "next"]
  6803. }),
  6804. $globals.Random);
  6805. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6806. $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.";
  6807. $core.addMethod(
  6808. $core.method({
  6809. selector: "=",
  6810. protocol: "testing",
  6811. fn: function (aRectangle){
  6812. var self=this,$self=this;
  6813. return $core.withContext(function($ctx1) {
  6814. var $1;
  6815. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6816. $ctx1.sendIdx["="]=1;
  6817. return $recv($1)._and_((function(){
  6818. return $core.withContext(function($ctx2) {
  6819. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6821. }));
  6822. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6823. },
  6824. args: ["aRectangle"],
  6825. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6826. referencedClasses: [],
  6827. messageSends: ["and:", "=", "origin", "corner"]
  6828. }),
  6829. $globals.Rectangle);
  6830. $core.addMethod(
  6831. $core.method({
  6832. selector: "containsPoint:",
  6833. protocol: "testing",
  6834. fn: function (aPoint){
  6835. var self=this,$self=this;
  6836. return $core.withContext(function($ctx1) {
  6837. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6838. return $core.withContext(function($ctx2) {
  6839. return $recv($self["@corner"]).__gt_eq(aPoint);
  6840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6841. }));
  6842. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6843. },
  6844. args: ["aPoint"],
  6845. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6846. referencedClasses: [],
  6847. messageSends: ["and:", "<=", ">="]
  6848. }),
  6849. $globals.Rectangle);
  6850. $core.addMethod(
  6851. $core.method({
  6852. selector: "containsRect:",
  6853. protocol: "testing",
  6854. fn: function (aRect){
  6855. var self=this,$self=this;
  6856. return $core.withContext(function($ctx1) {
  6857. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6858. return $core.withContext(function($ctx2) {
  6859. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6861. }));
  6862. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6863. },
  6864. args: ["aRect"],
  6865. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6866. referencedClasses: [],
  6867. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6868. }),
  6869. $globals.Rectangle);
  6870. $core.addMethod(
  6871. $core.method({
  6872. selector: "corner",
  6873. protocol: "accessing",
  6874. fn: function (){
  6875. var self=this,$self=this;
  6876. return $self["@corner"];
  6877. },
  6878. args: [],
  6879. source: "corner\x0a\x09^ corner",
  6880. referencedClasses: [],
  6881. messageSends: []
  6882. }),
  6883. $globals.Rectangle);
  6884. $core.addMethod(
  6885. $core.method({
  6886. selector: "origin",
  6887. protocol: "accessing",
  6888. fn: function (){
  6889. var self=this,$self=this;
  6890. return $self["@origin"];
  6891. },
  6892. args: [],
  6893. source: "origin\x0a\x09^ origin",
  6894. referencedClasses: [],
  6895. messageSends: []
  6896. }),
  6897. $globals.Rectangle);
  6898. $core.addMethod(
  6899. $core.method({
  6900. selector: "printOn:",
  6901. protocol: "testing",
  6902. fn: function (aStream){
  6903. var self=this,$self=this;
  6904. return $core.withContext(function($ctx1) {
  6905. $recv($self["@origin"])._printOn_(aStream);
  6906. $ctx1.sendIdx["printOn:"]=1;
  6907. $recv(aStream)._nextPutAll_(" corner: ");
  6908. $recv($self["@corner"])._printOn_(aStream);
  6909. return self;
  6910. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6911. },
  6912. args: ["aStream"],
  6913. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6914. referencedClasses: [],
  6915. messageSends: ["printOn:", "nextPutAll:"]
  6916. }),
  6917. $globals.Rectangle);
  6918. $core.addMethod(
  6919. $core.method({
  6920. selector: "setPoint:point:",
  6921. protocol: "private",
  6922. fn: function (pt1,pt2){
  6923. var self=this,$self=this;
  6924. return $core.withContext(function($ctx1) {
  6925. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6926. $2=$recv(pt1)._x();
  6927. $ctx1.sendIdx["x"]=1;
  6928. $3=$recv(pt2)._x();
  6929. $ctx1.sendIdx["x"]=2;
  6930. $1=$recv($2)._min_($3);
  6931. $ctx1.sendIdx["min:"]=1;
  6932. $5=$recv(pt1)._y();
  6933. $ctx1.sendIdx["y"]=1;
  6934. $6=$recv(pt2)._y();
  6935. $ctx1.sendIdx["y"]=2;
  6936. $4=$recv($5)._min_($6);
  6937. $self["@origin"]=$recv($1).__at($4);
  6938. $ctx1.sendIdx["@"]=1;
  6939. $8=$recv(pt1)._x();
  6940. $ctx1.sendIdx["x"]=3;
  6941. $7=$recv($8)._max_($recv(pt2)._x());
  6942. $ctx1.sendIdx["max:"]=1;
  6943. $10=$recv(pt1)._y();
  6944. $ctx1.sendIdx["y"]=3;
  6945. $9=$recv($10)._max_($recv(pt2)._y());
  6946. $self["@corner"]=$recv($7).__at($9);
  6947. return self;
  6948. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6949. },
  6950. args: ["pt1", "pt2"],
  6951. 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).",
  6952. referencedClasses: [],
  6953. messageSends: ["@", "min:", "x", "y", "max:"]
  6954. }),
  6955. $globals.Rectangle);
  6956. $core.addMethod(
  6957. $core.method({
  6958. selector: "origin:corner:",
  6959. protocol: "instance creation",
  6960. fn: function (anOrigin,aCorner){
  6961. var self=this,$self=this;
  6962. return $core.withContext(function($ctx1) {
  6963. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6964. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6965. },
  6966. args: ["anOrigin", "aCorner"],
  6967. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6968. referencedClasses: [],
  6969. messageSends: ["setPoint:point:", "basicNew"]
  6970. }),
  6971. $globals.Rectangle.a$cls);
  6972. $core.addMethod(
  6973. $core.method({
  6974. selector: "origin:extent:",
  6975. protocol: "instance creation",
  6976. fn: function (anOrigin,anExtent){
  6977. var self=this,$self=this;
  6978. return $core.withContext(function($ctx1) {
  6979. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  6980. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  6981. },
  6982. args: ["anOrigin", "anExtent"],
  6983. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  6984. referencedClasses: [],
  6985. messageSends: ["setPoint:point:", "basicNew", "+"]
  6986. }),
  6987. $globals.Rectangle.a$cls);
  6988. $core.addMethod(
  6989. $core.method({
  6990. selector: "point:point:",
  6991. protocol: "instance creation",
  6992. fn: function (anOrigin,aCorner){
  6993. var self=this,$self=this;
  6994. return $core.withContext(function($ctx1) {
  6995. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6996. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6997. },
  6998. args: ["anOrigin", "aCorner"],
  6999. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  7000. referencedClasses: [],
  7001. messageSends: ["setPoint:point:", "basicNew"]
  7002. }),
  7003. $globals.Rectangle.a$cls);
  7004. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  7005. $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`.";
  7006. $core.addMethod(
  7007. $core.method({
  7008. selector: "==",
  7009. protocol: "testing",
  7010. fn: function (anObject){
  7011. var self=this,$self=this;
  7012. return $core.withContext(function($ctx1) {
  7013. return $recv(anObject)._isNil();
  7014. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  7015. },
  7016. args: ["anObject"],
  7017. source: "== anObject\x0a\x09^ anObject isNil",
  7018. referencedClasses: [],
  7019. messageSends: ["isNil"]
  7020. }),
  7021. $globals.UndefinedObject);
  7022. $core.addMethod(
  7023. $core.method({
  7024. selector: "asJavaScriptObject",
  7025. protocol: "converting",
  7026. fn: function (){
  7027. var self=this,$self=this;
  7028. return null;
  7029. },
  7030. args: [],
  7031. source: "asJavaScriptObject\x0a\x09^ null",
  7032. referencedClasses: [],
  7033. messageSends: []
  7034. }),
  7035. $globals.UndefinedObject);
  7036. $core.addMethod(
  7037. $core.method({
  7038. selector: "deepCopy",
  7039. protocol: "copying",
  7040. fn: function (){
  7041. var self=this,$self=this;
  7042. return self;
  7043. },
  7044. args: [],
  7045. source: "deepCopy\x0a\x09^ self",
  7046. referencedClasses: [],
  7047. messageSends: []
  7048. }),
  7049. $globals.UndefinedObject);
  7050. $core.addMethod(
  7051. $core.method({
  7052. selector: "identityHash",
  7053. protocol: "accessing",
  7054. fn: function (){
  7055. var self=this,$self=this;
  7056. return "NIL";
  7057. },
  7058. args: [],
  7059. source: "identityHash\x0a\x09^ 'NIL'",
  7060. referencedClasses: [],
  7061. messageSends: []
  7062. }),
  7063. $globals.UndefinedObject);
  7064. $core.addMethod(
  7065. $core.method({
  7066. selector: "ifNil:",
  7067. protocol: "testing",
  7068. fn: function (aBlock){
  7069. var self=this,$self=this;
  7070. return $core.withContext(function($ctx1) {
  7071. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7072. }));
  7073. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7074. },
  7075. args: ["aBlock"],
  7076. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7077. referencedClasses: [],
  7078. messageSends: ["ifNil:ifNotNil:"]
  7079. }),
  7080. $globals.UndefinedObject);
  7081. $core.addMethod(
  7082. $core.method({
  7083. selector: "ifNil:ifNotNil:",
  7084. protocol: "testing",
  7085. fn: function (aBlock,anotherBlock){
  7086. var self=this,$self=this;
  7087. return $core.withContext(function($ctx1) {
  7088. return $recv(aBlock)._value();
  7089. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7090. },
  7091. args: ["aBlock", "anotherBlock"],
  7092. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7093. referencedClasses: [],
  7094. messageSends: ["value"]
  7095. }),
  7096. $globals.UndefinedObject);
  7097. $core.addMethod(
  7098. $core.method({
  7099. selector: "ifNotNil:",
  7100. protocol: "testing",
  7101. fn: function (aBlock){
  7102. var self=this,$self=this;
  7103. return self;
  7104. },
  7105. args: ["aBlock"],
  7106. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7107. referencedClasses: [],
  7108. messageSends: []
  7109. }),
  7110. $globals.UndefinedObject);
  7111. $core.addMethod(
  7112. $core.method({
  7113. selector: "ifNotNil:ifNil:",
  7114. protocol: "testing",
  7115. fn: function (aBlock,anotherBlock){
  7116. var self=this,$self=this;
  7117. return $core.withContext(function($ctx1) {
  7118. return $recv(anotherBlock)._value();
  7119. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7120. },
  7121. args: ["aBlock", "anotherBlock"],
  7122. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7123. referencedClasses: [],
  7124. messageSends: ["value"]
  7125. }),
  7126. $globals.UndefinedObject);
  7127. $core.addMethod(
  7128. $core.method({
  7129. selector: "isImmutable",
  7130. protocol: "testing",
  7131. fn: function (){
  7132. var self=this,$self=this;
  7133. return true;
  7134. },
  7135. args: [],
  7136. source: "isImmutable\x0a\x09^ true",
  7137. referencedClasses: [],
  7138. messageSends: []
  7139. }),
  7140. $globals.UndefinedObject);
  7141. $core.addMethod(
  7142. $core.method({
  7143. selector: "isNil",
  7144. protocol: "testing",
  7145. fn: function (){
  7146. var self=this,$self=this;
  7147. return true;
  7148. },
  7149. args: [],
  7150. source: "isNil\x0a\x09^ true",
  7151. referencedClasses: [],
  7152. messageSends: []
  7153. }),
  7154. $globals.UndefinedObject);
  7155. $core.addMethod(
  7156. $core.method({
  7157. selector: "notNil",
  7158. protocol: "testing",
  7159. fn: function (){
  7160. var self=this,$self=this;
  7161. return false;
  7162. },
  7163. args: [],
  7164. source: "notNil\x0a\x09^ false",
  7165. referencedClasses: [],
  7166. messageSends: []
  7167. }),
  7168. $globals.UndefinedObject);
  7169. $core.addMethod(
  7170. $core.method({
  7171. selector: "printOn:",
  7172. protocol: "printing",
  7173. fn: function (aStream){
  7174. var self=this,$self=this;
  7175. return $core.withContext(function($ctx1) {
  7176. $recv(aStream)._nextPutAll_("nil");
  7177. return self;
  7178. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7179. },
  7180. args: ["aStream"],
  7181. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7182. referencedClasses: [],
  7183. messageSends: ["nextPutAll:"]
  7184. }),
  7185. $globals.UndefinedObject);
  7186. $core.addMethod(
  7187. $core.method({
  7188. selector: "shallowCopy",
  7189. protocol: "copying",
  7190. fn: function (){
  7191. var self=this,$self=this;
  7192. return self;
  7193. },
  7194. args: [],
  7195. source: "shallowCopy\x0a\x09^ self",
  7196. referencedClasses: [],
  7197. messageSends: []
  7198. }),
  7199. $globals.UndefinedObject);
  7200. $core.addMethod(
  7201. $core.method({
  7202. selector: "value",
  7203. protocol: "evaluating",
  7204. fn: function (){
  7205. var self=this,$self=this;
  7206. return $core.withContext(function($ctx1) {
  7207. return null;
  7208. return self;
  7209. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7210. },
  7211. args: [],
  7212. source: "value\x0a\x09<inlineJS: 'return null'>",
  7213. referencedClasses: [],
  7214. messageSends: []
  7215. }),
  7216. $globals.UndefinedObject);
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "new",
  7220. protocol: "instance creation",
  7221. fn: function (){
  7222. var self=this,$self=this;
  7223. return $core.withContext(function($ctx1) {
  7224. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7225. return self;
  7226. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7227. },
  7228. args: [],
  7229. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7230. referencedClasses: [],
  7231. messageSends: ["error:"]
  7232. }),
  7233. $globals.UndefinedObject.a$cls);
  7234. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7235. });
  7236. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7237. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7238. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7239. $core.addPackage("Kernel-Collections");
  7240. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  7241. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7242. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7243. $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:`";
  7244. $core.addMethod(
  7245. $core.method({
  7246. selector: "=",
  7247. protocol: "comparing",
  7248. fn: function (anAssociation){
  7249. var self=this,$self=this;
  7250. return $core.withContext(function($ctx1) {
  7251. var $3,$2,$5,$4,$6,$1;
  7252. $3=$self._class();
  7253. $ctx1.sendIdx["class"]=1;
  7254. $2=$recv($3).__eq($recv(anAssociation)._class());
  7255. $ctx1.sendIdx["="]=1;
  7256. $1=$recv($2)._and_((function(){
  7257. return $core.withContext(function($ctx2) {
  7258. $5=$self._key();
  7259. $ctx2.sendIdx["key"]=1;
  7260. $4=$recv($5).__eq($recv(anAssociation)._key());
  7261. $ctx2.sendIdx["="]=2;
  7262. return $recv($4)._and_((function(){
  7263. return $core.withContext(function($ctx3) {
  7264. $6=$self._value();
  7265. $ctx3.sendIdx["value"]=1;
  7266. return $recv($6).__eq($recv(anAssociation)._value());
  7267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7268. }));
  7269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7270. }));
  7271. $ctx1.sendIdx["and:"]=1;
  7272. return $1;
  7273. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7274. },
  7275. args: ["anAssociation"],
  7276. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7277. referencedClasses: [],
  7278. messageSends: ["and:", "=", "class", "key", "value"]
  7279. }),
  7280. $globals.Association);
  7281. $core.addMethod(
  7282. $core.method({
  7283. selector: "key",
  7284. protocol: "accessing",
  7285. fn: function (){
  7286. var self=this,$self=this;
  7287. return $self["@key"];
  7288. },
  7289. args: [],
  7290. source: "key\x0a\x09^ key",
  7291. referencedClasses: [],
  7292. messageSends: []
  7293. }),
  7294. $globals.Association);
  7295. $core.addMethod(
  7296. $core.method({
  7297. selector: "key:",
  7298. protocol: "accessing",
  7299. fn: function (aKey){
  7300. var self=this,$self=this;
  7301. $self["@key"]=aKey;
  7302. return self;
  7303. },
  7304. args: ["aKey"],
  7305. source: "key: aKey\x0a\x09key := aKey",
  7306. referencedClasses: [],
  7307. messageSends: []
  7308. }),
  7309. $globals.Association);
  7310. $core.addMethod(
  7311. $core.method({
  7312. selector: "printOn:",
  7313. protocol: "printing",
  7314. fn: function (aStream){
  7315. var self=this,$self=this;
  7316. return $core.withContext(function($ctx1) {
  7317. $recv($self._key())._printOn_(aStream);
  7318. $ctx1.sendIdx["printOn:"]=1;
  7319. $recv(aStream)._nextPutAll_(" -> ");
  7320. $recv($self._value())._printOn_(aStream);
  7321. return self;
  7322. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7323. },
  7324. args: ["aStream"],
  7325. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7326. referencedClasses: [],
  7327. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7328. }),
  7329. $globals.Association);
  7330. $core.addMethod(
  7331. $core.method({
  7332. selector: "value",
  7333. protocol: "accessing",
  7334. fn: function (){
  7335. var self=this,$self=this;
  7336. return $self["@value"];
  7337. },
  7338. args: [],
  7339. source: "value\x0a\x09^ value",
  7340. referencedClasses: [],
  7341. messageSends: []
  7342. }),
  7343. $globals.Association);
  7344. $core.addMethod(
  7345. $core.method({
  7346. selector: "value:",
  7347. protocol: "accessing",
  7348. fn: function (aValue){
  7349. var self=this,$self=this;
  7350. $self["@value"]=aValue;
  7351. return self;
  7352. },
  7353. args: ["aValue"],
  7354. source: "value: aValue\x0a\x09value := aValue",
  7355. referencedClasses: [],
  7356. messageSends: []
  7357. }),
  7358. $globals.Association);
  7359. $core.addMethod(
  7360. $core.method({
  7361. selector: "key:value:",
  7362. protocol: "instance creation",
  7363. fn: function (aKey,aValue){
  7364. var self=this,$self=this;
  7365. return $core.withContext(function($ctx1) {
  7366. var $1;
  7367. $1=$self._new();
  7368. $recv($1)._key_(aKey);
  7369. $recv($1)._value_(aValue);
  7370. return $recv($1)._yourself();
  7371. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7372. },
  7373. args: ["aKey", "aValue"],
  7374. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7375. referencedClasses: [],
  7376. messageSends: ["key:", "new", "value:", "yourself"]
  7377. }),
  7378. $globals.Association.a$cls);
  7379. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7380. $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`.";
  7381. $core.addMethod(
  7382. $core.method({
  7383. selector: "bucketOfElement:",
  7384. protocol: "accessing",
  7385. fn: function (anObject){
  7386. var self=this,$self=this;
  7387. return $core.withContext(function($ctx1) {
  7388. var hash = $self['@hashBlock'](anObject);
  7389. if (!hash) return null;
  7390. var buckets = $self['@buckets'],
  7391. bucket = buckets[hash];
  7392. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7393. return bucket;
  7394. ;
  7395. return self;
  7396. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7397. },
  7398. args: ["anObject"],
  7399. 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'>",
  7400. referencedClasses: [],
  7401. messageSends: []
  7402. }),
  7403. $globals.BucketStore);
  7404. $core.addMethod(
  7405. $core.method({
  7406. selector: "do:",
  7407. protocol: "enumerating",
  7408. fn: function (aBlock){
  7409. var self=this,$self=this;
  7410. return $core.withContext(function($ctx1) {
  7411. var buckets = $self['@buckets'];
  7412. var keys = Object.keys(buckets);
  7413. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7414. ;
  7415. return self;
  7416. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7417. },
  7418. args: ["aBlock"],
  7419. 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'>",
  7420. referencedClasses: [],
  7421. messageSends: []
  7422. }),
  7423. $globals.BucketStore);
  7424. $core.addMethod(
  7425. $core.method({
  7426. selector: "hashBlock:",
  7427. protocol: "accessing",
  7428. fn: function (aBlock){
  7429. var self=this,$self=this;
  7430. $self["@hashBlock"]=aBlock;
  7431. return self;
  7432. },
  7433. args: ["aBlock"],
  7434. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7435. referencedClasses: [],
  7436. messageSends: []
  7437. }),
  7438. $globals.BucketStore);
  7439. $core.addMethod(
  7440. $core.method({
  7441. selector: "initialize",
  7442. protocol: "initialization",
  7443. fn: function (){
  7444. var self=this,$self=this;
  7445. return $core.withContext(function($ctx1) {
  7446. (
  7447. $ctx1.supercall = true,
  7448. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7449. $ctx1.supercall = false;
  7450. $self._removeAll();
  7451. return self;
  7452. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7453. },
  7454. args: [],
  7455. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7456. referencedClasses: [],
  7457. messageSends: ["initialize", "removeAll"]
  7458. }),
  7459. $globals.BucketStore);
  7460. $core.addMethod(
  7461. $core.method({
  7462. selector: "newBucket",
  7463. protocol: "private",
  7464. fn: function (){
  7465. var self=this,$self=this;
  7466. return $core.withContext(function($ctx1) {
  7467. $self._subclassResponsibility();
  7468. return self;
  7469. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7470. },
  7471. args: [],
  7472. source: "newBucket\x0a\x09self subclassResponsibility",
  7473. referencedClasses: [],
  7474. messageSends: ["subclassResponsibility"]
  7475. }),
  7476. $globals.BucketStore);
  7477. $core.addMethod(
  7478. $core.method({
  7479. selector: "removeAll",
  7480. protocol: "adding/removing",
  7481. fn: function (){
  7482. var self=this,$self=this;
  7483. return $core.withContext(function($ctx1) {
  7484. $self['@buckets'] = Object.create(null);;
  7485. return self;
  7486. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7487. },
  7488. args: [],
  7489. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7490. referencedClasses: [],
  7491. messageSends: []
  7492. }),
  7493. $globals.BucketStore);
  7494. $core.addMethod(
  7495. $core.method({
  7496. selector: "hashBlock:",
  7497. protocol: "instance creation",
  7498. fn: function (aBlock){
  7499. var self=this,$self=this;
  7500. return $core.withContext(function($ctx1) {
  7501. var $1;
  7502. $1=$self._new();
  7503. $recv($1)._hashBlock_(aBlock);
  7504. return $recv($1)._yourself();
  7505. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7506. },
  7507. args: ["aBlock"],
  7508. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7509. referencedClasses: [],
  7510. messageSends: ["hashBlock:", "new", "yourself"]
  7511. }),
  7512. $globals.BucketStore.a$cls);
  7513. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7514. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7515. $core.addMethod(
  7516. $core.method({
  7517. selector: "newBucket",
  7518. protocol: "private",
  7519. fn: function (){
  7520. var self=this,$self=this;
  7521. return [];
  7522. },
  7523. args: [],
  7524. source: "newBucket\x0a\x09^ #()",
  7525. referencedClasses: [],
  7526. messageSends: []
  7527. }),
  7528. $globals.ArrayBucketStore);
  7529. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7530. $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.";
  7531. $core.addMethod(
  7532. $core.method({
  7533. selector: ",",
  7534. protocol: "copying",
  7535. fn: function (aCollection){
  7536. var self=this,$self=this;
  7537. return $core.withContext(function($ctx1) {
  7538. var $1;
  7539. $1=$self._copy();
  7540. $recv($1)._addAll_(aCollection);
  7541. return $recv($1)._yourself();
  7542. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7543. },
  7544. args: ["aCollection"],
  7545. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7546. referencedClasses: [],
  7547. messageSends: ["addAll:", "copy", "yourself"]
  7548. }),
  7549. $globals.Collection);
  7550. $core.addMethod(
  7551. $core.method({
  7552. selector: "add:",
  7553. protocol: "adding/removing",
  7554. fn: function (anObject){
  7555. var self=this,$self=this;
  7556. return $core.withContext(function($ctx1) {
  7557. $self._subclassResponsibility();
  7558. return self;
  7559. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7560. },
  7561. args: ["anObject"],
  7562. source: "add: anObject\x0a\x09self subclassResponsibility",
  7563. referencedClasses: [],
  7564. messageSends: ["subclassResponsibility"]
  7565. }),
  7566. $globals.Collection);
  7567. $core.addMethod(
  7568. $core.method({
  7569. selector: "addAll:",
  7570. protocol: "adding/removing",
  7571. fn: function (aCollection){
  7572. var self=this,$self=this;
  7573. return $core.withContext(function($ctx1) {
  7574. $recv(aCollection)._do_((function(each){
  7575. return $core.withContext(function($ctx2) {
  7576. return $self._add_(each);
  7577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7578. }));
  7579. return aCollection;
  7580. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7581. },
  7582. args: ["aCollection"],
  7583. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7584. referencedClasses: [],
  7585. messageSends: ["do:", "add:"]
  7586. }),
  7587. $globals.Collection);
  7588. $core.addMethod(
  7589. $core.method({
  7590. selector: "allSatisfy:",
  7591. protocol: "enumerating",
  7592. fn: function (aBlock){
  7593. var self=this,$self=this;
  7594. return $core.withContext(function($ctx1) {
  7595. var $1;
  7596. var $early={};
  7597. try {
  7598. $self._do_((function(each){
  7599. return $core.withContext(function($ctx2) {
  7600. $1=$recv(aBlock)._value_(each);
  7601. if(!$core.assert($1)){
  7602. throw $early=[false];
  7603. }
  7604. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7605. }));
  7606. return true;
  7607. }
  7608. catch(e) {if(e===$early)return e[0]; throw e}
  7609. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7610. },
  7611. args: ["aBlock"],
  7612. 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",
  7613. referencedClasses: [],
  7614. messageSends: ["do:", "ifFalse:", "value:"]
  7615. }),
  7616. $globals.Collection);
  7617. $core.addMethod(
  7618. $core.method({
  7619. selector: "anyOne",
  7620. protocol: "accessing",
  7621. fn: function (){
  7622. var self=this,$self=this;
  7623. return $core.withContext(function($ctx1) {
  7624. var $early={};
  7625. try {
  7626. $self._ifEmpty_((function(){
  7627. return $core.withContext(function($ctx2) {
  7628. return $self._error_("Collection is empty");
  7629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7630. }));
  7631. $self._do_((function(each){
  7632. throw $early=[each];
  7633. }));
  7634. return self;
  7635. }
  7636. catch(e) {if(e===$early)return e[0]; throw e}
  7637. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7638. },
  7639. args: [],
  7640. 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 ]",
  7641. referencedClasses: [],
  7642. messageSends: ["ifEmpty:", "error:", "do:"]
  7643. }),
  7644. $globals.Collection);
  7645. $core.addMethod(
  7646. $core.method({
  7647. selector: "anySatisfy:",
  7648. protocol: "enumerating",
  7649. fn: function (aBlock){
  7650. var self=this,$self=this;
  7651. return $core.withContext(function($ctx1) {
  7652. var $1;
  7653. var $early={};
  7654. try {
  7655. $self._do_((function(each){
  7656. return $core.withContext(function($ctx2) {
  7657. $1=$recv(aBlock)._value_(each);
  7658. if($core.assert($1)){
  7659. throw $early=[true];
  7660. }
  7661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7662. }));
  7663. return false;
  7664. }
  7665. catch(e) {if(e===$early)return e[0]; throw e}
  7666. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7667. },
  7668. args: ["aBlock"],
  7669. 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",
  7670. referencedClasses: [],
  7671. messageSends: ["do:", "ifTrue:", "value:"]
  7672. }),
  7673. $globals.Collection);
  7674. $core.addMethod(
  7675. $core.method({
  7676. selector: "asArray",
  7677. protocol: "converting",
  7678. fn: function (){
  7679. var self=this,$self=this;
  7680. return $core.withContext(function($ctx1) {
  7681. return $recv($globals.Array)._withAll_(self);
  7682. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7683. },
  7684. args: [],
  7685. source: "asArray\x0a\x09^ Array withAll: self",
  7686. referencedClasses: ["Array"],
  7687. messageSends: ["withAll:"]
  7688. }),
  7689. $globals.Collection);
  7690. $core.addMethod(
  7691. $core.method({
  7692. selector: "asJavaScriptObject",
  7693. protocol: "converting",
  7694. fn: function (){
  7695. var self=this,$self=this;
  7696. return $core.withContext(function($ctx1) {
  7697. return $recv($self._asArray())._collect_((function(each){
  7698. return $core.withContext(function($ctx2) {
  7699. return $recv(each)._asJavaScriptObject();
  7700. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7701. }));
  7702. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7703. },
  7704. args: [],
  7705. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7706. referencedClasses: [],
  7707. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7708. }),
  7709. $globals.Collection);
  7710. $core.addMethod(
  7711. $core.method({
  7712. selector: "asOrderedCollection",
  7713. protocol: "converting",
  7714. fn: function (){
  7715. var self=this,$self=this;
  7716. return $core.withContext(function($ctx1) {
  7717. return $self._asArray();
  7718. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7719. },
  7720. args: [],
  7721. source: "asOrderedCollection\x0a\x09^ self asArray",
  7722. referencedClasses: [],
  7723. messageSends: ["asArray"]
  7724. }),
  7725. $globals.Collection);
  7726. $core.addMethod(
  7727. $core.method({
  7728. selector: "asSet",
  7729. protocol: "converting",
  7730. fn: function (){
  7731. var self=this,$self=this;
  7732. return $core.withContext(function($ctx1) {
  7733. return $recv($globals.Set)._withAll_(self);
  7734. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7735. },
  7736. args: [],
  7737. source: "asSet\x0a\x09^ Set withAll: self",
  7738. referencedClasses: ["Set"],
  7739. messageSends: ["withAll:"]
  7740. }),
  7741. $globals.Collection);
  7742. $core.addMethod(
  7743. $core.method({
  7744. selector: "collect:",
  7745. protocol: "enumerating",
  7746. fn: function (aBlock){
  7747. var self=this,$self=this;
  7748. var stream;
  7749. return $core.withContext(function($ctx1) {
  7750. stream=$recv($recv($self._class())._new())._writeStream();
  7751. $self._do_((function(each){
  7752. return $core.withContext(function($ctx2) {
  7753. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7755. }));
  7756. return $recv(stream)._contents();
  7757. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7758. },
  7759. args: ["aBlock"],
  7760. 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",
  7761. referencedClasses: [],
  7762. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7763. }),
  7764. $globals.Collection);
  7765. $core.addMethod(
  7766. $core.method({
  7767. selector: "copyWith:",
  7768. protocol: "copying",
  7769. fn: function (anObject){
  7770. var self=this,$self=this;
  7771. return $core.withContext(function($ctx1) {
  7772. var $1;
  7773. $1=$self._copy();
  7774. $recv($1)._add_(anObject);
  7775. return $recv($1)._yourself();
  7776. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7777. },
  7778. args: ["anObject"],
  7779. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7780. referencedClasses: [],
  7781. messageSends: ["add:", "copy", "yourself"]
  7782. }),
  7783. $globals.Collection);
  7784. $core.addMethod(
  7785. $core.method({
  7786. selector: "copyWithAll:",
  7787. protocol: "copying",
  7788. fn: function (aCollection){
  7789. var self=this,$self=this;
  7790. return $core.withContext(function($ctx1) {
  7791. var $1;
  7792. $1=$self._copy();
  7793. $recv($1)._addAll_(aCollection);
  7794. return $recv($1)._yourself();
  7795. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7796. },
  7797. args: ["aCollection"],
  7798. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  7799. referencedClasses: [],
  7800. messageSends: ["addAll:", "copy", "yourself"]
  7801. }),
  7802. $globals.Collection);
  7803. $core.addMethod(
  7804. $core.method({
  7805. selector: "copyWithout:",
  7806. protocol: "copying",
  7807. fn: function (anObject){
  7808. var self=this,$self=this;
  7809. return $core.withContext(function($ctx1) {
  7810. return $self._reject_((function(each){
  7811. return $core.withContext(function($ctx2) {
  7812. return $recv(each).__eq(anObject);
  7813. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7814. }));
  7815. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7816. },
  7817. args: ["anObject"],
  7818. 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 ]",
  7819. referencedClasses: [],
  7820. messageSends: ["reject:", "="]
  7821. }),
  7822. $globals.Collection);
  7823. $core.addMethod(
  7824. $core.method({
  7825. selector: "copyWithoutAll:",
  7826. protocol: "copying",
  7827. fn: function (aCollection){
  7828. var self=this,$self=this;
  7829. return $core.withContext(function($ctx1) {
  7830. return $self._reject_((function(each){
  7831. return $core.withContext(function($ctx2) {
  7832. return $recv(aCollection)._includes_(each);
  7833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7834. }));
  7835. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7836. },
  7837. args: ["aCollection"],
  7838. 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 ]",
  7839. referencedClasses: [],
  7840. messageSends: ["reject:", "includes:"]
  7841. }),
  7842. $globals.Collection);
  7843. $core.addMethod(
  7844. $core.method({
  7845. selector: "deepCopy",
  7846. protocol: "copying",
  7847. fn: function (){
  7848. var self=this,$self=this;
  7849. return $core.withContext(function($ctx1) {
  7850. return $self._collect_((function(each){
  7851. return $core.withContext(function($ctx2) {
  7852. return $recv(each)._deepCopy();
  7853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7854. }));
  7855. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7856. },
  7857. args: [],
  7858. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7859. referencedClasses: [],
  7860. messageSends: ["collect:", "deepCopy"]
  7861. }),
  7862. $globals.Collection);
  7863. $core.addMethod(
  7864. $core.method({
  7865. selector: "detect:",
  7866. protocol: "enumerating",
  7867. fn: function (aBlock){
  7868. var self=this,$self=this;
  7869. return $core.withContext(function($ctx1) {
  7870. return $self._detect_ifNone_(aBlock,(function(){
  7871. return $core.withContext(function($ctx2) {
  7872. return $self._errorNotFound();
  7873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7874. }));
  7875. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7876. },
  7877. args: ["aBlock"],
  7878. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7879. referencedClasses: [],
  7880. messageSends: ["detect:ifNone:", "errorNotFound"]
  7881. }),
  7882. $globals.Collection);
  7883. $core.addMethod(
  7884. $core.method({
  7885. selector: "detect:ifNone:",
  7886. protocol: "enumerating",
  7887. fn: function (aBlock,anotherBlock){
  7888. var self=this,$self=this;
  7889. return $core.withContext(function($ctx1) {
  7890. $self._subclassResponsibility();
  7891. return self;
  7892. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7893. },
  7894. args: ["aBlock", "anotherBlock"],
  7895. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  7896. referencedClasses: [],
  7897. messageSends: ["subclassResponsibility"]
  7898. }),
  7899. $globals.Collection);
  7900. $core.addMethod(
  7901. $core.method({
  7902. selector: "do:",
  7903. protocol: "enumerating",
  7904. fn: function (aBlock){
  7905. var self=this,$self=this;
  7906. return $core.withContext(function($ctx1) {
  7907. $self._subclassResponsibility();
  7908. return self;
  7909. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7910. },
  7911. args: ["aBlock"],
  7912. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7913. referencedClasses: [],
  7914. messageSends: ["subclassResponsibility"]
  7915. }),
  7916. $globals.Collection);
  7917. $core.addMethod(
  7918. $core.method({
  7919. selector: "do:separatedBy:",
  7920. protocol: "enumerating",
  7921. fn: function (aBlock,anotherBlock){
  7922. var self=this,$self=this;
  7923. var actionBeforeElement;
  7924. return $core.withContext(function($ctx1) {
  7925. actionBeforeElement=(function(){
  7926. actionBeforeElement=anotherBlock;
  7927. return actionBeforeElement;
  7928. });
  7929. $self._do_((function(each){
  7930. return $core.withContext(function($ctx2) {
  7931. $recv(actionBeforeElement)._value();
  7932. return $recv(aBlock)._value_(each);
  7933. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7934. }));
  7935. return self;
  7936. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7937. },
  7938. args: ["aBlock", "anotherBlock"],
  7939. 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 ]",
  7940. referencedClasses: [],
  7941. messageSends: ["do:", "value", "value:"]
  7942. }),
  7943. $globals.Collection);
  7944. $core.addMethod(
  7945. $core.method({
  7946. selector: "errorNotFound",
  7947. protocol: "error handling",
  7948. fn: function (){
  7949. var self=this,$self=this;
  7950. return $core.withContext(function($ctx1) {
  7951. $self._error_("Object is not in the collection");
  7952. return self;
  7953. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7954. },
  7955. args: [],
  7956. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7957. referencedClasses: [],
  7958. messageSends: ["error:"]
  7959. }),
  7960. $globals.Collection);
  7961. $core.addMethod(
  7962. $core.method({
  7963. selector: "ifEmpty:",
  7964. protocol: "testing",
  7965. fn: function (aBlock){
  7966. var self=this,$self=this;
  7967. return $core.withContext(function($ctx1) {
  7968. var $1;
  7969. $1=$self._isEmpty();
  7970. if($core.assert($1)){
  7971. return $recv(aBlock)._value();
  7972. } else {
  7973. return self;
  7974. }
  7975. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  7976. },
  7977. args: ["aBlock"],
  7978. 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 ]",
  7979. referencedClasses: [],
  7980. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  7981. }),
  7982. $globals.Collection);
  7983. $core.addMethod(
  7984. $core.method({
  7985. selector: "ifEmpty:ifNotEmpty:",
  7986. protocol: "testing",
  7987. fn: function (aBlock,anotherBlock){
  7988. var self=this,$self=this;
  7989. return $core.withContext(function($ctx1) {
  7990. var $1;
  7991. $1=$self._isEmpty();
  7992. if($core.assert($1)){
  7993. return $recv(aBlock)._value();
  7994. } else {
  7995. return $recv(anotherBlock)._value_(self);
  7996. }
  7997. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7998. },
  7999. args: ["aBlock", "anotherBlock"],
  8000. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  8001. referencedClasses: [],
  8002. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  8003. }),
  8004. $globals.Collection);
  8005. $core.addMethod(
  8006. $core.method({
  8007. selector: "ifNotEmpty:",
  8008. protocol: "testing",
  8009. fn: function (aBlock){
  8010. var self=this,$self=this;
  8011. return $core.withContext(function($ctx1) {
  8012. var $1;
  8013. $1=$self._notEmpty();
  8014. if($core.assert($1)){
  8015. return $recv(aBlock)._value_(self);
  8016. } else {
  8017. return self;
  8018. }
  8019. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  8020. },
  8021. args: ["aBlock"],
  8022. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  8023. referencedClasses: [],
  8024. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  8025. }),
  8026. $globals.Collection);
  8027. $core.addMethod(
  8028. $core.method({
  8029. selector: "ifNotEmpty:ifEmpty:",
  8030. protocol: "testing",
  8031. fn: function (aBlock,anotherBlock){
  8032. var self=this,$self=this;
  8033. return $core.withContext(function($ctx1) {
  8034. var $1;
  8035. $1=$self._notEmpty();
  8036. if($core.assert($1)){
  8037. return $recv(aBlock)._value_(self);
  8038. } else {
  8039. return $recv(anotherBlock)._value();
  8040. }
  8041. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8042. },
  8043. args: ["aBlock", "anotherBlock"],
  8044. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8045. referencedClasses: [],
  8046. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8047. }),
  8048. $globals.Collection);
  8049. $core.addMethod(
  8050. $core.method({
  8051. selector: "includes:",
  8052. protocol: "testing",
  8053. fn: function (anObject){
  8054. var self=this,$self=this;
  8055. return $core.withContext(function($ctx1) {
  8056. return $self._anySatisfy_((function(each){
  8057. return $core.withContext(function($ctx2) {
  8058. return $recv(each).__eq(anObject);
  8059. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8060. }));
  8061. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8062. },
  8063. args: ["anObject"],
  8064. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8065. referencedClasses: [],
  8066. messageSends: ["anySatisfy:", "="]
  8067. }),
  8068. $globals.Collection);
  8069. $core.addMethod(
  8070. $core.method({
  8071. selector: "inject:into:",
  8072. protocol: "enumerating",
  8073. fn: function (anObject,aBlock){
  8074. var self=this,$self=this;
  8075. var result;
  8076. return $core.withContext(function($ctx1) {
  8077. result=anObject;
  8078. $self._do_((function(each){
  8079. return $core.withContext(function($ctx2) {
  8080. result=$recv(aBlock)._value_value_(result,each);
  8081. return result;
  8082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8083. }));
  8084. return result;
  8085. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8086. },
  8087. args: ["anObject", "aBlock"],
  8088. 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",
  8089. referencedClasses: [],
  8090. messageSends: ["do:", "value:value:"]
  8091. }),
  8092. $globals.Collection);
  8093. $core.addMethod(
  8094. $core.method({
  8095. selector: "intersection:",
  8096. protocol: "enumerating",
  8097. fn: function (aCollection){
  8098. var self=this,$self=this;
  8099. var set,outputSet;
  8100. return $core.withContext(function($ctx1) {
  8101. var $2,$1;
  8102. set=$self._asSet();
  8103. outputSet=$recv($globals.Set)._new();
  8104. $recv(aCollection)._do_((function(each){
  8105. return $core.withContext(function($ctx2) {
  8106. $2=$recv(set)._includes_(each);
  8107. $ctx2.sendIdx["includes:"]=1;
  8108. $1=$recv($2)._and_((function(){
  8109. return $core.withContext(function($ctx3) {
  8110. return $recv($recv(outputSet)._includes_(each))._not();
  8111. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8112. }));
  8113. if($core.assert($1)){
  8114. return $recv(outputSet)._add_(each);
  8115. }
  8116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8117. }));
  8118. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8119. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8120. },
  8121. args: ["aCollection"],
  8122. 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",
  8123. referencedClasses: ["Set"],
  8124. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8125. }),
  8126. $globals.Collection);
  8127. $core.addMethod(
  8128. $core.method({
  8129. selector: "isEmpty",
  8130. protocol: "testing",
  8131. fn: function (){
  8132. var self=this,$self=this;
  8133. return $core.withContext(function($ctx1) {
  8134. return $recv($self._size()).__eq((0));
  8135. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8136. },
  8137. args: [],
  8138. source: "isEmpty\x0a\x09^ self size = 0",
  8139. referencedClasses: [],
  8140. messageSends: ["=", "size"]
  8141. }),
  8142. $globals.Collection);
  8143. $core.addMethod(
  8144. $core.method({
  8145. selector: "noneSatisfy:",
  8146. protocol: "enumerating",
  8147. fn: function (aBlock){
  8148. var self=this,$self=this;
  8149. return $core.withContext(function($ctx1) {
  8150. var $1;
  8151. var $early={};
  8152. try {
  8153. $self._do_((function(item){
  8154. return $core.withContext(function($ctx2) {
  8155. $1=$recv(aBlock)._value_(item);
  8156. if($core.assert($1)){
  8157. throw $early=[false];
  8158. }
  8159. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8160. }));
  8161. return true;
  8162. }
  8163. catch(e) {if(e===$early)return e[0]; throw e}
  8164. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8165. },
  8166. args: ["aBlock"],
  8167. 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",
  8168. referencedClasses: [],
  8169. messageSends: ["do:", "ifTrue:", "value:"]
  8170. }),
  8171. $globals.Collection);
  8172. $core.addMethod(
  8173. $core.method({
  8174. selector: "notEmpty",
  8175. protocol: "testing",
  8176. fn: function (){
  8177. var self=this,$self=this;
  8178. return $core.withContext(function($ctx1) {
  8179. return $recv($self._isEmpty())._not();
  8180. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8181. },
  8182. args: [],
  8183. source: "notEmpty\x0a\x09^ self isEmpty not",
  8184. referencedClasses: [],
  8185. messageSends: ["not", "isEmpty"]
  8186. }),
  8187. $globals.Collection);
  8188. $core.addMethod(
  8189. $core.method({
  8190. selector: "occurrencesOf:",
  8191. protocol: "accessing",
  8192. fn: function (anObject){
  8193. var self=this,$self=this;
  8194. var tally;
  8195. return $core.withContext(function($ctx1) {
  8196. var $1;
  8197. tally=(0);
  8198. $self._do_((function(each){
  8199. return $core.withContext(function($ctx2) {
  8200. $1=$recv(anObject).__eq(each);
  8201. if($core.assert($1)){
  8202. tally=$recv(tally).__plus((1));
  8203. return tally;
  8204. }
  8205. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8206. }));
  8207. return tally;
  8208. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8209. },
  8210. args: ["anObject"],
  8211. 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",
  8212. referencedClasses: [],
  8213. messageSends: ["do:", "ifTrue:", "=", "+"]
  8214. }),
  8215. $globals.Collection);
  8216. $core.addMethod(
  8217. $core.method({
  8218. selector: "putOn:",
  8219. protocol: "streaming",
  8220. fn: function (aStream){
  8221. var self=this,$self=this;
  8222. return $core.withContext(function($ctx1) {
  8223. $self._do_((function(each){
  8224. return $core.withContext(function($ctx2) {
  8225. return $recv(each)._putOn_(aStream);
  8226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8227. }));
  8228. return self;
  8229. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8230. },
  8231. args: ["aStream"],
  8232. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8233. referencedClasses: [],
  8234. messageSends: ["do:", "putOn:"]
  8235. }),
  8236. $globals.Collection);
  8237. $core.addMethod(
  8238. $core.method({
  8239. selector: "reject:",
  8240. protocol: "enumerating",
  8241. fn: function (aBlock){
  8242. var self=this,$self=this;
  8243. return $core.withContext(function($ctx1) {
  8244. return $self._select_((function(each){
  8245. return $core.withContext(function($ctx2) {
  8246. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8247. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8248. }));
  8249. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8250. },
  8251. args: ["aBlock"],
  8252. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8253. referencedClasses: [],
  8254. messageSends: ["select:", "=", "value:"]
  8255. }),
  8256. $globals.Collection);
  8257. $core.addMethod(
  8258. $core.method({
  8259. selector: "remove:",
  8260. protocol: "adding/removing",
  8261. fn: function (anObject){
  8262. var self=this,$self=this;
  8263. return $core.withContext(function($ctx1) {
  8264. return $self._remove_ifAbsent_(anObject,(function(){
  8265. return $core.withContext(function($ctx2) {
  8266. return $self._errorNotFound();
  8267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8268. }));
  8269. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8270. },
  8271. args: ["anObject"],
  8272. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8273. referencedClasses: [],
  8274. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8275. }),
  8276. $globals.Collection);
  8277. $core.addMethod(
  8278. $core.method({
  8279. selector: "remove:ifAbsent:",
  8280. protocol: "adding/removing",
  8281. fn: function (anObject,aBlock){
  8282. var self=this,$self=this;
  8283. return $core.withContext(function($ctx1) {
  8284. $self._subclassResponsibility();
  8285. return self;
  8286. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8287. },
  8288. args: ["anObject", "aBlock"],
  8289. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8290. referencedClasses: [],
  8291. messageSends: ["subclassResponsibility"]
  8292. }),
  8293. $globals.Collection);
  8294. $core.addMethod(
  8295. $core.method({
  8296. selector: "removeAll",
  8297. protocol: "adding/removing",
  8298. fn: function (){
  8299. var self=this,$self=this;
  8300. return $core.withContext(function($ctx1) {
  8301. $self._subclassResponsibility();
  8302. return self;
  8303. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8304. },
  8305. args: [],
  8306. source: "removeAll\x0a\x09self subclassResponsibility",
  8307. referencedClasses: [],
  8308. messageSends: ["subclassResponsibility"]
  8309. }),
  8310. $globals.Collection);
  8311. $core.addMethod(
  8312. $core.method({
  8313. selector: "select:",
  8314. protocol: "enumerating",
  8315. fn: function (aBlock){
  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(aBlock)._value_(each);
  8324. if($core.assert($1)){
  8325. return $recv(stream)._nextPut_(each);
  8326. }
  8327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8328. }));
  8329. return $recv(stream)._contents();
  8330. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8331. },
  8332. args: ["aBlock"],
  8333. 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",
  8334. referencedClasses: [],
  8335. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8336. }),
  8337. $globals.Collection);
  8338. $core.addMethod(
  8339. $core.method({
  8340. selector: "select:thenCollect:",
  8341. protocol: "enumerating",
  8342. fn: function (selectBlock,collectBlock){
  8343. var self=this,$self=this;
  8344. var stream;
  8345. return $core.withContext(function($ctx1) {
  8346. var $1;
  8347. stream=$recv($recv($self._class())._new())._writeStream();
  8348. $self._do_((function(each){
  8349. return $core.withContext(function($ctx2) {
  8350. $1=$recv(selectBlock)._value_(each);
  8351. $ctx2.sendIdx["value:"]=1;
  8352. if($core.assert($1)){
  8353. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8354. }
  8355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8356. }));
  8357. return $recv(stream)._contents();
  8358. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8359. },
  8360. args: ["selectBlock", "collectBlock"],
  8361. 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",
  8362. referencedClasses: [],
  8363. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8364. }),
  8365. $globals.Collection);
  8366. $core.addMethod(
  8367. $core.method({
  8368. selector: "shallowCopy",
  8369. protocol: "copying",
  8370. fn: function (){
  8371. var self=this,$self=this;
  8372. return $core.withContext(function($ctx1) {
  8373. return $self._collect_((function(each){
  8374. return each;
  8375. }));
  8376. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8377. },
  8378. args: [],
  8379. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8380. referencedClasses: [],
  8381. messageSends: ["collect:"]
  8382. }),
  8383. $globals.Collection);
  8384. $core.addMethod(
  8385. $core.method({
  8386. selector: "single",
  8387. protocol: "accessing",
  8388. fn: function (){
  8389. var self=this,$self=this;
  8390. return $core.withContext(function($ctx1) {
  8391. var $1;
  8392. $self._ifEmpty_((function(){
  8393. return $core.withContext(function($ctx2) {
  8394. return $self._error_("Collection is empty");
  8395. $ctx2.sendIdx["error:"]=1;
  8396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8397. }));
  8398. $1=$recv($self._size()).__gt((1));
  8399. if($core.assert($1)){
  8400. $self._error_("Collection holds more than one element");
  8401. }
  8402. return $self._anyOne();
  8403. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8404. },
  8405. args: [],
  8406. 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",
  8407. referencedClasses: [],
  8408. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8409. }),
  8410. $globals.Collection);
  8411. $core.addMethod(
  8412. $core.method({
  8413. selector: "size",
  8414. protocol: "accessing",
  8415. fn: function (){
  8416. var self=this,$self=this;
  8417. return $core.withContext(function($ctx1) {
  8418. $self._subclassResponsibility();
  8419. return self;
  8420. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8421. },
  8422. args: [],
  8423. source: "size\x0a\x09self subclassResponsibility",
  8424. referencedClasses: [],
  8425. messageSends: ["subclassResponsibility"]
  8426. }),
  8427. $globals.Collection);
  8428. $core.addMethod(
  8429. $core.method({
  8430. selector: "classTag",
  8431. protocol: "accessing",
  8432. fn: function (){
  8433. var self=this,$self=this;
  8434. return "collection";
  8435. },
  8436. args: [],
  8437. 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'",
  8438. referencedClasses: [],
  8439. messageSends: []
  8440. }),
  8441. $globals.Collection.a$cls);
  8442. $core.addMethod(
  8443. $core.method({
  8444. selector: "new:",
  8445. protocol: "instance creation",
  8446. fn: function (anInteger){
  8447. var self=this,$self=this;
  8448. return $core.withContext(function($ctx1) {
  8449. return $self._new();
  8450. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8451. },
  8452. args: ["anInteger"],
  8453. source: "new: anInteger\x0a\x09^ self new",
  8454. referencedClasses: [],
  8455. messageSends: ["new"]
  8456. }),
  8457. $globals.Collection.a$cls);
  8458. $core.addMethod(
  8459. $core.method({
  8460. selector: "with:",
  8461. protocol: "instance creation",
  8462. fn: function (anObject){
  8463. var self=this,$self=this;
  8464. return $core.withContext(function($ctx1) {
  8465. var $1;
  8466. $1=$self._new();
  8467. $recv($1)._add_(anObject);
  8468. return $recv($1)._yourself();
  8469. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8470. },
  8471. args: ["anObject"],
  8472. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8473. referencedClasses: [],
  8474. messageSends: ["add:", "new", "yourself"]
  8475. }),
  8476. $globals.Collection.a$cls);
  8477. $core.addMethod(
  8478. $core.method({
  8479. selector: "with:with:",
  8480. protocol: "instance creation",
  8481. fn: function (anObject,anotherObject){
  8482. var self=this,$self=this;
  8483. return $core.withContext(function($ctx1) {
  8484. var $1;
  8485. $1=$self._new();
  8486. $recv($1)._add_(anObject);
  8487. $ctx1.sendIdx["add:"]=1;
  8488. $recv($1)._add_(anotherObject);
  8489. return $recv($1)._yourself();
  8490. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8491. },
  8492. args: ["anObject", "anotherObject"],
  8493. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8494. referencedClasses: [],
  8495. messageSends: ["add:", "new", "yourself"]
  8496. }),
  8497. $globals.Collection.a$cls);
  8498. $core.addMethod(
  8499. $core.method({
  8500. selector: "with:with:with:",
  8501. protocol: "instance creation",
  8502. fn: function (firstObject,secondObject,thirdObject){
  8503. var self=this,$self=this;
  8504. return $core.withContext(function($ctx1) {
  8505. var $1;
  8506. $1=$self._new();
  8507. $recv($1)._add_(firstObject);
  8508. $ctx1.sendIdx["add:"]=1;
  8509. $recv($1)._add_(secondObject);
  8510. $ctx1.sendIdx["add:"]=2;
  8511. $recv($1)._add_(thirdObject);
  8512. return $recv($1)._yourself();
  8513. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8514. },
  8515. args: ["firstObject", "secondObject", "thirdObject"],
  8516. 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",
  8517. referencedClasses: [],
  8518. messageSends: ["add:", "new", "yourself"]
  8519. }),
  8520. $globals.Collection.a$cls);
  8521. $core.addMethod(
  8522. $core.method({
  8523. selector: "withAll:",
  8524. protocol: "instance creation",
  8525. fn: function (aCollection){
  8526. var self=this,$self=this;
  8527. return $core.withContext(function($ctx1) {
  8528. var $1;
  8529. $1=$self._new();
  8530. $recv($1)._addAll_(aCollection);
  8531. return $recv($1)._yourself();
  8532. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8533. },
  8534. args: ["aCollection"],
  8535. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8536. referencedClasses: [],
  8537. messageSends: ["addAll:", "new", "yourself"]
  8538. }),
  8539. $globals.Collection.a$cls);
  8540. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  8541. $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.";
  8542. $core.addMethod(
  8543. $core.method({
  8544. selector: "at:",
  8545. protocol: "accessing",
  8546. fn: function (anIndex){
  8547. var self=this,$self=this;
  8548. return $core.withContext(function($ctx1) {
  8549. return $self._at_ifAbsent_(anIndex,(function(){
  8550. return $core.withContext(function($ctx2) {
  8551. return $self._errorNotFound();
  8552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8553. }));
  8554. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  8555. },
  8556. args: ["anIndex"],
  8557. 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 ]",
  8558. referencedClasses: [],
  8559. messageSends: ["at:ifAbsent:", "errorNotFound"]
  8560. }),
  8561. $globals.IndexableCollection);
  8562. $core.addMethod(
  8563. $core.method({
  8564. selector: "at:ifAbsent:",
  8565. protocol: "accessing",
  8566. fn: function (anIndex,aBlock){
  8567. var self=this,$self=this;
  8568. return $core.withContext(function($ctx1) {
  8569. $self._subclassResponsibility();
  8570. return self;
  8571. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8572. },
  8573. args: ["anIndex", "aBlock"],
  8574. 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",
  8575. referencedClasses: [],
  8576. messageSends: ["subclassResponsibility"]
  8577. }),
  8578. $globals.IndexableCollection);
  8579. $core.addMethod(
  8580. $core.method({
  8581. selector: "at:ifAbsentPut:",
  8582. protocol: "accessing",
  8583. fn: function (aKey,aBlock){
  8584. var self=this,$self=this;
  8585. return $core.withContext(function($ctx1) {
  8586. return $self._at_ifAbsent_(aKey,(function(){
  8587. return $core.withContext(function($ctx2) {
  8588. return $self._at_put_(aKey,$recv(aBlock)._value());
  8589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8590. }));
  8591. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  8592. },
  8593. args: ["aKey", "aBlock"],
  8594. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  8595. referencedClasses: [],
  8596. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  8597. }),
  8598. $globals.IndexableCollection);
  8599. $core.addMethod(
  8600. $core.method({
  8601. selector: "at:ifPresent:",
  8602. protocol: "accessing",
  8603. fn: function (anIndex,aBlock){
  8604. var self=this,$self=this;
  8605. return $core.withContext(function($ctx1) {
  8606. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  8607. return nil;
  8608. }));
  8609. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8610. },
  8611. args: ["anIndex", "aBlock"],
  8612. 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 ]",
  8613. referencedClasses: [],
  8614. messageSends: ["at:ifPresent:ifAbsent:"]
  8615. }),
  8616. $globals.IndexableCollection);
  8617. $core.addMethod(
  8618. $core.method({
  8619. selector: "at:ifPresent:ifAbsent:",
  8620. protocol: "accessing",
  8621. fn: function (anIndex,aBlock,anotherBlock){
  8622. var self=this,$self=this;
  8623. return $core.withContext(function($ctx1) {
  8624. $self._subclassResponsibility();
  8625. return self;
  8626. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  8627. },
  8628. args: ["anIndex", "aBlock", "anotherBlock"],
  8629. 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",
  8630. referencedClasses: [],
  8631. messageSends: ["subclassResponsibility"]
  8632. }),
  8633. $globals.IndexableCollection);
  8634. $core.addMethod(
  8635. $core.method({
  8636. selector: "at:put:",
  8637. protocol: "accessing",
  8638. fn: function (anIndex,anObject){
  8639. var self=this,$self=this;
  8640. return $core.withContext(function($ctx1) {
  8641. $self._subclassResponsibility();
  8642. return self;
  8643. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  8644. },
  8645. args: ["anIndex", "anObject"],
  8646. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  8647. referencedClasses: [],
  8648. messageSends: ["subclassResponsibility"]
  8649. }),
  8650. $globals.IndexableCollection);
  8651. $core.addMethod(
  8652. $core.method({
  8653. selector: "indexOf:",
  8654. protocol: "accessing",
  8655. fn: function (anObject){
  8656. var self=this,$self=this;
  8657. return $core.withContext(function($ctx1) {
  8658. return $self._indexOf_ifAbsent_(anObject,(function(){
  8659. return $core.withContext(function($ctx2) {
  8660. return $self._errorNotFound();
  8661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8662. }));
  8663. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  8664. },
  8665. args: ["anObject"],
  8666. 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 ]",
  8667. referencedClasses: [],
  8668. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  8669. }),
  8670. $globals.IndexableCollection);
  8671. $core.addMethod(
  8672. $core.method({
  8673. selector: "indexOf:ifAbsent:",
  8674. protocol: "accessing",
  8675. fn: function (anObject,aBlock){
  8676. var self=this,$self=this;
  8677. return $core.withContext(function($ctx1) {
  8678. $self._subclassResponsibility();
  8679. return self;
  8680. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  8681. },
  8682. args: ["anObject", "aBlock"],
  8683. 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",
  8684. referencedClasses: [],
  8685. messageSends: ["subclassResponsibility"]
  8686. }),
  8687. $globals.IndexableCollection);
  8688. $core.addMethod(
  8689. $core.method({
  8690. selector: "with:do:",
  8691. protocol: "enumerating",
  8692. fn: function (anotherCollection,aBlock){
  8693. var self=this,$self=this;
  8694. return $core.withContext(function($ctx1) {
  8695. $self._withIndexDo_((function(each,index){
  8696. return $core.withContext(function($ctx2) {
  8697. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  8698. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  8699. }));
  8700. return self;
  8701. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  8702. },
  8703. args: ["anotherCollection", "aBlock"],
  8704. 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) ]",
  8705. referencedClasses: [],
  8706. messageSends: ["withIndexDo:", "value:value:", "at:"]
  8707. }),
  8708. $globals.IndexableCollection);
  8709. $core.addMethod(
  8710. $core.method({
  8711. selector: "withIndexDo:",
  8712. protocol: "enumerating",
  8713. fn: function (aBlock){
  8714. var self=this,$self=this;
  8715. return $core.withContext(function($ctx1) {
  8716. $self._subclassResponsibility();
  8717. return self;
  8718. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  8719. },
  8720. args: ["aBlock"],
  8721. 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",
  8722. referencedClasses: [],
  8723. messageSends: ["subclassResponsibility"]
  8724. }),
  8725. $globals.IndexableCollection);
  8726. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8727. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "=",
  8731. protocol: "comparing",
  8732. fn: function (anAssocitativeCollection){
  8733. var self=this,$self=this;
  8734. return $core.withContext(function($ctx1) {
  8735. var $2,$1,$4,$3,$5;
  8736. $2=$self._class();
  8737. $ctx1.sendIdx["class"]=1;
  8738. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8739. $ctx1.sendIdx["="]=1;
  8740. if(!$core.assert($1)){
  8741. return false;
  8742. }
  8743. $4=$self._size();
  8744. $ctx1.sendIdx["size"]=1;
  8745. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8746. $ctx1.sendIdx["="]=2;
  8747. if(!$core.assert($3)){
  8748. return false;
  8749. }
  8750. $5=$self._associations();
  8751. $ctx1.sendIdx["associations"]=1;
  8752. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8753. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8754. },
  8755. args: ["anAssocitativeCollection"],
  8756. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8757. referencedClasses: [],
  8758. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8759. }),
  8760. $globals.AssociativeCollection);
  8761. $core.addMethod(
  8762. $core.method({
  8763. selector: "add:",
  8764. protocol: "adding/removing",
  8765. fn: function (anAssociation){
  8766. var self=this,$self=this;
  8767. return $core.withContext(function($ctx1) {
  8768. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8769. return self;
  8770. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8771. },
  8772. args: ["anAssociation"],
  8773. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8774. referencedClasses: [],
  8775. messageSends: ["at:put:", "key", "value"]
  8776. }),
  8777. $globals.AssociativeCollection);
  8778. $core.addMethod(
  8779. $core.method({
  8780. selector: "addAll:",
  8781. protocol: "adding/removing",
  8782. fn: function (anAssociativeCollection){
  8783. var self=this,$self=this;
  8784. return $core.withContext(function($ctx1) {
  8785. (
  8786. $ctx1.supercall = true,
  8787. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8788. $ctx1.supercall = false;
  8789. return anAssociativeCollection;
  8790. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8791. },
  8792. args: ["anAssociativeCollection"],
  8793. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8794. referencedClasses: [],
  8795. messageSends: ["addAll:", "associations"]
  8796. }),
  8797. $globals.AssociativeCollection);
  8798. $core.addMethod(
  8799. $core.method({
  8800. selector: "asDictionary",
  8801. protocol: "converting",
  8802. fn: function (){
  8803. var self=this,$self=this;
  8804. return $core.withContext(function($ctx1) {
  8805. return $recv($globals.Dictionary)._from_($self._associations());
  8806. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8807. },
  8808. args: [],
  8809. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8810. referencedClasses: ["Dictionary"],
  8811. messageSends: ["from:", "associations"]
  8812. }),
  8813. $globals.AssociativeCollection);
  8814. $core.addMethod(
  8815. $core.method({
  8816. selector: "asHashedCollection",
  8817. protocol: "converting",
  8818. fn: function (){
  8819. var self=this,$self=this;
  8820. return $core.withContext(function($ctx1) {
  8821. return $recv($globals.HashedCollection)._from_($self._associations());
  8822. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8823. },
  8824. args: [],
  8825. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8826. referencedClasses: ["HashedCollection"],
  8827. messageSends: ["from:", "associations"]
  8828. }),
  8829. $globals.AssociativeCollection);
  8830. $core.addMethod(
  8831. $core.method({
  8832. selector: "asJavaScriptObject",
  8833. protocol: "converting",
  8834. fn: function (){
  8835. var self=this,$self=this;
  8836. var hash;
  8837. return $core.withContext(function($ctx1) {
  8838. hash=$recv($globals.HashedCollection)._new();
  8839. $self._keysAndValuesDo_((function(key,value){
  8840. return $core.withContext(function($ctx2) {
  8841. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8842. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8843. }));
  8844. return hash;
  8845. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8846. },
  8847. args: [],
  8848. 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",
  8849. referencedClasses: ["HashedCollection"],
  8850. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8851. }),
  8852. $globals.AssociativeCollection);
  8853. $core.addMethod(
  8854. $core.method({
  8855. selector: "associations",
  8856. protocol: "accessing",
  8857. fn: function (){
  8858. var self=this,$self=this;
  8859. var associations;
  8860. return $core.withContext(function($ctx1) {
  8861. associations=[];
  8862. $self._associationsDo_((function(each){
  8863. return $core.withContext(function($ctx2) {
  8864. return $recv(associations)._add_(each);
  8865. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8866. }));
  8867. return associations;
  8868. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8869. },
  8870. args: [],
  8871. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8872. referencedClasses: [],
  8873. messageSends: ["associationsDo:", "add:"]
  8874. }),
  8875. $globals.AssociativeCollection);
  8876. $core.addMethod(
  8877. $core.method({
  8878. selector: "associationsDo:",
  8879. protocol: "enumerating",
  8880. fn: function (aBlock){
  8881. var self=this,$self=this;
  8882. return $core.withContext(function($ctx1) {
  8883. $self._keysAndValuesDo_((function(key,value){
  8884. return $core.withContext(function($ctx2) {
  8885. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8886. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8887. }));
  8888. return self;
  8889. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8890. },
  8891. args: ["aBlock"],
  8892. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8893. referencedClasses: ["Association"],
  8894. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8895. }),
  8896. $globals.AssociativeCollection);
  8897. $core.addMethod(
  8898. $core.method({
  8899. selector: "at:ifPresent:ifAbsent:",
  8900. protocol: "accessing",
  8901. fn: function (aKey,aBlock,anotherBlock){
  8902. var self=this,$self=this;
  8903. return $core.withContext(function($ctx1) {
  8904. var $1;
  8905. $1=$self._includesKey_(aKey);
  8906. if($core.assert($1)){
  8907. return $recv(aBlock)._value_($self._at_(aKey));
  8908. } else {
  8909. return $recv(anotherBlock)._value();
  8910. }
  8911. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8912. },
  8913. args: ["aKey", "aBlock", "anotherBlock"],
  8914. 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 ]",
  8915. referencedClasses: [],
  8916. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8917. }),
  8918. $globals.AssociativeCollection);
  8919. $core.addMethod(
  8920. $core.method({
  8921. selector: "collect:",
  8922. protocol: "enumerating",
  8923. fn: function (aBlock){
  8924. var self=this,$self=this;
  8925. var newDict;
  8926. return $core.withContext(function($ctx1) {
  8927. newDict=$recv($self._class())._new();
  8928. $self._keysAndValuesDo_((function(key,value){
  8929. return $core.withContext(function($ctx2) {
  8930. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8931. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8932. }));
  8933. return newDict;
  8934. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8935. },
  8936. args: ["aBlock"],
  8937. 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",
  8938. referencedClasses: [],
  8939. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8940. }),
  8941. $globals.AssociativeCollection);
  8942. $core.addMethod(
  8943. $core.method({
  8944. selector: "deepCopy",
  8945. protocol: "copying",
  8946. fn: function (){
  8947. var self=this,$self=this;
  8948. var copy;
  8949. return $core.withContext(function($ctx1) {
  8950. copy=$recv($self._class())._new();
  8951. $self._keysAndValuesDo_((function(key,value){
  8952. return $core.withContext(function($ctx2) {
  8953. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8954. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8955. }));
  8956. return copy;
  8957. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8958. },
  8959. args: [],
  8960. 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",
  8961. referencedClasses: [],
  8962. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8963. }),
  8964. $globals.AssociativeCollection);
  8965. $core.addMethod(
  8966. $core.method({
  8967. selector: "detect:ifNone:",
  8968. protocol: "enumerating",
  8969. fn: function (aBlock,anotherBlock){
  8970. var self=this,$self=this;
  8971. return $core.withContext(function($ctx1) {
  8972. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8973. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8974. },
  8975. args: ["aBlock", "anotherBlock"],
  8976. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8977. referencedClasses: [],
  8978. messageSends: ["detect:ifNone:", "values"]
  8979. }),
  8980. $globals.AssociativeCollection);
  8981. $core.addMethod(
  8982. $core.method({
  8983. selector: "do:",
  8984. protocol: "enumerating",
  8985. fn: function (aBlock){
  8986. var self=this,$self=this;
  8987. return $core.withContext(function($ctx1) {
  8988. $self._valuesDo_(aBlock);
  8989. return self;
  8990. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8991. },
  8992. args: ["aBlock"],
  8993. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8994. referencedClasses: [],
  8995. messageSends: ["valuesDo:"]
  8996. }),
  8997. $globals.AssociativeCollection);
  8998. $core.addMethod(
  8999. $core.method({
  9000. selector: "includes:",
  9001. protocol: "enumerating",
  9002. fn: function (anObject){
  9003. var self=this,$self=this;
  9004. return $core.withContext(function($ctx1) {
  9005. return $recv($self._values())._includes_(anObject);
  9006. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  9007. },
  9008. args: ["anObject"],
  9009. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  9010. referencedClasses: [],
  9011. messageSends: ["includes:", "values"]
  9012. }),
  9013. $globals.AssociativeCollection);
  9014. $core.addMethod(
  9015. $core.method({
  9016. selector: "includesKey:",
  9017. protocol: "testing",
  9018. fn: function (aKey){
  9019. var self=this,$self=this;
  9020. return $core.withContext(function($ctx1) {
  9021. $self._subclassResponsibility();
  9022. return self;
  9023. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9024. },
  9025. args: ["aKey"],
  9026. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  9027. referencedClasses: [],
  9028. messageSends: ["subclassResponsibility"]
  9029. }),
  9030. $globals.AssociativeCollection);
  9031. $core.addMethod(
  9032. $core.method({
  9033. selector: "indexOf:ifAbsent:",
  9034. protocol: "accessing",
  9035. fn: function (anObject,aBlock){
  9036. var self=this,$self=this;
  9037. return $core.withContext(function($ctx1) {
  9038. return $recv($self._keys())._detect_ifNone_((function(each){
  9039. return $core.withContext(function($ctx2) {
  9040. return $recv($self._at_(each)).__eq(anObject);
  9041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9042. }),aBlock);
  9043. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9044. },
  9045. args: ["anObject", "aBlock"],
  9046. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  9047. referencedClasses: [],
  9048. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  9049. }),
  9050. $globals.AssociativeCollection);
  9051. $core.addMethod(
  9052. $core.method({
  9053. selector: "keyAtValue:",
  9054. protocol: "accessing",
  9055. fn: function (anObject){
  9056. var self=this,$self=this;
  9057. return $core.withContext(function($ctx1) {
  9058. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  9059. return $core.withContext(function($ctx2) {
  9060. return $self._errorNotFound();
  9061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9062. }));
  9063. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  9064. },
  9065. args: ["anObject"],
  9066. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  9067. referencedClasses: [],
  9068. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  9069. }),
  9070. $globals.AssociativeCollection);
  9071. $core.addMethod(
  9072. $core.method({
  9073. selector: "keyAtValue:ifAbsent:",
  9074. protocol: "accessing",
  9075. fn: function (anObject,aBlock){
  9076. var self=this,$self=this;
  9077. return $core.withContext(function($ctx1) {
  9078. return $self._indexOf_ifAbsent_(anObject,aBlock);
  9079. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9080. },
  9081. args: ["anObject", "aBlock"],
  9082. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  9083. referencedClasses: [],
  9084. messageSends: ["indexOf:ifAbsent:"]
  9085. }),
  9086. $globals.AssociativeCollection);
  9087. $core.addMethod(
  9088. $core.method({
  9089. selector: "keys",
  9090. protocol: "accessing",
  9091. fn: function (){
  9092. var self=this,$self=this;
  9093. return $core.withContext(function($ctx1) {
  9094. $self._subclassResponsibility();
  9095. return self;
  9096. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  9097. },
  9098. args: [],
  9099. source: "keys\x0a\x09self subclassResponsibility",
  9100. referencedClasses: [],
  9101. messageSends: ["subclassResponsibility"]
  9102. }),
  9103. $globals.AssociativeCollection);
  9104. $core.addMethod(
  9105. $core.method({
  9106. selector: "keysAndValuesDo:",
  9107. protocol: "enumerating",
  9108. fn: function (aBlock){
  9109. var self=this,$self=this;
  9110. return $core.withContext(function($ctx1) {
  9111. $self._keysDo_((function(each){
  9112. return $core.withContext(function($ctx2) {
  9113. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9115. }));
  9116. return self;
  9117. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9118. },
  9119. args: ["aBlock"],
  9120. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9121. referencedClasses: [],
  9122. messageSends: ["keysDo:", "value:value:", "at:"]
  9123. }),
  9124. $globals.AssociativeCollection);
  9125. $core.addMethod(
  9126. $core.method({
  9127. selector: "keysDo:",
  9128. protocol: "enumerating",
  9129. fn: function (aBlock){
  9130. var self=this,$self=this;
  9131. return $core.withContext(function($ctx1) {
  9132. $self._subclassResponsibility();
  9133. return self;
  9134. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9135. },
  9136. args: ["aBlock"],
  9137. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9138. referencedClasses: [],
  9139. messageSends: ["subclassResponsibility"]
  9140. }),
  9141. $globals.AssociativeCollection);
  9142. $core.addMethod(
  9143. $core.method({
  9144. selector: "printOn:",
  9145. protocol: "printing",
  9146. fn: function (aStream){
  9147. var self=this,$self=this;
  9148. return $core.withContext(function($ctx1) {
  9149. (
  9150. $ctx1.supercall = true,
  9151. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9152. $ctx1.supercall = false;
  9153. $ctx1.sendIdx["printOn:"]=1;
  9154. $recv(aStream)._nextPutAll_(" (");
  9155. $ctx1.sendIdx["nextPutAll:"]=1;
  9156. $recv($self._associations())._do_separatedBy_((function(each){
  9157. return $core.withContext(function($ctx2) {
  9158. return $recv(each)._printOn_(aStream);
  9159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9160. }),(function(){
  9161. return $core.withContext(function($ctx2) {
  9162. return $recv(aStream)._nextPutAll_(" , ");
  9163. $ctx2.sendIdx["nextPutAll:"]=2;
  9164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9165. }));
  9166. $recv(aStream)._nextPutAll_(")");
  9167. return self;
  9168. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9169. },
  9170. args: ["aStream"],
  9171. 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: ')'",
  9172. referencedClasses: [],
  9173. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9174. }),
  9175. $globals.AssociativeCollection);
  9176. $core.addMethod(
  9177. $core.method({
  9178. selector: "remove:ifAbsent:",
  9179. protocol: "adding/removing",
  9180. fn: function (aKey,aBlock){
  9181. var self=this,$self=this;
  9182. return $core.withContext(function($ctx1) {
  9183. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9184. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9185. },
  9186. args: ["aKey", "aBlock"],
  9187. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9188. referencedClasses: [],
  9189. messageSends: ["removeKey:ifAbsent:"]
  9190. }),
  9191. $globals.AssociativeCollection);
  9192. $core.addMethod(
  9193. $core.method({
  9194. selector: "removeAll",
  9195. protocol: "adding/removing",
  9196. fn: function (){
  9197. var self=this,$self=this;
  9198. return $core.withContext(function($ctx1) {
  9199. return $recv($self._keys())._do_((function(each){
  9200. return $core.withContext(function($ctx2) {
  9201. return $self._removeKey_(each);
  9202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9203. }));
  9204. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9205. },
  9206. args: [],
  9207. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9208. referencedClasses: [],
  9209. messageSends: ["do:", "keys", "removeKey:"]
  9210. }),
  9211. $globals.AssociativeCollection);
  9212. $core.addMethod(
  9213. $core.method({
  9214. selector: "removeKey:",
  9215. protocol: "adding/removing",
  9216. fn: function (aKey){
  9217. var self=this,$self=this;
  9218. return $core.withContext(function($ctx1) {
  9219. return $self._remove_(aKey);
  9220. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9221. },
  9222. args: ["aKey"],
  9223. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9224. referencedClasses: [],
  9225. messageSends: ["remove:"]
  9226. }),
  9227. $globals.AssociativeCollection);
  9228. $core.addMethod(
  9229. $core.method({
  9230. selector: "removeKey:ifAbsent:",
  9231. protocol: "adding/removing",
  9232. fn: function (aKey,aBlock){
  9233. var self=this,$self=this;
  9234. return $core.withContext(function($ctx1) {
  9235. $self._subclassResponsibility();
  9236. return self;
  9237. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9238. },
  9239. args: ["aKey", "aBlock"],
  9240. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9241. referencedClasses: [],
  9242. messageSends: ["subclassResponsibility"]
  9243. }),
  9244. $globals.AssociativeCollection);
  9245. $core.addMethod(
  9246. $core.method({
  9247. selector: "select:",
  9248. protocol: "enumerating",
  9249. fn: function (aBlock){
  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(aBlock)._value_(value);
  9258. if($core.assert($1)){
  9259. return $recv(newDict)._at_put_(key,value);
  9260. }
  9261. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9262. }));
  9263. return newDict;
  9264. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9265. },
  9266. args: ["aBlock"],
  9267. 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",
  9268. referencedClasses: [],
  9269. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9270. }),
  9271. $globals.AssociativeCollection);
  9272. $core.addMethod(
  9273. $core.method({
  9274. selector: "select:thenCollect:",
  9275. protocol: "enumerating",
  9276. fn: function (selectBlock,collectBlock){
  9277. var self=this,$self=this;
  9278. var newDict;
  9279. return $core.withContext(function($ctx1) {
  9280. var $1;
  9281. newDict=$recv($self._class())._new();
  9282. $self._keysAndValuesDo_((function(key,value){
  9283. return $core.withContext(function($ctx2) {
  9284. $1=$recv(selectBlock)._value_(value);
  9285. $ctx2.sendIdx["value:"]=1;
  9286. if($core.assert($1)){
  9287. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9288. }
  9289. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9290. }));
  9291. return newDict;
  9292. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9293. },
  9294. args: ["selectBlock", "collectBlock"],
  9295. 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",
  9296. referencedClasses: [],
  9297. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9298. }),
  9299. $globals.AssociativeCollection);
  9300. $core.addMethod(
  9301. $core.method({
  9302. selector: "shallowCopy",
  9303. protocol: "copying",
  9304. fn: function (){
  9305. var self=this,$self=this;
  9306. var copy;
  9307. return $core.withContext(function($ctx1) {
  9308. copy=$recv($self._class())._new();
  9309. $self._keysAndValuesDo_((function(key,value){
  9310. return $core.withContext(function($ctx2) {
  9311. return $recv(copy)._at_put_(key,value);
  9312. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9313. }));
  9314. return copy;
  9315. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9316. },
  9317. args: [],
  9318. 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",
  9319. referencedClasses: [],
  9320. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9321. }),
  9322. $globals.AssociativeCollection);
  9323. $core.addMethod(
  9324. $core.method({
  9325. selector: "size",
  9326. protocol: "accessing",
  9327. fn: function (){
  9328. var self=this,$self=this;
  9329. return $core.withContext(function($ctx1) {
  9330. return $recv($self._keys())._size();
  9331. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9332. },
  9333. args: [],
  9334. source: "size\x0a\x09^ self keys size",
  9335. referencedClasses: [],
  9336. messageSends: ["size", "keys"]
  9337. }),
  9338. $globals.AssociativeCollection);
  9339. $core.addMethod(
  9340. $core.method({
  9341. selector: "values",
  9342. protocol: "accessing",
  9343. fn: function (){
  9344. var self=this,$self=this;
  9345. return $core.withContext(function($ctx1) {
  9346. $self._subclassResponsibility();
  9347. return self;
  9348. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9349. },
  9350. args: [],
  9351. source: "values\x0a\x09self subclassResponsibility",
  9352. referencedClasses: [],
  9353. messageSends: ["subclassResponsibility"]
  9354. }),
  9355. $globals.AssociativeCollection);
  9356. $core.addMethod(
  9357. $core.method({
  9358. selector: "valuesDo:",
  9359. protocol: "enumerating",
  9360. fn: function (aBlock){
  9361. var self=this,$self=this;
  9362. return $core.withContext(function($ctx1) {
  9363. $self._subclassResponsibility();
  9364. return self;
  9365. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9366. },
  9367. args: ["aBlock"],
  9368. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9369. referencedClasses: [],
  9370. messageSends: ["subclassResponsibility"]
  9371. }),
  9372. $globals.AssociativeCollection);
  9373. $core.addMethod(
  9374. $core.method({
  9375. selector: "withIndexDo:",
  9376. protocol: "enumerating",
  9377. fn: function (aBlock){
  9378. var self=this,$self=this;
  9379. return $core.withContext(function($ctx1) {
  9380. $self._keysAndValuesDo_((function(key,value){
  9381. return $core.withContext(function($ctx2) {
  9382. return $recv(aBlock)._value_value_(value,key);
  9383. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9384. }));
  9385. return self;
  9386. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9387. },
  9388. args: ["aBlock"],
  9389. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9390. referencedClasses: [],
  9391. messageSends: ["keysAndValuesDo:", "value:value:"]
  9392. }),
  9393. $globals.AssociativeCollection);
  9394. $core.addMethod(
  9395. $core.method({
  9396. selector: "from:",
  9397. protocol: "instance creation",
  9398. fn: function (aCollection){
  9399. var self=this,$self=this;
  9400. var newCollection;
  9401. return $core.withContext(function($ctx1) {
  9402. newCollection=$self._new();
  9403. $recv(aCollection)._do_((function(each){
  9404. return $core.withContext(function($ctx2) {
  9405. return $recv(newCollection)._add_(each);
  9406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9407. }));
  9408. return newCollection;
  9409. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9410. },
  9411. args: ["aCollection"],
  9412. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9413. referencedClasses: [],
  9414. messageSends: ["new", "do:", "add:"]
  9415. }),
  9416. $globals.AssociativeCollection.a$cls);
  9417. $core.addMethod(
  9418. $core.method({
  9419. selector: "fromPairs:",
  9420. protocol: "instance creation",
  9421. fn: function (aCollection){
  9422. var self=this,$self=this;
  9423. return $core.withContext(function($ctx1) {
  9424. return $self._from_(aCollection);
  9425. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9426. },
  9427. args: ["aCollection"],
  9428. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9429. referencedClasses: [],
  9430. messageSends: ["from:"]
  9431. }),
  9432. $globals.AssociativeCollection.a$cls);
  9433. $core.addMethod(
  9434. $core.method({
  9435. selector: "newFromPairs:",
  9436. protocol: "instance creation",
  9437. fn: function (aCollection){
  9438. var self=this,$self=this;
  9439. var newCollection;
  9440. return $core.withContext(function($ctx1) {
  9441. var $2,$1,$3,$4;
  9442. $2=$recv(aCollection)._size();
  9443. $ctx1.sendIdx["size"]=1;
  9444. $1=$recv($2)._even();
  9445. if(!$core.assert($1)){
  9446. $self._error_("#newFromPairs only accepts arrays of an even length");
  9447. }
  9448. newCollection=$self._new();
  9449. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9450. return $core.withContext(function($ctx2) {
  9451. $3=newCollection;
  9452. $4=$recv(aCollection)._at_(each);
  9453. $ctx2.sendIdx["at:"]=1;
  9454. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9456. }));
  9457. return newCollection;
  9458. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9459. },
  9460. args: ["aCollection"],
  9461. 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",
  9462. referencedClasses: [],
  9463. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9464. }),
  9465. $globals.AssociativeCollection.a$cls);
  9466. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9467. $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.";
  9468. $core.addMethod(
  9469. $core.method({
  9470. selector: "at:ifAbsent:",
  9471. protocol: "accessing",
  9472. fn: function (aKey,aBlock){
  9473. var self=this,$self=this;
  9474. return $core.withContext(function($ctx1) {
  9475. var index = $self._positionOfKey_(aKey);
  9476. return index >=0 ? $self['@values'][index] : aBlock._value();
  9477. ;
  9478. return self;
  9479. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9480. },
  9481. args: ["aKey", "aBlock"],
  9482. 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'>",
  9483. referencedClasses: [],
  9484. messageSends: []
  9485. }),
  9486. $globals.Dictionary);
  9487. $core.addMethod(
  9488. $core.method({
  9489. selector: "at:put:",
  9490. protocol: "accessing",
  9491. fn: function (aKey,aValue){
  9492. var self=this,$self=this;
  9493. return $core.withContext(function($ctx1) {
  9494. var index = $self._positionOfKey_(aKey);
  9495. if(index === -1) {
  9496. var keys = $self['@keys'];
  9497. index = keys.length;
  9498. keys.push(aKey);
  9499. }
  9500. return $self['@values'][index] = aValue;
  9501. ;
  9502. return self;
  9503. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9504. },
  9505. args: ["aKey", "aValue"],
  9506. 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'>",
  9507. referencedClasses: [],
  9508. messageSends: []
  9509. }),
  9510. $globals.Dictionary);
  9511. $core.addMethod(
  9512. $core.method({
  9513. selector: "includesKey:",
  9514. protocol: "testing",
  9515. fn: function (aKey){
  9516. var self=this,$self=this;
  9517. return $core.withContext(function($ctx1) {
  9518. return $self._positionOfKey_(aKey) >= 0;;
  9519. return self;
  9520. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9521. },
  9522. args: ["aKey"],
  9523. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9524. referencedClasses: [],
  9525. messageSends: []
  9526. }),
  9527. $globals.Dictionary);
  9528. $core.addMethod(
  9529. $core.method({
  9530. selector: "indexOf:ifAbsent:",
  9531. protocol: "accessing",
  9532. fn: function (anObject,aBlock){
  9533. var self=this,$self=this;
  9534. var index;
  9535. return $core.withContext(function($ctx1) {
  9536. var $1;
  9537. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9538. return (0);
  9539. }));
  9540. $1=$recv(index).__eq((0));
  9541. if($core.assert($1)){
  9542. return $recv(aBlock)._value();
  9543. } else {
  9544. return $recv($self["@keys"])._at_(index);
  9545. }
  9546. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9547. },
  9548. args: ["anObject", "aBlock"],
  9549. 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 ]",
  9550. referencedClasses: [],
  9551. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9552. }),
  9553. $globals.Dictionary);
  9554. $core.addMethod(
  9555. $core.method({
  9556. selector: "initialize",
  9557. protocol: "initialization",
  9558. fn: function (){
  9559. var self=this,$self=this;
  9560. return $core.withContext(function($ctx1) {
  9561. (
  9562. $ctx1.supercall = true,
  9563. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9564. $ctx1.supercall = false;
  9565. $self["@keys"]=[];
  9566. $self["@values"]=[];
  9567. return self;
  9568. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9569. },
  9570. args: [],
  9571. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9572. referencedClasses: [],
  9573. messageSends: ["initialize"]
  9574. }),
  9575. $globals.Dictionary);
  9576. $core.addMethod(
  9577. $core.method({
  9578. selector: "keys",
  9579. protocol: "accessing",
  9580. fn: function (){
  9581. var self=this,$self=this;
  9582. return $core.withContext(function($ctx1) {
  9583. return $recv($self["@keys"])._copy();
  9584. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9585. },
  9586. args: [],
  9587. source: "keys\x0a\x09^ keys copy",
  9588. referencedClasses: [],
  9589. messageSends: ["copy"]
  9590. }),
  9591. $globals.Dictionary);
  9592. $core.addMethod(
  9593. $core.method({
  9594. selector: "keysAndValuesDo:",
  9595. protocol: "enumerating",
  9596. fn: function (aBlock){
  9597. var self=this,$self=this;
  9598. return $core.withContext(function($ctx1) {
  9599. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9600. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9601. },
  9602. args: ["aBlock"],
  9603. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9604. referencedClasses: [],
  9605. messageSends: ["with:do:"]
  9606. }),
  9607. $globals.Dictionary);
  9608. $core.addMethod(
  9609. $core.method({
  9610. selector: "keysDo:",
  9611. protocol: "enumerating",
  9612. fn: function (aBlock){
  9613. var self=this,$self=this;
  9614. return $core.withContext(function($ctx1) {
  9615. return $recv($self["@keys"])._do_(aBlock);
  9616. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9617. },
  9618. args: ["aBlock"],
  9619. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9620. referencedClasses: [],
  9621. messageSends: ["do:"]
  9622. }),
  9623. $globals.Dictionary);
  9624. $core.addMethod(
  9625. $core.method({
  9626. selector: "positionOfKey:",
  9627. protocol: "private",
  9628. fn: function (anObject){
  9629. var self=this,$self=this;
  9630. return $core.withContext(function($ctx1) {
  9631. var keys = $self['@keys'];
  9632. for(var i=0;i<keys.length;i++){
  9633. if(keys[i].__eq(anObject)) { return i;}
  9634. }
  9635. return -1;
  9636. ;
  9637. return self;
  9638. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9639. },
  9640. args: ["anObject"],
  9641. 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'>",
  9642. referencedClasses: [],
  9643. messageSends: []
  9644. }),
  9645. $globals.Dictionary);
  9646. $core.addMethod(
  9647. $core.method({
  9648. selector: "removeAll",
  9649. protocol: "adding/removing",
  9650. fn: function (){
  9651. var self=this,$self=this;
  9652. return $core.withContext(function($ctx1) {
  9653. $recv($self["@keys"])._removeAll();
  9654. $ctx1.sendIdx["removeAll"]=1;
  9655. $recv($self["@values"])._removeAll();
  9656. return self;
  9657. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9658. },
  9659. args: [],
  9660. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9661. referencedClasses: [],
  9662. messageSends: ["removeAll"]
  9663. }),
  9664. $globals.Dictionary);
  9665. $core.addMethod(
  9666. $core.method({
  9667. selector: "removeKey:ifAbsent:",
  9668. protocol: "adding/removing",
  9669. fn: function (aKey,aBlock){
  9670. var self=this,$self=this;
  9671. return $core.withContext(function($ctx1) {
  9672. var index = $self._positionOfKey_(aKey);
  9673. if(index === -1) {
  9674. return aBlock._value()
  9675. } else {
  9676. var keys = $self['@keys'], values = $self['@values'];
  9677. var value = values[index], l = keys.length;
  9678. keys[index] = keys[l-1];
  9679. keys.pop();
  9680. values[index] = values[l-1];
  9681. values.pop();
  9682. return value;
  9683. }
  9684. ;
  9685. return self;
  9686. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9687. },
  9688. args: ["aKey", "aBlock"],
  9689. 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'>",
  9690. referencedClasses: [],
  9691. messageSends: []
  9692. }),
  9693. $globals.Dictionary);
  9694. $core.addMethod(
  9695. $core.method({
  9696. selector: "values",
  9697. protocol: "accessing",
  9698. fn: function (){
  9699. var self=this,$self=this;
  9700. return $self["@values"];
  9701. },
  9702. args: [],
  9703. source: "values\x0a\x09^ values",
  9704. referencedClasses: [],
  9705. messageSends: []
  9706. }),
  9707. $globals.Dictionary);
  9708. $core.addMethod(
  9709. $core.method({
  9710. selector: "valuesDo:",
  9711. protocol: "enumerating",
  9712. fn: function (aBlock){
  9713. var self=this,$self=this;
  9714. return $core.withContext(function($ctx1) {
  9715. return $recv($self["@values"])._do_(aBlock);
  9716. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9717. },
  9718. args: ["aBlock"],
  9719. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9720. referencedClasses: [],
  9721. messageSends: ["do:"]
  9722. }),
  9723. $globals.Dictionary);
  9724. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9725. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9726. $core.addMethod(
  9727. $core.method({
  9728. selector: "at:ifAbsent:",
  9729. protocol: "accessing",
  9730. fn: function (aKey,aBlock){
  9731. var self=this,$self=this;
  9732. return $core.withContext(function($ctx1) {
  9733. var $1;
  9734. $1=$self._includesKey_(aKey);
  9735. if($core.assert($1)){
  9736. return $self._basicAt_(aKey);
  9737. } else {
  9738. return $recv(aBlock)._value();
  9739. }
  9740. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9741. },
  9742. args: ["aKey", "aBlock"],
  9743. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9744. referencedClasses: [],
  9745. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9746. }),
  9747. $globals.HashedCollection);
  9748. $core.addMethod(
  9749. $core.method({
  9750. selector: "at:put:",
  9751. protocol: "accessing",
  9752. fn: function (aKey,aValue){
  9753. var self=this,$self=this;
  9754. return $core.withContext(function($ctx1) {
  9755. return $self._basicAt_put_(aKey,aValue);
  9756. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9757. },
  9758. args: ["aKey", "aValue"],
  9759. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9760. referencedClasses: [],
  9761. messageSends: ["basicAt:put:"]
  9762. }),
  9763. $globals.HashedCollection);
  9764. $core.addMethod(
  9765. $core.method({
  9766. selector: "includesKey:",
  9767. protocol: "testing",
  9768. fn: function (aKey){
  9769. var self=this,$self=this;
  9770. return $core.withContext(function($ctx1) {
  9771. return self.hasOwnProperty(aKey);
  9772. return self;
  9773. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9774. },
  9775. args: ["aKey"],
  9776. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9777. referencedClasses: [],
  9778. messageSends: []
  9779. }),
  9780. $globals.HashedCollection);
  9781. $core.addMethod(
  9782. $core.method({
  9783. selector: "keys",
  9784. protocol: "accessing",
  9785. fn: function (){
  9786. var self=this,$self=this;
  9787. return $core.withContext(function($ctx1) {
  9788. return Object.keys(self);
  9789. return self;
  9790. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9791. },
  9792. args: [],
  9793. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9794. referencedClasses: [],
  9795. messageSends: []
  9796. }),
  9797. $globals.HashedCollection);
  9798. $core.addMethod(
  9799. $core.method({
  9800. selector: "keysDo:",
  9801. protocol: "enumerating",
  9802. fn: function (aBlock){
  9803. var self=this,$self=this;
  9804. return $core.withContext(function($ctx1) {
  9805. $recv($self._keys())._do_(aBlock);
  9806. return self;
  9807. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9808. },
  9809. args: ["aBlock"],
  9810. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9811. referencedClasses: [],
  9812. messageSends: ["do:", "keys"]
  9813. }),
  9814. $globals.HashedCollection);
  9815. $core.addMethod(
  9816. $core.method({
  9817. selector: "removeKey:ifAbsent:",
  9818. protocol: "adding/removing",
  9819. fn: function (aKey,aBlock){
  9820. var self=this,$self=this;
  9821. return $core.withContext(function($ctx1) {
  9822. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9823. return $core.withContext(function($ctx2) {
  9824. $self._basicDelete_(aKey);
  9825. return removed;
  9826. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9827. }),(function(){
  9828. return $core.withContext(function($ctx2) {
  9829. return $recv(aBlock)._value();
  9830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9831. }));
  9832. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9833. },
  9834. args: ["aKey", "aBlock"],
  9835. 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 ]",
  9836. referencedClasses: [],
  9837. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9838. }),
  9839. $globals.HashedCollection);
  9840. $core.addMethod(
  9841. $core.method({
  9842. selector: "values",
  9843. protocol: "accessing",
  9844. fn: function (){
  9845. var self=this,$self=this;
  9846. return $core.withContext(function($ctx1) {
  9847. return $self._keys().map(function(key){
  9848. return $self._at_(key);
  9849. });
  9850. ;
  9851. return self;
  9852. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9853. },
  9854. args: [],
  9855. 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'>",
  9856. referencedClasses: [],
  9857. messageSends: []
  9858. }),
  9859. $globals.HashedCollection);
  9860. $core.addMethod(
  9861. $core.method({
  9862. selector: "valuesDo:",
  9863. protocol: "enumerating",
  9864. fn: function (aBlock){
  9865. var self=this,$self=this;
  9866. return $core.withContext(function($ctx1) {
  9867. $recv($self._values())._do_(aBlock);
  9868. return self;
  9869. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9870. },
  9871. args: ["aBlock"],
  9872. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9873. referencedClasses: [],
  9874. messageSends: ["do:", "values"]
  9875. }),
  9876. $globals.HashedCollection);
  9877. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  9878. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9879. $core.addMethod(
  9880. $core.method({
  9881. selector: "=",
  9882. protocol: "comparing",
  9883. fn: function (aCollection){
  9884. var self=this,$self=this;
  9885. return $core.withContext(function($ctx1) {
  9886. var $3,$2,$4,$1,$5;
  9887. var $early={};
  9888. try {
  9889. $3=$self._class();
  9890. $ctx1.sendIdx["class"]=1;
  9891. $2=$recv($3).__eq($recv(aCollection)._class());
  9892. $ctx1.sendIdx["="]=1;
  9893. $1=$recv($2)._and_((function(){
  9894. return $core.withContext(function($ctx2) {
  9895. $4=$self._size();
  9896. $ctx2.sendIdx["size"]=1;
  9897. return $recv($4).__eq($recv(aCollection)._size());
  9898. $ctx2.sendIdx["="]=2;
  9899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9900. }));
  9901. if(!$core.assert($1)){
  9902. return false;
  9903. }
  9904. $self._withIndexDo_((function(each,i){
  9905. return $core.withContext(function($ctx2) {
  9906. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9907. if(!$core.assert($5)){
  9908. throw $early=[false];
  9909. }
  9910. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9911. }));
  9912. return true;
  9913. }
  9914. catch(e) {if(e===$early)return e[0]; throw e}
  9915. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9916. },
  9917. args: ["aCollection"],
  9918. 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",
  9919. referencedClasses: [],
  9920. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9921. }),
  9922. $globals.SequenceableCollection);
  9923. $core.addMethod(
  9924. $core.method({
  9925. selector: "addLast:",
  9926. protocol: "adding/removing",
  9927. fn: function (anObject){
  9928. var self=this,$self=this;
  9929. return $core.withContext(function($ctx1) {
  9930. $self._add_(anObject);
  9931. return self;
  9932. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9933. },
  9934. args: ["anObject"],
  9935. source: "addLast: anObject\x0a\x09self add: anObject",
  9936. referencedClasses: [],
  9937. messageSends: ["add:"]
  9938. }),
  9939. $globals.SequenceableCollection);
  9940. $core.addMethod(
  9941. $core.method({
  9942. selector: "allButFirst",
  9943. protocol: "accessing",
  9944. fn: function (){
  9945. var self=this,$self=this;
  9946. return $core.withContext(function($ctx1) {
  9947. return $self._copyFrom_to_((2),$self._size());
  9948. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9949. },
  9950. args: [],
  9951. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9952. referencedClasses: [],
  9953. messageSends: ["copyFrom:to:", "size"]
  9954. }),
  9955. $globals.SequenceableCollection);
  9956. $core.addMethod(
  9957. $core.method({
  9958. selector: "allButLast",
  9959. protocol: "accessing",
  9960. fn: function (){
  9961. var self=this,$self=this;
  9962. return $core.withContext(function($ctx1) {
  9963. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9964. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9965. },
  9966. args: [],
  9967. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9968. referencedClasses: [],
  9969. messageSends: ["copyFrom:to:", "-", "size"]
  9970. }),
  9971. $globals.SequenceableCollection);
  9972. $core.addMethod(
  9973. $core.method({
  9974. selector: "anyOne",
  9975. protocol: "accessing",
  9976. fn: function (){
  9977. var self=this,$self=this;
  9978. return $core.withContext(function($ctx1) {
  9979. return $self._at_((1));
  9980. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9981. },
  9982. args: [],
  9983. source: "anyOne\x0a\x09^ self at: 1",
  9984. referencedClasses: [],
  9985. messageSends: ["at:"]
  9986. }),
  9987. $globals.SequenceableCollection);
  9988. $core.addMethod(
  9989. $core.method({
  9990. selector: "atRandom",
  9991. protocol: "accessing",
  9992. fn: function (){
  9993. var self=this,$self=this;
  9994. return $core.withContext(function($ctx1) {
  9995. return $self._at_($recv($self._size())._atRandom());
  9996. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9997. },
  9998. args: [],
  9999. source: "atRandom\x0a\x09^ self at: self size atRandom",
  10000. referencedClasses: [],
  10001. messageSends: ["at:", "atRandom", "size"]
  10002. }),
  10003. $globals.SequenceableCollection);
  10004. $core.addMethod(
  10005. $core.method({
  10006. selector: "beginsWith:",
  10007. protocol: "testing",
  10008. fn: function (prefix){
  10009. var self=this,$self=this;
  10010. return $core.withContext(function($ctx1) {
  10011. var $2,$3,$1;
  10012. $2=$self._size();
  10013. $ctx1.sendIdx["size"]=1;
  10014. $3=$recv(prefix)._size();
  10015. $ctx1.sendIdx["size"]=2;
  10016. $1=$recv($2).__lt($3);
  10017. if($core.assert($1)){
  10018. return false;
  10019. }
  10020. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  10021. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  10022. },
  10023. args: ["prefix"],
  10024. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  10025. referencedClasses: [],
  10026. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  10027. }),
  10028. $globals.SequenceableCollection);
  10029. $core.addMethod(
  10030. $core.method({
  10031. selector: "copyFrom:to:",
  10032. protocol: "copying",
  10033. fn: function (anIndex,anotherIndex){
  10034. var self=this,$self=this;
  10035. return $core.withContext(function($ctx1) {
  10036. $self._subclassResponsibility();
  10037. return self;
  10038. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  10039. },
  10040. args: ["anIndex", "anotherIndex"],
  10041. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  10042. referencedClasses: [],
  10043. messageSends: ["subclassResponsibility"]
  10044. }),
  10045. $globals.SequenceableCollection);
  10046. $core.addMethod(
  10047. $core.method({
  10048. selector: "detect:ifNone:",
  10049. protocol: "enumerating",
  10050. fn: function (aBlock,anotherBlock){
  10051. var self=this,$self=this;
  10052. return $core.withContext(function($ctx1) {
  10053. var nself = $self._numericallyIndexable();
  10054. for(var i = 0; i < nself.length; i++)
  10055. if(aBlock._value_(nself[i]))
  10056. return nself[i];
  10057. return anotherBlock._value();
  10058. ;
  10059. return self;
  10060. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  10061. },
  10062. args: ["aBlock", "anotherBlock"],
  10063. 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'>",
  10064. referencedClasses: [],
  10065. messageSends: []
  10066. }),
  10067. $globals.SequenceableCollection);
  10068. $core.addMethod(
  10069. $core.method({
  10070. selector: "do:",
  10071. protocol: "enumerating",
  10072. fn: function (aBlock){
  10073. var self=this,$self=this;
  10074. return $core.withContext(function($ctx1) {
  10075. var nself = $self._numericallyIndexable();
  10076. for(var i=0; i < nself.length; i++) {
  10077. aBlock._value_(nself[i]);
  10078. }
  10079. ;
  10080. return self;
  10081. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10082. },
  10083. args: ["aBlock"],
  10084. 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'>",
  10085. referencedClasses: [],
  10086. messageSends: []
  10087. }),
  10088. $globals.SequenceableCollection);
  10089. $core.addMethod(
  10090. $core.method({
  10091. selector: "endsWith:",
  10092. protocol: "testing",
  10093. fn: function (suffix){
  10094. var self=this,$self=this;
  10095. return $core.withContext(function($ctx1) {
  10096. var $2,$3,$1;
  10097. $2=$self._size();
  10098. $ctx1.sendIdx["size"]=1;
  10099. $3=$recv(suffix)._size();
  10100. $ctx1.sendIdx["size"]=2;
  10101. $1=$recv($2).__lt($3);
  10102. if($core.assert($1)){
  10103. return false;
  10104. }
  10105. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  10106. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  10107. },
  10108. args: ["suffix"],
  10109. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  10110. referencedClasses: [],
  10111. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  10112. }),
  10113. $globals.SequenceableCollection);
  10114. $core.addMethod(
  10115. $core.method({
  10116. selector: "first",
  10117. protocol: "accessing",
  10118. fn: function (){
  10119. var self=this,$self=this;
  10120. return $core.withContext(function($ctx1) {
  10121. return $self._at_((1));
  10122. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  10123. },
  10124. args: [],
  10125. source: "first\x0a\x09^ self at: 1",
  10126. referencedClasses: [],
  10127. messageSends: ["at:"]
  10128. }),
  10129. $globals.SequenceableCollection);
  10130. $core.addMethod(
  10131. $core.method({
  10132. selector: "first:",
  10133. protocol: "accessing",
  10134. fn: function (aNumber){
  10135. var self=this,$self=this;
  10136. return $core.withContext(function($ctx1) {
  10137. var $1;
  10138. $1=$recv($self._size()).__lt(aNumber);
  10139. if($core.assert($1)){
  10140. $self._error_("Invalid number of elements");
  10141. }
  10142. return $self._copyFrom_to_((1),aNumber);
  10143. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10144. },
  10145. args: ["aNumber"],
  10146. 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",
  10147. referencedClasses: [],
  10148. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10149. }),
  10150. $globals.SequenceableCollection);
  10151. $core.addMethod(
  10152. $core.method({
  10153. selector: "fourth",
  10154. protocol: "accessing",
  10155. fn: function (){
  10156. var self=this,$self=this;
  10157. return $core.withContext(function($ctx1) {
  10158. return $self._at_((4));
  10159. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  10160. },
  10161. args: [],
  10162. source: "fourth\x0a\x09^ self at: 4",
  10163. referencedClasses: [],
  10164. messageSends: ["at:"]
  10165. }),
  10166. $globals.SequenceableCollection);
  10167. $core.addMethod(
  10168. $core.method({
  10169. selector: "includes:",
  10170. protocol: "testing",
  10171. fn: function (anObject){
  10172. var self=this,$self=this;
  10173. return $core.withContext(function($ctx1) {
  10174. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10175. return nil;
  10176. })))._notNil();
  10177. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  10178. },
  10179. args: ["anObject"],
  10180. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10181. referencedClasses: [],
  10182. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10183. }),
  10184. $globals.SequenceableCollection);
  10185. $core.addMethod(
  10186. $core.method({
  10187. selector: "indexOf:ifAbsent:",
  10188. protocol: "accessing",
  10189. fn: function (anObject,aBlock){
  10190. var self=this,$self=this;
  10191. return $core.withContext(function($ctx1) {
  10192. var nself = $self._numericallyIndexable();
  10193. for(var i=0; i < nself.length; i++) {
  10194. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10195. };
  10196. return aBlock._value();
  10197. ;
  10198. return self;
  10199. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  10200. },
  10201. args: ["anObject", "aBlock"],
  10202. 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'>",
  10203. referencedClasses: [],
  10204. messageSends: []
  10205. }),
  10206. $globals.SequenceableCollection);
  10207. $core.addMethod(
  10208. $core.method({
  10209. selector: "indexOf:startingAt:",
  10210. protocol: "accessing",
  10211. fn: function (anObject,start){
  10212. var self=this,$self=this;
  10213. return $core.withContext(function($ctx1) {
  10214. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10215. return (0);
  10216. }));
  10217. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10218. },
  10219. args: ["anObject", "start"],
  10220. 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 ]",
  10221. referencedClasses: [],
  10222. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10223. }),
  10224. $globals.SequenceableCollection);
  10225. $core.addMethod(
  10226. $core.method({
  10227. selector: "indexOf:startingAt:ifAbsent:",
  10228. protocol: "accessing",
  10229. fn: function (anObject,start,aBlock){
  10230. var self=this,$self=this;
  10231. return $core.withContext(function($ctx1) {
  10232. var nself = $self._numericallyIndexable();
  10233. for(var i=start - 1; i < nself.length; i++){
  10234. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10235. }
  10236. return aBlock._value();
  10237. ;
  10238. return self;
  10239. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10240. },
  10241. args: ["anObject", "start", "aBlock"],
  10242. 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'>",
  10243. referencedClasses: [],
  10244. messageSends: []
  10245. }),
  10246. $globals.SequenceableCollection);
  10247. $core.addMethod(
  10248. $core.method({
  10249. selector: "last",
  10250. protocol: "accessing",
  10251. fn: function (){
  10252. var self=this,$self=this;
  10253. return $core.withContext(function($ctx1) {
  10254. return $self._at_($self._size());
  10255. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10256. },
  10257. args: [],
  10258. source: "last\x0a\x09^ self at: self size",
  10259. referencedClasses: [],
  10260. messageSends: ["at:", "size"]
  10261. }),
  10262. $globals.SequenceableCollection);
  10263. $core.addMethod(
  10264. $core.method({
  10265. selector: "last:",
  10266. protocol: "accessing",
  10267. fn: function (aNumber){
  10268. var self=this,$self=this;
  10269. return $core.withContext(function($ctx1) {
  10270. var $2,$1,$5,$4,$3;
  10271. $2=$self._size();
  10272. $ctx1.sendIdx["size"]=1;
  10273. $1=$recv($2).__lt(aNumber);
  10274. if($core.assert($1)){
  10275. $self._error_("Invalid number of elements");
  10276. }
  10277. $5=$self._size();
  10278. $ctx1.sendIdx["size"]=2;
  10279. $4=$recv($5).__minus(aNumber);
  10280. $3=$recv($4).__plus((1));
  10281. return $self._copyFrom_to_($3,$self._size());
  10282. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10283. },
  10284. args: ["aNumber"],
  10285. 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",
  10286. referencedClasses: [],
  10287. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10288. }),
  10289. $globals.SequenceableCollection);
  10290. $core.addMethod(
  10291. $core.method({
  10292. selector: "newStream",
  10293. protocol: "streaming",
  10294. fn: function (){
  10295. var self=this,$self=this;
  10296. return $core.withContext(function($ctx1) {
  10297. return $recv($self._streamClass())._on_(self);
  10298. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10299. },
  10300. args: [],
  10301. source: "newStream\x0a\x09^ self streamClass on: self",
  10302. referencedClasses: [],
  10303. messageSends: ["on:", "streamClass"]
  10304. }),
  10305. $globals.SequenceableCollection);
  10306. $core.addMethod(
  10307. $core.method({
  10308. selector: "numericallyIndexable",
  10309. protocol: "private",
  10310. fn: function (){
  10311. var self=this,$self=this;
  10312. return $core.withContext(function($ctx1) {
  10313. $self._subclassResponsibility();
  10314. return self;
  10315. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  10316. },
  10317. args: [],
  10318. 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",
  10319. referencedClasses: [],
  10320. messageSends: ["subclassResponsibility"]
  10321. }),
  10322. $globals.SequenceableCollection);
  10323. $core.addMethod(
  10324. $core.method({
  10325. selector: "readStream",
  10326. protocol: "streaming",
  10327. fn: function (){
  10328. var self=this,$self=this;
  10329. return $core.withContext(function($ctx1) {
  10330. return $self._stream();
  10331. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10332. },
  10333. args: [],
  10334. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10335. referencedClasses: [],
  10336. messageSends: ["stream"]
  10337. }),
  10338. $globals.SequenceableCollection);
  10339. $core.addMethod(
  10340. $core.method({
  10341. selector: "removeLast",
  10342. protocol: "adding/removing",
  10343. fn: function (){
  10344. var self=this,$self=this;
  10345. return $core.withContext(function($ctx1) {
  10346. return $self._remove_($self._last());
  10347. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10348. },
  10349. args: [],
  10350. source: "removeLast\x0a\x09^ self remove: self last",
  10351. referencedClasses: [],
  10352. messageSends: ["remove:", "last"]
  10353. }),
  10354. $globals.SequenceableCollection);
  10355. $core.addMethod(
  10356. $core.method({
  10357. selector: "reverseDo:",
  10358. protocol: "enumerating",
  10359. fn: function (aBlock){
  10360. var self=this,$self=this;
  10361. return $core.withContext(function($ctx1) {
  10362. $recv($self._reversed())._do_(aBlock);
  10363. return self;
  10364. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10365. },
  10366. args: ["aBlock"],
  10367. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10368. referencedClasses: [],
  10369. messageSends: ["do:", "reversed"]
  10370. }),
  10371. $globals.SequenceableCollection);
  10372. $core.addMethod(
  10373. $core.method({
  10374. selector: "reversed",
  10375. protocol: "converting",
  10376. fn: function (){
  10377. var self=this,$self=this;
  10378. return $core.withContext(function($ctx1) {
  10379. $self._subclassResponsibility();
  10380. return self;
  10381. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10382. },
  10383. args: [],
  10384. source: "reversed\x0a\x09self subclassResponsibility",
  10385. referencedClasses: [],
  10386. messageSends: ["subclassResponsibility"]
  10387. }),
  10388. $globals.SequenceableCollection);
  10389. $core.addMethod(
  10390. $core.method({
  10391. selector: "second",
  10392. protocol: "accessing",
  10393. fn: function (){
  10394. var self=this,$self=this;
  10395. return $core.withContext(function($ctx1) {
  10396. return $self._at_((2));
  10397. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10398. },
  10399. args: [],
  10400. source: "second\x0a\x09^ self at: 2",
  10401. referencedClasses: [],
  10402. messageSends: ["at:"]
  10403. }),
  10404. $globals.SequenceableCollection);
  10405. $core.addMethod(
  10406. $core.method({
  10407. selector: "single",
  10408. protocol: "accessing",
  10409. fn: function (){
  10410. var self=this,$self=this;
  10411. return $core.withContext(function($ctx1) {
  10412. if (self.length == 0) throw new Error("Collection is empty");
  10413. if (self.length > 1) throw new Error("Collection holds more than one element.");
  10414. return $self._numericallyIndexable()[0];;
  10415. return self;
  10416. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  10417. },
  10418. args: [],
  10419. 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'>",
  10420. referencedClasses: [],
  10421. messageSends: []
  10422. }),
  10423. $globals.SequenceableCollection);
  10424. $core.addMethod(
  10425. $core.method({
  10426. selector: "stream",
  10427. protocol: "streaming",
  10428. fn: function (){
  10429. var self=this,$self=this;
  10430. return $core.withContext(function($ctx1) {
  10431. return $self._newStream();
  10432. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10433. },
  10434. args: [],
  10435. source: "stream\x0a\x09^ self newStream",
  10436. referencedClasses: [],
  10437. messageSends: ["newStream"]
  10438. }),
  10439. $globals.SequenceableCollection);
  10440. $core.addMethod(
  10441. $core.method({
  10442. selector: "streamClass",
  10443. protocol: "streaming",
  10444. fn: function (){
  10445. var self=this,$self=this;
  10446. return $core.withContext(function($ctx1) {
  10447. return $recv($self._class())._streamClass();
  10448. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10449. },
  10450. args: [],
  10451. source: "streamClass\x0a\x09^ self class streamClass",
  10452. referencedClasses: [],
  10453. messageSends: ["streamClass", "class"]
  10454. }),
  10455. $globals.SequenceableCollection);
  10456. $core.addMethod(
  10457. $core.method({
  10458. selector: "third",
  10459. protocol: "accessing",
  10460. fn: function (){
  10461. var self=this,$self=this;
  10462. return $core.withContext(function($ctx1) {
  10463. return $self._at_((3));
  10464. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10465. },
  10466. args: [],
  10467. source: "third\x0a\x09^ self at: 3",
  10468. referencedClasses: [],
  10469. messageSends: ["at:"]
  10470. }),
  10471. $globals.SequenceableCollection);
  10472. $core.addMethod(
  10473. $core.method({
  10474. selector: "with:do:",
  10475. protocol: "enumerating",
  10476. fn: function (anotherCollection,aBlock){
  10477. var self=this,$self=this;
  10478. return $core.withContext(function($ctx1) {
  10479. var nself = $self._numericallyIndexable();
  10480. anotherCollection = anotherCollection._numericallyIndexable();
  10481. for(var i=0; i<nself.length; i++) {
  10482. aBlock._value_value_(nself[i], anotherCollection[i]);
  10483. }
  10484. ;
  10485. return self;
  10486. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  10487. },
  10488. args: ["anotherCollection", "aBlock"],
  10489. 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'>",
  10490. referencedClasses: [],
  10491. messageSends: []
  10492. }),
  10493. $globals.SequenceableCollection);
  10494. $core.addMethod(
  10495. $core.method({
  10496. selector: "withIndexDo:",
  10497. protocol: "enumerating",
  10498. fn: function (aBlock){
  10499. var self=this,$self=this;
  10500. return $core.withContext(function($ctx1) {
  10501. var nself = $self._numericallyIndexable();
  10502. for(var i=0; i < nself.length; i++) {
  10503. aBlock._value_value_(nself[i], i+1);
  10504. }
  10505. ;
  10506. return self;
  10507. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10508. },
  10509. args: ["aBlock"],
  10510. 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'>",
  10511. referencedClasses: [],
  10512. messageSends: []
  10513. }),
  10514. $globals.SequenceableCollection);
  10515. $core.addMethod(
  10516. $core.method({
  10517. selector: "writeStream",
  10518. protocol: "streaming",
  10519. fn: function (){
  10520. var self=this,$self=this;
  10521. return $core.withContext(function($ctx1) {
  10522. return $self._stream();
  10523. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10524. },
  10525. args: [],
  10526. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10527. referencedClasses: [],
  10528. messageSends: ["stream"]
  10529. }),
  10530. $globals.SequenceableCollection);
  10531. $core.addMethod(
  10532. $core.method({
  10533. selector: "streamClass",
  10534. protocol: "accessing",
  10535. fn: function (){
  10536. var self=this,$self=this;
  10537. return $globals.Stream;
  10538. },
  10539. args: [],
  10540. source: "streamClass\x0a\x09\x09^ Stream",
  10541. referencedClasses: ["Stream"],
  10542. messageSends: []
  10543. }),
  10544. $globals.SequenceableCollection.a$cls);
  10545. $core.addMethod(
  10546. $core.method({
  10547. selector: "streamContents:",
  10548. protocol: "streaming",
  10549. fn: function (aBlock){
  10550. var self=this,$self=this;
  10551. var stream;
  10552. return $core.withContext(function($ctx1) {
  10553. stream=$recv($self._streamClass())._on_($self._new());
  10554. $recv(aBlock)._value_(stream);
  10555. return $recv(stream)._contents();
  10556. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10557. },
  10558. args: ["aBlock"],
  10559. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10560. referencedClasses: [],
  10561. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10562. }),
  10563. $globals.SequenceableCollection.a$cls);
  10564. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10565. $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`.";
  10566. $core.addMethod(
  10567. $core.method({
  10568. selector: "add:",
  10569. protocol: "adding/removing",
  10570. fn: function (anObject){
  10571. var self=this,$self=this;
  10572. return $core.withContext(function($ctx1) {
  10573. self.push(anObject); return anObject;;
  10574. return self;
  10575. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10576. },
  10577. args: ["anObject"],
  10578. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10579. referencedClasses: [],
  10580. messageSends: []
  10581. }),
  10582. $globals.Array);
  10583. $core.addMethod(
  10584. $core.method({
  10585. selector: "addAll:",
  10586. protocol: "adding/removing",
  10587. fn: function (aCollection){
  10588. var self=this,$self=this;
  10589. return $core.withContext(function($ctx1) {
  10590. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10591. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10592. return aCollection;;
  10593. return self;
  10594. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10595. },
  10596. args: ["aCollection"],
  10597. 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'>",
  10598. referencedClasses: [],
  10599. messageSends: []
  10600. }),
  10601. $globals.Array);
  10602. $core.addMethod(
  10603. $core.method({
  10604. selector: "addFirst:",
  10605. protocol: "adding/removing",
  10606. fn: function (anObject){
  10607. var self=this,$self=this;
  10608. return $core.withContext(function($ctx1) {
  10609. self.unshift(anObject); return anObject;;
  10610. return self;
  10611. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10612. },
  10613. args: ["anObject"],
  10614. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10615. referencedClasses: [],
  10616. messageSends: []
  10617. }),
  10618. $globals.Array);
  10619. $core.addMethod(
  10620. $core.method({
  10621. selector: "asJavaScriptSource",
  10622. protocol: "converting",
  10623. fn: function (){
  10624. var self=this,$self=this;
  10625. return $core.withContext(function($ctx1) {
  10626. var $1;
  10627. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10628. return $core.withContext(function($ctx2) {
  10629. return $recv(each)._asJavaScriptSource();
  10630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10631. })))._join_(", "))).__comma("]");
  10632. $ctx1.sendIdx[","]=1;
  10633. return $1;
  10634. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10635. },
  10636. args: [],
  10637. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10638. referencedClasses: [],
  10639. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10640. }),
  10641. $globals.Array);
  10642. $core.addMethod(
  10643. $core.method({
  10644. selector: "at:ifAbsent:",
  10645. protocol: "accessing",
  10646. fn: function (anIndex,aBlock){
  10647. var self=this,$self=this;
  10648. return $core.withContext(function($ctx1) {
  10649. return anIndex >= 1 && anIndex <= self.length
  10650. ? self[anIndex - 1]
  10651. : aBlock._value()
  10652. ;
  10653. return self;
  10654. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  10655. },
  10656. args: ["anIndex", "aBlock"],
  10657. 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'>",
  10658. referencedClasses: [],
  10659. messageSends: []
  10660. }),
  10661. $globals.Array);
  10662. $core.addMethod(
  10663. $core.method({
  10664. selector: "at:ifPresent:ifAbsent:",
  10665. protocol: "accessing",
  10666. fn: function (anIndex,aBlock,anotherBlock){
  10667. var self=this,$self=this;
  10668. return $core.withContext(function($ctx1) {
  10669. return anIndex >= 1 && anIndex <= self.length
  10670. ? aBlock._value_(self[anIndex - 1])
  10671. : anotherBlock._value()
  10672. ;
  10673. return self;
  10674. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  10675. },
  10676. args: ["anIndex", "aBlock", "anotherBlock"],
  10677. 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'>",
  10678. referencedClasses: [],
  10679. messageSends: []
  10680. }),
  10681. $globals.Array);
  10682. $core.addMethod(
  10683. $core.method({
  10684. selector: "at:put:",
  10685. protocol: "accessing",
  10686. fn: function (anIndex,anObject){
  10687. var self=this,$self=this;
  10688. return $core.withContext(function($ctx1) {
  10689. return self[anIndex - 1] = anObject;
  10690. return self;
  10691. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10692. },
  10693. args: ["anIndex", "anObject"],
  10694. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10695. referencedClasses: [],
  10696. messageSends: []
  10697. }),
  10698. $globals.Array);
  10699. $core.addMethod(
  10700. $core.method({
  10701. selector: "collect:",
  10702. protocol: "enumerating",
  10703. fn: function (aBlock){
  10704. var self=this,$self=this;
  10705. return $core.withContext(function($ctx1) {
  10706. return self.map(function(each) {return aBlock._value_(each)});
  10707. return self;
  10708. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10709. },
  10710. args: ["aBlock"],
  10711. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10712. referencedClasses: [],
  10713. messageSends: []
  10714. }),
  10715. $globals.Array);
  10716. $core.addMethod(
  10717. $core.method({
  10718. selector: "copyFrom:to:",
  10719. protocol: "copying",
  10720. fn: function (anIndex,anotherIndex){
  10721. var self=this,$self=this;
  10722. return $core.withContext(function($ctx1) {
  10723. if (anIndex >= 1 && anotherIndex <= self.length) {
  10724. return self.slice(anIndex - 1, anotherIndex);
  10725. } else {
  10726. self._at_(anIndex);
  10727. self._at_(self.length + 1);
  10728. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10729. };
  10730. return self;
  10731. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10732. },
  10733. args: ["anIndex", "anotherIndex"],
  10734. 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'>",
  10735. referencedClasses: [],
  10736. messageSends: []
  10737. }),
  10738. $globals.Array);
  10739. $core.addMethod(
  10740. $core.method({
  10741. selector: "join:",
  10742. protocol: "enumerating",
  10743. fn: function (aString){
  10744. var self=this,$self=this;
  10745. return $core.withContext(function($ctx1) {
  10746. return self.join(aString);
  10747. return self;
  10748. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10749. },
  10750. args: ["aString"],
  10751. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10752. referencedClasses: [],
  10753. messageSends: []
  10754. }),
  10755. $globals.Array);
  10756. $core.addMethod(
  10757. $core.method({
  10758. selector: "numericallyIndexable",
  10759. protocol: "private",
  10760. fn: function (){
  10761. var self=this,$self=this;
  10762. return self;
  10763. },
  10764. args: [],
  10765. source: "numericallyIndexable\x0a\x09^ self",
  10766. referencedClasses: [],
  10767. messageSends: []
  10768. }),
  10769. $globals.Array);
  10770. $core.addMethod(
  10771. $core.method({
  10772. selector: "printOn:",
  10773. protocol: "printing",
  10774. fn: function (aStream){
  10775. var self=this,$self=this;
  10776. return $core.withContext(function($ctx1) {
  10777. (
  10778. $ctx1.supercall = true,
  10779. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10780. $ctx1.supercall = false;
  10781. $ctx1.sendIdx["printOn:"]=1;
  10782. $recv(aStream)._nextPutAll_(" (");
  10783. $ctx1.sendIdx["nextPutAll:"]=1;
  10784. $self._do_separatedBy_((function(each){
  10785. return $core.withContext(function($ctx2) {
  10786. return $recv(each)._printOn_(aStream);
  10787. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10788. }),(function(){
  10789. return $core.withContext(function($ctx2) {
  10790. return $recv(aStream)._nextPutAll_(" ");
  10791. $ctx2.sendIdx["nextPutAll:"]=2;
  10792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10793. }));
  10794. $recv(aStream)._nextPutAll_(")");
  10795. return self;
  10796. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10797. },
  10798. args: ["aStream"],
  10799. 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: ')'",
  10800. referencedClasses: [],
  10801. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10802. }),
  10803. $globals.Array);
  10804. $core.addMethod(
  10805. $core.method({
  10806. selector: "remove:ifAbsent:",
  10807. protocol: "adding/removing",
  10808. fn: function (anObject,aBlock){
  10809. var self=this,$self=this;
  10810. var index;
  10811. return $core.withContext(function($ctx1) {
  10812. var $1;
  10813. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10814. return (0);
  10815. }));
  10816. $1=$recv(index).__eq((0));
  10817. if($core.assert($1)){
  10818. return $recv(aBlock)._value();
  10819. } else {
  10820. $self._removeIndex_(index);
  10821. return anObject;
  10822. }
  10823. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10824. },
  10825. args: ["anObject", "aBlock"],
  10826. 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 ]",
  10827. referencedClasses: [],
  10828. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10829. }),
  10830. $globals.Array);
  10831. $core.addMethod(
  10832. $core.method({
  10833. selector: "removeAll",
  10834. protocol: "adding/removing",
  10835. fn: function (){
  10836. var self=this,$self=this;
  10837. return $core.withContext(function($ctx1) {
  10838. self.length = 0;
  10839. return self;
  10840. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10841. },
  10842. args: [],
  10843. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10844. referencedClasses: [],
  10845. messageSends: []
  10846. }),
  10847. $globals.Array);
  10848. $core.addMethod(
  10849. $core.method({
  10850. selector: "removeFrom:to:",
  10851. protocol: "adding/removing",
  10852. fn: function (aNumber,anotherNumber){
  10853. var self=this,$self=this;
  10854. return $core.withContext(function($ctx1) {
  10855. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10856. return self;
  10857. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10858. },
  10859. args: ["aNumber", "anotherNumber"],
  10860. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10861. referencedClasses: [],
  10862. messageSends: []
  10863. }),
  10864. $globals.Array);
  10865. $core.addMethod(
  10866. $core.method({
  10867. selector: "removeIndex:",
  10868. protocol: "adding/removing",
  10869. fn: function (anInteger){
  10870. var self=this,$self=this;
  10871. return $core.withContext(function($ctx1) {
  10872. self.splice(anInteger - 1, 1);
  10873. return self;
  10874. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10875. },
  10876. args: ["anInteger"],
  10877. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10878. referencedClasses: [],
  10879. messageSends: []
  10880. }),
  10881. $globals.Array);
  10882. $core.addMethod(
  10883. $core.method({
  10884. selector: "removeLast",
  10885. protocol: "adding/removing",
  10886. fn: function (){
  10887. var self=this,$self=this;
  10888. return $core.withContext(function($ctx1) {
  10889. return self.pop();;
  10890. return self;
  10891. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10892. },
  10893. args: [],
  10894. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10895. referencedClasses: [],
  10896. messageSends: []
  10897. }),
  10898. $globals.Array);
  10899. $core.addMethod(
  10900. $core.method({
  10901. selector: "reversed",
  10902. protocol: "converting",
  10903. fn: function (){
  10904. var self=this,$self=this;
  10905. return $core.withContext(function($ctx1) {
  10906. return self.slice().reverse();
  10907. return self;
  10908. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10909. },
  10910. args: [],
  10911. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10912. referencedClasses: [],
  10913. messageSends: []
  10914. }),
  10915. $globals.Array);
  10916. $core.addMethod(
  10917. $core.method({
  10918. selector: "select:",
  10919. protocol: "enumerating",
  10920. fn: function (aBlock){
  10921. var self=this,$self=this;
  10922. return $core.withContext(function($ctx1) {
  10923. return self.filter(function(each) {return aBlock._value_(each)});
  10924. return self;
  10925. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10926. },
  10927. args: ["aBlock"],
  10928. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10929. referencedClasses: [],
  10930. messageSends: []
  10931. }),
  10932. $globals.Array);
  10933. $core.addMethod(
  10934. $core.method({
  10935. selector: "shallowCopy",
  10936. protocol: "copying",
  10937. fn: function (){
  10938. var self=this,$self=this;
  10939. return $core.withContext(function($ctx1) {
  10940. return self.slice();
  10941. return self;
  10942. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10943. },
  10944. args: [],
  10945. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10946. referencedClasses: [],
  10947. messageSends: []
  10948. }),
  10949. $globals.Array);
  10950. $core.addMethod(
  10951. $core.method({
  10952. selector: "size",
  10953. protocol: "accessing",
  10954. fn: function (){
  10955. var self=this,$self=this;
  10956. return $core.withContext(function($ctx1) {
  10957. return self.length;
  10958. return self;
  10959. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  10960. },
  10961. args: [],
  10962. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  10963. referencedClasses: [],
  10964. messageSends: []
  10965. }),
  10966. $globals.Array);
  10967. $core.addMethod(
  10968. $core.method({
  10969. selector: "sort",
  10970. protocol: "enumerating",
  10971. fn: function (){
  10972. var self=this,$self=this;
  10973. return $core.withContext(function($ctx1) {
  10974. return $self._sort_((function(a,b){
  10975. return $core.withContext(function($ctx2) {
  10976. return $recv(a).__lt(b);
  10977. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10978. }));
  10979. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10980. },
  10981. args: [],
  10982. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10983. referencedClasses: [],
  10984. messageSends: ["sort:", "<"]
  10985. }),
  10986. $globals.Array);
  10987. $core.addMethod(
  10988. $core.method({
  10989. selector: "sort:",
  10990. protocol: "enumerating",
  10991. fn: function (aBlock){
  10992. var self=this,$self=this;
  10993. return $core.withContext(function($ctx1) {
  10994. return self.sort(function(a, b) {
  10995. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10996. })
  10997. ;
  10998. return self;
  10999. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  11000. },
  11001. args: ["aBlock"],
  11002. 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'>",
  11003. referencedClasses: [],
  11004. messageSends: []
  11005. }),
  11006. $globals.Array);
  11007. $core.addMethod(
  11008. $core.method({
  11009. selector: "sorted",
  11010. protocol: "enumerating",
  11011. fn: function (){
  11012. var self=this,$self=this;
  11013. return $core.withContext(function($ctx1) {
  11014. return $recv($self._copy())._sort();
  11015. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  11016. },
  11017. args: [],
  11018. source: "sorted\x0a\x09^ self copy sort",
  11019. referencedClasses: [],
  11020. messageSends: ["sort", "copy"]
  11021. }),
  11022. $globals.Array);
  11023. $core.addMethod(
  11024. $core.method({
  11025. selector: "sorted:",
  11026. protocol: "enumerating",
  11027. fn: function (aBlock){
  11028. var self=this,$self=this;
  11029. return $core.withContext(function($ctx1) {
  11030. return $recv($self._copy())._sort_(aBlock);
  11031. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  11032. },
  11033. args: ["aBlock"],
  11034. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  11035. referencedClasses: [],
  11036. messageSends: ["sort:", "copy"]
  11037. }),
  11038. $globals.Array);
  11039. $core.addMethod(
  11040. $core.method({
  11041. selector: "new:",
  11042. protocol: "instance creation",
  11043. fn: function (anInteger){
  11044. var self=this,$self=this;
  11045. return $core.withContext(function($ctx1) {
  11046. return new Array(anInteger);
  11047. return self;
  11048. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  11049. },
  11050. args: ["anInteger"],
  11051. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  11052. referencedClasses: [],
  11053. messageSends: []
  11054. }),
  11055. $globals.Array.a$cls);
  11056. $core.addMethod(
  11057. $core.method({
  11058. selector: "with:",
  11059. protocol: "instance creation",
  11060. fn: function (anObject){
  11061. var self=this,$self=this;
  11062. return $core.withContext(function($ctx1) {
  11063. var $1;
  11064. $1=$self._new_((1));
  11065. $recv($1)._at_put_((1),anObject);
  11066. return $recv($1)._yourself();
  11067. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  11068. },
  11069. args: ["anObject"],
  11070. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  11071. referencedClasses: [],
  11072. messageSends: ["at:put:", "new:", "yourself"]
  11073. }),
  11074. $globals.Array.a$cls);
  11075. $core.addMethod(
  11076. $core.method({
  11077. selector: "with:with:",
  11078. protocol: "instance creation",
  11079. fn: function (anObject,anObject2){
  11080. var self=this,$self=this;
  11081. return $core.withContext(function($ctx1) {
  11082. var $1;
  11083. $1=$self._new_((2));
  11084. $recv($1)._at_put_((1),anObject);
  11085. $ctx1.sendIdx["at:put:"]=1;
  11086. $recv($1)._at_put_((2),anObject2);
  11087. return $recv($1)._yourself();
  11088. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  11089. },
  11090. args: ["anObject", "anObject2"],
  11091. 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",
  11092. referencedClasses: [],
  11093. messageSends: ["at:put:", "new:", "yourself"]
  11094. }),
  11095. $globals.Array.a$cls);
  11096. $core.addMethod(
  11097. $core.method({
  11098. selector: "with:with:with:",
  11099. protocol: "instance creation",
  11100. fn: function (anObject,anObject2,anObject3){
  11101. var self=this,$self=this;
  11102. return $core.withContext(function($ctx1) {
  11103. var $1;
  11104. $1=$self._new_((3));
  11105. $recv($1)._at_put_((1),anObject);
  11106. $ctx1.sendIdx["at:put:"]=1;
  11107. $recv($1)._at_put_((2),anObject2);
  11108. $ctx1.sendIdx["at:put:"]=2;
  11109. $recv($1)._at_put_((3),anObject3);
  11110. return $recv($1)._yourself();
  11111. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  11112. },
  11113. args: ["anObject", "anObject2", "anObject3"],
  11114. 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",
  11115. referencedClasses: [],
  11116. messageSends: ["at:put:", "new:", "yourself"]
  11117. }),
  11118. $globals.Array.a$cls);
  11119. $core.addMethod(
  11120. $core.method({
  11121. selector: "withAll:",
  11122. protocol: "instance creation",
  11123. fn: function (aCollection){
  11124. var self=this,$self=this;
  11125. var instance,index;
  11126. return $core.withContext(function($ctx1) {
  11127. index=(1);
  11128. instance=$self._new_($recv(aCollection)._size());
  11129. $recv(aCollection)._do_((function(each){
  11130. return $core.withContext(function($ctx2) {
  11131. $recv(instance)._at_put_(index,each);
  11132. index=$recv(index).__plus((1));
  11133. return index;
  11134. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11135. }));
  11136. return instance;
  11137. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  11138. },
  11139. args: ["aCollection"],
  11140. 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",
  11141. referencedClasses: [],
  11142. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  11143. }),
  11144. $globals.Array.a$cls);
  11145. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  11146. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  11147. $core.addMethod(
  11148. $core.method({
  11149. selector: ",",
  11150. protocol: "copying",
  11151. fn: function (aString){
  11152. var self=this,$self=this;
  11153. return $core.withContext(function($ctx1) {
  11154. var $1;
  11155. $1=$self._asString();
  11156. $ctx1.sendIdx["asString"]=1;
  11157. return $recv($1).__comma($recv(aString)._asString());
  11158. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  11159. },
  11160. args: ["aString"],
  11161. source: ", aString\x0a\x09^ self asString, aString asString",
  11162. referencedClasses: [],
  11163. messageSends: [",", "asString"]
  11164. }),
  11165. $globals.CharacterArray);
  11166. $core.addMethod(
  11167. $core.method({
  11168. selector: "add:",
  11169. protocol: "adding/removing",
  11170. fn: function (anObject){
  11171. var self=this,$self=this;
  11172. return $core.withContext(function($ctx1) {
  11173. $self._errorReadOnly();
  11174. return self;
  11175. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  11176. },
  11177. args: ["anObject"],
  11178. source: "add: anObject\x0a\x09self errorReadOnly",
  11179. referencedClasses: [],
  11180. messageSends: ["errorReadOnly"]
  11181. }),
  11182. $globals.CharacterArray);
  11183. $core.addMethod(
  11184. $core.method({
  11185. selector: "asLowercase",
  11186. protocol: "converting",
  11187. fn: function (){
  11188. var self=this,$self=this;
  11189. return $core.withContext(function($ctx1) {
  11190. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  11191. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  11192. },
  11193. args: [],
  11194. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  11195. referencedClasses: [],
  11196. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  11197. }),
  11198. $globals.CharacterArray);
  11199. $core.addMethod(
  11200. $core.method({
  11201. selector: "asNumber",
  11202. protocol: "converting",
  11203. fn: function (){
  11204. var self=this,$self=this;
  11205. return $core.withContext(function($ctx1) {
  11206. return $recv($self._asString())._asNumber();
  11207. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  11208. },
  11209. args: [],
  11210. source: "asNumber\x0a\x09^ self asString asNumber",
  11211. referencedClasses: [],
  11212. messageSends: ["asNumber", "asString"]
  11213. }),
  11214. $globals.CharacterArray);
  11215. $core.addMethod(
  11216. $core.method({
  11217. selector: "asString",
  11218. protocol: "converting",
  11219. fn: function (){
  11220. var self=this,$self=this;
  11221. return $core.withContext(function($ctx1) {
  11222. return $self._subclassResponsibility();
  11223. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  11224. },
  11225. args: [],
  11226. source: "asString\x0a\x09^ self subclassResponsibility",
  11227. referencedClasses: [],
  11228. messageSends: ["subclassResponsibility"]
  11229. }),
  11230. $globals.CharacterArray);
  11231. $core.addMethod(
  11232. $core.method({
  11233. selector: "asSymbol",
  11234. protocol: "converting",
  11235. fn: function (){
  11236. var self=this,$self=this;
  11237. return $core.withContext(function($ctx1) {
  11238. return $self._asString();
  11239. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  11240. },
  11241. args: [],
  11242. source: "asSymbol\x0a\x09^ self asString",
  11243. referencedClasses: [],
  11244. messageSends: ["asString"]
  11245. }),
  11246. $globals.CharacterArray);
  11247. $core.addMethod(
  11248. $core.method({
  11249. selector: "asSymbolPrintOn:",
  11250. protocol: "printing",
  11251. fn: function (aStream){
  11252. var self=this,$self=this;
  11253. return $core.withContext(function($ctx1) {
  11254. var $1;
  11255. $recv(aStream)._nextPutAll_("#");
  11256. $1=$recv($self._asString())._isSelector();
  11257. if($core.assert($1)){
  11258. $recv(aStream)._nextPut_(self);
  11259. } else {
  11260. $self._printOn_(aStream);
  11261. }
  11262. return self;
  11263. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  11264. },
  11265. args: ["aStream"],
  11266. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11267. referencedClasses: [],
  11268. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11269. }),
  11270. $globals.CharacterArray);
  11271. $core.addMethod(
  11272. $core.method({
  11273. selector: "asUppercase",
  11274. protocol: "converting",
  11275. fn: function (){
  11276. var self=this,$self=this;
  11277. return $core.withContext(function($ctx1) {
  11278. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  11279. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  11280. },
  11281. args: [],
  11282. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  11283. referencedClasses: [],
  11284. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  11285. }),
  11286. $globals.CharacterArray);
  11287. $core.addMethod(
  11288. $core.method({
  11289. selector: "at:put:",
  11290. protocol: "accessing",
  11291. fn: function (anIndex,anObject){
  11292. var self=this,$self=this;
  11293. return $core.withContext(function($ctx1) {
  11294. $self._errorReadOnly();
  11295. return self;
  11296. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  11297. },
  11298. args: ["anIndex", "anObject"],
  11299. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11300. referencedClasses: [],
  11301. messageSends: ["errorReadOnly"]
  11302. }),
  11303. $globals.CharacterArray);
  11304. $core.addMethod(
  11305. $core.method({
  11306. selector: "errorReadOnly",
  11307. protocol: "error handling",
  11308. fn: function (){
  11309. var self=this,$self=this;
  11310. return $core.withContext(function($ctx1) {
  11311. $self._error_("Object is read-only");
  11312. return self;
  11313. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  11314. },
  11315. args: [],
  11316. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11317. referencedClasses: [],
  11318. messageSends: ["error:"]
  11319. }),
  11320. $globals.CharacterArray);
  11321. $core.addMethod(
  11322. $core.method({
  11323. selector: "printOn:",
  11324. protocol: "printing",
  11325. fn: function (aStream){
  11326. var self=this,$self=this;
  11327. return $core.withContext(function($ctx1) {
  11328. $recv($self._asString())._printOn_(aStream);
  11329. return self;
  11330. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  11331. },
  11332. args: ["aStream"],
  11333. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  11334. referencedClasses: [],
  11335. messageSends: ["printOn:", "asString"]
  11336. }),
  11337. $globals.CharacterArray);
  11338. $core.addMethod(
  11339. $core.method({
  11340. selector: "putOn:",
  11341. protocol: "streaming",
  11342. fn: function (aStream){
  11343. var self=this,$self=this;
  11344. return $core.withContext(function($ctx1) {
  11345. $recv(aStream)._nextPutString_(self);
  11346. return self;
  11347. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  11348. },
  11349. args: ["aStream"],
  11350. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11351. referencedClasses: [],
  11352. messageSends: ["nextPutString:"]
  11353. }),
  11354. $globals.CharacterArray);
  11355. $core.addMethod(
  11356. $core.method({
  11357. selector: "remove:",
  11358. protocol: "adding/removing",
  11359. fn: function (anObject){
  11360. var self=this,$self=this;
  11361. return $core.withContext(function($ctx1) {
  11362. $self._errorReadOnly();
  11363. return self;
  11364. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  11365. },
  11366. args: ["anObject"],
  11367. source: "remove: anObject\x0a\x09self errorReadOnly",
  11368. referencedClasses: [],
  11369. messageSends: ["errorReadOnly"]
  11370. }),
  11371. $globals.CharacterArray);
  11372. $core.addMethod(
  11373. $core.method({
  11374. selector: "remove:ifAbsent:",
  11375. protocol: "adding/removing",
  11376. fn: function (anObject,aBlock){
  11377. var self=this,$self=this;
  11378. return $core.withContext(function($ctx1) {
  11379. $self._errorReadOnly();
  11380. return self;
  11381. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.CharacterArray)});
  11382. },
  11383. args: ["anObject", "aBlock"],
  11384. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11385. referencedClasses: [],
  11386. messageSends: ["errorReadOnly"]
  11387. }),
  11388. $globals.CharacterArray);
  11389. $core.addMethod(
  11390. $core.method({
  11391. selector: "symbolPrintString",
  11392. protocol: "printing",
  11393. fn: function (){
  11394. var self=this,$self=this;
  11395. return $core.withContext(function($ctx1) {
  11396. return $recv($globals.String)._streamContents_((function(str){
  11397. return $core.withContext(function($ctx2) {
  11398. return $self._asSymbolPrintOn_(str);
  11399. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11400. }));
  11401. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  11402. },
  11403. args: [],
  11404. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11405. referencedClasses: ["String"],
  11406. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11407. }),
  11408. $globals.CharacterArray);
  11409. $core.addMethod(
  11410. $core.method({
  11411. selector: "fromString:",
  11412. protocol: "instance creation",
  11413. fn: function (aString){
  11414. var self=this,$self=this;
  11415. return $core.withContext(function($ctx1) {
  11416. $self._subclassResponsibility();
  11417. return self;
  11418. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  11419. },
  11420. args: ["aString"],
  11421. source: "fromString: aString\x0a\x09self subclassResponsibility",
  11422. referencedClasses: [],
  11423. messageSends: ["subclassResponsibility"]
  11424. }),
  11425. $globals.CharacterArray.a$cls);
  11426. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  11427. $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 >> #,`";
  11428. $core.addMethod(
  11429. $core.method({
  11430. selector: ",",
  11431. protocol: "copying",
  11432. fn: function (aString){
  11433. var self=this,$self=this;
  11434. return $core.withContext(function($ctx1) {
  11435. return String(self) + aString;
  11436. return self;
  11437. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  11438. },
  11439. args: ["aString"],
  11440. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  11441. referencedClasses: [],
  11442. messageSends: []
  11443. }),
  11444. $globals.String);
  11445. $core.addMethod(
  11446. $core.method({
  11447. selector: "<",
  11448. protocol: "comparing",
  11449. fn: function (aString){
  11450. var self=this,$self=this;
  11451. return $core.withContext(function($ctx1) {
  11452. return String(self) < aString._asString();
  11453. return self;
  11454. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  11455. },
  11456. args: ["aString"],
  11457. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  11458. referencedClasses: [],
  11459. messageSends: []
  11460. }),
  11461. $globals.String);
  11462. $core.addMethod(
  11463. $core.method({
  11464. selector: "<=",
  11465. protocol: "comparing",
  11466. fn: function (aString){
  11467. var self=this,$self=this;
  11468. return $core.withContext(function($ctx1) {
  11469. return String(self) <= aString._asString();
  11470. return self;
  11471. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  11472. },
  11473. args: ["aString"],
  11474. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  11475. referencedClasses: [],
  11476. messageSends: []
  11477. }),
  11478. $globals.String);
  11479. $core.addMethod(
  11480. $core.method({
  11481. selector: "=",
  11482. protocol: "comparing",
  11483. fn: function (aString){
  11484. var self=this,$self=this;
  11485. return $core.withContext(function($ctx1) {
  11486. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  11487. return self;
  11488. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  11489. },
  11490. args: ["aString"],
  11491. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  11492. referencedClasses: [],
  11493. messageSends: []
  11494. }),
  11495. $globals.String);
  11496. $core.addMethod(
  11497. $core.method({
  11498. selector: "==",
  11499. protocol: "comparing",
  11500. fn: function (aString){
  11501. var self=this,$self=this;
  11502. return $core.withContext(function($ctx1) {
  11503. if (typeof aString === "string") return String(self) === aString;
  11504. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  11505. else return false;;
  11506. return self;
  11507. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  11508. },
  11509. args: ["aString"],
  11510. 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'>",
  11511. referencedClasses: [],
  11512. messageSends: []
  11513. }),
  11514. $globals.String);
  11515. $core.addMethod(
  11516. $core.method({
  11517. selector: ">",
  11518. protocol: "comparing",
  11519. fn: function (aString){
  11520. var self=this,$self=this;
  11521. return $core.withContext(function($ctx1) {
  11522. return String(self) > aString._asString();
  11523. return self;
  11524. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  11525. },
  11526. args: ["aString"],
  11527. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11528. referencedClasses: [],
  11529. messageSends: []
  11530. }),
  11531. $globals.String);
  11532. $core.addMethod(
  11533. $core.method({
  11534. selector: ">=",
  11535. protocol: "comparing",
  11536. fn: function (aString){
  11537. var self=this,$self=this;
  11538. return $core.withContext(function($ctx1) {
  11539. return String(self) >= aString._asString();
  11540. return self;
  11541. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  11542. },
  11543. args: ["aString"],
  11544. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11545. referencedClasses: [],
  11546. messageSends: []
  11547. }),
  11548. $globals.String);
  11549. $core.addMethod(
  11550. $core.method({
  11551. selector: "asJavaScriptMethodName",
  11552. protocol: "converting",
  11553. fn: function (){
  11554. var self=this,$self=this;
  11555. return $core.withContext(function($ctx1) {
  11556. return $core.st2js(self);
  11557. return self;
  11558. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  11559. },
  11560. args: [],
  11561. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11562. referencedClasses: [],
  11563. messageSends: []
  11564. }),
  11565. $globals.String);
  11566. $core.addMethod(
  11567. $core.method({
  11568. selector: "asJavaScriptObject",
  11569. protocol: "converting",
  11570. fn: function (){
  11571. var self=this,$self=this;
  11572. return self;
  11573. },
  11574. args: [],
  11575. source: "asJavaScriptObject\x0a\x09^ self",
  11576. referencedClasses: [],
  11577. messageSends: []
  11578. }),
  11579. $globals.String);
  11580. $core.addMethod(
  11581. $core.method({
  11582. selector: "asJavaScriptSource",
  11583. protocol: "converting",
  11584. fn: function (){
  11585. var self=this,$self=this;
  11586. return $core.withContext(function($ctx1) {
  11587. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11588. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11589. else
  11590. return "\"" + self + "\"";
  11591. ;
  11592. return self;
  11593. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  11594. },
  11595. args: [],
  11596. 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'>",
  11597. referencedClasses: [],
  11598. messageSends: []
  11599. }),
  11600. $globals.String);
  11601. $core.addMethod(
  11602. $core.method({
  11603. selector: "asLowercase",
  11604. protocol: "converting",
  11605. fn: function (){
  11606. var self=this,$self=this;
  11607. return $core.withContext(function($ctx1) {
  11608. return self.toLowerCase();
  11609. return self;
  11610. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  11611. },
  11612. args: [],
  11613. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11614. referencedClasses: [],
  11615. messageSends: []
  11616. }),
  11617. $globals.String);
  11618. $core.addMethod(
  11619. $core.method({
  11620. selector: "asMutator",
  11621. protocol: "converting",
  11622. fn: function (){
  11623. var self=this,$self=this;
  11624. return $core.withContext(function($ctx1) {
  11625. var $1;
  11626. $1=$recv($self._last()).__eq(":");
  11627. if(!$core.assert($1)){
  11628. return $self.__comma(":");
  11629. }
  11630. return self;
  11631. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11632. },
  11633. args: [],
  11634. 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",
  11635. referencedClasses: [],
  11636. messageSends: ["ifFalse:", "=", "last", ","]
  11637. }),
  11638. $globals.String);
  11639. $core.addMethod(
  11640. $core.method({
  11641. selector: "asNumber",
  11642. protocol: "converting",
  11643. fn: function (){
  11644. var self=this,$self=this;
  11645. return $core.withContext(function($ctx1) {
  11646. return Number(self);
  11647. return self;
  11648. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11649. },
  11650. args: [],
  11651. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11652. referencedClasses: [],
  11653. messageSends: []
  11654. }),
  11655. $globals.String);
  11656. $core.addMethod(
  11657. $core.method({
  11658. selector: "asRegexp",
  11659. protocol: "converting",
  11660. fn: function (){
  11661. var self=this,$self=this;
  11662. return $core.withContext(function($ctx1) {
  11663. return $recv($globals.RegularExpression)._fromString_(self);
  11664. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11665. },
  11666. args: [],
  11667. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11668. referencedClasses: ["RegularExpression"],
  11669. messageSends: ["fromString:"]
  11670. }),
  11671. $globals.String);
  11672. $core.addMethod(
  11673. $core.method({
  11674. selector: "asString",
  11675. protocol: "converting",
  11676. fn: function (){
  11677. var self=this,$self=this;
  11678. return self;
  11679. },
  11680. args: [],
  11681. source: "asString\x0a\x09^ self",
  11682. referencedClasses: [],
  11683. messageSends: []
  11684. }),
  11685. $globals.String);
  11686. $core.addMethod(
  11687. $core.method({
  11688. selector: "asSymbol",
  11689. protocol: "converting",
  11690. fn: function (){
  11691. var self=this,$self=this;
  11692. return self;
  11693. },
  11694. args: [],
  11695. source: "asSymbol\x0a\x09^ self",
  11696. referencedClasses: [],
  11697. messageSends: []
  11698. }),
  11699. $globals.String);
  11700. $core.addMethod(
  11701. $core.method({
  11702. selector: "asUppercase",
  11703. protocol: "converting",
  11704. fn: function (){
  11705. var self=this,$self=this;
  11706. return $core.withContext(function($ctx1) {
  11707. return self.toUpperCase();
  11708. return self;
  11709. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11710. },
  11711. args: [],
  11712. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11713. referencedClasses: [],
  11714. messageSends: []
  11715. }),
  11716. $globals.String);
  11717. $core.addMethod(
  11718. $core.method({
  11719. selector: "asciiValue",
  11720. protocol: "accessing",
  11721. fn: function (){
  11722. var self=this,$self=this;
  11723. return $core.withContext(function($ctx1) {
  11724. return self.charCodeAt(0);;
  11725. return self;
  11726. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11727. },
  11728. args: [],
  11729. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11730. referencedClasses: [],
  11731. messageSends: []
  11732. }),
  11733. $globals.String);
  11734. $core.addMethod(
  11735. $core.method({
  11736. selector: "at:ifAbsent:",
  11737. protocol: "accessing",
  11738. fn: function (anIndex,aBlock){
  11739. var self=this,$self=this;
  11740. return $core.withContext(function($ctx1) {
  11741. return String(self)[anIndex - 1] || aBlock._value();
  11742. return self;
  11743. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11744. },
  11745. args: ["anIndex", "aBlock"],
  11746. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11747. referencedClasses: [],
  11748. messageSends: []
  11749. }),
  11750. $globals.String);
  11751. $core.addMethod(
  11752. $core.method({
  11753. selector: "at:ifPresent:ifAbsent:",
  11754. protocol: "accessing",
  11755. fn: function (anIndex,aBlock,anotherBlock){
  11756. var self=this,$self=this;
  11757. return $core.withContext(function($ctx1) {
  11758. var result = String(self)[anIndex - 1];
  11759. return result ? aBlock._value_(result) : anotherBlock._value();
  11760. ;
  11761. return self;
  11762. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11763. },
  11764. args: ["anIndex", "aBlock", "anotherBlock"],
  11765. 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'>",
  11766. referencedClasses: [],
  11767. messageSends: []
  11768. }),
  11769. $globals.String);
  11770. $core.addMethod(
  11771. $core.method({
  11772. selector: "capitalized",
  11773. protocol: "converting",
  11774. fn: function (){
  11775. var self=this,$self=this;
  11776. return $core.withContext(function($ctx1) {
  11777. return $self._ifNotEmpty_((function(){
  11778. return $core.withContext(function($ctx2) {
  11779. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11781. }));
  11782. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11783. },
  11784. args: [],
  11785. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11786. referencedClasses: [],
  11787. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11788. }),
  11789. $globals.String);
  11790. $core.addMethod(
  11791. $core.method({
  11792. selector: "charCodeAt:",
  11793. protocol: "accessing",
  11794. fn: function (anInteger){
  11795. var self=this,$self=this;
  11796. return $core.withContext(function($ctx1) {
  11797. return self.charCodeAt(anInteger - 1);
  11798. return self;
  11799. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11800. },
  11801. args: ["anInteger"],
  11802. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11803. referencedClasses: [],
  11804. messageSends: []
  11805. }),
  11806. $globals.String);
  11807. $core.addMethod(
  11808. $core.method({
  11809. selector: "copyFrom:to:",
  11810. protocol: "copying",
  11811. fn: function (anIndex,anotherIndex){
  11812. var self=this,$self=this;
  11813. return $core.withContext(function($ctx1) {
  11814. return self.substring(anIndex - 1, anotherIndex);
  11815. return self;
  11816. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11817. },
  11818. args: ["anIndex", "anotherIndex"],
  11819. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11820. referencedClasses: [],
  11821. messageSends: []
  11822. }),
  11823. $globals.String);
  11824. $core.addMethod(
  11825. $core.method({
  11826. selector: "crlfSanitized",
  11827. protocol: "converting",
  11828. fn: function (){
  11829. var self=this,$self=this;
  11830. return $core.withContext(function($ctx1) {
  11831. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11832. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11833. },
  11834. args: [],
  11835. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11836. referencedClasses: ["String"],
  11837. messageSends: ["join:", "lines", "lf"]
  11838. }),
  11839. $globals.String);
  11840. $core.addMethod(
  11841. $core.method({
  11842. selector: "deepCopy",
  11843. protocol: "copying",
  11844. fn: function (){
  11845. var self=this,$self=this;
  11846. return $core.withContext(function($ctx1) {
  11847. return $self._shallowCopy();
  11848. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11849. },
  11850. args: [],
  11851. source: "deepCopy\x0a\x09^ self shallowCopy",
  11852. referencedClasses: [],
  11853. messageSends: ["shallowCopy"]
  11854. }),
  11855. $globals.String);
  11856. $core.addMethod(
  11857. $core.method({
  11858. selector: "escaped",
  11859. protocol: "converting",
  11860. fn: function (){
  11861. var self=this,$self=this;
  11862. return $core.withContext(function($ctx1) {
  11863. return escape(self);
  11864. return self;
  11865. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11866. },
  11867. args: [],
  11868. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11869. referencedClasses: [],
  11870. messageSends: []
  11871. }),
  11872. $globals.String);
  11873. $core.addMethod(
  11874. $core.method({
  11875. selector: "includesSubString:",
  11876. protocol: "testing",
  11877. fn: function (subString){
  11878. var self=this,$self=this;
  11879. return $core.withContext(function($ctx1) {
  11880. return self.indexOf(subString) != -1;
  11881. return self;
  11882. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11883. },
  11884. args: ["subString"],
  11885. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11886. referencedClasses: [],
  11887. messageSends: []
  11888. }),
  11889. $globals.String);
  11890. $core.addMethod(
  11891. $core.method({
  11892. selector: "isCapitalized",
  11893. protocol: "testing",
  11894. fn: function (){
  11895. var self=this,$self=this;
  11896. return $core.withContext(function($ctx1) {
  11897. var $2,$1;
  11898. $2=$self._first();
  11899. $ctx1.sendIdx["first"]=1;
  11900. $1=$recv($2)._asUppercase();
  11901. return $recv($1).__eq_eq($self._first());
  11902. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11903. },
  11904. args: [],
  11905. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11906. referencedClasses: [],
  11907. messageSends: ["==", "asUppercase", "first"]
  11908. }),
  11909. $globals.String);
  11910. $core.addMethod(
  11911. $core.method({
  11912. selector: "isImmutable",
  11913. protocol: "testing",
  11914. fn: function (){
  11915. var self=this,$self=this;
  11916. return true;
  11917. },
  11918. args: [],
  11919. source: "isImmutable\x0a\x09^ true",
  11920. referencedClasses: [],
  11921. messageSends: []
  11922. }),
  11923. $globals.String);
  11924. $core.addMethod(
  11925. $core.method({
  11926. selector: "isSelector",
  11927. protocol: "testing",
  11928. fn: function (){
  11929. var self=this,$self=this;
  11930. return $core.withContext(function($ctx1) {
  11931. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11932. return self;
  11933. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11934. },
  11935. args: [],
  11936. 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>",
  11937. referencedClasses: [],
  11938. messageSends: []
  11939. }),
  11940. $globals.String);
  11941. $core.addMethod(
  11942. $core.method({
  11943. selector: "isString",
  11944. protocol: "testing",
  11945. fn: function (){
  11946. var self=this,$self=this;
  11947. return true;
  11948. },
  11949. args: [],
  11950. source: "isString\x0a\x09^ true",
  11951. referencedClasses: [],
  11952. messageSends: []
  11953. }),
  11954. $globals.String);
  11955. $core.addMethod(
  11956. $core.method({
  11957. selector: "isVowel",
  11958. protocol: "testing",
  11959. fn: function (){
  11960. var self=this,$self=this;
  11961. return $core.withContext(function($ctx1) {
  11962. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11963. return $core.withContext(function($ctx2) {
  11964. return "aeiou"._includes_($self._asLowercase());
  11965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11966. }));
  11967. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11968. },
  11969. args: [],
  11970. 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 ]",
  11971. referencedClasses: [],
  11972. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11973. }),
  11974. $globals.String);
  11975. $core.addMethod(
  11976. $core.method({
  11977. selector: "join:",
  11978. protocol: "split join",
  11979. fn: function (aCollection){
  11980. var self=this,$self=this;
  11981. return $core.withContext(function($ctx1) {
  11982. return $recv($globals.String)._streamContents_((function(stream){
  11983. return $core.withContext(function($ctx2) {
  11984. return $recv(aCollection)._do_separatedBy_((function(each){
  11985. return $core.withContext(function($ctx3) {
  11986. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11987. $ctx3.sendIdx["nextPutAll:"]=1;
  11988. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11989. }),(function(){
  11990. return $core.withContext(function($ctx3) {
  11991. return $recv(stream)._nextPutAll_(self);
  11992. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11993. }));
  11994. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11995. }));
  11996. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11997. },
  11998. args: ["aCollection"],
  11999. 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 ]]",
  12000. referencedClasses: ["String"],
  12001. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  12002. }),
  12003. $globals.String);
  12004. $core.addMethod(
  12005. $core.method({
  12006. selector: "lineIndicesDo:",
  12007. protocol: "split join",
  12008. fn: function (aBlock){
  12009. var self=this,$self=this;
  12010. var cr,lf,start,sz,nextLF,nextCR;
  12011. return $core.withContext(function($ctx1) {
  12012. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  12013. var $early={};
  12014. try {
  12015. start=(1);
  12016. sz=$self._size();
  12017. cr=$recv($globals.String)._cr();
  12018. nextCR=$self._indexOf_startingAt_(cr,(1));
  12019. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  12020. lf=$recv($globals.String)._lf();
  12021. nextLF=$self._indexOf_startingAt_(lf,(1));
  12022. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  12023. $recv((function(){
  12024. return $core.withContext(function($ctx2) {
  12025. return $recv(start).__lt_eq(sz);
  12026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12027. }))._whileTrue_((function(){
  12028. return $core.withContext(function($ctx2) {
  12029. $2=$recv(nextLF).__eq((0));
  12030. $ctx2.sendIdx["="]=1;
  12031. $1=$recv($2)._and_((function(){
  12032. return $core.withContext(function($ctx3) {
  12033. return $recv(nextCR).__eq((0));
  12034. $ctx3.sendIdx["="]=2;
  12035. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  12036. }));
  12037. $ctx2.sendIdx["and:"]=1;
  12038. if($core.assert($1)){
  12039. $recv(aBlock)._value_value_value_(start,sz,sz);
  12040. $ctx2.sendIdx["value:value:value:"]=1;
  12041. throw $early=[self];
  12042. }
  12043. $4=$recv(nextCR).__eq((0));
  12044. $ctx2.sendIdx["="]=3;
  12045. $3=$recv($4)._or_((function(){
  12046. return $core.withContext(function($ctx3) {
  12047. $5=(0).__lt(nextLF);
  12048. $ctx3.sendIdx["<"]=1;
  12049. return $recv($5)._and_((function(){
  12050. return $core.withContext(function($ctx4) {
  12051. return $recv(nextLF).__lt(nextCR);
  12052. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  12053. }));
  12054. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  12055. }));
  12056. if($core.assert($3)){
  12057. $6=start;
  12058. $7=$recv(nextLF).__minus((1));
  12059. $ctx2.sendIdx["-"]=1;
  12060. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  12061. $ctx2.sendIdx["value:value:value:"]=2;
  12062. start=(1).__plus(nextLF);
  12063. $ctx2.sendIdx["+"]=1;
  12064. start;
  12065. nextLF=$self._indexOf_startingAt_(lf,start);
  12066. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  12067. return nextLF;
  12068. } else {
  12069. $9=(1).__plus(nextCR);
  12070. $ctx2.sendIdx["+"]=2;
  12071. $8=$recv($9).__eq(nextLF);
  12072. if($core.assert($8)){
  12073. $10=start;
  12074. $11=$recv(nextCR).__minus((1));
  12075. $ctx2.sendIdx["-"]=2;
  12076. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  12077. $ctx2.sendIdx["value:value:value:"]=3;
  12078. start=(1).__plus(nextLF);
  12079. $ctx2.sendIdx["+"]=3;
  12080. start;
  12081. nextCR=$self._indexOf_startingAt_(cr,start);
  12082. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  12083. nextCR;
  12084. nextLF=$self._indexOf_startingAt_(lf,start);
  12085. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  12086. return nextLF;
  12087. } else {
  12088. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  12089. start=(1).__plus(nextCR);
  12090. start;
  12091. nextCR=$self._indexOf_startingAt_(cr,start);
  12092. return nextCR;
  12093. }
  12094. }
  12095. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12096. }));
  12097. return self;
  12098. }
  12099. catch(e) {if(e===$early)return e[0]; throw e}
  12100. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  12101. },
  12102. args: ["aBlock"],
  12103. 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 ] ]]",
  12104. referencedClasses: ["String"],
  12105. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  12106. }),
  12107. $globals.String);
  12108. $core.addMethod(
  12109. $core.method({
  12110. selector: "lineNumber:",
  12111. protocol: "split join",
  12112. fn: function (anIndex){
  12113. var self=this,$self=this;
  12114. var lineCount;
  12115. return $core.withContext(function($ctx1) {
  12116. var $2,$1;
  12117. var $early={};
  12118. try {
  12119. lineCount=(0);
  12120. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12121. return $core.withContext(function($ctx2) {
  12122. lineCount=$recv(lineCount).__plus((1));
  12123. $2=lineCount;
  12124. $1=$recv($2).__eq(anIndex);
  12125. if($core.assert($1)){
  12126. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  12127. }
  12128. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  12129. }));
  12130. return nil;
  12131. }
  12132. catch(e) {if(e===$early)return e[0]; throw e}
  12133. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  12134. },
  12135. args: ["anIndex"],
  12136. 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",
  12137. referencedClasses: [],
  12138. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  12139. }),
  12140. $globals.String);
  12141. $core.addMethod(
  12142. $core.method({
  12143. selector: "lines",
  12144. protocol: "split join",
  12145. fn: function (){
  12146. var self=this,$self=this;
  12147. return $core.withContext(function($ctx1) {
  12148. var result = self.split(/\r\n|\r|\n/);
  12149. if (!result[result.length-1]) result.pop();
  12150. return result;;
  12151. return self;
  12152. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  12153. },
  12154. args: [],
  12155. 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'>",
  12156. referencedClasses: [],
  12157. messageSends: []
  12158. }),
  12159. $globals.String);
  12160. $core.addMethod(
  12161. $core.method({
  12162. selector: "linesDo:",
  12163. protocol: "split join",
  12164. fn: function (aBlock){
  12165. var self=this,$self=this;
  12166. return $core.withContext(function($ctx1) {
  12167. $recv($self._lines())._do_(aBlock);
  12168. return self;
  12169. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  12170. },
  12171. args: ["aBlock"],
  12172. 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",
  12173. referencedClasses: [],
  12174. messageSends: ["do:", "lines"]
  12175. }),
  12176. $globals.String);
  12177. $core.addMethod(
  12178. $core.method({
  12179. selector: "match:",
  12180. protocol: "regular expressions",
  12181. fn: function (aRegexp){
  12182. var self=this,$self=this;
  12183. return $core.withContext(function($ctx1) {
  12184. return self.search(aRegexp) != -1;
  12185. return self;
  12186. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  12187. },
  12188. args: ["aRegexp"],
  12189. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  12190. referencedClasses: [],
  12191. messageSends: []
  12192. }),
  12193. $globals.String);
  12194. $core.addMethod(
  12195. $core.method({
  12196. selector: "matchesOf:",
  12197. protocol: "regular expressions",
  12198. fn: function (aRegularExpression){
  12199. var self=this,$self=this;
  12200. return $core.withContext(function($ctx1) {
  12201. return self.match(aRegularExpression);
  12202. return self;
  12203. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  12204. },
  12205. args: ["aRegularExpression"],
  12206. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  12207. referencedClasses: [],
  12208. messageSends: []
  12209. }),
  12210. $globals.String);
  12211. $core.addMethod(
  12212. $core.method({
  12213. selector: "numericallyIndexable",
  12214. protocol: "private",
  12215. fn: function (){
  12216. var self=this,$self=this;
  12217. return $core.withContext(function($ctx1) {
  12218. return String(self);
  12219. return self;
  12220. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  12221. },
  12222. args: [],
  12223. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  12224. referencedClasses: [],
  12225. messageSends: []
  12226. }),
  12227. $globals.String);
  12228. $core.addMethod(
  12229. $core.method({
  12230. selector: "printNl",
  12231. protocol: "printing",
  12232. fn: function (){
  12233. var self=this,$self=this;
  12234. return $core.withContext(function($ctx1) {
  12235. console.log(self);
  12236. return self;
  12237. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  12238. },
  12239. args: [],
  12240. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  12241. referencedClasses: [],
  12242. messageSends: []
  12243. }),
  12244. $globals.String);
  12245. $core.addMethod(
  12246. $core.method({
  12247. selector: "printOn:",
  12248. protocol: "printing",
  12249. fn: function (aStream){
  12250. var self=this,$self=this;
  12251. return $core.withContext(function($ctx1) {
  12252. $recv(aStream)._nextPutAll_("'");
  12253. $ctx1.sendIdx["nextPutAll:"]=1;
  12254. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  12255. $ctx1.sendIdx["nextPutAll:"]=2;
  12256. $recv(aStream)._nextPutAll_("'");
  12257. return self;
  12258. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  12259. },
  12260. args: ["aStream"],
  12261. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  12262. referencedClasses: [],
  12263. messageSends: ["nextPutAll:", "replace:with:"]
  12264. }),
  12265. $globals.String);
  12266. $core.addMethod(
  12267. $core.method({
  12268. selector: "replace:with:",
  12269. protocol: "regular expressions",
  12270. fn: function (aString,anotherString){
  12271. var self=this,$self=this;
  12272. return $core.withContext(function($ctx1) {
  12273. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  12274. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  12275. },
  12276. args: ["aString", "anotherString"],
  12277. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12278. referencedClasses: ["RegularExpression"],
  12279. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  12280. }),
  12281. $globals.String);
  12282. $core.addMethod(
  12283. $core.method({
  12284. selector: "replaceRegexp:with:",
  12285. protocol: "regular expressions",
  12286. fn: function (aRegexp,aString){
  12287. var self=this,$self=this;
  12288. return $core.withContext(function($ctx1) {
  12289. return self.replace(aRegexp, aString);
  12290. return self;
  12291. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  12292. },
  12293. args: ["aRegexp", "aString"],
  12294. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  12295. referencedClasses: [],
  12296. messageSends: []
  12297. }),
  12298. $globals.String);
  12299. $core.addMethod(
  12300. $core.method({
  12301. selector: "reversed",
  12302. protocol: "converting",
  12303. fn: function (){
  12304. var self=this,$self=this;
  12305. return $core.withContext(function($ctx1) {
  12306. return self.split("").reverse().join("");
  12307. return self;
  12308. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  12309. },
  12310. args: [],
  12311. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  12312. referencedClasses: [],
  12313. messageSends: []
  12314. }),
  12315. $globals.String);
  12316. $core.addMethod(
  12317. $core.method({
  12318. selector: "shallowCopy",
  12319. protocol: "copying",
  12320. fn: function (){
  12321. var self=this,$self=this;
  12322. return self;
  12323. },
  12324. args: [],
  12325. source: "shallowCopy\x0a\x09^ self",
  12326. referencedClasses: [],
  12327. messageSends: []
  12328. }),
  12329. $globals.String);
  12330. $core.addMethod(
  12331. $core.method({
  12332. selector: "size",
  12333. protocol: "accessing",
  12334. fn: function (){
  12335. var self=this,$self=this;
  12336. return $core.withContext(function($ctx1) {
  12337. return self.length;
  12338. return self;
  12339. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  12340. },
  12341. args: [],
  12342. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  12343. referencedClasses: [],
  12344. messageSends: []
  12345. }),
  12346. $globals.String);
  12347. $core.addMethod(
  12348. $core.method({
  12349. selector: "subStrings:",
  12350. protocol: "split join",
  12351. fn: function (aString){
  12352. var self=this,$self=this;
  12353. return $core.withContext(function($ctx1) {
  12354. return $self._tokenize_(aString);
  12355. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  12356. },
  12357. args: ["aString"],
  12358. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12359. referencedClasses: [],
  12360. messageSends: ["tokenize:"]
  12361. }),
  12362. $globals.String);
  12363. $core.addMethod(
  12364. $core.method({
  12365. selector: "tokenize:",
  12366. protocol: "split join",
  12367. fn: function (aString){
  12368. var self=this,$self=this;
  12369. return $core.withContext(function($ctx1) {
  12370. return self.split(aString);
  12371. return self;
  12372. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  12373. },
  12374. args: ["aString"],
  12375. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12376. referencedClasses: [],
  12377. messageSends: []
  12378. }),
  12379. $globals.String);
  12380. $core.addMethod(
  12381. $core.method({
  12382. selector: "trimBoth",
  12383. protocol: "regular expressions",
  12384. fn: function (){
  12385. var self=this,$self=this;
  12386. return $core.withContext(function($ctx1) {
  12387. return $self._trimBoth_("\x5cs");
  12388. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  12389. },
  12390. args: [],
  12391. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12392. referencedClasses: [],
  12393. messageSends: ["trimBoth:"]
  12394. }),
  12395. $globals.String);
  12396. $core.addMethod(
  12397. $core.method({
  12398. selector: "trimBoth:",
  12399. protocol: "regular expressions",
  12400. fn: function (separators){
  12401. var self=this,$self=this;
  12402. return $core.withContext(function($ctx1) {
  12403. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12404. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  12405. },
  12406. args: ["separators"],
  12407. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12408. referencedClasses: [],
  12409. messageSends: ["trimRight:", "trimLeft:"]
  12410. }),
  12411. $globals.String);
  12412. $core.addMethod(
  12413. $core.method({
  12414. selector: "trimLeft",
  12415. protocol: "regular expressions",
  12416. fn: function (){
  12417. var self=this,$self=this;
  12418. return $core.withContext(function($ctx1) {
  12419. return $self._trimLeft_("\x5cs");
  12420. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  12421. },
  12422. args: [],
  12423. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12424. referencedClasses: [],
  12425. messageSends: ["trimLeft:"]
  12426. }),
  12427. $globals.String);
  12428. $core.addMethod(
  12429. $core.method({
  12430. selector: "trimLeft:",
  12431. protocol: "regular expressions",
  12432. fn: function (separators){
  12433. var self=this,$self=this;
  12434. return $core.withContext(function($ctx1) {
  12435. var $2,$1;
  12436. $2=$recv("^[".__comma(separators)).__comma("]+");
  12437. $ctx1.sendIdx[","]=1;
  12438. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12439. return $self._replaceRegexp_with_($1,"");
  12440. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  12441. },
  12442. args: ["separators"],
  12443. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12444. referencedClasses: ["RegularExpression"],
  12445. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12446. }),
  12447. $globals.String);
  12448. $core.addMethod(
  12449. $core.method({
  12450. selector: "trimRight",
  12451. protocol: "regular expressions",
  12452. fn: function (){
  12453. var self=this,$self=this;
  12454. return $core.withContext(function($ctx1) {
  12455. return $self._trimRight_("\x5cs");
  12456. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  12457. },
  12458. args: [],
  12459. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12460. referencedClasses: [],
  12461. messageSends: ["trimRight:"]
  12462. }),
  12463. $globals.String);
  12464. $core.addMethod(
  12465. $core.method({
  12466. selector: "trimRight:",
  12467. protocol: "regular expressions",
  12468. fn: function (separators){
  12469. var self=this,$self=this;
  12470. return $core.withContext(function($ctx1) {
  12471. var $2,$1;
  12472. $2=$recv("[".__comma(separators)).__comma("]+$");
  12473. $ctx1.sendIdx[","]=1;
  12474. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12475. return $self._replaceRegexp_with_($1,"");
  12476. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  12477. },
  12478. args: ["separators"],
  12479. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12480. referencedClasses: ["RegularExpression"],
  12481. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12482. }),
  12483. $globals.String);
  12484. $core.addMethod(
  12485. $core.method({
  12486. selector: "unescaped",
  12487. protocol: "converting",
  12488. fn: function (){
  12489. var self=this,$self=this;
  12490. return $core.withContext(function($ctx1) {
  12491. return unescape(self);
  12492. return self;
  12493. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  12494. },
  12495. args: [],
  12496. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12497. referencedClasses: [],
  12498. messageSends: []
  12499. }),
  12500. $globals.String);
  12501. $core.addMethod(
  12502. $core.method({
  12503. selector: "uriComponentDecoded",
  12504. protocol: "converting",
  12505. fn: function (){
  12506. var self=this,$self=this;
  12507. return $core.withContext(function($ctx1) {
  12508. return decodeURIComponent(self);
  12509. return self;
  12510. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  12511. },
  12512. args: [],
  12513. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12514. referencedClasses: [],
  12515. messageSends: []
  12516. }),
  12517. $globals.String);
  12518. $core.addMethod(
  12519. $core.method({
  12520. selector: "uriComponentEncoded",
  12521. protocol: "converting",
  12522. fn: function (){
  12523. var self=this,$self=this;
  12524. return $core.withContext(function($ctx1) {
  12525. return encodeURIComponent(self);
  12526. return self;
  12527. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  12528. },
  12529. args: [],
  12530. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12531. referencedClasses: [],
  12532. messageSends: []
  12533. }),
  12534. $globals.String);
  12535. $core.addMethod(
  12536. $core.method({
  12537. selector: "uriDecoded",
  12538. protocol: "converting",
  12539. fn: function (){
  12540. var self=this,$self=this;
  12541. return $core.withContext(function($ctx1) {
  12542. return decodeURI(self);
  12543. return self;
  12544. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12545. },
  12546. args: [],
  12547. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12548. referencedClasses: [],
  12549. messageSends: []
  12550. }),
  12551. $globals.String);
  12552. $core.addMethod(
  12553. $core.method({
  12554. selector: "uriEncoded",
  12555. protocol: "converting",
  12556. fn: function (){
  12557. var self=this,$self=this;
  12558. return $core.withContext(function($ctx1) {
  12559. return encodeURI(self);
  12560. return self;
  12561. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12562. },
  12563. args: [],
  12564. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12565. referencedClasses: [],
  12566. messageSends: []
  12567. }),
  12568. $globals.String);
  12569. $core.addMethod(
  12570. $core.method({
  12571. selector: "value:",
  12572. protocol: "evaluating",
  12573. fn: function (anObject){
  12574. var self=this,$self=this;
  12575. return $core.withContext(function($ctx1) {
  12576. return $recv(anObject)._perform_(self);
  12577. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12578. },
  12579. args: ["anObject"],
  12580. source: "value: anObject \x0a\x09^ anObject perform: self",
  12581. referencedClasses: [],
  12582. messageSends: ["perform:"]
  12583. }),
  12584. $globals.String);
  12585. $core.addMethod(
  12586. $core.method({
  12587. selector: "cr",
  12588. protocol: "accessing",
  12589. fn: function (){
  12590. var self=this,$self=this;
  12591. return $core.withContext(function($ctx1) {
  12592. return "\r";
  12593. return self;
  12594. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12595. },
  12596. args: [],
  12597. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12598. referencedClasses: [],
  12599. messageSends: []
  12600. }),
  12601. $globals.String.a$cls);
  12602. $core.addMethod(
  12603. $core.method({
  12604. selector: "crlf",
  12605. protocol: "accessing",
  12606. fn: function (){
  12607. var self=this,$self=this;
  12608. return $core.withContext(function($ctx1) {
  12609. return "\r\n";
  12610. return self;
  12611. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12612. },
  12613. args: [],
  12614. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12615. referencedClasses: [],
  12616. messageSends: []
  12617. }),
  12618. $globals.String.a$cls);
  12619. $core.addMethod(
  12620. $core.method({
  12621. selector: "esc",
  12622. protocol: "accessing",
  12623. fn: function (){
  12624. var self=this,$self=this;
  12625. return $core.withContext(function($ctx1) {
  12626. return $self._fromCharCode_((27));
  12627. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12628. },
  12629. args: [],
  12630. source: "esc\x0a\x09^ self fromCharCode: 27",
  12631. referencedClasses: [],
  12632. messageSends: ["fromCharCode:"]
  12633. }),
  12634. $globals.String.a$cls);
  12635. $core.addMethod(
  12636. $core.method({
  12637. selector: "fromCharCode:",
  12638. protocol: "instance creation",
  12639. fn: function (anInteger){
  12640. var self=this,$self=this;
  12641. return $core.withContext(function($ctx1) {
  12642. return String.fromCharCode(anInteger);
  12643. return self;
  12644. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12645. },
  12646. args: ["anInteger"],
  12647. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12648. referencedClasses: [],
  12649. messageSends: []
  12650. }),
  12651. $globals.String.a$cls);
  12652. $core.addMethod(
  12653. $core.method({
  12654. selector: "fromString:",
  12655. protocol: "instance creation",
  12656. fn: function (aString){
  12657. var self=this,$self=this;
  12658. return $core.withContext(function($ctx1) {
  12659. return String(aString);
  12660. return self;
  12661. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12662. },
  12663. args: ["aString"],
  12664. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12665. referencedClasses: [],
  12666. messageSends: []
  12667. }),
  12668. $globals.String.a$cls);
  12669. $core.addMethod(
  12670. $core.method({
  12671. selector: "lf",
  12672. protocol: "accessing",
  12673. fn: function (){
  12674. var self=this,$self=this;
  12675. return $core.withContext(function($ctx1) {
  12676. return "\n";
  12677. return self;
  12678. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12679. },
  12680. args: [],
  12681. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12682. referencedClasses: [],
  12683. messageSends: []
  12684. }),
  12685. $globals.String.a$cls);
  12686. $core.addMethod(
  12687. $core.method({
  12688. selector: "random",
  12689. protocol: "random",
  12690. fn: function (){
  12691. var self=this,$self=this;
  12692. return $core.withContext(function($ctx1) {
  12693. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  12694. return self;
  12695. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12696. },
  12697. args: [],
  12698. 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);'>",
  12699. referencedClasses: [],
  12700. messageSends: []
  12701. }),
  12702. $globals.String.a$cls);
  12703. $core.addMethod(
  12704. $core.method({
  12705. selector: "randomNotIn:",
  12706. protocol: "random",
  12707. fn: function (aString){
  12708. var self=this,$self=this;
  12709. var result;
  12710. return $core.withContext(function($ctx1) {
  12711. $recv((function(){
  12712. return $core.withContext(function($ctx2) {
  12713. result=$self._random();
  12714. result;
  12715. return $recv(aString)._includesSubString_(result);
  12716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12717. }))._whileTrue();
  12718. return result;
  12719. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12720. },
  12721. args: ["aString"],
  12722. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12723. referencedClasses: [],
  12724. messageSends: ["whileTrue", "random", "includesSubString:"]
  12725. }),
  12726. $globals.String.a$cls);
  12727. $core.addMethod(
  12728. $core.method({
  12729. selector: "space",
  12730. protocol: "accessing",
  12731. fn: function (){
  12732. var self=this,$self=this;
  12733. return $core.withContext(function($ctx1) {
  12734. return " ";
  12735. return self;
  12736. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12737. },
  12738. args: [],
  12739. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12740. referencedClasses: [],
  12741. messageSends: []
  12742. }),
  12743. $globals.String.a$cls);
  12744. $core.addMethod(
  12745. $core.method({
  12746. selector: "streamClass",
  12747. protocol: "accessing",
  12748. fn: function (){
  12749. var self=this,$self=this;
  12750. return $globals.StringStream;
  12751. },
  12752. args: [],
  12753. source: "streamClass\x0a\x09\x09^ StringStream",
  12754. referencedClasses: ["StringStream"],
  12755. messageSends: []
  12756. }),
  12757. $globals.String.a$cls);
  12758. $core.addMethod(
  12759. $core.method({
  12760. selector: "tab",
  12761. protocol: "accessing",
  12762. fn: function (){
  12763. var self=this,$self=this;
  12764. return $core.withContext(function($ctx1) {
  12765. return "\t";
  12766. return self;
  12767. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12768. },
  12769. args: [],
  12770. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12771. referencedClasses: [],
  12772. messageSends: []
  12773. }),
  12774. $globals.String.a$cls);
  12775. $core.addMethod(
  12776. $core.method({
  12777. selector: "value:",
  12778. protocol: "instance creation",
  12779. fn: function (aUTFCharCode){
  12780. var self=this,$self=this;
  12781. return $core.withContext(function($ctx1) {
  12782. return String.fromCharCode(aUTFCharCode);;
  12783. return self;
  12784. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12785. },
  12786. args: ["aUTFCharCode"],
  12787. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12788. referencedClasses: [],
  12789. messageSends: []
  12790. }),
  12791. $globals.String.a$cls);
  12792. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12793. $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`.";
  12794. $core.addMethod(
  12795. $core.method({
  12796. selector: "=",
  12797. protocol: "comparing",
  12798. fn: function (aCollection){
  12799. var self=this,$self=this;
  12800. return $core.withContext(function($ctx1) {
  12801. var $2,$1,$4,$3,$5;
  12802. var $early={};
  12803. try {
  12804. $2=$self._class();
  12805. $ctx1.sendIdx["class"]=1;
  12806. $1=$recv($2).__eq($recv(aCollection)._class());
  12807. $ctx1.sendIdx["="]=1;
  12808. if(!$core.assert($1)){
  12809. return false;
  12810. }
  12811. $4=$self._size();
  12812. $ctx1.sendIdx["size"]=1;
  12813. $3=$recv($4).__eq($recv(aCollection)._size());
  12814. if(!$core.assert($3)){
  12815. return false;
  12816. }
  12817. $self._do_((function(each){
  12818. return $core.withContext(function($ctx2) {
  12819. $5=$recv(aCollection)._includes_(each);
  12820. if(!$core.assert($5)){
  12821. throw $early=[false];
  12822. }
  12823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12824. }));
  12825. return true;
  12826. }
  12827. catch(e) {if(e===$early)return e[0]; throw e}
  12828. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12829. },
  12830. args: ["aCollection"],
  12831. 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",
  12832. referencedClasses: [],
  12833. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12834. }),
  12835. $globals.Set);
  12836. $core.addMethod(
  12837. $core.method({
  12838. selector: "add:",
  12839. protocol: "adding/removing",
  12840. fn: function (anObject){
  12841. var self=this,$self=this;
  12842. var bucket;
  12843. return $core.withContext(function($ctx1) {
  12844. var $1,$receiver;
  12845. bucket=$self._bucketsOfElement_(anObject);
  12846. $1=$recv(bucket)._second();
  12847. if(($receiver = $1) == null || $receiver.a$nil){
  12848. var object,slowBucket;
  12849. object=$recv(bucket)._first();
  12850. $ctx1.sendIdx["first"]=1;
  12851. object;
  12852. slowBucket=$recv(bucket)._third();
  12853. slowBucket;
  12854. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12855. return $core.withContext(function($ctx2) {
  12856. $recv(slowBucket)._add_(object);
  12857. $self["@size"]=$recv($self["@size"]).__plus((1));
  12858. return $self["@size"];
  12859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12860. }));
  12861. return object;
  12862. } else {
  12863. var primitiveBucket;
  12864. primitiveBucket=$receiver;
  12865. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12866. }
  12867. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12868. },
  12869. args: ["anObject"],
  12870. 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 ]",
  12871. referencedClasses: [],
  12872. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12873. }),
  12874. $globals.Set);
  12875. $core.addMethod(
  12876. $core.method({
  12877. selector: "add:in:",
  12878. protocol: "private",
  12879. fn: function (anObject,anotherObject){
  12880. var self=this,$self=this;
  12881. return $core.withContext(function($ctx1) {
  12882. if (anObject in anotherObject.store) { return false; }
  12883. $self['@size']++;
  12884. anotherObject.store[anObject] = true;
  12885. return anObject;
  12886. ;
  12887. return self;
  12888. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12889. },
  12890. args: ["anObject", "anotherObject"],
  12891. 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'>",
  12892. referencedClasses: [],
  12893. messageSends: []
  12894. }),
  12895. $globals.Set);
  12896. $core.addMethod(
  12897. $core.method({
  12898. selector: "bucketsOfElement:",
  12899. protocol: "private",
  12900. fn: function (anObject){
  12901. var self=this,$self=this;
  12902. return $core.withContext(function($ctx1) {
  12903. // include nil to well-known objects under "boolean" fastBucket
  12904. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12905. var prim = anObject.valueOf();
  12906. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12907. var bucket = null;
  12908. $self['@slowBucketStores'].some(function (store) {
  12909. return bucket = store._bucketOfElement_(anObject);
  12910. });
  12911. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12912. }
  12913. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12914. ;
  12915. return self;
  12916. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12917. },
  12918. args: ["anObject"],
  12919. 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'>",
  12920. referencedClasses: [],
  12921. messageSends: []
  12922. }),
  12923. $globals.Set);
  12924. $core.addMethod(
  12925. $core.method({
  12926. selector: "classNameOf:",
  12927. protocol: "private",
  12928. fn: function (anObject){
  12929. var self=this,$self=this;
  12930. return $core.withContext(function($ctx1) {
  12931. return anObject.a$cls != null && anObject.a$cls.name;
  12932. return self;
  12933. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12934. },
  12935. args: ["anObject"],
  12936. 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'>",
  12937. referencedClasses: [],
  12938. messageSends: []
  12939. }),
  12940. $globals.Set);
  12941. $core.addMethod(
  12942. $core.method({
  12943. selector: "collect:",
  12944. protocol: "enumerating",
  12945. fn: function (aBlock){
  12946. var self=this,$self=this;
  12947. var collection;
  12948. return $core.withContext(function($ctx1) {
  12949. collection=$recv($self._class())._new();
  12950. $self._do_((function(each){
  12951. return $core.withContext(function($ctx2) {
  12952. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12954. }));
  12955. return collection;
  12956. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12957. },
  12958. args: ["aBlock"],
  12959. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12960. referencedClasses: [],
  12961. messageSends: ["new", "class", "do:", "add:", "value:"]
  12962. }),
  12963. $globals.Set);
  12964. $core.addMethod(
  12965. $core.method({
  12966. selector: "detect:ifNone:",
  12967. protocol: "enumerating",
  12968. fn: function (aBlock,anotherBlock){
  12969. var self=this,$self=this;
  12970. return $core.withContext(function($ctx1) {
  12971. var $1;
  12972. var $early={};
  12973. try {
  12974. $self._do_((function(each){
  12975. return $core.withContext(function($ctx2) {
  12976. $1=$recv(aBlock)._value_(each);
  12977. if($core.assert($1)){
  12978. throw $early=[each];
  12979. }
  12980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12981. }));
  12982. return $recv(anotherBlock)._value();
  12983. }
  12984. catch(e) {if(e===$early)return e[0]; throw e}
  12985. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  12986. },
  12987. args: ["aBlock", "anotherBlock"],
  12988. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  12989. referencedClasses: [],
  12990. messageSends: ["do:", "ifTrue:", "value:", "value"]
  12991. }),
  12992. $globals.Set);
  12993. $core.addMethod(
  12994. $core.method({
  12995. selector: "do:",
  12996. protocol: "enumerating",
  12997. fn: function (aBlock){
  12998. var self=this,$self=this;
  12999. return $core.withContext(function($ctx1) {
  13000. var el, keys, i;
  13001. el = $self['@fastBuckets'];
  13002. keys = Object.keys(el);
  13003. for (i = 0; i < keys.length; ++i) {
  13004. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  13005. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  13006. else { store._do_(aBlock); }
  13007. }
  13008. el = $self['@slowBucketStores'];
  13009. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  13010. $self['@defaultBucket']._do_(aBlock);
  13011. ;
  13012. return self;
  13013. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  13014. },
  13015. args: ["aBlock"],
  13016. 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'>",
  13017. referencedClasses: [],
  13018. messageSends: []
  13019. }),
  13020. $globals.Set);
  13021. $core.addMethod(
  13022. $core.method({
  13023. selector: "includes:",
  13024. protocol: "testing",
  13025. fn: function (anObject){
  13026. var self=this,$self=this;
  13027. var bucket;
  13028. return $core.withContext(function($ctx1) {
  13029. var $1,$2,$3,$receiver;
  13030. bucket=$self._bucketsOfElement_(anObject);
  13031. $1=$recv(bucket)._second();
  13032. if(($receiver = $1) == null || $receiver.a$nil){
  13033. $2=$recv(bucket)._third();
  13034. $3=$recv(bucket)._first();
  13035. $ctx1.sendIdx["first"]=1;
  13036. return $recv($2)._includes_($3);
  13037. } else {
  13038. var primitiveBucket;
  13039. primitiveBucket=$receiver;
  13040. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  13041. }
  13042. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  13043. },
  13044. args: ["anObject"],
  13045. 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 ]",
  13046. referencedClasses: [],
  13047. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  13048. }),
  13049. $globals.Set);
  13050. $core.addMethod(
  13051. $core.method({
  13052. selector: "includes:in:",
  13053. protocol: "private",
  13054. fn: function (anObject,anotherObject){
  13055. var self=this,$self=this;
  13056. return $core.withContext(function($ctx1) {
  13057. return anObject in anotherObject.store;
  13058. return self;
  13059. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13060. },
  13061. args: ["anObject", "anotherObject"],
  13062. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  13063. referencedClasses: [],
  13064. messageSends: []
  13065. }),
  13066. $globals.Set);
  13067. $core.addMethod(
  13068. $core.method({
  13069. selector: "initialize",
  13070. protocol: "initialization",
  13071. fn: function (){
  13072. var self=this,$self=this;
  13073. return $core.withContext(function($ctx1) {
  13074. (
  13075. $ctx1.supercall = true,
  13076. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13077. $ctx1.supercall = false;
  13078. $self["@defaultBucket"]=[];
  13079. $self._initializeSlowBucketStores();
  13080. $self._removeAll();
  13081. return self;
  13082. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  13083. },
  13084. args: [],
  13085. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  13086. referencedClasses: [],
  13087. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  13088. }),
  13089. $globals.Set);
  13090. $core.addMethod(
  13091. $core.method({
  13092. selector: "initializeSlowBucketStores",
  13093. protocol: "initialization",
  13094. fn: function (){
  13095. var self=this,$self=this;
  13096. return $core.withContext(function($ctx1) {
  13097. var $1;
  13098. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13099. return $core.withContext(function($ctx2) {
  13100. return $self._classNameOf_(x);
  13101. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  13102. }));
  13103. $ctx1.sendIdx["hashBlock:"]=1;
  13104. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13105. return $core.withContext(function($ctx2) {
  13106. return $self._jsConstructorNameOf_(x);
  13107. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  13108. }))];
  13109. return self;
  13110. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  13111. },
  13112. args: [],
  13113. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  13114. referencedClasses: ["ArrayBucketStore"],
  13115. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  13116. }),
  13117. $globals.Set);
  13118. $core.addMethod(
  13119. $core.method({
  13120. selector: "jsConstructorNameOf:",
  13121. protocol: "private",
  13122. fn: function (anObject){
  13123. var self=this,$self=this;
  13124. return $core.withContext(function($ctx1) {
  13125. return anObject.constructor && anObject.constructor.name;
  13126. return self;
  13127. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  13128. },
  13129. args: ["anObject"],
  13130. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  13131. referencedClasses: [],
  13132. messageSends: []
  13133. }),
  13134. $globals.Set);
  13135. $core.addMethod(
  13136. $core.method({
  13137. selector: "printOn:",
  13138. protocol: "printing",
  13139. fn: function (aStream){
  13140. var self=this,$self=this;
  13141. return $core.withContext(function($ctx1) {
  13142. (
  13143. $ctx1.supercall = true,
  13144. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  13145. $ctx1.supercall = false;
  13146. $ctx1.sendIdx["printOn:"]=1;
  13147. $recv(aStream)._nextPutAll_(" (");
  13148. $ctx1.sendIdx["nextPutAll:"]=1;
  13149. $self._do_separatedBy_((function(each){
  13150. return $core.withContext(function($ctx2) {
  13151. return $recv(each)._printOn_(aStream);
  13152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13153. }),(function(){
  13154. return $core.withContext(function($ctx2) {
  13155. return $recv(aStream)._nextPutAll_(" ");
  13156. $ctx2.sendIdx["nextPutAll:"]=2;
  13157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13158. }));
  13159. $recv(aStream)._nextPutAll_(")");
  13160. return self;
  13161. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  13162. },
  13163. args: ["aStream"],
  13164. 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: ')'",
  13165. referencedClasses: [],
  13166. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13167. }),
  13168. $globals.Set);
  13169. $core.addMethod(
  13170. $core.method({
  13171. selector: "remove:ifAbsent:",
  13172. protocol: "adding/removing",
  13173. fn: function (anObject,aBlock){
  13174. var self=this,$self=this;
  13175. var bucket;
  13176. return $core.withContext(function($ctx1) {
  13177. var $1,$2,$3,$receiver;
  13178. var $early={};
  13179. try {
  13180. bucket=$self._bucketsOfElement_(anObject);
  13181. $1=$recv(bucket)._second();
  13182. if(($receiver = $1) == null || $receiver.a$nil){
  13183. $2=$recv(bucket)._third();
  13184. $3=$recv(bucket)._first();
  13185. $ctx1.sendIdx["first"]=1;
  13186. $recv($2)._remove_ifAbsent_($3,(function(){
  13187. return $core.withContext(function($ctx2) {
  13188. throw $early=[$recv(aBlock)._value()];
  13189. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13190. }));
  13191. $self["@size"]=$recv($self["@size"]).__minus((1));
  13192. return $self["@size"];
  13193. } else {
  13194. var primitiveBucket;
  13195. primitiveBucket=$receiver;
  13196. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  13197. }
  13198. }
  13199. catch(e) {if(e===$early)return e[0]; throw e}
  13200. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  13201. },
  13202. args: ["anObject", "aBlock"],
  13203. 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 ]",
  13204. referencedClasses: [],
  13205. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  13206. }),
  13207. $globals.Set);
  13208. $core.addMethod(
  13209. $core.method({
  13210. selector: "remove:in:",
  13211. protocol: "private",
  13212. fn: function (anObject,anotherObject){
  13213. var self=this,$self=this;
  13214. return $core.withContext(function($ctx1) {
  13215. if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self['@size']--; };
  13216. return self;
  13217. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13218. },
  13219. args: ["anObject", "anotherObject"],
  13220. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self[''@size'']--; }'>",
  13221. referencedClasses: [],
  13222. messageSends: []
  13223. }),
  13224. $globals.Set);
  13225. $core.addMethod(
  13226. $core.method({
  13227. selector: "removeAll",
  13228. protocol: "adding/removing",
  13229. fn: function (){
  13230. var self=this,$self=this;
  13231. return $core.withContext(function($ctx1) {
  13232. $self['@fastBuckets'] = {
  13233. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  13234. "number": { store: Object.create(null), fn: Number },
  13235. "string": { store: Object.create(null) }
  13236. };
  13237. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  13238. $self['@defaultBucket']._removeAll();
  13239. $self['@size'] = 0;
  13240. ;
  13241. return self;
  13242. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  13243. },
  13244. args: [],
  13245. 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'>",
  13246. referencedClasses: [],
  13247. messageSends: []
  13248. }),
  13249. $globals.Set);
  13250. $core.addMethod(
  13251. $core.method({
  13252. selector: "select:",
  13253. protocol: "enumerating",
  13254. fn: function (aBlock){
  13255. var self=this,$self=this;
  13256. var collection;
  13257. return $core.withContext(function($ctx1) {
  13258. var $1;
  13259. collection=$recv($self._class())._new();
  13260. $self._do_((function(each){
  13261. return $core.withContext(function($ctx2) {
  13262. $1=$recv(aBlock)._value_(each);
  13263. if($core.assert($1)){
  13264. return $recv(collection)._add_(each);
  13265. }
  13266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13267. }));
  13268. return collection;
  13269. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  13270. },
  13271. args: ["aBlock"],
  13272. 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",
  13273. referencedClasses: [],
  13274. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13275. }),
  13276. $globals.Set);
  13277. $core.addMethod(
  13278. $core.method({
  13279. selector: "select:thenCollect:",
  13280. protocol: "enumerating",
  13281. fn: function (selectBlock,collectBlock){
  13282. var self=this,$self=this;
  13283. var collection;
  13284. return $core.withContext(function($ctx1) {
  13285. var $1;
  13286. collection=$recv($self._class())._new();
  13287. $self._do_((function(each){
  13288. return $core.withContext(function($ctx2) {
  13289. $1=$recv(selectBlock)._value_(each);
  13290. $ctx2.sendIdx["value:"]=1;
  13291. if($core.assert($1)){
  13292. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  13293. }
  13294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13295. }));
  13296. return collection;
  13297. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  13298. },
  13299. args: ["selectBlock", "collectBlock"],
  13300. 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",
  13301. referencedClasses: [],
  13302. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13303. }),
  13304. $globals.Set);
  13305. $core.addMethod(
  13306. $core.method({
  13307. selector: "size",
  13308. protocol: "accessing",
  13309. fn: function (){
  13310. var self=this,$self=this;
  13311. return $self["@size"];
  13312. },
  13313. args: [],
  13314. source: "size\x0a\x09^ size",
  13315. referencedClasses: [],
  13316. messageSends: []
  13317. }),
  13318. $globals.Set);
  13319. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  13320. $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.";
  13321. $core.addMethod(
  13322. $core.method({
  13323. selector: "<<",
  13324. protocol: "writing",
  13325. fn: function (anObject){
  13326. var self=this,$self=this;
  13327. return $core.withContext(function($ctx1) {
  13328. $self._write_(anObject);
  13329. return self;
  13330. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  13331. },
  13332. args: ["anObject"],
  13333. source: "<< anObject\x0a\x09self write: anObject",
  13334. referencedClasses: [],
  13335. messageSends: ["write:"]
  13336. }),
  13337. $globals.ProtoStream);
  13338. $core.addMethod(
  13339. $core.method({
  13340. selector: "atEnd",
  13341. protocol: "testing",
  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,"atEnd",{},$globals.ProtoStream)});
  13348. },
  13349. args: [],
  13350. source: "atEnd\x0a\x09self subclassResponsibility",
  13351. referencedClasses: [],
  13352. messageSends: ["subclassResponsibility"]
  13353. }),
  13354. $globals.ProtoStream);
  13355. $core.addMethod(
  13356. $core.method({
  13357. selector: "atStart",
  13358. protocol: "testing",
  13359. fn: function (){
  13360. var self=this,$self=this;
  13361. return $core.withContext(function($ctx1) {
  13362. $self._subclassResponsibility();
  13363. return self;
  13364. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  13365. },
  13366. args: [],
  13367. source: "atStart\x0a\x09self subclassResponsibility",
  13368. referencedClasses: [],
  13369. messageSends: ["subclassResponsibility"]
  13370. }),
  13371. $globals.ProtoStream);
  13372. $core.addMethod(
  13373. $core.method({
  13374. selector: "contents",
  13375. protocol: "accessing",
  13376. fn: function (){
  13377. var self=this,$self=this;
  13378. return $core.withContext(function($ctx1) {
  13379. $self._subclassResponsibility();
  13380. return self;
  13381. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  13382. },
  13383. args: [],
  13384. source: "contents\x0a\x09self subclassResponsibility",
  13385. referencedClasses: [],
  13386. messageSends: ["subclassResponsibility"]
  13387. }),
  13388. $globals.ProtoStream);
  13389. $core.addMethod(
  13390. $core.method({
  13391. selector: "do:",
  13392. protocol: "enumerating",
  13393. fn: function (aBlock){
  13394. var self=this,$self=this;
  13395. return $core.withContext(function($ctx1) {
  13396. $recv((function(){
  13397. return $core.withContext(function($ctx2) {
  13398. return $self._atEnd();
  13399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13400. }))._whileFalse_((function(){
  13401. return $core.withContext(function($ctx2) {
  13402. return $recv(aBlock)._value_($self._next());
  13403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13404. }));
  13405. return self;
  13406. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  13407. },
  13408. args: ["aBlock"],
  13409. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13410. referencedClasses: [],
  13411. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13412. }),
  13413. $globals.ProtoStream);
  13414. $core.addMethod(
  13415. $core.method({
  13416. selector: "isEmpty",
  13417. protocol: "testing",
  13418. fn: function (){
  13419. var self=this,$self=this;
  13420. return $core.withContext(function($ctx1) {
  13421. return $recv($self._atStart())._and_((function(){
  13422. return $core.withContext(function($ctx2) {
  13423. return $self._atEnd();
  13424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13425. }));
  13426. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  13427. },
  13428. args: [],
  13429. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13430. referencedClasses: [],
  13431. messageSends: ["and:", "atStart", "atEnd"]
  13432. }),
  13433. $globals.ProtoStream);
  13434. $core.addMethod(
  13435. $core.method({
  13436. selector: "next",
  13437. protocol: "reading",
  13438. fn: function (){
  13439. var self=this,$self=this;
  13440. return $core.withContext(function($ctx1) {
  13441. var $1;
  13442. $1=$self._atEnd();
  13443. if($core.assert($1)){
  13444. return nil;
  13445. } else {
  13446. return $self._subclassResponsibility();
  13447. }
  13448. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  13449. },
  13450. args: [],
  13451. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13452. referencedClasses: [],
  13453. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13454. }),
  13455. $globals.ProtoStream);
  13456. $core.addMethod(
  13457. $core.method({
  13458. selector: "nextPut:",
  13459. protocol: "writing",
  13460. fn: function (anObject){
  13461. var self=this,$self=this;
  13462. return $core.withContext(function($ctx1) {
  13463. $self._subclassResponsibility();
  13464. return self;
  13465. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  13466. },
  13467. args: ["anObject"],
  13468. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13469. referencedClasses: [],
  13470. messageSends: ["subclassResponsibility"]
  13471. }),
  13472. $globals.ProtoStream);
  13473. $core.addMethod(
  13474. $core.method({
  13475. selector: "nextPutAll:",
  13476. protocol: "writing",
  13477. fn: function (aCollection){
  13478. var self=this,$self=this;
  13479. return $core.withContext(function($ctx1) {
  13480. $recv(aCollection)._do_((function(each){
  13481. return $core.withContext(function($ctx2) {
  13482. return $self._nextPut_(each);
  13483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13484. }));
  13485. return self;
  13486. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  13487. },
  13488. args: ["aCollection"],
  13489. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13490. referencedClasses: [],
  13491. messageSends: ["do:", "nextPut:"]
  13492. }),
  13493. $globals.ProtoStream);
  13494. $core.addMethod(
  13495. $core.method({
  13496. selector: "nextPutString:",
  13497. protocol: "writing",
  13498. fn: function (aString){
  13499. var self=this,$self=this;
  13500. return $core.withContext(function($ctx1) {
  13501. $self._nextPut_(aString);
  13502. return self;
  13503. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  13504. },
  13505. args: ["aString"],
  13506. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13507. referencedClasses: [],
  13508. messageSends: ["nextPut:"]
  13509. }),
  13510. $globals.ProtoStream);
  13511. $core.addMethod(
  13512. $core.method({
  13513. selector: "peek",
  13514. protocol: "reading",
  13515. fn: function (){
  13516. var self=this,$self=this;
  13517. return $core.withContext(function($ctx1) {
  13518. var $1;
  13519. $1=$self._atEnd();
  13520. if($core.assert($1)){
  13521. return nil;
  13522. } else {
  13523. return $self._subclassResponsibility();
  13524. }
  13525. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  13526. },
  13527. args: [],
  13528. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13529. referencedClasses: [],
  13530. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13531. }),
  13532. $globals.ProtoStream);
  13533. $core.addMethod(
  13534. $core.method({
  13535. selector: "reset",
  13536. protocol: "actions",
  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,"reset",{},$globals.ProtoStream)});
  13543. },
  13544. args: [],
  13545. source: "reset\x0a\x09self subclassResponsibility",
  13546. referencedClasses: [],
  13547. messageSends: ["subclassResponsibility"]
  13548. }),
  13549. $globals.ProtoStream);
  13550. $core.addMethod(
  13551. $core.method({
  13552. selector: "resetContents",
  13553. protocol: "actions",
  13554. fn: function (){
  13555. var self=this,$self=this;
  13556. return $core.withContext(function($ctx1) {
  13557. $self._subclassResponsibility();
  13558. return self;
  13559. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  13560. },
  13561. args: [],
  13562. source: "resetContents\x0a\x09self subclassResponsibility",
  13563. referencedClasses: [],
  13564. messageSends: ["subclassResponsibility"]
  13565. }),
  13566. $globals.ProtoStream);
  13567. $core.addMethod(
  13568. $core.method({
  13569. selector: "setToEnd",
  13570. protocol: "positioning",
  13571. fn: function (){
  13572. var self=this,$self=this;
  13573. return $core.withContext(function($ctx1) {
  13574. $self._subclassResponsibility();
  13575. return self;
  13576. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13577. },
  13578. args: [],
  13579. source: "setToEnd\x0a\x09self subclassResponsibility",
  13580. referencedClasses: [],
  13581. messageSends: ["subclassResponsibility"]
  13582. }),
  13583. $globals.ProtoStream);
  13584. $core.addMethod(
  13585. $core.method({
  13586. selector: "setToStart",
  13587. protocol: "positioning",
  13588. fn: function (){
  13589. var self=this,$self=this;
  13590. return $core.withContext(function($ctx1) {
  13591. $self._reset();
  13592. return self;
  13593. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13594. },
  13595. args: [],
  13596. source: "setToStart\x0a\x09self reset",
  13597. referencedClasses: [],
  13598. messageSends: ["reset"]
  13599. }),
  13600. $globals.ProtoStream);
  13601. $core.addMethod(
  13602. $core.method({
  13603. selector: "write:",
  13604. protocol: "writing",
  13605. fn: function (anObject){
  13606. var self=this,$self=this;
  13607. return $core.withContext(function($ctx1) {
  13608. $recv(anObject)._putOn_(self);
  13609. return self;
  13610. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13611. },
  13612. args: ["anObject"],
  13613. source: "write: anObject\x0a\x09anObject putOn: self",
  13614. referencedClasses: [],
  13615. messageSends: ["putOn:"]
  13616. }),
  13617. $globals.ProtoStream);
  13618. $core.addMethod(
  13619. $core.method({
  13620. selector: "on:",
  13621. protocol: "instance creation",
  13622. fn: function (aCollection){
  13623. var self=this,$self=this;
  13624. return $core.withContext(function($ctx1) {
  13625. var $1;
  13626. $1=$self._new();
  13627. $recv($1)._setCollection_(aCollection);
  13628. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13629. return $recv($1)._yourself();
  13630. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13631. },
  13632. args: ["aCollection"],
  13633. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13634. referencedClasses: [],
  13635. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13636. }),
  13637. $globals.ProtoStream.a$cls);
  13638. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13639. $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.";
  13640. $core.addMethod(
  13641. $core.method({
  13642. selector: "atEnd",
  13643. protocol: "testing",
  13644. fn: function (){
  13645. var self=this,$self=this;
  13646. return $core.withContext(function($ctx1) {
  13647. return $recv($self._position()).__eq($self._size());
  13648. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13649. },
  13650. args: [],
  13651. source: "atEnd\x0a\x09^ self position = self size",
  13652. referencedClasses: [],
  13653. messageSends: ["=", "position", "size"]
  13654. }),
  13655. $globals.Stream);
  13656. $core.addMethod(
  13657. $core.method({
  13658. selector: "atStart",
  13659. protocol: "testing",
  13660. fn: function (){
  13661. var self=this,$self=this;
  13662. return $core.withContext(function($ctx1) {
  13663. return $recv($self._position()).__eq((0));
  13664. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13665. },
  13666. args: [],
  13667. source: "atStart\x0a\x09^ self position = 0",
  13668. referencedClasses: [],
  13669. messageSends: ["=", "position"]
  13670. }),
  13671. $globals.Stream);
  13672. $core.addMethod(
  13673. $core.method({
  13674. selector: "close",
  13675. protocol: "actions",
  13676. fn: function (){
  13677. var self=this,$self=this;
  13678. return self;
  13679. },
  13680. args: [],
  13681. source: "close",
  13682. referencedClasses: [],
  13683. messageSends: []
  13684. }),
  13685. $globals.Stream);
  13686. $core.addMethod(
  13687. $core.method({
  13688. selector: "collection",
  13689. protocol: "accessing",
  13690. fn: function (){
  13691. var self=this,$self=this;
  13692. return $self["@collection"];
  13693. },
  13694. args: [],
  13695. source: "collection\x0a\x09^ collection",
  13696. referencedClasses: [],
  13697. messageSends: []
  13698. }),
  13699. $globals.Stream);
  13700. $core.addMethod(
  13701. $core.method({
  13702. selector: "contents",
  13703. protocol: "accessing",
  13704. fn: function (){
  13705. var self=this,$self=this;
  13706. return $core.withContext(function($ctx1) {
  13707. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13708. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13709. },
  13710. args: [],
  13711. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13712. referencedClasses: [],
  13713. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13714. }),
  13715. $globals.Stream);
  13716. $core.addMethod(
  13717. $core.method({
  13718. selector: "flush",
  13719. protocol: "actions",
  13720. fn: function (){
  13721. var self=this,$self=this;
  13722. return self;
  13723. },
  13724. args: [],
  13725. source: "flush",
  13726. referencedClasses: [],
  13727. messageSends: []
  13728. }),
  13729. $globals.Stream);
  13730. $core.addMethod(
  13731. $core.method({
  13732. selector: "isEmpty",
  13733. protocol: "testing",
  13734. fn: function (){
  13735. var self=this,$self=this;
  13736. return $core.withContext(function($ctx1) {
  13737. return $recv($self._size()).__eq((0));
  13738. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13739. },
  13740. args: [],
  13741. source: "isEmpty\x0a\x09^ self size = 0",
  13742. referencedClasses: [],
  13743. messageSends: ["=", "size"]
  13744. }),
  13745. $globals.Stream);
  13746. $core.addMethod(
  13747. $core.method({
  13748. selector: "next",
  13749. protocol: "reading",
  13750. fn: function (){
  13751. var self=this,$self=this;
  13752. return $core.withContext(function($ctx1) {
  13753. var $1,$3,$2;
  13754. $1=$self._atEnd();
  13755. if($core.assert($1)){
  13756. return nil;
  13757. } else {
  13758. $3=$self._position();
  13759. $ctx1.sendIdx["position"]=1;
  13760. $2=$recv($3).__plus((1));
  13761. $self._position_($2);
  13762. return $recv($self["@collection"])._at_($self._position());
  13763. }
  13764. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13765. },
  13766. args: [],
  13767. 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 ]",
  13768. referencedClasses: [],
  13769. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13770. }),
  13771. $globals.Stream);
  13772. $core.addMethod(
  13773. $core.method({
  13774. selector: "next:",
  13775. protocol: "reading",
  13776. fn: function (anInteger){
  13777. var self=this,$self=this;
  13778. var tempCollection;
  13779. return $core.withContext(function($ctx1) {
  13780. var $1;
  13781. tempCollection=$recv($recv($self._collection())._class())._new();
  13782. $recv(anInteger)._timesRepeat_((function(){
  13783. return $core.withContext(function($ctx2) {
  13784. $1=$self._atEnd();
  13785. if(!$core.assert($1)){
  13786. return $recv(tempCollection)._add_($self._next());
  13787. }
  13788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13789. }));
  13790. return tempCollection;
  13791. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13792. },
  13793. args: ["anInteger"],
  13794. 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",
  13795. referencedClasses: [],
  13796. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13797. }),
  13798. $globals.Stream);
  13799. $core.addMethod(
  13800. $core.method({
  13801. selector: "nextPut:",
  13802. protocol: "writing",
  13803. fn: function (anObject){
  13804. var self=this,$self=this;
  13805. return $core.withContext(function($ctx1) {
  13806. var $2,$1,$3,$4;
  13807. $2=$self._position();
  13808. $ctx1.sendIdx["position"]=1;
  13809. $1=$recv($2).__plus((1));
  13810. $self._position_($1);
  13811. $3=$self._collection();
  13812. $4=$self._position();
  13813. $ctx1.sendIdx["position"]=2;
  13814. $recv($3)._at_put_($4,anObject);
  13815. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13816. return self;
  13817. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13818. },
  13819. args: ["anObject"],
  13820. 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)",
  13821. referencedClasses: [],
  13822. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13823. }),
  13824. $globals.Stream);
  13825. $core.addMethod(
  13826. $core.method({
  13827. selector: "peek",
  13828. protocol: "reading",
  13829. fn: function (){
  13830. var self=this,$self=this;
  13831. return $core.withContext(function($ctx1) {
  13832. var $1;
  13833. $1=$self._atEnd();
  13834. if(!$core.assert($1)){
  13835. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13836. }
  13837. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13838. },
  13839. args: [],
  13840. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13841. referencedClasses: [],
  13842. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13843. }),
  13844. $globals.Stream);
  13845. $core.addMethod(
  13846. $core.method({
  13847. selector: "position",
  13848. protocol: "accessing",
  13849. fn: function (){
  13850. var self=this,$self=this;
  13851. return $core.withContext(function($ctx1) {
  13852. var $1,$receiver;
  13853. $1=$self["@position"];
  13854. if(($receiver = $1) == null || $receiver.a$nil){
  13855. $self["@position"]=(0);
  13856. return $self["@position"];
  13857. } else {
  13858. return $1;
  13859. }
  13860. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13861. },
  13862. args: [],
  13863. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13864. referencedClasses: [],
  13865. messageSends: ["ifNil:"]
  13866. }),
  13867. $globals.Stream);
  13868. $core.addMethod(
  13869. $core.method({
  13870. selector: "position:",
  13871. protocol: "accessing",
  13872. fn: function (anInteger){
  13873. var self=this,$self=this;
  13874. $self["@position"]=anInteger;
  13875. return self;
  13876. },
  13877. args: ["anInteger"],
  13878. source: "position: anInteger\x0a\x09position := anInteger",
  13879. referencedClasses: [],
  13880. messageSends: []
  13881. }),
  13882. $globals.Stream);
  13883. $core.addMethod(
  13884. $core.method({
  13885. selector: "reset",
  13886. protocol: "actions",
  13887. fn: function (){
  13888. var self=this,$self=this;
  13889. return $core.withContext(function($ctx1) {
  13890. $self._position_((0));
  13891. return self;
  13892. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13893. },
  13894. args: [],
  13895. source: "reset\x0a\x09self position: 0",
  13896. referencedClasses: [],
  13897. messageSends: ["position:"]
  13898. }),
  13899. $globals.Stream);
  13900. $core.addMethod(
  13901. $core.method({
  13902. selector: "resetContents",
  13903. protocol: "actions",
  13904. fn: function (){
  13905. var self=this,$self=this;
  13906. return $core.withContext(function($ctx1) {
  13907. $self._reset();
  13908. $self._setStreamSize_((0));
  13909. return self;
  13910. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13911. },
  13912. args: [],
  13913. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13914. referencedClasses: [],
  13915. messageSends: ["reset", "setStreamSize:"]
  13916. }),
  13917. $globals.Stream);
  13918. $core.addMethod(
  13919. $core.method({
  13920. selector: "setCollection:",
  13921. protocol: "accessing",
  13922. fn: function (aCollection){
  13923. var self=this,$self=this;
  13924. $self["@collection"]=aCollection;
  13925. return self;
  13926. },
  13927. args: ["aCollection"],
  13928. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13929. referencedClasses: [],
  13930. messageSends: []
  13931. }),
  13932. $globals.Stream);
  13933. $core.addMethod(
  13934. $core.method({
  13935. selector: "setStreamSize:",
  13936. protocol: "accessing",
  13937. fn: function (anInteger){
  13938. var self=this,$self=this;
  13939. $self["@streamSize"]=anInteger;
  13940. return self;
  13941. },
  13942. args: ["anInteger"],
  13943. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13944. referencedClasses: [],
  13945. messageSends: []
  13946. }),
  13947. $globals.Stream);
  13948. $core.addMethod(
  13949. $core.method({
  13950. selector: "setToEnd",
  13951. protocol: "positioning",
  13952. fn: function (){
  13953. var self=this,$self=this;
  13954. return $core.withContext(function($ctx1) {
  13955. $self._position_($self._size());
  13956. return self;
  13957. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13958. },
  13959. args: [],
  13960. source: "setToEnd\x0a\x09self position: self size",
  13961. referencedClasses: [],
  13962. messageSends: ["position:", "size"]
  13963. }),
  13964. $globals.Stream);
  13965. $core.addMethod(
  13966. $core.method({
  13967. selector: "size",
  13968. protocol: "accessing",
  13969. fn: function (){
  13970. var self=this,$self=this;
  13971. return $core.withContext(function($ctx1) {
  13972. return $self._streamSize();
  13973. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13974. },
  13975. args: [],
  13976. source: "size\x0a\x09^ self streamSize",
  13977. referencedClasses: [],
  13978. messageSends: ["streamSize"]
  13979. }),
  13980. $globals.Stream);
  13981. $core.addMethod(
  13982. $core.method({
  13983. selector: "skip:",
  13984. protocol: "positioning",
  13985. fn: function (anInteger){
  13986. var self=this,$self=this;
  13987. return $core.withContext(function($ctx1) {
  13988. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13989. return self;
  13990. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13991. },
  13992. args: ["anInteger"],
  13993. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13994. referencedClasses: [],
  13995. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13996. }),
  13997. $globals.Stream);
  13998. $core.addMethod(
  13999. $core.method({
  14000. selector: "streamSize",
  14001. protocol: "accessing",
  14002. fn: function (){
  14003. var self=this,$self=this;
  14004. return $self["@streamSize"];
  14005. },
  14006. args: [],
  14007. source: "streamSize\x0a\x09^ streamSize",
  14008. referencedClasses: [],
  14009. messageSends: []
  14010. }),
  14011. $globals.Stream);
  14012. $core.addMethod(
  14013. $core.method({
  14014. selector: "on:",
  14015. protocol: "instance creation",
  14016. fn: function (aCollection){
  14017. var self=this,$self=this;
  14018. return $core.withContext(function($ctx1) {
  14019. var $1;
  14020. $1=$self._new();
  14021. $recv($1)._setCollection_(aCollection);
  14022. $recv($1)._setStreamSize_($recv(aCollection)._size());
  14023. return $recv($1)._yourself();
  14024. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  14025. },
  14026. args: ["aCollection"],
  14027. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  14028. referencedClasses: [],
  14029. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  14030. }),
  14031. $globals.Stream.a$cls);
  14032. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  14033. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  14034. $core.addMethod(
  14035. $core.method({
  14036. selector: "cr",
  14037. protocol: "writing",
  14038. fn: function (){
  14039. var self=this,$self=this;
  14040. return $core.withContext(function($ctx1) {
  14041. return $self._nextPutAll_($recv($globals.String)._cr());
  14042. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  14043. },
  14044. args: [],
  14045. source: "cr\x0a\x09^ self nextPutAll: String cr",
  14046. referencedClasses: ["String"],
  14047. messageSends: ["nextPutAll:", "cr"]
  14048. }),
  14049. $globals.StringStream);
  14050. $core.addMethod(
  14051. $core.method({
  14052. selector: "crlf",
  14053. protocol: "writing",
  14054. fn: function (){
  14055. var self=this,$self=this;
  14056. return $core.withContext(function($ctx1) {
  14057. return $self._nextPutAll_($recv($globals.String)._crlf());
  14058. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  14059. },
  14060. args: [],
  14061. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  14062. referencedClasses: ["String"],
  14063. messageSends: ["nextPutAll:", "crlf"]
  14064. }),
  14065. $globals.StringStream);
  14066. $core.addMethod(
  14067. $core.method({
  14068. selector: "lf",
  14069. protocol: "writing",
  14070. fn: function (){
  14071. var self=this,$self=this;
  14072. return $core.withContext(function($ctx1) {
  14073. return $self._nextPutAll_($recv($globals.String)._lf());
  14074. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  14075. },
  14076. args: [],
  14077. source: "lf\x0a\x09^ self nextPutAll: String lf",
  14078. referencedClasses: ["String"],
  14079. messageSends: ["nextPutAll:", "lf"]
  14080. }),
  14081. $globals.StringStream);
  14082. $core.addMethod(
  14083. $core.method({
  14084. selector: "next:",
  14085. protocol: "reading",
  14086. fn: function (anInteger){
  14087. var self=this,$self=this;
  14088. var tempCollection;
  14089. return $core.withContext(function($ctx1) {
  14090. var $1;
  14091. tempCollection=$recv($recv($self._collection())._class())._new();
  14092. $recv(anInteger)._timesRepeat_((function(){
  14093. return $core.withContext(function($ctx2) {
  14094. $1=$self._atEnd();
  14095. if(!$core.assert($1)){
  14096. tempCollection=$recv(tempCollection).__comma($self._next());
  14097. return tempCollection;
  14098. }
  14099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14100. }));
  14101. return tempCollection;
  14102. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  14103. },
  14104. args: ["anInteger"],
  14105. 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",
  14106. referencedClasses: [],
  14107. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  14108. }),
  14109. $globals.StringStream);
  14110. $core.addMethod(
  14111. $core.method({
  14112. selector: "nextPut:",
  14113. protocol: "writing",
  14114. fn: function (aString){
  14115. var self=this,$self=this;
  14116. return $core.withContext(function($ctx1) {
  14117. $self._nextPutAll_(aString);
  14118. return self;
  14119. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  14120. },
  14121. args: ["aString"],
  14122. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14123. referencedClasses: [],
  14124. messageSends: ["nextPutAll:"]
  14125. }),
  14126. $globals.StringStream);
  14127. $core.addMethod(
  14128. $core.method({
  14129. selector: "nextPutAll:",
  14130. protocol: "writing",
  14131. fn: function (aString){
  14132. var self=this,$self=this;
  14133. var pre,post;
  14134. return $core.withContext(function($ctx1) {
  14135. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  14136. $1=$self._atEnd();
  14137. if($core.assert($1)){
  14138. $3=$self._collection();
  14139. $ctx1.sendIdx["collection"]=1;
  14140. $2=$recv($3).__comma(aString);
  14141. $ctx1.sendIdx[","]=1;
  14142. $self._setCollection_($2);
  14143. $ctx1.sendIdx["setCollection:"]=1;
  14144. } else {
  14145. $4=$self._collection();
  14146. $ctx1.sendIdx["collection"]=2;
  14147. $5=$self._position();
  14148. $ctx1.sendIdx["position"]=1;
  14149. pre=$recv($4)._copyFrom_to_((1),$5);
  14150. $ctx1.sendIdx["copyFrom:to:"]=1;
  14151. pre;
  14152. $6=$self._collection();
  14153. $ctx1.sendIdx["collection"]=3;
  14154. $9=$self._position();
  14155. $ctx1.sendIdx["position"]=2;
  14156. $8=$recv($9).__plus((1));
  14157. $ctx1.sendIdx["+"]=2;
  14158. $10=$recv(aString)._size();
  14159. $ctx1.sendIdx["size"]=1;
  14160. $7=$recv($8).__plus($10);
  14161. $ctx1.sendIdx["+"]=1;
  14162. $11=$recv($self._collection())._size();
  14163. $ctx1.sendIdx["size"]=2;
  14164. post=$recv($6)._copyFrom_to_($7,$11);
  14165. post;
  14166. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  14167. $ctx1.sendIdx[","]=2;
  14168. $self._setCollection_($12);
  14169. }
  14170. $14=$self._position();
  14171. $ctx1.sendIdx["position"]=3;
  14172. $13=$recv($14).__plus($recv(aString)._size());
  14173. $self._position_($13);
  14174. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  14175. return self;
  14176. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  14177. },
  14178. args: ["aString"],
  14179. 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)",
  14180. referencedClasses: [],
  14181. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  14182. }),
  14183. $globals.StringStream);
  14184. $core.addMethod(
  14185. $core.method({
  14186. selector: "nextPutString:",
  14187. protocol: "writing",
  14188. fn: function (aString){
  14189. var self=this,$self=this;
  14190. return $core.withContext(function($ctx1) {
  14191. $self._nextPutAll_(aString);
  14192. return self;
  14193. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  14194. },
  14195. args: ["aString"],
  14196. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14197. referencedClasses: [],
  14198. messageSends: ["nextPutAll:"]
  14199. }),
  14200. $globals.StringStream);
  14201. $core.addMethod(
  14202. $core.method({
  14203. selector: "print:",
  14204. protocol: "writing",
  14205. fn: function (anObject){
  14206. var self=this,$self=this;
  14207. return $core.withContext(function($ctx1) {
  14208. $recv(anObject)._printOn_(self);
  14209. return self;
  14210. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  14211. },
  14212. args: ["anObject"],
  14213. source: "print: anObject\x0a\x09anObject printOn: self",
  14214. referencedClasses: [],
  14215. messageSends: ["printOn:"]
  14216. }),
  14217. $globals.StringStream);
  14218. $core.addMethod(
  14219. $core.method({
  14220. selector: "printSymbol:",
  14221. protocol: "writing",
  14222. fn: function (anObject){
  14223. var self=this,$self=this;
  14224. return $core.withContext(function($ctx1) {
  14225. $recv(anObject)._asSymbolPrintOn_(self);
  14226. return self;
  14227. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  14228. },
  14229. args: ["anObject"],
  14230. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  14231. referencedClasses: [],
  14232. messageSends: ["asSymbolPrintOn:"]
  14233. }),
  14234. $globals.StringStream);
  14235. $core.addMethod(
  14236. $core.method({
  14237. selector: "space",
  14238. protocol: "writing",
  14239. fn: function (){
  14240. var self=this,$self=this;
  14241. return $core.withContext(function($ctx1) {
  14242. $self._nextPut_(" ");
  14243. return self;
  14244. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  14245. },
  14246. args: [],
  14247. source: "space\x0a\x09self nextPut: ' '",
  14248. referencedClasses: [],
  14249. messageSends: ["nextPut:"]
  14250. }),
  14251. $globals.StringStream);
  14252. $core.addMethod(
  14253. $core.method({
  14254. selector: "tab",
  14255. protocol: "writing",
  14256. fn: function (){
  14257. var self=this,$self=this;
  14258. return $core.withContext(function($ctx1) {
  14259. return $self._nextPutAll_($recv($globals.String)._tab());
  14260. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  14261. },
  14262. args: [],
  14263. source: "tab\x0a\x09^ self nextPutAll: String tab",
  14264. referencedClasses: ["String"],
  14265. messageSends: ["nextPutAll:", "tab"]
  14266. }),
  14267. $globals.StringStream);
  14268. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  14269. $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.";
  14270. $core.addMethod(
  14271. $core.method({
  14272. selector: "initialize",
  14273. protocol: "initialization",
  14274. fn: function (){
  14275. var self=this,$self=this;
  14276. return $core.withContext(function($ctx1) {
  14277. (
  14278. $ctx1.supercall = true,
  14279. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  14280. $ctx1.supercall = false;
  14281. $self["@read"]=$recv($globals.OrderedCollection)._new();
  14282. $ctx1.sendIdx["new"]=1;
  14283. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14284. $self["@readIndex"]=(1);
  14285. return self;
  14286. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  14287. },
  14288. args: [],
  14289. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14290. referencedClasses: ["OrderedCollection"],
  14291. messageSends: ["initialize", "new"]
  14292. }),
  14293. $globals.Queue);
  14294. $core.addMethod(
  14295. $core.method({
  14296. selector: "next",
  14297. protocol: "accessing",
  14298. fn: function (){
  14299. var self=this,$self=this;
  14300. return $core.withContext(function($ctx1) {
  14301. return $self._nextIfAbsent_((function(){
  14302. return $core.withContext(function($ctx2) {
  14303. return $self._error_("Cannot read from empty Queue.");
  14304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14305. }));
  14306. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  14307. },
  14308. args: [],
  14309. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14310. referencedClasses: [],
  14311. messageSends: ["nextIfAbsent:", "error:"]
  14312. }),
  14313. $globals.Queue);
  14314. $core.addMethod(
  14315. $core.method({
  14316. selector: "nextIfAbsent:",
  14317. protocol: "accessing",
  14318. fn: function (aBlock){
  14319. var self=this,$self=this;
  14320. var result;
  14321. return $core.withContext(function($ctx1) {
  14322. var $1;
  14323. var $early={};
  14324. try {
  14325. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  14326. return $core.withContext(function($ctx2) {
  14327. $recv($self["@write"])._ifEmpty_((function(){
  14328. return $core.withContext(function($ctx3) {
  14329. $1=$recv($self["@readIndex"]).__gt((1));
  14330. if($core.assert($1)){
  14331. $self["@read"]=[];
  14332. $self["@read"];
  14333. $self["@readIndex"]=(1);
  14334. $self["@readIndex"];
  14335. }
  14336. throw $early=[$recv(aBlock)._value()];
  14337. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14338. }));
  14339. $self["@read"]=$self["@write"];
  14340. $self["@read"];
  14341. $self["@readIndex"]=(1);
  14342. $self["@readIndex"];
  14343. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14344. $self["@write"];
  14345. return $recv($self["@read"])._first();
  14346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14347. }));
  14348. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  14349. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  14350. return result;
  14351. }
  14352. catch(e) {if(e===$early)return e[0]; throw e}
  14353. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  14354. },
  14355. args: ["aBlock"],
  14356. 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",
  14357. referencedClasses: ["OrderedCollection"],
  14358. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  14359. }),
  14360. $globals.Queue);
  14361. $core.addMethod(
  14362. $core.method({
  14363. selector: "nextPut:",
  14364. protocol: "accessing",
  14365. fn: function (anObject){
  14366. var self=this,$self=this;
  14367. return $core.withContext(function($ctx1) {
  14368. $recv($self["@write"])._add_(anObject);
  14369. return self;
  14370. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  14371. },
  14372. args: ["anObject"],
  14373. source: "nextPut: anObject\x0a\x09write add: anObject",
  14374. referencedClasses: [],
  14375. messageSends: ["add:"]
  14376. }),
  14377. $globals.Queue);
  14378. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  14379. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14380. $core.addMethod(
  14381. $core.method({
  14382. selector: "compile:",
  14383. protocol: "evaluating",
  14384. fn: function (aString){
  14385. var self=this,$self=this;
  14386. return $core.withContext(function($ctx1) {
  14387. return self.compile(aString);
  14388. return self;
  14389. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  14390. },
  14391. args: ["aString"],
  14392. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  14393. referencedClasses: [],
  14394. messageSends: []
  14395. }),
  14396. $globals.RegularExpression);
  14397. $core.addMethod(
  14398. $core.method({
  14399. selector: "exec:",
  14400. protocol: "evaluating",
  14401. fn: function (aString){
  14402. var self=this,$self=this;
  14403. return $core.withContext(function($ctx1) {
  14404. return self.exec(aString) || nil;
  14405. return self;
  14406. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  14407. },
  14408. args: ["aString"],
  14409. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  14410. referencedClasses: [],
  14411. messageSends: []
  14412. }),
  14413. $globals.RegularExpression);
  14414. $core.addMethod(
  14415. $core.method({
  14416. selector: "test:",
  14417. protocol: "evaluating",
  14418. fn: function (aString){
  14419. var self=this,$self=this;
  14420. return $core.withContext(function($ctx1) {
  14421. return self.test(aString);
  14422. return self;
  14423. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  14424. },
  14425. args: ["aString"],
  14426. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14427. referencedClasses: [],
  14428. messageSends: []
  14429. }),
  14430. $globals.RegularExpression);
  14431. $core.addMethod(
  14432. $core.method({
  14433. selector: "fromString:",
  14434. protocol: "instance creation",
  14435. fn: function (aString){
  14436. var self=this,$self=this;
  14437. return $core.withContext(function($ctx1) {
  14438. return $self._fromString_flag_(aString,"");
  14439. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  14440. },
  14441. args: ["aString"],
  14442. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14443. referencedClasses: [],
  14444. messageSends: ["fromString:flag:"]
  14445. }),
  14446. $globals.RegularExpression.a$cls);
  14447. $core.addMethod(
  14448. $core.method({
  14449. selector: "fromString:flag:",
  14450. protocol: "instance creation",
  14451. fn: function (aString,anotherString){
  14452. var self=this,$self=this;
  14453. return $core.withContext(function($ctx1) {
  14454. return new RegExp(aString, anotherString);
  14455. return self;
  14456. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  14457. },
  14458. args: ["aString", "anotherString"],
  14459. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14460. referencedClasses: [],
  14461. messageSends: []
  14462. }),
  14463. $globals.RegularExpression.a$cls);
  14464. });
  14465. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14466. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14467. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14468. $core.addPackage("Kernel-Classes");
  14469. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  14470. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  14471. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14472. $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.";
  14473. $core.addMethod(
  14474. $core.method({
  14475. selector: "allInstanceVariableNames",
  14476. protocol: "accessing",
  14477. fn: function (){
  14478. var self=this,$self=this;
  14479. var result;
  14480. return $core.withContext(function($ctx1) {
  14481. var $1,$receiver;
  14482. result=$recv($self._instanceVariableNames())._copy();
  14483. $1=$self._superclass();
  14484. $ctx1.sendIdx["superclass"]=1;
  14485. if(($receiver = $1) == null || $receiver.a$nil){
  14486. $1;
  14487. } else {
  14488. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14489. }
  14490. return result;
  14491. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14492. },
  14493. args: [],
  14494. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14495. referencedClasses: [],
  14496. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14497. }),
  14498. $globals.Behavior);
  14499. $core.addMethod(
  14500. $core.method({
  14501. selector: "allSelectors",
  14502. protocol: "accessing",
  14503. fn: function (){
  14504. var self=this,$self=this;
  14505. return $core.withContext(function($ctx1) {
  14506. var $1,$2;
  14507. $1=$self._allSuperclasses();
  14508. $2=$self._selectors();
  14509. $ctx1.sendIdx["selectors"]=1;
  14510. return $recv($1)._inject_into_($2,(function(acc,each){
  14511. return $core.withContext(function($ctx2) {
  14512. $recv(acc)._addAll_($recv(each)._selectors());
  14513. return $recv(acc)._yourself();
  14514. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14515. }));
  14516. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14517. },
  14518. args: [],
  14519. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14520. referencedClasses: [],
  14521. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14522. }),
  14523. $globals.Behavior);
  14524. $core.addMethod(
  14525. $core.method({
  14526. selector: "allSubclasses",
  14527. protocol: "accessing",
  14528. fn: function (){
  14529. var self=this,$self=this;
  14530. return $core.withContext(function($ctx1) {
  14531. return $recv($globals.Array)._streamContents_((function(str){
  14532. return $core.withContext(function($ctx2) {
  14533. return $self._allSubclassesDo_((function(each){
  14534. return $core.withContext(function($ctx3) {
  14535. return $recv(str)._nextPut_(each);
  14536. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14537. }));
  14538. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14539. }));
  14540. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14541. },
  14542. args: [],
  14543. 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 ] ]",
  14544. referencedClasses: ["Array"],
  14545. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14546. }),
  14547. $globals.Behavior);
  14548. $core.addMethod(
  14549. $core.method({
  14550. selector: "allSubclassesDo:",
  14551. protocol: "enumerating",
  14552. fn: function (aBlock){
  14553. var self=this,$self=this;
  14554. return $core.withContext(function($ctx1) {
  14555. $core.traverseClassTree(self, function(subclass) {
  14556. if (subclass !== self) aBlock._value_(subclass);
  14557. });
  14558. return self;
  14559. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14560. },
  14561. args: ["aBlock"],
  14562. 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})'>",
  14563. referencedClasses: [],
  14564. messageSends: []
  14565. }),
  14566. $globals.Behavior);
  14567. $core.addMethod(
  14568. $core.method({
  14569. selector: "allSuperclasses",
  14570. protocol: "accessing",
  14571. fn: function (){
  14572. var self=this,$self=this;
  14573. return $core.withContext(function($ctx1) {
  14574. var $1,$3,$2,$receiver;
  14575. $1=$self._superclass();
  14576. $ctx1.sendIdx["superclass"]=1;
  14577. if(($receiver = $1) == null || $receiver.a$nil){
  14578. return [];
  14579. } else {
  14580. $1;
  14581. }
  14582. $3=$self._superclass();
  14583. $ctx1.sendIdx["superclass"]=2;
  14584. $2=$recv($globals.OrderedCollection)._with_($3);
  14585. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14586. return $recv($2)._yourself();
  14587. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14588. },
  14589. args: [],
  14590. 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",
  14591. referencedClasses: ["OrderedCollection"],
  14592. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14593. }),
  14594. $globals.Behavior);
  14595. $core.addMethod(
  14596. $core.method({
  14597. selector: "basicNew",
  14598. protocol: "instance creation",
  14599. fn: function (){
  14600. var self=this,$self=this;
  14601. return $core.withContext(function($ctx1) {
  14602. return new self.fn();
  14603. return self;
  14604. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14605. },
  14606. args: [],
  14607. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14608. referencedClasses: [],
  14609. messageSends: []
  14610. }),
  14611. $globals.Behavior);
  14612. $core.addMethod(
  14613. $core.method({
  14614. selector: "basicOrganization",
  14615. protocol: "accessing",
  14616. fn: function (){
  14617. var self=this,$self=this;
  14618. return $self["@organization"];
  14619. },
  14620. args: [],
  14621. source: "basicOrganization\x0a\x09^ organization",
  14622. referencedClasses: [],
  14623. messageSends: []
  14624. }),
  14625. $globals.Behavior);
  14626. $core.addMethod(
  14627. $core.method({
  14628. selector: "basicOrganization:",
  14629. protocol: "accessing",
  14630. fn: function (aClassOrganizer){
  14631. var self=this,$self=this;
  14632. $self["@organization"]=aClassOrganizer;
  14633. return self;
  14634. },
  14635. args: ["aClassOrganizer"],
  14636. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14637. referencedClasses: [],
  14638. messageSends: []
  14639. }),
  14640. $globals.Behavior);
  14641. $core.addMethod(
  14642. $core.method({
  14643. selector: "canUnderstand:",
  14644. protocol: "testing",
  14645. fn: function (aSelector){
  14646. var self=this,$self=this;
  14647. return $core.withContext(function($ctx1) {
  14648. var $2,$1;
  14649. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14650. return $core.withContext(function($ctx2) {
  14651. $2=$self._superclass();
  14652. $ctx2.sendIdx["superclass"]=1;
  14653. $1=$recv($2)._notNil();
  14654. return $recv($1)._and_((function(){
  14655. return $core.withContext(function($ctx3) {
  14656. return $recv($self._superclass())._canUnderstand_(aSelector);
  14657. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14658. }));
  14659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14660. }));
  14661. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14662. },
  14663. args: ["aSelector"],
  14664. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14665. referencedClasses: [],
  14666. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14667. }),
  14668. $globals.Behavior);
  14669. $core.addMethod(
  14670. $core.method({
  14671. selector: "includesBehavior:",
  14672. protocol: "testing",
  14673. fn: function (aClass){
  14674. var self=this,$self=this;
  14675. return $core.withContext(function($ctx1) {
  14676. return $recv($self.__eq_eq(aClass))._or_((function(){
  14677. return $core.withContext(function($ctx2) {
  14678. return $self._inheritsFrom_(aClass);
  14679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14680. }));
  14681. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14682. },
  14683. args: ["aClass"],
  14684. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14685. referencedClasses: [],
  14686. messageSends: ["or:", "==", "inheritsFrom:"]
  14687. }),
  14688. $globals.Behavior);
  14689. $core.addMethod(
  14690. $core.method({
  14691. selector: "inheritsFrom:",
  14692. protocol: "testing",
  14693. fn: function (aClass){
  14694. var self=this,$self=this;
  14695. return $core.withContext(function($ctx1) {
  14696. var $1,$3,$2,$receiver;
  14697. $1=$self._superclass();
  14698. $ctx1.sendIdx["superclass"]=1;
  14699. if(($receiver = $1) == null || $receiver.a$nil){
  14700. return false;
  14701. } else {
  14702. $1;
  14703. }
  14704. $3=$self._superclass();
  14705. $ctx1.sendIdx["superclass"]=2;
  14706. $2=$recv(aClass).__eq_eq($3);
  14707. return $recv($2)._or_((function(){
  14708. return $core.withContext(function($ctx2) {
  14709. return $recv($self._superclass())._inheritsFrom_(aClass);
  14710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14711. }));
  14712. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14713. },
  14714. args: ["aClass"],
  14715. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14716. referencedClasses: [],
  14717. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14718. }),
  14719. $globals.Behavior);
  14720. $core.addMethod(
  14721. $core.method({
  14722. selector: "instanceVariableNames",
  14723. protocol: "accessing",
  14724. fn: function (){
  14725. var self=this,$self=this;
  14726. return $core.withContext(function($ctx1) {
  14727. return self.iVarNames;
  14728. return self;
  14729. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14730. },
  14731. args: [],
  14732. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14733. referencedClasses: [],
  14734. messageSends: []
  14735. }),
  14736. $globals.Behavior);
  14737. $core.addMethod(
  14738. $core.method({
  14739. selector: "isBehavior",
  14740. protocol: "testing",
  14741. fn: function (){
  14742. var self=this,$self=this;
  14743. return true;
  14744. },
  14745. args: [],
  14746. source: "isBehavior\x0a\x09^ true",
  14747. referencedClasses: [],
  14748. messageSends: []
  14749. }),
  14750. $globals.Behavior);
  14751. $core.addMethod(
  14752. $core.method({
  14753. selector: "javascriptConstructor",
  14754. protocol: "accessing",
  14755. fn: function (){
  14756. var self=this,$self=this;
  14757. return $core.withContext(function($ctx1) {
  14758. return self.fn;
  14759. return self;
  14760. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14761. },
  14762. args: [],
  14763. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14764. referencedClasses: [],
  14765. messageSends: []
  14766. }),
  14767. $globals.Behavior);
  14768. $core.addMethod(
  14769. $core.method({
  14770. selector: "javascriptConstructor:",
  14771. protocol: "accessing",
  14772. fn: function (aJavaScriptFunction){
  14773. var self=this,$self=this;
  14774. return $core.withContext(function($ctx1) {
  14775. $core.setClassConstructor(self, aJavaScriptFunction);;
  14776. return self;
  14777. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14778. },
  14779. args: ["aJavaScriptFunction"],
  14780. 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);'>",
  14781. referencedClasses: [],
  14782. messageSends: []
  14783. }),
  14784. $globals.Behavior);
  14785. $core.addMethod(
  14786. $core.method({
  14787. selector: "lookupSelector:",
  14788. protocol: "accessing",
  14789. fn: function (selector){
  14790. var self=this,$self=this;
  14791. var lookupClass;
  14792. return $core.withContext(function($ctx1) {
  14793. var $1;
  14794. var $early={};
  14795. try {
  14796. lookupClass=self;
  14797. $recv((function(){
  14798. return $core.withContext(function($ctx2) {
  14799. return $recv(lookupClass).__eq(nil);
  14800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14801. }))._whileFalse_((function(){
  14802. return $core.withContext(function($ctx2) {
  14803. $1=$recv(lookupClass)._includesSelector_(selector);
  14804. if($core.assert($1)){
  14805. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14806. }
  14807. lookupClass=$recv(lookupClass)._superclass();
  14808. return lookupClass;
  14809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14810. }));
  14811. return nil;
  14812. }
  14813. catch(e) {if(e===$early)return e[0]; throw e}
  14814. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14815. },
  14816. args: ["selector"],
  14817. 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",
  14818. referencedClasses: [],
  14819. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14820. }),
  14821. $globals.Behavior);
  14822. $core.addMethod(
  14823. $core.method({
  14824. selector: "new",
  14825. protocol: "instance creation",
  14826. fn: function (){
  14827. var self=this,$self=this;
  14828. return $core.withContext(function($ctx1) {
  14829. return $recv($self._basicNew())._initialize();
  14830. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14831. },
  14832. args: [],
  14833. source: "new\x0a\x09^ self basicNew initialize",
  14834. referencedClasses: [],
  14835. messageSends: ["initialize", "basicNew"]
  14836. }),
  14837. $globals.Behavior);
  14838. $core.addMethod(
  14839. $core.method({
  14840. selector: "prototype",
  14841. protocol: "accessing",
  14842. fn: function (){
  14843. var self=this,$self=this;
  14844. return $core.withContext(function($ctx1) {
  14845. return self.fn.prototype;
  14846. return self;
  14847. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14848. },
  14849. args: [],
  14850. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14851. referencedClasses: [],
  14852. messageSends: []
  14853. }),
  14854. $globals.Behavior);
  14855. $core.addMethod(
  14856. $core.method({
  14857. selector: "subclasses",
  14858. protocol: "accessing",
  14859. fn: function (){
  14860. var self=this,$self=this;
  14861. return $core.withContext(function($ctx1) {
  14862. $self._subclassResponsibility();
  14863. return self;
  14864. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14865. },
  14866. args: [],
  14867. source: "subclasses\x0a\x09self subclassResponsibility",
  14868. referencedClasses: [],
  14869. messageSends: ["subclassResponsibility"]
  14870. }),
  14871. $globals.Behavior);
  14872. $core.addMethod(
  14873. $core.method({
  14874. selector: "superclass",
  14875. protocol: "accessing",
  14876. fn: function (){
  14877. var self=this,$self=this;
  14878. return $core.withContext(function($ctx1) {
  14879. return self.superclass;
  14880. return self;
  14881. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14882. },
  14883. args: [],
  14884. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14885. referencedClasses: [],
  14886. messageSends: []
  14887. }),
  14888. $globals.Behavior);
  14889. $core.addMethod(
  14890. $core.method({
  14891. selector: "theMetaClass",
  14892. protocol: "accessing",
  14893. fn: function (){
  14894. var self=this,$self=this;
  14895. return $core.withContext(function($ctx1) {
  14896. $self._subclassResponsibility();
  14897. return self;
  14898. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14899. },
  14900. args: [],
  14901. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14902. referencedClasses: [],
  14903. messageSends: ["subclassResponsibility"]
  14904. }),
  14905. $globals.Behavior);
  14906. $core.addMethod(
  14907. $core.method({
  14908. selector: "theNonMetaClass",
  14909. protocol: "accessing",
  14910. fn: function (){
  14911. var self=this,$self=this;
  14912. return $core.withContext(function($ctx1) {
  14913. $self._subclassResponsibility();
  14914. return self;
  14915. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14916. },
  14917. args: [],
  14918. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14919. referencedClasses: [],
  14920. messageSends: ["subclassResponsibility"]
  14921. }),
  14922. $globals.Behavior);
  14923. $core.addMethod(
  14924. $core.method({
  14925. selector: "withAllSubclasses",
  14926. protocol: "accessing",
  14927. fn: function (){
  14928. var self=this,$self=this;
  14929. return $core.withContext(function($ctx1) {
  14930. var $1;
  14931. $1=$recv($globals.Array)._with_(self);
  14932. $recv($1)._addAll_($self._allSubclasses());
  14933. return $recv($1)._yourself();
  14934. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14935. },
  14936. args: [],
  14937. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14938. referencedClasses: ["Array"],
  14939. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14940. }),
  14941. $globals.Behavior);
  14942. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14943. $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.";
  14944. $core.addMethod(
  14945. $core.method({
  14946. selector: "basicPackage:",
  14947. protocol: "accessing",
  14948. fn: function (aPackage){
  14949. var self=this,$self=this;
  14950. $self["@package"]=aPackage;
  14951. return self;
  14952. },
  14953. args: ["aPackage"],
  14954. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14955. referencedClasses: [],
  14956. messageSends: []
  14957. }),
  14958. $globals.Class);
  14959. $core.addMethod(
  14960. $core.method({
  14961. selector: "classTag",
  14962. protocol: "accessing",
  14963. fn: function (){
  14964. var self=this,$self=this;
  14965. return "class";
  14966. },
  14967. args: [],
  14968. 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'",
  14969. referencedClasses: [],
  14970. messageSends: []
  14971. }),
  14972. $globals.Class);
  14973. $core.addMethod(
  14974. $core.method({
  14975. selector: "definition",
  14976. protocol: "accessing",
  14977. fn: function (){
  14978. var self=this,$self=this;
  14979. return $core.withContext(function($ctx1) {
  14980. var $1,$2;
  14981. return $recv($globals.String)._streamContents_((function(stream){
  14982. return $core.withContext(function($ctx2) {
  14983. $recv(stream)._print_($self._superclass());
  14984. $ctx2.sendIdx["print:"]=1;
  14985. $recv(stream)._write_(" subclass: ");
  14986. $ctx2.sendIdx["write:"]=1;
  14987. $recv(stream)._printSymbol_($self._name());
  14988. $recv(stream)._lf();
  14989. $ctx2.sendIdx["lf"]=1;
  14990. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14991. return $core.withContext(function($ctx3) {
  14992. $1=$recv($globals.String)._tab();
  14993. $ctx3.sendIdx["tab"]=1;
  14994. $2=$recv($globals.String)._lf();
  14995. $ctx3.sendIdx["lf"]=2;
  14996. return [$1,"uses: ",tcd,$2];
  14997. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14998. })));
  14999. $ctx2.sendIdx["write:"]=2;
  15000. $recv(stream)._tab();
  15001. $ctx2.sendIdx["tab"]=2;
  15002. $recv(stream)._write_("instanceVariableNames: ");
  15003. $ctx2.sendIdx["write:"]=3;
  15004. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15005. $ctx2.sendIdx["print:"]=2;
  15006. $recv(stream)._lf();
  15007. $recv(stream)._tab();
  15008. $recv(stream)._write_("package: ");
  15009. return $recv(stream)._print_($self._category());
  15010. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15011. }));
  15012. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  15013. },
  15014. args: [],
  15015. 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 ]",
  15016. referencedClasses: ["String"],
  15017. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  15018. }),
  15019. $globals.Class);
  15020. $core.addMethod(
  15021. $core.method({
  15022. selector: "isClass",
  15023. protocol: "testing",
  15024. fn: function (){
  15025. var self=this,$self=this;
  15026. return true;
  15027. },
  15028. args: [],
  15029. source: "isClass\x0a\x09^ true",
  15030. referencedClasses: [],
  15031. messageSends: []
  15032. }),
  15033. $globals.Class);
  15034. $core.addMethod(
  15035. $core.method({
  15036. selector: "package",
  15037. protocol: "accessing",
  15038. fn: function (){
  15039. var self=this,$self=this;
  15040. return $self["@package"];
  15041. },
  15042. args: [],
  15043. source: "package\x0a\x09^ package",
  15044. referencedClasses: [],
  15045. messageSends: []
  15046. }),
  15047. $globals.Class);
  15048. $core.addMethod(
  15049. $core.method({
  15050. selector: "rename:",
  15051. protocol: "accessing",
  15052. fn: function (aString){
  15053. var self=this,$self=this;
  15054. return $core.withContext(function($ctx1) {
  15055. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  15056. return self;
  15057. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  15058. },
  15059. args: ["aString"],
  15060. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  15061. referencedClasses: ["ClassBuilder"],
  15062. messageSends: ["renameClass:to:", "new"]
  15063. }),
  15064. $globals.Class);
  15065. $core.addMethod(
  15066. $core.method({
  15067. selector: "subclasses",
  15068. protocol: "accessing",
  15069. fn: function (){
  15070. var self=this,$self=this;
  15071. return $core.withContext(function($ctx1) {
  15072. return self.subclasses._copy();
  15073. return self;
  15074. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  15075. },
  15076. args: [],
  15077. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  15078. referencedClasses: [],
  15079. messageSends: []
  15080. }),
  15081. $globals.Class);
  15082. $core.addMethod(
  15083. $core.method({
  15084. selector: "theMetaClass",
  15085. protocol: "accessing",
  15086. fn: function (){
  15087. var self=this,$self=this;
  15088. return $core.withContext(function($ctx1) {
  15089. return $self._class();
  15090. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  15091. },
  15092. args: [],
  15093. source: "theMetaClass\x0a\x09^ self class",
  15094. referencedClasses: [],
  15095. messageSends: ["class"]
  15096. }),
  15097. $globals.Class);
  15098. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  15099. $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.";
  15100. $core.addMethod(
  15101. $core.method({
  15102. selector: "asJavaScriptSource",
  15103. protocol: "converting",
  15104. fn: function (){
  15105. var self=this,$self=this;
  15106. return $core.withContext(function($ctx1) {
  15107. var $1;
  15108. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15109. $ctx1.sendIdx[","]=1;
  15110. return $1;
  15111. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  15112. },
  15113. args: [],
  15114. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15115. referencedClasses: [],
  15116. messageSends: [",", "name", "instanceClass"]
  15117. }),
  15118. $globals.Metaclass);
  15119. $core.addMethod(
  15120. $core.method({
  15121. selector: "definition",
  15122. protocol: "accessing",
  15123. fn: function (){
  15124. var self=this,$self=this;
  15125. return $core.withContext(function($ctx1) {
  15126. var $1,$2;
  15127. return $recv($globals.String)._streamContents_((function(stream){
  15128. return $core.withContext(function($ctx2) {
  15129. $recv(stream)._print_(self);
  15130. $ctx2.sendIdx["print:"]=1;
  15131. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15132. return " ";
  15133. }),(function(tcd){
  15134. return $core.withContext(function($ctx3) {
  15135. $1=$recv($globals.String)._lf();
  15136. $ctx3.sendIdx["lf"]=1;
  15137. $2=$recv($globals.String)._tab();
  15138. $ctx3.sendIdx["tab"]=1;
  15139. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15140. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15141. })));
  15142. $ctx2.sendIdx["write:"]=1;
  15143. $recv(stream)._write_("instanceVariableNames: ");
  15144. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15145. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15146. }));
  15147. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  15148. },
  15149. args: [],
  15150. 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) ]",
  15151. referencedClasses: ["String"],
  15152. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  15153. }),
  15154. $globals.Metaclass);
  15155. $core.addMethod(
  15156. $core.method({
  15157. selector: "instanceClass",
  15158. protocol: "accessing",
  15159. fn: function (){
  15160. var self=this,$self=this;
  15161. return $core.withContext(function($ctx1) {
  15162. return self.instanceClass;
  15163. return self;
  15164. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  15165. },
  15166. args: [],
  15167. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15168. referencedClasses: [],
  15169. messageSends: []
  15170. }),
  15171. $globals.Metaclass);
  15172. $core.addMethod(
  15173. $core.method({
  15174. selector: "instanceVariableNames:",
  15175. protocol: "accessing",
  15176. fn: function (aCollection){
  15177. var self=this,$self=this;
  15178. return $core.withContext(function($ctx1) {
  15179. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15180. return self;
  15181. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15182. },
  15183. args: ["aCollection"],
  15184. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15185. referencedClasses: ["ClassBuilder"],
  15186. messageSends: ["class:instanceVariableNames:", "new"]
  15187. }),
  15188. $globals.Metaclass);
  15189. $core.addMethod(
  15190. $core.method({
  15191. selector: "isMetaclass",
  15192. protocol: "testing",
  15193. fn: function (){
  15194. var self=this,$self=this;
  15195. return true;
  15196. },
  15197. args: [],
  15198. source: "isMetaclass\x0a\x09^ true",
  15199. referencedClasses: [],
  15200. messageSends: []
  15201. }),
  15202. $globals.Metaclass);
  15203. $core.addMethod(
  15204. $core.method({
  15205. selector: "name",
  15206. protocol: "accessing",
  15207. fn: function (){
  15208. var self=this,$self=this;
  15209. return $core.withContext(function($ctx1) {
  15210. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15211. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15212. },
  15213. args: [],
  15214. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15215. referencedClasses: [],
  15216. messageSends: [",", "name", "instanceClass"]
  15217. }),
  15218. $globals.Metaclass);
  15219. $core.addMethod(
  15220. $core.method({
  15221. selector: "package",
  15222. protocol: "accessing",
  15223. fn: function (){
  15224. var self=this,$self=this;
  15225. return $core.withContext(function($ctx1) {
  15226. return $recv($self._instanceClass())._package();
  15227. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15228. },
  15229. args: [],
  15230. source: "package\x0a\x09^ self instanceClass package",
  15231. referencedClasses: [],
  15232. messageSends: ["package", "instanceClass"]
  15233. }),
  15234. $globals.Metaclass);
  15235. $core.addMethod(
  15236. $core.method({
  15237. selector: "subclasses",
  15238. protocol: "accessing",
  15239. fn: function (){
  15240. var self=this,$self=this;
  15241. return $core.withContext(function($ctx1) {
  15242. return $core.metaSubclasses(self);
  15243. return self;
  15244. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15245. },
  15246. args: [],
  15247. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15248. referencedClasses: [],
  15249. messageSends: []
  15250. }),
  15251. $globals.Metaclass);
  15252. $core.addMethod(
  15253. $core.method({
  15254. selector: "theMetaClass",
  15255. protocol: "accessing",
  15256. fn: function (){
  15257. var self=this,$self=this;
  15258. return self;
  15259. },
  15260. args: [],
  15261. source: "theMetaClass\x0a\x09^ self",
  15262. referencedClasses: [],
  15263. messageSends: []
  15264. }),
  15265. $globals.Metaclass);
  15266. $core.addMethod(
  15267. $core.method({
  15268. selector: "theNonMetaClass",
  15269. protocol: "accessing",
  15270. fn: function (){
  15271. var self=this,$self=this;
  15272. return $core.withContext(function($ctx1) {
  15273. return $self._instanceClass();
  15274. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15275. },
  15276. args: [],
  15277. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15278. referencedClasses: [],
  15279. messageSends: ["instanceClass"]
  15280. }),
  15281. $globals.Metaclass);
  15282. $core.addMethod(
  15283. $core.method({
  15284. selector: "uses:instanceVariableNames:",
  15285. protocol: "accessing",
  15286. fn: function (aTraitCompositionDescription,aCollection){
  15287. var self=this,$self=this;
  15288. var metaclass;
  15289. return $core.withContext(function($ctx1) {
  15290. metaclass=$self._instanceVariableNames_(aCollection);
  15291. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15292. return metaclass;
  15293. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15294. },
  15295. args: ["aTraitCompositionDescription", "aCollection"],
  15296. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15297. referencedClasses: [],
  15298. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15299. }),
  15300. $globals.Metaclass);
  15301. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15302. $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:`.";
  15303. $core.addMethod(
  15304. $core.method({
  15305. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15306. protocol: "class definition",
  15307. fn: function (aClass,className,aCollection,packageName){
  15308. var self=this,$self=this;
  15309. var theClass,thePackage;
  15310. return $core.withContext(function($ctx1) {
  15311. var $1,$2,$3,$receiver;
  15312. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15313. thePackage=$recv($globals.Package)._named_(packageName);
  15314. $1=theClass;
  15315. if(($receiver = $1) == null || $receiver.a$nil){
  15316. $1;
  15317. } else {
  15318. $recv(theClass)._package_(thePackage);
  15319. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15320. if(!$core.assert($2)){
  15321. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15322. }
  15323. }
  15324. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15325. $recv($3)._recompile();
  15326. return $recv($3)._yourself();
  15327. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15328. },
  15329. args: ["aClass", "className", "aCollection", "packageName"],
  15330. 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",
  15331. referencedClasses: ["Smalltalk", "Package"],
  15332. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15333. }),
  15334. $globals.ClassBuilder);
  15335. $core.addMethod(
  15336. $core.method({
  15337. selector: "addTraitNamed:package:",
  15338. protocol: "class definition",
  15339. fn: function (traitName,packageName){
  15340. var self=this,$self=this;
  15341. var theTrait,thePackage;
  15342. return $core.withContext(function($ctx1) {
  15343. var $1,$2,$receiver;
  15344. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15345. thePackage=$recv($globals.Package)._named_(packageName);
  15346. $1=theTrait;
  15347. if(($receiver = $1) == null || $receiver.a$nil){
  15348. $1;
  15349. } else {
  15350. $2=theTrait;
  15351. $recv($2)._package_(thePackage);
  15352. $recv($2)._recompile();
  15353. return $recv($2)._yourself();
  15354. }
  15355. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15356. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15357. },
  15358. args: ["traitName", "packageName"],
  15359. 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",
  15360. referencedClasses: ["Smalltalk", "Package"],
  15361. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15362. }),
  15363. $globals.ClassBuilder);
  15364. $core.addMethod(
  15365. $core.method({
  15366. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15367. protocol: "private",
  15368. fn: function (aClass,aString,aCollection,packageName){
  15369. var self=this,$self=this;
  15370. return $core.withContext(function($ctx1) {
  15371. return $core.addClass(aString, aClass, aCollection, packageName);
  15372. ;
  15373. return self;
  15374. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15375. },
  15376. args: ["aClass", "aString", "aCollection", "packageName"],
  15377. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15378. referencedClasses: [],
  15379. messageSends: []
  15380. }),
  15381. $globals.ClassBuilder);
  15382. $core.addMethod(
  15383. $core.method({
  15384. selector: "basicAddTraitNamed:package:",
  15385. protocol: "private",
  15386. fn: function (aString,anotherString){
  15387. var self=this,$self=this;
  15388. return $core.withContext(function($ctx1) {
  15389. return $core.addTrait(aString, anotherString);
  15390. return self;
  15391. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15392. },
  15393. args: ["aString", "anotherString"],
  15394. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15395. referencedClasses: [],
  15396. messageSends: []
  15397. }),
  15398. $globals.ClassBuilder);
  15399. $core.addMethod(
  15400. $core.method({
  15401. selector: "basicClass:instanceVariableNames:",
  15402. protocol: "private",
  15403. fn: function (aClass,aString){
  15404. var self=this,$self=this;
  15405. return $core.withContext(function($ctx1) {
  15406. $self._basicClass_instanceVariables_(aClass,$self._instanceVariableNamesFor_(aString));
  15407. return self;
  15408. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15409. },
  15410. args: ["aClass", "aString"],
  15411. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  15412. referencedClasses: [],
  15413. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  15414. }),
  15415. $globals.ClassBuilder);
  15416. $core.addMethod(
  15417. $core.method({
  15418. selector: "basicClass:instanceVariables:",
  15419. protocol: "private",
  15420. fn: function (aClass,aCollection){
  15421. var self=this,$self=this;
  15422. return $core.withContext(function($ctx1) {
  15423. var $1;
  15424. $1=$recv(aClass)._isMetaclass();
  15425. if(!$core.assert($1)){
  15426. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15427. }
  15428. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15429. return self;
  15430. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15431. },
  15432. args: ["aClass", "aCollection"],
  15433. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15434. referencedClasses: [],
  15435. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15436. }),
  15437. $globals.ClassBuilder);
  15438. $core.addMethod(
  15439. $core.method({
  15440. selector: "basicRemoveClass:",
  15441. protocol: "private",
  15442. fn: function (aClass){
  15443. var self=this,$self=this;
  15444. return $core.withContext(function($ctx1) {
  15445. $core.removeClass(aClass);
  15446. return self;
  15447. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15448. },
  15449. args: ["aClass"],
  15450. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15451. referencedClasses: [],
  15452. messageSends: []
  15453. }),
  15454. $globals.ClassBuilder);
  15455. $core.addMethod(
  15456. $core.method({
  15457. selector: "basicRenameClass:to:",
  15458. protocol: "private",
  15459. fn: function (aClass,aString){
  15460. var self=this,$self=this;
  15461. return $core.withContext(function($ctx1) {
  15462. $globals[aString] = aClass;
  15463. delete $globals[aClass.name];
  15464. aClass.name = aString;
  15465. ;
  15466. return self;
  15467. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15468. },
  15469. args: ["aClass", "aString"],
  15470. 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'>",
  15471. referencedClasses: [],
  15472. messageSends: []
  15473. }),
  15474. $globals.ClassBuilder);
  15475. $core.addMethod(
  15476. $core.method({
  15477. selector: "basicSwapClassNames:with:",
  15478. protocol: "private",
  15479. fn: function (aClass,anotherClass){
  15480. var self=this,$self=this;
  15481. return $core.withContext(function($ctx1) {
  15482. var tmp = aClass.name;
  15483. aClass.name = anotherClass.name;
  15484. anotherClass.name = tmp;
  15485. ;
  15486. return self;
  15487. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15488. },
  15489. args: ["aClass", "anotherClass"],
  15490. 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'>",
  15491. referencedClasses: [],
  15492. messageSends: []
  15493. }),
  15494. $globals.ClassBuilder);
  15495. $core.addMethod(
  15496. $core.method({
  15497. selector: "class:instanceVariableNames:",
  15498. protocol: "class definition",
  15499. fn: function (aClass,ivarNames){
  15500. var self=this,$self=this;
  15501. return $core.withContext(function($ctx1) {
  15502. var $1,$3,$2;
  15503. $self._basicClass_instanceVariableNames_(aClass,ivarNames);
  15504. $1=$recv($globals.SystemAnnouncer)._current();
  15505. $3=$recv($globals.ClassDefinitionChanged)._new();
  15506. $recv($3)._theClass_(aClass);
  15507. $2=$recv($3)._yourself();
  15508. $recv($1)._announce_($2);
  15509. return self;
  15510. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15511. },
  15512. args: ["aClass", "ivarNames"],
  15513. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15514. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15515. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  15516. }),
  15517. $globals.ClassBuilder);
  15518. $core.addMethod(
  15519. $core.method({
  15520. selector: "copyClass:named:",
  15521. protocol: "copying",
  15522. fn: function (aClass,className){
  15523. var self=this,$self=this;
  15524. var newClass;
  15525. return $core.withContext(function($ctx1) {
  15526. var $1,$3,$2;
  15527. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15528. $self._copyClass_to_(aClass,newClass);
  15529. $1=$recv($globals.SystemAnnouncer)._current();
  15530. $3=$recv($globals.ClassAdded)._new();
  15531. $recv($3)._theClass_(newClass);
  15532. $2=$recv($3)._yourself();
  15533. $recv($1)._announce_($2);
  15534. return newClass;
  15535. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15536. },
  15537. args: ["aClass", "className"],
  15538. 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",
  15539. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15540. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15541. }),
  15542. $globals.ClassBuilder);
  15543. $core.addMethod(
  15544. $core.method({
  15545. selector: "copyClass:to:",
  15546. protocol: "copying",
  15547. fn: function (aClass,anotherClass){
  15548. var self=this,$self=this;
  15549. return $core.withContext(function($ctx1) {
  15550. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15551. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15552. $1=$recv(aClass)._methodDictionary();
  15553. $ctx1.sendIdx["methodDictionary"]=1;
  15554. $recv($1)._valuesDo_((function(each){
  15555. return $core.withContext(function($ctx2) {
  15556. $3=$recv(each)._methodClass();
  15557. $ctx2.sendIdx["methodClass"]=1;
  15558. $2=$recv($3).__eq(aClass);
  15559. $ctx2.sendIdx["="]=1;
  15560. if($core.assert($2)){
  15561. $4=$recv($globals.Compiler)._new();
  15562. $ctx2.sendIdx["new"]=1;
  15563. $5=$recv(each)._source();
  15564. $ctx2.sendIdx["source"]=1;
  15565. $6=$recv(each)._protocol();
  15566. $ctx2.sendIdx["protocol"]=1;
  15567. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15568. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15569. }
  15570. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15571. }));
  15572. $ctx1.sendIdx["valuesDo:"]=1;
  15573. $7=$recv(aClass)._traitComposition();
  15574. $ctx1.sendIdx["traitComposition"]=1;
  15575. $recv(anotherClass)._setTraitComposition_($7);
  15576. $ctx1.sendIdx["setTraitComposition:"]=1;
  15577. $8=$recv(anotherClass)._class();
  15578. $ctx1.sendIdx["class"]=1;
  15579. $10=$recv(aClass)._class();
  15580. $ctx1.sendIdx["class"]=2;
  15581. $9=$recv($10)._instanceVariableNames();
  15582. $self._basicClass_instanceVariables_($8,$9);
  15583. $12=$recv(aClass)._class();
  15584. $ctx1.sendIdx["class"]=3;
  15585. $11=$recv($12)._methodDictionary();
  15586. $recv($11)._valuesDo_((function(each){
  15587. return $core.withContext(function($ctx2) {
  15588. $14=$recv(each)._methodClass();
  15589. $15=$recv(aClass)._class();
  15590. $ctx2.sendIdx["class"]=4;
  15591. $13=$recv($14).__eq($15);
  15592. if($core.assert($13)){
  15593. $16=$recv($globals.Compiler)._new();
  15594. $17=$recv(each)._source();
  15595. $18=$recv(anotherClass)._class();
  15596. $ctx2.sendIdx["class"]=5;
  15597. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15598. }
  15599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15600. }));
  15601. $19=$recv(anotherClass)._class();
  15602. $ctx1.sendIdx["class"]=6;
  15603. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15604. return self;
  15605. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15606. },
  15607. args: ["aClass", "anotherClass"],
  15608. 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",
  15609. referencedClasses: ["Compiler"],
  15610. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15611. }),
  15612. $globals.ClassBuilder);
  15613. $core.addMethod(
  15614. $core.method({
  15615. selector: "installMethod:forClass:protocol:",
  15616. protocol: "method definition",
  15617. fn: function (aCompiledMethod,aBehavior,aString){
  15618. var self=this,$self=this;
  15619. return $core.withContext(function($ctx1) {
  15620. $recv(aCompiledMethod)._protocol_(aString);
  15621. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15622. return aCompiledMethod;
  15623. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15624. },
  15625. args: ["aCompiledMethod", "aBehavior", "aString"],
  15626. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15627. referencedClasses: [],
  15628. messageSends: ["protocol:", "addCompiledMethod:"]
  15629. }),
  15630. $globals.ClassBuilder);
  15631. $core.addMethod(
  15632. $core.method({
  15633. selector: "instanceVariableNamesFor:",
  15634. protocol: "accessing",
  15635. fn: function (aString){
  15636. var self=this,$self=this;
  15637. return $core.withContext(function($ctx1) {
  15638. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15639. return $core.withContext(function($ctx2) {
  15640. return $recv(each)._isEmpty();
  15641. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15642. }));
  15643. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15644. },
  15645. args: ["aString"],
  15646. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15647. referencedClasses: [],
  15648. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15649. }),
  15650. $globals.ClassBuilder);
  15651. $core.addMethod(
  15652. $core.method({
  15653. selector: "migrateClass:superclass:",
  15654. protocol: "class migration",
  15655. fn: function (aClass,anotherClass){
  15656. var self=this,$self=this;
  15657. return $core.withContext(function($ctx1) {
  15658. var $1;
  15659. $1=$recv(aClass)._name();
  15660. $ctx1.sendIdx["name"]=1;
  15661. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15662. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15663. },
  15664. args: ["aClass", "anotherClass"],
  15665. 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",
  15666. referencedClasses: [],
  15667. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15668. }),
  15669. $globals.ClassBuilder);
  15670. $core.addMethod(
  15671. $core.method({
  15672. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15673. protocol: "class migration",
  15674. fn: function (className,aClass,aCollection,packageName){
  15675. var self=this,$self=this;
  15676. var oldClass,newClass,tmp;
  15677. return $core.withContext(function($ctx1) {
  15678. var $1,$2,$4,$3;
  15679. tmp="new*".__comma(className);
  15680. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15681. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15682. $self._basicSwapClassNames_with_(oldClass,newClass);
  15683. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15684. $recv((function(){
  15685. return $core.withContext(function($ctx2) {
  15686. return $self._copyClass_to_(oldClass,newClass);
  15687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15688. }))._on_do_($globals.Error,(function(exception){
  15689. return $core.withContext(function($ctx2) {
  15690. $self._basicSwapClassNames_with_(oldClass,newClass);
  15691. $1=$self._basicRemoveClass_(newClass);
  15692. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15693. $1;
  15694. return $recv(exception)._resignal();
  15695. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15696. }));
  15697. $self._rawRenameClass_to_(oldClass,tmp);
  15698. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15699. $self._rawRenameClass_to_(newClass,className);
  15700. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15701. return $core.withContext(function($ctx2) {
  15702. return $self._migrateClass_superclass_(each,newClass);
  15703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15704. }));
  15705. $self._basicRemoveClass_(oldClass);
  15706. $2=$recv($globals.SystemAnnouncer)._current();
  15707. $4=$recv($globals.ClassMigrated)._new();
  15708. $recv($4)._theClass_(newClass);
  15709. $recv($4)._oldClass_(oldClass);
  15710. $3=$recv($4)._yourself();
  15711. $recv($2)._announce_($3);
  15712. return newClass;
  15713. }, 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)});
  15714. },
  15715. args: ["className", "aClass", "aCollection", "packageName"],
  15716. 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",
  15717. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15718. 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"]
  15719. }),
  15720. $globals.ClassBuilder);
  15721. $core.addMethod(
  15722. $core.method({
  15723. selector: "rawRenameClass:to:",
  15724. protocol: "private",
  15725. fn: function (aClass,aString){
  15726. var self=this,$self=this;
  15727. return $core.withContext(function($ctx1) {
  15728. $globals[aString] = aClass;
  15729. ;
  15730. return self;
  15731. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15732. },
  15733. args: ["aClass", "aString"],
  15734. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15735. referencedClasses: [],
  15736. messageSends: []
  15737. }),
  15738. $globals.ClassBuilder);
  15739. $core.addMethod(
  15740. $core.method({
  15741. selector: "renameClass:to:",
  15742. protocol: "class migration",
  15743. fn: function (aClass,className){
  15744. var self=this,$self=this;
  15745. return $core.withContext(function($ctx1) {
  15746. var $1,$3,$2;
  15747. $self._basicRenameClass_to_(aClass,className);
  15748. $recv(aClass)._recompile();
  15749. $1=$recv($globals.SystemAnnouncer)._current();
  15750. $3=$recv($globals.ClassRenamed)._new();
  15751. $recv($3)._theClass_(aClass);
  15752. $2=$recv($3)._yourself();
  15753. $recv($1)._announce_($2);
  15754. return self;
  15755. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15756. },
  15757. args: ["aClass", "className"],
  15758. 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)",
  15759. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15760. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15761. }),
  15762. $globals.ClassBuilder);
  15763. $core.addMethod(
  15764. $core.method({
  15765. selector: "setupClass:",
  15766. protocol: "public",
  15767. fn: function (aClass){
  15768. var self=this,$self=this;
  15769. return $core.withContext(function($ctx1) {
  15770. $self._deprecatedAPI_("Classes are now auto-inited.");
  15771. return self;
  15772. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  15773. },
  15774. args: ["aClass"],
  15775. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  15776. referencedClasses: [],
  15777. messageSends: ["deprecatedAPI:"]
  15778. }),
  15779. $globals.ClassBuilder);
  15780. $core.addMethod(
  15781. $core.method({
  15782. selector: "superclass:subclass:",
  15783. protocol: "class definition",
  15784. fn: function (aClass,className){
  15785. var self=this,$self=this;
  15786. return $core.withContext(function($ctx1) {
  15787. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15788. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15789. },
  15790. args: ["aClass", "className"],
  15791. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15792. referencedClasses: [],
  15793. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15794. }),
  15795. $globals.ClassBuilder);
  15796. $core.addMethod(
  15797. $core.method({
  15798. selector: "superclass:subclass:instanceVariableNames:package:",
  15799. protocol: "class definition",
  15800. fn: function (aClass,className,ivarNames,packageName){
  15801. var self=this,$self=this;
  15802. var newClass;
  15803. return $core.withContext(function($ctx1) {
  15804. var $1,$2,$3,$5,$4,$receiver;
  15805. $1=$self._instanceVariableNamesFor_(ivarNames);
  15806. if(($receiver = packageName) == null || $receiver.a$nil){
  15807. $2="unclassified";
  15808. } else {
  15809. $2=packageName;
  15810. }
  15811. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15812. $3=$recv($globals.SystemAnnouncer)._current();
  15813. $5=$recv($globals.ClassAdded)._new();
  15814. $recv($5)._theClass_(newClass);
  15815. $4=$recv($5)._yourself();
  15816. $recv($3)._announce_($4);
  15817. return newClass;
  15818. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15819. },
  15820. args: ["aClass", "className", "ivarNames", "packageName"],
  15821. 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",
  15822. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15823. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15824. }),
  15825. $globals.ClassBuilder);
  15826. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15827. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15828. $core.addMethod(
  15829. $core.method({
  15830. selector: "getNodesFrom:",
  15831. protocol: "accessing",
  15832. fn: function (aCollection){
  15833. var self=this,$self=this;
  15834. var children,others;
  15835. return $core.withContext(function($ctx1) {
  15836. var $1;
  15837. children=[];
  15838. others=[];
  15839. $recv(aCollection)._do_((function(each){
  15840. return $core.withContext(function($ctx2) {
  15841. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15842. if($core.assert($1)){
  15843. return $recv(children)._add_(each);
  15844. $ctx2.sendIdx["add:"]=1;
  15845. } else {
  15846. return $recv(others)._add_(each);
  15847. }
  15848. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15849. }));
  15850. $self["@nodes"]=$recv(children)._collect_((function(each){
  15851. return $core.withContext(function($ctx2) {
  15852. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15854. }));
  15855. return self;
  15856. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15857. },
  15858. args: ["aCollection"],
  15859. 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 ]",
  15860. referencedClasses: ["ClassSorterNode"],
  15861. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15862. }),
  15863. $globals.ClassSorterNode);
  15864. $core.addMethod(
  15865. $core.method({
  15866. selector: "level",
  15867. protocol: "accessing",
  15868. fn: function (){
  15869. var self=this,$self=this;
  15870. return $self["@level"];
  15871. },
  15872. args: [],
  15873. source: "level\x0a\x09^ level",
  15874. referencedClasses: [],
  15875. messageSends: []
  15876. }),
  15877. $globals.ClassSorterNode);
  15878. $core.addMethod(
  15879. $core.method({
  15880. selector: "level:",
  15881. protocol: "accessing",
  15882. fn: function (anInteger){
  15883. var self=this,$self=this;
  15884. $self["@level"]=anInteger;
  15885. return self;
  15886. },
  15887. args: ["anInteger"],
  15888. source: "level: anInteger\x0a\x09level := anInteger",
  15889. referencedClasses: [],
  15890. messageSends: []
  15891. }),
  15892. $globals.ClassSorterNode);
  15893. $core.addMethod(
  15894. $core.method({
  15895. selector: "nodes",
  15896. protocol: "accessing",
  15897. fn: function (){
  15898. var self=this,$self=this;
  15899. return $self["@nodes"];
  15900. },
  15901. args: [],
  15902. source: "nodes\x0a\x09^ nodes",
  15903. referencedClasses: [],
  15904. messageSends: []
  15905. }),
  15906. $globals.ClassSorterNode);
  15907. $core.addMethod(
  15908. $core.method({
  15909. selector: "theClass",
  15910. protocol: "accessing",
  15911. fn: function (){
  15912. var self=this,$self=this;
  15913. return $self["@theClass"];
  15914. },
  15915. args: [],
  15916. source: "theClass\x0a\x09^ theClass",
  15917. referencedClasses: [],
  15918. messageSends: []
  15919. }),
  15920. $globals.ClassSorterNode);
  15921. $core.addMethod(
  15922. $core.method({
  15923. selector: "theClass:",
  15924. protocol: "accessing",
  15925. fn: function (aClass){
  15926. var self=this,$self=this;
  15927. $self["@theClass"]=aClass;
  15928. return self;
  15929. },
  15930. args: ["aClass"],
  15931. source: "theClass: aClass\x0a\x09theClass := aClass",
  15932. referencedClasses: [],
  15933. messageSends: []
  15934. }),
  15935. $globals.ClassSorterNode);
  15936. $core.addMethod(
  15937. $core.method({
  15938. selector: "traverseClassesWith:",
  15939. protocol: "visiting",
  15940. fn: function (aCollection){
  15941. var self=this,$self=this;
  15942. return $core.withContext(function($ctx1) {
  15943. var $1,$3,$2;
  15944. $1=$self._theClass();
  15945. $ctx1.sendIdx["theClass"]=1;
  15946. $recv(aCollection)._add_($1);
  15947. $recv($recv($self._nodes())._sorted_((function(a,b){
  15948. return $core.withContext(function($ctx2) {
  15949. $3=$recv(a)._theClass();
  15950. $ctx2.sendIdx["theClass"]=2;
  15951. $2=$recv($3)._name();
  15952. $ctx2.sendIdx["name"]=1;
  15953. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15954. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15955. })))._do_((function(aNode){
  15956. return $core.withContext(function($ctx2) {
  15957. return $recv(aNode)._traverseClassesWith_(aCollection);
  15958. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15959. }));
  15960. return self;
  15961. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15962. },
  15963. args: ["aCollection"],
  15964. 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 ].",
  15965. referencedClasses: [],
  15966. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15967. }),
  15968. $globals.ClassSorterNode);
  15969. $core.addMethod(
  15970. $core.method({
  15971. selector: "on:classes:level:",
  15972. protocol: "instance creation",
  15973. fn: function (aClass,aCollection,anInteger){
  15974. var self=this,$self=this;
  15975. return $core.withContext(function($ctx1) {
  15976. var $1;
  15977. $1=$self._new();
  15978. $recv($1)._theClass_(aClass);
  15979. $recv($1)._level_(anInteger);
  15980. $recv($1)._getNodesFrom_(aCollection);
  15981. return $recv($1)._yourself();
  15982. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15983. },
  15984. args: ["aClass", "aCollection", "anInteger"],
  15985. 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",
  15986. referencedClasses: [],
  15987. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15988. }),
  15989. $globals.ClassSorterNode.a$cls);
  15990. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15991. $core.addMethod(
  15992. $core.method({
  15993. selector: "allInstanceVariableNames",
  15994. protocol: "accessing",
  15995. fn: function (){
  15996. var self=this,$self=this;
  15997. return [];
  15998. },
  15999. args: [],
  16000. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  16001. referencedClasses: [],
  16002. messageSends: []
  16003. }),
  16004. $globals.TBehaviorDefaults);
  16005. $core.addMethod(
  16006. $core.method({
  16007. selector: "allSubclassesDo:",
  16008. protocol: "enumerating",
  16009. fn: function (aBlock){
  16010. var self=this,$self=this;
  16011. return self;
  16012. },
  16013. args: ["aBlock"],
  16014. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  16015. referencedClasses: [],
  16016. messageSends: []
  16017. }),
  16018. $globals.TBehaviorDefaults);
  16019. $core.addMethod(
  16020. $core.method({
  16021. selector: "name",
  16022. protocol: "accessing",
  16023. fn: function (){
  16024. var self=this,$self=this;
  16025. return nil;
  16026. },
  16027. args: [],
  16028. source: "name\x0a\x09^ nil",
  16029. referencedClasses: [],
  16030. messageSends: []
  16031. }),
  16032. $globals.TBehaviorDefaults);
  16033. $core.addMethod(
  16034. $core.method({
  16035. selector: "printOn:",
  16036. protocol: "printing",
  16037. fn: function (aStream){
  16038. var self=this,$self=this;
  16039. return $core.withContext(function($ctx1) {
  16040. var $1,$receiver;
  16041. $1=$self._name();
  16042. if(($receiver = $1) == null || $receiver.a$nil){
  16043. (
  16044. $ctx1.supercall = true,
  16045. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  16046. $ctx1.supercall = false;
  16047. } else {
  16048. var name;
  16049. name=$receiver;
  16050. $recv(aStream)._nextPutAll_(name);
  16051. }
  16052. return self;
  16053. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  16054. },
  16055. args: ["aStream"],
  16056. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  16057. referencedClasses: [],
  16058. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  16059. }),
  16060. $globals.TBehaviorDefaults);
  16061. $core.addMethod(
  16062. $core.method({
  16063. selector: "superclass",
  16064. protocol: "accessing",
  16065. fn: function (){
  16066. var self=this,$self=this;
  16067. return nil;
  16068. },
  16069. args: [],
  16070. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  16071. referencedClasses: [],
  16072. messageSends: []
  16073. }),
  16074. $globals.TBehaviorDefaults);
  16075. $core.addMethod(
  16076. $core.method({
  16077. selector: "traitUsers",
  16078. protocol: "accessing",
  16079. fn: function (){
  16080. var self=this,$self=this;
  16081. return [];
  16082. },
  16083. args: [],
  16084. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  16085. referencedClasses: [],
  16086. messageSends: []
  16087. }),
  16088. $globals.TBehaviorDefaults);
  16089. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16090. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16091. $core.addMethod(
  16092. $core.method({
  16093. selector: ">>",
  16094. protocol: "accessing",
  16095. fn: function (aString){
  16096. var self=this,$self=this;
  16097. return $core.withContext(function($ctx1) {
  16098. return $self._methodAt_(aString);
  16099. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  16100. },
  16101. args: ["aString"],
  16102. source: ">> aString\x0a\x09^ self methodAt: aString",
  16103. referencedClasses: [],
  16104. messageSends: ["methodAt:"]
  16105. }),
  16106. $globals.TBehaviorProvider);
  16107. $core.addMethod(
  16108. $core.method({
  16109. selector: "addCompiledMethod:",
  16110. protocol: "compiling",
  16111. fn: function (aMethod){
  16112. var self=this,$self=this;
  16113. var oldMethod,announcement;
  16114. return $core.withContext(function($ctx1) {
  16115. var $1,$2,$3,$4,$receiver;
  16116. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16117. return nil;
  16118. }));
  16119. $self._basicAddCompiledMethod_(aMethod);
  16120. $1=oldMethod;
  16121. if(($receiver = $1) == null || $receiver.a$nil){
  16122. $2=$recv($globals.MethodAdded)._new();
  16123. $ctx1.sendIdx["new"]=1;
  16124. $recv($2)._method_(aMethod);
  16125. $ctx1.sendIdx["method:"]=1;
  16126. $3=$recv($2)._yourself();
  16127. $ctx1.sendIdx["yourself"]=1;
  16128. announcement=$3;
  16129. } else {
  16130. $4=$recv($globals.MethodModified)._new();
  16131. $recv($4)._oldMethod_(oldMethod);
  16132. $recv($4)._method_(aMethod);
  16133. announcement=$recv($4)._yourself();
  16134. }
  16135. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16136. return self;
  16137. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  16138. },
  16139. args: ["aMethod"],
  16140. 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",
  16141. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16142. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16143. }),
  16144. $globals.TBehaviorProvider);
  16145. $core.addMethod(
  16146. $core.method({
  16147. selector: "basicAddCompiledMethod:",
  16148. protocol: "private",
  16149. fn: function (aMethod){
  16150. var self=this,$self=this;
  16151. return $core.withContext(function($ctx1) {
  16152. $core.addMethod(aMethod, self);
  16153. return self;
  16154. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16155. },
  16156. args: ["aMethod"],
  16157. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16158. referencedClasses: [],
  16159. messageSends: []
  16160. }),
  16161. $globals.TBehaviorProvider);
  16162. $core.addMethod(
  16163. $core.method({
  16164. selector: "basicRemoveCompiledMethod:",
  16165. protocol: "private",
  16166. fn: function (aMethod){
  16167. var self=this,$self=this;
  16168. return $core.withContext(function($ctx1) {
  16169. $core.removeMethod(aMethod,self);
  16170. return self;
  16171. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16172. },
  16173. args: ["aMethod"],
  16174. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16175. referencedClasses: [],
  16176. messageSends: []
  16177. }),
  16178. $globals.TBehaviorProvider);
  16179. $core.addMethod(
  16180. $core.method({
  16181. selector: "compile:protocol:",
  16182. protocol: "compiling",
  16183. fn: function (aString,anotherString){
  16184. var self=this,$self=this;
  16185. return $core.withContext(function($ctx1) {
  16186. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16187. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16188. },
  16189. args: ["aString", "anotherString"],
  16190. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16191. referencedClasses: ["Compiler"],
  16192. messageSends: ["install:forClass:protocol:", "new"]
  16193. }),
  16194. $globals.TBehaviorProvider);
  16195. $core.addMethod(
  16196. $core.method({
  16197. selector: "includesSelector:",
  16198. protocol: "testing",
  16199. fn: function (aString){
  16200. var self=this,$self=this;
  16201. return $core.withContext(function($ctx1) {
  16202. return $recv($self._methodDictionary())._includesKey_(aString);
  16203. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16204. },
  16205. args: ["aString"],
  16206. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16207. referencedClasses: [],
  16208. messageSends: ["includesKey:", "methodDictionary"]
  16209. }),
  16210. $globals.TBehaviorProvider);
  16211. $core.addMethod(
  16212. $core.method({
  16213. selector: "methodAt:",
  16214. protocol: "accessing",
  16215. fn: function (aString){
  16216. var self=this,$self=this;
  16217. return $core.withContext(function($ctx1) {
  16218. return $recv($self._methodDictionary())._at_(aString);
  16219. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16220. },
  16221. args: ["aString"],
  16222. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16223. referencedClasses: [],
  16224. messageSends: ["at:", "methodDictionary"]
  16225. }),
  16226. $globals.TBehaviorProvider);
  16227. $core.addMethod(
  16228. $core.method({
  16229. selector: "methodDictionary",
  16230. protocol: "accessing",
  16231. fn: function (){
  16232. var self=this,$self=this;
  16233. return $core.withContext(function($ctx1) {
  16234. var dict = $globals.HashedCollection._new();
  16235. var methods = self.methods;
  16236. Object.keys(methods).forEach(function(i) {
  16237. if(methods[i].selector) {
  16238. dict._at_put_(methods[i].selector, methods[i]);
  16239. }
  16240. });
  16241. return dict;
  16242. return self;
  16243. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16244. },
  16245. args: [],
  16246. 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'>",
  16247. referencedClasses: [],
  16248. messageSends: []
  16249. }),
  16250. $globals.TBehaviorProvider);
  16251. $core.addMethod(
  16252. $core.method({
  16253. selector: "methodOrganizationEnter:andLeave:",
  16254. protocol: "accessing",
  16255. fn: function (aMethod,oldMethod){
  16256. var self=this,$self=this;
  16257. return $core.withContext(function($ctx1) {
  16258. var $1,$2,$receiver;
  16259. if(($receiver = aMethod) == null || $receiver.a$nil){
  16260. aMethod;
  16261. } else {
  16262. $1=$self._organization();
  16263. $2=$recv(aMethod)._protocol();
  16264. $ctx1.sendIdx["protocol"]=1;
  16265. $recv($1)._addElement_($2);
  16266. }
  16267. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16268. oldMethod;
  16269. } else {
  16270. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16271. }
  16272. return self;
  16273. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16274. },
  16275. args: ["aMethod", "oldMethod"],
  16276. 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 ]",
  16277. referencedClasses: [],
  16278. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16279. }),
  16280. $globals.TBehaviorProvider);
  16281. $core.addMethod(
  16282. $core.method({
  16283. selector: "methodTemplate",
  16284. protocol: "accessing",
  16285. fn: function (){
  16286. var self=this,$self=this;
  16287. return $core.withContext(function($ctx1) {
  16288. return $recv($globals.String)._streamContents_((function(stream){
  16289. return $core.withContext(function($ctx2) {
  16290. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16291. $ctx2.sendIdx["write:"]=1;
  16292. $recv(stream)._lf();
  16293. $ctx2.sendIdx["lf"]=1;
  16294. $recv(stream)._tab();
  16295. $ctx2.sendIdx["tab"]=1;
  16296. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16297. $ctx2.sendIdx["write:"]=2;
  16298. $recv(stream)._lf();
  16299. $ctx2.sendIdx["lf"]=2;
  16300. $recv(stream)._lf();
  16301. $ctx2.sendIdx["lf"]=3;
  16302. $recv(stream)._tab();
  16303. $ctx2.sendIdx["tab"]=2;
  16304. $recv(stream)._write_("| temporary variable names |");
  16305. $ctx2.sendIdx["write:"]=3;
  16306. $recv(stream)._lf();
  16307. $recv(stream)._tab();
  16308. return $recv(stream)._write_("statements");
  16309. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16310. }));
  16311. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16312. },
  16313. args: [],
  16314. 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' ]",
  16315. referencedClasses: ["String"],
  16316. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16317. }),
  16318. $globals.TBehaviorProvider);
  16319. $core.addMethod(
  16320. $core.method({
  16321. selector: "methods",
  16322. protocol: "accessing",
  16323. fn: function (){
  16324. var self=this,$self=this;
  16325. return $core.withContext(function($ctx1) {
  16326. return $recv($self._methodDictionary())._values();
  16327. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16328. },
  16329. args: [],
  16330. source: "methods\x0a\x09^ self methodDictionary values",
  16331. referencedClasses: [],
  16332. messageSends: ["values", "methodDictionary"]
  16333. }),
  16334. $globals.TBehaviorProvider);
  16335. $core.addMethod(
  16336. $core.method({
  16337. selector: "methodsInProtocol:",
  16338. protocol: "accessing",
  16339. fn: function (aString){
  16340. var self=this,$self=this;
  16341. return $core.withContext(function($ctx1) {
  16342. return $recv($self._methods())._select_((function(each){
  16343. return $core.withContext(function($ctx2) {
  16344. return $recv($recv(each)._protocol()).__eq(aString);
  16345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16346. }));
  16347. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16348. },
  16349. args: ["aString"],
  16350. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16351. referencedClasses: [],
  16352. messageSends: ["select:", "methods", "=", "protocol"]
  16353. }),
  16354. $globals.TBehaviorProvider);
  16355. $core.addMethod(
  16356. $core.method({
  16357. selector: "organization",
  16358. protocol: "accessing",
  16359. fn: function (){
  16360. var self=this,$self=this;
  16361. return $core.withContext(function($ctx1) {
  16362. var $1,$receiver;
  16363. $1=$self._basicOrganization();
  16364. $ctx1.sendIdx["basicOrganization"]=1;
  16365. if(($receiver = $1) == null || $receiver.a$nil){
  16366. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16367. return $self._basicOrganization();
  16368. } else {
  16369. return $1;
  16370. }
  16371. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16372. },
  16373. args: [],
  16374. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16375. referencedClasses: ["ClassOrganizer"],
  16376. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16377. }),
  16378. $globals.TBehaviorProvider);
  16379. $core.addMethod(
  16380. $core.method({
  16381. selector: "ownMethods",
  16382. protocol: "accessing",
  16383. fn: function (){
  16384. var self=this,$self=this;
  16385. return $core.withContext(function($ctx1) {
  16386. var $1;
  16387. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16388. return $core.withContext(function($ctx2) {
  16389. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16390. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16391. })))._sorted_((function(a,b){
  16392. return $core.withContext(function($ctx2) {
  16393. $1=$recv(a)._selector();
  16394. $ctx2.sendIdx["selector"]=1;
  16395. return $recv($1).__lt_eq($recv(b)._selector());
  16396. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16397. }));
  16398. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16399. },
  16400. args: [],
  16401. 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 ]",
  16402. referencedClasses: ["OrderedCollection"],
  16403. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16404. }),
  16405. $globals.TBehaviorProvider);
  16406. $core.addMethod(
  16407. $core.method({
  16408. selector: "ownMethodsInProtocol:",
  16409. protocol: "accessing",
  16410. fn: function (aString){
  16411. var self=this,$self=this;
  16412. return $core.withContext(function($ctx1) {
  16413. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16414. return $core.withContext(function($ctx2) {
  16415. return $recv($recv(each)._methodClass()).__eq(self);
  16416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16417. }));
  16418. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16419. },
  16420. args: ["aString"],
  16421. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16422. referencedClasses: [],
  16423. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16424. }),
  16425. $globals.TBehaviorProvider);
  16426. $core.addMethod(
  16427. $core.method({
  16428. selector: "ownProtocols",
  16429. protocol: "accessing",
  16430. fn: function (){
  16431. var self=this,$self=this;
  16432. return $core.withContext(function($ctx1) {
  16433. return $recv($self._protocols())._reject_((function(each){
  16434. return $core.withContext(function($ctx2) {
  16435. return $recv(each)._match_("^\x5c*");
  16436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16437. }));
  16438. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16439. },
  16440. args: [],
  16441. 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*' ]",
  16442. referencedClasses: [],
  16443. messageSends: ["reject:", "protocols", "match:"]
  16444. }),
  16445. $globals.TBehaviorProvider);
  16446. $core.addMethod(
  16447. $core.method({
  16448. selector: "packageOfProtocol:",
  16449. protocol: "accessing",
  16450. fn: function (aString){
  16451. var self=this,$self=this;
  16452. return $core.withContext(function($ctx1) {
  16453. var $1;
  16454. $1=$recv(aString)._beginsWith_("*");
  16455. if(!$core.assert($1)){
  16456. return $self._package();
  16457. }
  16458. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16459. return nil;
  16460. }));
  16461. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16462. },
  16463. args: ["aString"],
  16464. 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 ]",
  16465. referencedClasses: ["Package"],
  16466. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16467. }),
  16468. $globals.TBehaviorProvider);
  16469. $core.addMethod(
  16470. $core.method({
  16471. selector: "protocols",
  16472. protocol: "accessing",
  16473. fn: function (){
  16474. var self=this,$self=this;
  16475. return $core.withContext(function($ctx1) {
  16476. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16477. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16478. },
  16479. args: [],
  16480. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16481. referencedClasses: [],
  16482. messageSends: ["sorted", "asArray", "elements", "organization"]
  16483. }),
  16484. $globals.TBehaviorProvider);
  16485. $core.addMethod(
  16486. $core.method({
  16487. selector: "protocolsDo:",
  16488. protocol: "enumerating",
  16489. fn: function (aBlock){
  16490. var self=this,$self=this;
  16491. var methodsByProtocol;
  16492. return $core.withContext(function($ctx1) {
  16493. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16494. $ctx1.sendIdx["new"]=1;
  16495. $recv($self._methodDictionary())._valuesDo_((function(m){
  16496. return $core.withContext(function($ctx2) {
  16497. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16498. return $core.withContext(function($ctx3) {
  16499. return $recv($globals.Array)._new();
  16500. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16501. })))._add_(m);
  16502. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16503. }));
  16504. $recv($self._protocols())._do_((function(protocol){
  16505. return $core.withContext(function($ctx2) {
  16506. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16507. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16508. }));
  16509. return self;
  16510. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16511. },
  16512. args: ["aBlock"],
  16513. 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) ]",
  16514. referencedClasses: ["HashedCollection", "Array"],
  16515. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16516. }),
  16517. $globals.TBehaviorProvider);
  16518. $core.addMethod(
  16519. $core.method({
  16520. selector: "recompile",
  16521. protocol: "compiling",
  16522. fn: function (){
  16523. var self=this,$self=this;
  16524. return $core.withContext(function($ctx1) {
  16525. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16526. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16527. },
  16528. args: [],
  16529. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16530. referencedClasses: ["Compiler"],
  16531. messageSends: ["recompile:", "new"]
  16532. }),
  16533. $globals.TBehaviorProvider);
  16534. $core.addMethod(
  16535. $core.method({
  16536. selector: "removeCompiledMethod:",
  16537. protocol: "compiling",
  16538. fn: function (aMethod){
  16539. var self=this,$self=this;
  16540. return $core.withContext(function($ctx1) {
  16541. var $1,$3,$2;
  16542. $self._basicRemoveCompiledMethod_(aMethod);
  16543. $1=$recv($globals.SystemAnnouncer)._current();
  16544. $3=$recv($globals.MethodRemoved)._new();
  16545. $recv($3)._method_(aMethod);
  16546. $2=$recv($3)._yourself();
  16547. $recv($1)._announce_($2);
  16548. return self;
  16549. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16550. },
  16551. args: ["aMethod"],
  16552. 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)",
  16553. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16554. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16555. }),
  16556. $globals.TBehaviorProvider);
  16557. $core.addMethod(
  16558. $core.method({
  16559. selector: "removeProtocolIfEmpty:",
  16560. protocol: "accessing",
  16561. fn: function (aString){
  16562. var self=this,$self=this;
  16563. return $core.withContext(function($ctx1) {
  16564. $recv($self._methods())._detect_ifNone_((function(each){
  16565. return $core.withContext(function($ctx2) {
  16566. return $recv($recv(each)._protocol()).__eq(aString);
  16567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16568. }),(function(){
  16569. return $core.withContext(function($ctx2) {
  16570. return $recv($self._organization())._removeElement_(aString);
  16571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16572. }));
  16573. return self;
  16574. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16575. },
  16576. args: ["aString"],
  16577. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16578. referencedClasses: [],
  16579. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16580. }),
  16581. $globals.TBehaviorProvider);
  16582. $core.addMethod(
  16583. $core.method({
  16584. selector: "selectors",
  16585. protocol: "accessing",
  16586. fn: function (){
  16587. var self=this,$self=this;
  16588. return $core.withContext(function($ctx1) {
  16589. return $recv($self._methodDictionary())._keys();
  16590. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16591. },
  16592. args: [],
  16593. source: "selectors\x0a\x09^ self methodDictionary keys",
  16594. referencedClasses: [],
  16595. messageSends: ["keys", "methodDictionary"]
  16596. }),
  16597. $globals.TBehaviorProvider);
  16598. $core.addMethod(
  16599. $core.method({
  16600. selector: "setTraitComposition:",
  16601. protocol: "compiling",
  16602. fn: function (aTraitComposition){
  16603. var self=this,$self=this;
  16604. return $core.withContext(function($ctx1) {
  16605. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16606. return self;
  16607. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16608. },
  16609. args: ["aTraitComposition"],
  16610. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16611. referencedClasses: [],
  16612. messageSends: []
  16613. }),
  16614. $globals.TBehaviorProvider);
  16615. $core.addMethod(
  16616. $core.method({
  16617. selector: "traitComposition",
  16618. protocol: "accessing",
  16619. fn: function (){
  16620. var self=this,$self=this;
  16621. return $core.withContext(function($ctx1) {
  16622. var $1,$receiver;
  16623. $1=$self._basicAt_("traitComposition");
  16624. if(($receiver = $1) == null || $receiver.a$nil){
  16625. return [];
  16626. } else {
  16627. var aCollection;
  16628. aCollection=$receiver;
  16629. return $recv(aCollection)._collect_((function(each){
  16630. return $core.withContext(function($ctx2) {
  16631. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16632. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16633. }));
  16634. }
  16635. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16636. },
  16637. args: [],
  16638. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16639. referencedClasses: ["TraitTransformation"],
  16640. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16641. }),
  16642. $globals.TBehaviorProvider);
  16643. $core.addMethod(
  16644. $core.method({
  16645. selector: "traitCompositionDefinition",
  16646. protocol: "accessing",
  16647. fn: function (){
  16648. var self=this,$self=this;
  16649. return $core.withContext(function($ctx1) {
  16650. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16651. return $core.withContext(function($ctx2) {
  16652. return $recv($globals.String)._streamContents_((function(str){
  16653. return $core.withContext(function($ctx3) {
  16654. $recv(str)._write_("{");
  16655. $ctx3.sendIdx["write:"]=1;
  16656. $recv(traitComposition)._do_separatedBy_((function(each){
  16657. return $core.withContext(function($ctx4) {
  16658. return $recv(str)._write_($recv(each)._definition());
  16659. $ctx4.sendIdx["write:"]=2;
  16660. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16661. }),(function(){
  16662. return $core.withContext(function($ctx4) {
  16663. return $recv(str)._write_(". ");
  16664. $ctx4.sendIdx["write:"]=3;
  16665. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16666. }));
  16667. return $recv(str)._write_("}");
  16668. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16669. }));
  16670. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16671. }));
  16672. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16673. },
  16674. args: [],
  16675. 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: '}' ] ]",
  16676. referencedClasses: ["String"],
  16677. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16678. }),
  16679. $globals.TBehaviorProvider);
  16680. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16681. $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.";
  16682. $core.addMethod(
  16683. $core.method({
  16684. selector: "asJavaScriptSource",
  16685. protocol: "converting",
  16686. fn: function (){
  16687. var self=this,$self=this;
  16688. return $core.withContext(function($ctx1) {
  16689. return "$globals.".__comma($self._name());
  16690. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16691. },
  16692. args: [],
  16693. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16694. referencedClasses: [],
  16695. messageSends: [",", "name"]
  16696. }),
  16697. $globals.TMasterBehavior);
  16698. $core.addMethod(
  16699. $core.method({
  16700. selector: "browse",
  16701. protocol: "browsing",
  16702. fn: function (){
  16703. var self=this,$self=this;
  16704. return $core.withContext(function($ctx1) {
  16705. $recv($globals.Finder)._findClass_(self);
  16706. return self;
  16707. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16708. },
  16709. args: [],
  16710. source: "browse\x0a\x09Finder findClass: self",
  16711. referencedClasses: ["Finder"],
  16712. messageSends: ["findClass:"]
  16713. }),
  16714. $globals.TMasterBehavior);
  16715. $core.addMethod(
  16716. $core.method({
  16717. selector: "category",
  16718. protocol: "accessing",
  16719. fn: function (){
  16720. var self=this,$self=this;
  16721. return $core.withContext(function($ctx1) {
  16722. var $1,$receiver;
  16723. $1=$self._package();
  16724. $ctx1.sendIdx["package"]=1;
  16725. if(($receiver = $1) == null || $receiver.a$nil){
  16726. return "Unclassified";
  16727. } else {
  16728. return $recv($self._package())._name();
  16729. }
  16730. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16731. },
  16732. args: [],
  16733. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16734. referencedClasses: [],
  16735. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16736. }),
  16737. $globals.TMasterBehavior);
  16738. $core.addMethod(
  16739. $core.method({
  16740. selector: "classTag",
  16741. protocol: "accessing",
  16742. fn: function (){
  16743. var self=this,$self=this;
  16744. return $core.withContext(function($ctx1) {
  16745. return $self._subclassResponsibility();
  16746. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16747. },
  16748. args: [],
  16749. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16750. referencedClasses: [],
  16751. messageSends: ["subclassResponsibility"]
  16752. }),
  16753. $globals.TMasterBehavior);
  16754. $core.addMethod(
  16755. $core.method({
  16756. selector: "comment",
  16757. protocol: "accessing",
  16758. fn: function (){
  16759. var self=this,$self=this;
  16760. return $core.withContext(function($ctx1) {
  16761. var $1,$receiver;
  16762. $1=$self._basicAt_("comment");
  16763. if(($receiver = $1) == null || $receiver.a$nil){
  16764. return "";
  16765. } else {
  16766. return $1;
  16767. }
  16768. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16769. },
  16770. args: [],
  16771. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16772. referencedClasses: [],
  16773. messageSends: ["ifNil:", "basicAt:"]
  16774. }),
  16775. $globals.TMasterBehavior);
  16776. $core.addMethod(
  16777. $core.method({
  16778. selector: "comment:",
  16779. protocol: "accessing",
  16780. fn: function (aString){
  16781. var self=this,$self=this;
  16782. return $core.withContext(function($ctx1) {
  16783. var $1,$3,$2;
  16784. $self._basicAt_put_("comment",aString);
  16785. $1=$recv($globals.SystemAnnouncer)._current();
  16786. $3=$recv($globals.ClassCommentChanged)._new();
  16787. $recv($3)._theClass_(self);
  16788. $2=$recv($3)._yourself();
  16789. $recv($1)._announce_($2);
  16790. return self;
  16791. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16792. },
  16793. args: ["aString"],
  16794. 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)",
  16795. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16796. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16797. }),
  16798. $globals.TMasterBehavior);
  16799. $core.addMethod(
  16800. $core.method({
  16801. selector: "definedMethods",
  16802. protocol: "accessing",
  16803. fn: function (){
  16804. var self=this,$self=this;
  16805. var methods;
  16806. return $core.withContext(function($ctx1) {
  16807. var $1,$receiver;
  16808. methods=$self._methods();
  16809. $ctx1.sendIdx["methods"]=1;
  16810. $1=$self._theMetaClass();
  16811. if(($receiver = $1) == null || $receiver.a$nil){
  16812. return methods;
  16813. } else {
  16814. var meta;
  16815. meta=$receiver;
  16816. return $recv(methods).__comma($recv(meta)._methods());
  16817. }
  16818. return self;
  16819. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16820. },
  16821. args: [],
  16822. 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 ]",
  16823. referencedClasses: [],
  16824. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16825. }),
  16826. $globals.TMasterBehavior);
  16827. $core.addMethod(
  16828. $core.method({
  16829. selector: "enterOrganization",
  16830. protocol: "accessing",
  16831. fn: function (){
  16832. var self=this,$self=this;
  16833. return $core.withContext(function($ctx1) {
  16834. var $1,$receiver;
  16835. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16836. $globals.Smalltalk;
  16837. } else {
  16838. $1=$self._basicAt_("category");
  16839. if(($receiver = $1) == null || $receiver.a$nil){
  16840. $self._basicPackage_(nil);
  16841. $ctx1.sendIdx["basicPackage:"]=1;
  16842. } else {
  16843. var category;
  16844. category=$receiver;
  16845. $self._basicPackage_($recv($globals.Package)._named_(category));
  16846. $recv($recv($self._package())._organization())._addElement_(self);
  16847. }
  16848. }
  16849. return self;
  16850. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16851. },
  16852. args: [],
  16853. 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 ] ]",
  16854. referencedClasses: ["Smalltalk", "Package"],
  16855. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16856. }),
  16857. $globals.TMasterBehavior);
  16858. $core.addMethod(
  16859. $core.method({
  16860. selector: "leaveOrganization",
  16861. protocol: "accessing",
  16862. fn: function (){
  16863. var self=this,$self=this;
  16864. return $core.withContext(function($ctx1) {
  16865. var $receiver;
  16866. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16867. $globals.Smalltalk;
  16868. } else {
  16869. $recv($recv($self._package())._organization())._removeElement_(self);
  16870. }
  16871. return self;
  16872. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16873. },
  16874. args: [],
  16875. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16876. referencedClasses: ["Smalltalk"],
  16877. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16878. }),
  16879. $globals.TMasterBehavior);
  16880. $core.addMethod(
  16881. $core.method({
  16882. selector: "name",
  16883. protocol: "accessing",
  16884. fn: function (){
  16885. var self=this,$self=this;
  16886. return $core.withContext(function($ctx1) {
  16887. return self.name;
  16888. return self;
  16889. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16890. },
  16891. args: [],
  16892. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16893. referencedClasses: [],
  16894. messageSends: []
  16895. }),
  16896. $globals.TMasterBehavior);
  16897. $core.addMethod(
  16898. $core.method({
  16899. selector: "package:",
  16900. protocol: "accessing",
  16901. fn: function (aPackage){
  16902. var self=this,$self=this;
  16903. var oldPackage;
  16904. return $core.withContext(function($ctx1) {
  16905. var $2,$1,$3,$5,$4;
  16906. $2=$self._package();
  16907. $ctx1.sendIdx["package"]=1;
  16908. $1=$recv($2).__eq(aPackage);
  16909. if($core.assert($1)){
  16910. return self;
  16911. }
  16912. oldPackage=$self._package();
  16913. $self._leaveOrganization();
  16914. $self._basicAt_put_("category",aPackage);
  16915. $self._enterOrganization();
  16916. $3=$recv($globals.SystemAnnouncer)._current();
  16917. $5=$recv($globals.ClassMoved)._new();
  16918. $recv($5)._theClass_(self);
  16919. $recv($5)._oldPackage_(oldPackage);
  16920. $4=$recv($5)._yourself();
  16921. $recv($3)._announce_($4);
  16922. return self;
  16923. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16924. },
  16925. args: ["aPackage"],
  16926. 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;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16927. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16928. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16929. }),
  16930. $globals.TMasterBehavior);
  16931. $core.addMethod(
  16932. $core.method({
  16933. selector: "theNonMetaClass",
  16934. protocol: "accessing",
  16935. fn: function (){
  16936. var self=this,$self=this;
  16937. return self;
  16938. },
  16939. args: [],
  16940. source: "theNonMetaClass\x0a\x09^ self",
  16941. referencedClasses: [],
  16942. messageSends: []
  16943. }),
  16944. $globals.TMasterBehavior);
  16945. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16946. $core.addMethod(
  16947. $core.method({
  16948. selector: "-",
  16949. protocol: "composition",
  16950. fn: function (anArray){
  16951. var self=this,$self=this;
  16952. return $core.withContext(function($ctx1) {
  16953. return $recv($self._asTraitTransformation()).__minus(anArray);
  16954. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16955. },
  16956. args: ["anArray"],
  16957. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16958. referencedClasses: [],
  16959. messageSends: ["-", "asTraitTransformation"]
  16960. }),
  16961. $globals.Trait);
  16962. $core.addMethod(
  16963. $core.method({
  16964. selector: "@",
  16965. protocol: "composition",
  16966. fn: function (anArrayOfAssociations){
  16967. var self=this,$self=this;
  16968. return $core.withContext(function($ctx1) {
  16969. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16970. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16971. },
  16972. args: ["anArrayOfAssociations"],
  16973. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16974. referencedClasses: [],
  16975. messageSends: ["@", "asTraitTransformation"]
  16976. }),
  16977. $globals.Trait);
  16978. $core.addMethod(
  16979. $core.method({
  16980. selector: "asTraitComposition",
  16981. protocol: "converting",
  16982. fn: function (){
  16983. var self=this,$self=this;
  16984. return $core.withContext(function($ctx1) {
  16985. return $recv($self._asTraitTransformation())._asTraitComposition();
  16986. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16987. },
  16988. args: [],
  16989. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16990. referencedClasses: [],
  16991. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16992. }),
  16993. $globals.Trait);
  16994. $core.addMethod(
  16995. $core.method({
  16996. selector: "asTraitTransformation",
  16997. protocol: "converting",
  16998. fn: function (){
  16999. var self=this,$self=this;
  17000. return $core.withContext(function($ctx1) {
  17001. return $recv($globals.TraitTransformation)._on_(self);
  17002. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  17003. },
  17004. args: [],
  17005. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  17006. referencedClasses: ["TraitTransformation"],
  17007. messageSends: ["on:"]
  17008. }),
  17009. $globals.Trait);
  17010. $core.addMethod(
  17011. $core.method({
  17012. selector: "basicOrganization",
  17013. protocol: "accessing",
  17014. fn: function (){
  17015. var self=this,$self=this;
  17016. return $self["@organization"];
  17017. },
  17018. args: [],
  17019. source: "basicOrganization\x0a\x09^ organization",
  17020. referencedClasses: [],
  17021. messageSends: []
  17022. }),
  17023. $globals.Trait);
  17024. $core.addMethod(
  17025. $core.method({
  17026. selector: "basicOrganization:",
  17027. protocol: "accessing",
  17028. fn: function (aClassOrganizer){
  17029. var self=this,$self=this;
  17030. $self["@organization"]=aClassOrganizer;
  17031. return self;
  17032. },
  17033. args: ["aClassOrganizer"],
  17034. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  17035. referencedClasses: [],
  17036. messageSends: []
  17037. }),
  17038. $globals.Trait);
  17039. $core.addMethod(
  17040. $core.method({
  17041. selector: "basicPackage:",
  17042. protocol: "accessing",
  17043. fn: function (aPackage){
  17044. var self=this,$self=this;
  17045. $self["@package"]=aPackage;
  17046. return self;
  17047. },
  17048. args: ["aPackage"],
  17049. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  17050. referencedClasses: [],
  17051. messageSends: []
  17052. }),
  17053. $globals.Trait);
  17054. $core.addMethod(
  17055. $core.method({
  17056. selector: "classTag",
  17057. protocol: "accessing",
  17058. fn: function (){
  17059. var self=this,$self=this;
  17060. return "trait";
  17061. },
  17062. args: [],
  17063. source: "classTag\x0a\x09^ 'trait'",
  17064. referencedClasses: [],
  17065. messageSends: []
  17066. }),
  17067. $globals.Trait);
  17068. $core.addMethod(
  17069. $core.method({
  17070. selector: "definition",
  17071. protocol: "accessing",
  17072. fn: function (){
  17073. var self=this,$self=this;
  17074. return $core.withContext(function($ctx1) {
  17075. var $1;
  17076. return $recv($globals.String)._streamContents_((function(stream){
  17077. return $core.withContext(function($ctx2) {
  17078. $recv(stream)._write_("Trait named: ");
  17079. $ctx2.sendIdx["write:"]=1;
  17080. $recv(stream)._printSymbol_($self._name());
  17081. $recv(stream)._lf();
  17082. $ctx2.sendIdx["lf"]=1;
  17083. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  17084. return $core.withContext(function($ctx3) {
  17085. $1=$recv($globals.String)._tab();
  17086. $ctx3.sendIdx["tab"]=1;
  17087. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  17088. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17089. })));
  17090. $ctx2.sendIdx["write:"]=2;
  17091. $recv(stream)._tab();
  17092. $recv(stream)._write_("package: ");
  17093. return $recv(stream)._print_($self._category());
  17094. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17095. }));
  17096. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  17097. },
  17098. args: [],
  17099. 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 ]",
  17100. referencedClasses: ["String"],
  17101. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17102. }),
  17103. $globals.Trait);
  17104. $core.addMethod(
  17105. $core.method({
  17106. selector: "package",
  17107. protocol: "accessing",
  17108. fn: function (){
  17109. var self=this,$self=this;
  17110. return $self["@package"];
  17111. },
  17112. args: [],
  17113. source: "package\x0a\x09^ package",
  17114. referencedClasses: [],
  17115. messageSends: []
  17116. }),
  17117. $globals.Trait);
  17118. $core.addMethod(
  17119. $core.method({
  17120. selector: "theMetaClass",
  17121. protocol: "accessing",
  17122. fn: function (){
  17123. var self=this,$self=this;
  17124. return nil;
  17125. },
  17126. args: [],
  17127. source: "theMetaClass\x0a\x09^ nil",
  17128. referencedClasses: [],
  17129. messageSends: []
  17130. }),
  17131. $globals.Trait);
  17132. $core.addMethod(
  17133. $core.method({
  17134. selector: "traitUsers",
  17135. protocol: "accessing",
  17136. fn: function (){
  17137. var self=this,$self=this;
  17138. return $core.withContext(function($ctx1) {
  17139. return $recv($self._basicAt_("traitUsers"))._copy();
  17140. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  17141. },
  17142. args: [],
  17143. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  17144. referencedClasses: [],
  17145. messageSends: ["copy", "basicAt:"]
  17146. }),
  17147. $globals.Trait);
  17148. $core.addMethod(
  17149. $core.method({
  17150. selector: "named:package:",
  17151. protocol: "instance creation",
  17152. fn: function (aString,anotherString){
  17153. var self=this,$self=this;
  17154. return $core.withContext(function($ctx1) {
  17155. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17156. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  17157. },
  17158. args: ["aString", "anotherString"],
  17159. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17160. referencedClasses: ["ClassBuilder"],
  17161. messageSends: ["addTraitNamed:package:", "new"]
  17162. }),
  17163. $globals.Trait.a$cls);
  17164. $core.addMethod(
  17165. $core.method({
  17166. selector: "named:uses:package:",
  17167. protocol: "instance creation",
  17168. fn: function (aString,aTraitCompositionDescription,anotherString){
  17169. var self=this,$self=this;
  17170. var trait;
  17171. return $core.withContext(function($ctx1) {
  17172. trait=$self._named_package_(aString,anotherString);
  17173. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17174. return trait;
  17175. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  17176. },
  17177. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17178. 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",
  17179. referencedClasses: [],
  17180. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17181. }),
  17182. $globals.Trait.a$cls);
  17183. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17184. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17185. $core.addMethod(
  17186. $core.method({
  17187. selector: "-",
  17188. protocol: "composition",
  17189. fn: function (anArray){
  17190. var self=this,$self=this;
  17191. return $core.withContext(function($ctx1) {
  17192. var $1;
  17193. $1=$self._copy();
  17194. $recv($1)._addExclusions_(anArray);
  17195. return $recv($1)._yourself();
  17196. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17197. },
  17198. args: ["anArray"],
  17199. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17200. referencedClasses: [],
  17201. messageSends: ["addExclusions:", "copy", "yourself"]
  17202. }),
  17203. $globals.TraitTransformation);
  17204. $core.addMethod(
  17205. $core.method({
  17206. selector: "@",
  17207. protocol: "composition",
  17208. fn: function (anArrayOfAssociations){
  17209. var self=this,$self=this;
  17210. return $core.withContext(function($ctx1) {
  17211. var $1;
  17212. $1=$self._copy();
  17213. $recv($1)._addAliases_(anArrayOfAssociations);
  17214. return $recv($1)._yourself();
  17215. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17216. },
  17217. args: ["anArrayOfAssociations"],
  17218. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17219. referencedClasses: [],
  17220. messageSends: ["addAliases:", "copy", "yourself"]
  17221. }),
  17222. $globals.TraitTransformation);
  17223. $core.addMethod(
  17224. $core.method({
  17225. selector: "addAliases:",
  17226. protocol: "accessing",
  17227. fn: function (anArrayOfAssociations){
  17228. var self=this,$self=this;
  17229. return $core.withContext(function($ctx1) {
  17230. $recv(anArrayOfAssociations)._do_((function(each){
  17231. var key;
  17232. return $core.withContext(function($ctx2) {
  17233. key=$recv(each)._key();
  17234. key;
  17235. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17236. return $core.withContext(function($ctx3) {
  17237. return $self._error_("Cannot use same alias name twice.");
  17238. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17239. }),(function(){
  17240. return $core.withContext(function($ctx3) {
  17241. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17242. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17243. }));
  17244. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17245. }));
  17246. return anArrayOfAssociations;
  17247. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17248. },
  17249. args: ["anArrayOfAssociations"],
  17250. 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",
  17251. referencedClasses: [],
  17252. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17253. }),
  17254. $globals.TraitTransformation);
  17255. $core.addMethod(
  17256. $core.method({
  17257. selector: "addExclusions:",
  17258. protocol: "accessing",
  17259. fn: function (anArray){
  17260. var self=this,$self=this;
  17261. return $core.withContext(function($ctx1) {
  17262. $recv($self["@exclusions"])._addAll_(anArray);
  17263. return anArray;
  17264. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17265. },
  17266. args: ["anArray"],
  17267. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17268. referencedClasses: [],
  17269. messageSends: ["addAll:"]
  17270. }),
  17271. $globals.TraitTransformation);
  17272. $core.addMethod(
  17273. $core.method({
  17274. selector: "aliases",
  17275. protocol: "accessing",
  17276. fn: function (){
  17277. var self=this,$self=this;
  17278. return $self["@aliases"];
  17279. },
  17280. args: [],
  17281. source: "aliases\x0a\x09^ aliases",
  17282. referencedClasses: [],
  17283. messageSends: []
  17284. }),
  17285. $globals.TraitTransformation);
  17286. $core.addMethod(
  17287. $core.method({
  17288. selector: "asJavaScriptObject",
  17289. protocol: "converting",
  17290. fn: function (){
  17291. var self=this,$self=this;
  17292. return $core.withContext(function($ctx1) {
  17293. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17294. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17295. },
  17296. args: [],
  17297. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17298. referencedClasses: [],
  17299. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17300. }),
  17301. $globals.TraitTransformation);
  17302. $core.addMethod(
  17303. $core.method({
  17304. selector: "asJavaScriptSource",
  17305. protocol: "converting",
  17306. fn: function (){
  17307. var self=this,$self=this;
  17308. return $core.withContext(function($ctx1) {
  17309. var $2,$3,$1;
  17310. return $recv($globals.String)._streamContents_((function(str){
  17311. return $core.withContext(function($ctx2) {
  17312. $2=$recv($self._trait())._asJavaScriptSource();
  17313. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17314. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17315. return $core.withContext(function($ctx3) {
  17316. return [", aliases: ",$recv(al)._asJSONString()];
  17317. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17318. }));
  17319. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17320. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17321. return $core.withContext(function($ctx3) {
  17322. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17323. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17324. })),"}"];
  17325. return $recv(str)._write_($1);
  17326. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17327. }));
  17328. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17329. },
  17330. args: [],
  17331. 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'}' } ]",
  17332. referencedClasses: ["String"],
  17333. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17334. }),
  17335. $globals.TraitTransformation);
  17336. $core.addMethod(
  17337. $core.method({
  17338. selector: "asTraitComposition",
  17339. protocol: "converting",
  17340. fn: function (){
  17341. var self=this,$self=this;
  17342. return [self];
  17343. },
  17344. args: [],
  17345. source: "asTraitComposition\x0a\x09^ { self }",
  17346. referencedClasses: [],
  17347. messageSends: []
  17348. }),
  17349. $globals.TraitTransformation);
  17350. $core.addMethod(
  17351. $core.method({
  17352. selector: "asTraitTransformation",
  17353. protocol: "converting",
  17354. fn: function (){
  17355. var self=this,$self=this;
  17356. return self;
  17357. },
  17358. args: [],
  17359. source: "asTraitTransformation\x0a\x09^ self",
  17360. referencedClasses: [],
  17361. messageSends: []
  17362. }),
  17363. $globals.TraitTransformation);
  17364. $core.addMethod(
  17365. $core.method({
  17366. selector: "definition",
  17367. protocol: "accessing",
  17368. fn: function (){
  17369. var self=this,$self=this;
  17370. return $core.withContext(function($ctx1) {
  17371. return $recv($globals.String)._streamContents_((function(str){
  17372. return $core.withContext(function($ctx2) {
  17373. $recv(str)._print_($self._trait());
  17374. $recv($self._aliases())._ifNotEmpty_((function(al){
  17375. return $core.withContext(function($ctx3) {
  17376. $recv(str)._write_(" @ {");
  17377. $ctx3.sendIdx["write:"]=1;
  17378. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17379. return $core.withContext(function($ctx4) {
  17380. $recv(str)._printSymbol_($recv(each)._key());
  17381. $ctx4.sendIdx["printSymbol:"]=1;
  17382. $recv(str)._write_(" -> ");
  17383. $ctx4.sendIdx["write:"]=2;
  17384. return $recv(str)._printSymbol_($recv(each)._value());
  17385. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17386. }),(function(){
  17387. return $core.withContext(function($ctx4) {
  17388. return $recv(str)._write_(". ");
  17389. $ctx4.sendIdx["write:"]=3;
  17390. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17391. }));
  17392. $ctx3.sendIdx["do:separatedBy:"]=1;
  17393. return $recv(str)._write_("}");
  17394. $ctx3.sendIdx["write:"]=4;
  17395. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17396. }));
  17397. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17398. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17399. return $core.withContext(function($ctx3) {
  17400. $recv(str)._write_(" - #(");
  17401. $ctx3.sendIdx["write:"]=5;
  17402. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17403. return $core.withContext(function($ctx4) {
  17404. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17405. $ctx4.sendIdx["write:"]=6;
  17406. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17407. }),(function(){
  17408. return $core.withContext(function($ctx4) {
  17409. return $recv(str)._space();
  17410. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17411. }));
  17412. return $recv(str)._write_(")");
  17413. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17414. }));
  17415. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17416. }));
  17417. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17418. },
  17419. args: [],
  17420. 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: ')' ] ]",
  17421. referencedClasses: ["String"],
  17422. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17423. }),
  17424. $globals.TraitTransformation);
  17425. $core.addMethod(
  17426. $core.method({
  17427. selector: "exclusions",
  17428. protocol: "accessing",
  17429. fn: function (){
  17430. var self=this,$self=this;
  17431. return $self["@exclusions"];
  17432. },
  17433. args: [],
  17434. source: "exclusions\x0a\x09^ exclusions",
  17435. referencedClasses: [],
  17436. messageSends: []
  17437. }),
  17438. $globals.TraitTransformation);
  17439. $core.addMethod(
  17440. $core.method({
  17441. selector: "initialize",
  17442. protocol: "initialization",
  17443. fn: function (){
  17444. var self=this,$self=this;
  17445. return $core.withContext(function($ctx1) {
  17446. (
  17447. $ctx1.supercall = true,
  17448. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17449. $ctx1.supercall = false;
  17450. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17451. $self["@exclusions"]=$recv($globals.Set)._new();
  17452. $self["@trait"]=nil;
  17453. return self;
  17454. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17455. },
  17456. args: [],
  17457. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17458. referencedClasses: ["Set"],
  17459. messageSends: ["initialize", "new"]
  17460. }),
  17461. $globals.TraitTransformation);
  17462. $core.addMethod(
  17463. $core.method({
  17464. selector: "postCopy",
  17465. protocol: "copying",
  17466. fn: function (){
  17467. var self=this,$self=this;
  17468. return $core.withContext(function($ctx1) {
  17469. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17470. $ctx1.sendIdx["copy"]=1;
  17471. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17472. return self;
  17473. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17474. },
  17475. args: [],
  17476. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17477. referencedClasses: [],
  17478. messageSends: ["copy"]
  17479. }),
  17480. $globals.TraitTransformation);
  17481. $core.addMethod(
  17482. $core.method({
  17483. selector: "trait",
  17484. protocol: "accessing",
  17485. fn: function (){
  17486. var self=this,$self=this;
  17487. return $self["@trait"];
  17488. },
  17489. args: [],
  17490. source: "trait\x0a\x09^ trait",
  17491. referencedClasses: [],
  17492. messageSends: []
  17493. }),
  17494. $globals.TraitTransformation);
  17495. $core.addMethod(
  17496. $core.method({
  17497. selector: "trait:",
  17498. protocol: "accessing",
  17499. fn: function (anObject){
  17500. var self=this,$self=this;
  17501. $self["@trait"]=anObject;
  17502. return self;
  17503. },
  17504. args: ["anObject"],
  17505. source: "trait: anObject\x0a\x09trait := anObject",
  17506. referencedClasses: [],
  17507. messageSends: []
  17508. }),
  17509. $globals.TraitTransformation);
  17510. $core.addMethod(
  17511. $core.method({
  17512. selector: "fromJSON:",
  17513. protocol: "instance creation",
  17514. fn: function (aJSObject){
  17515. var self=this,$self=this;
  17516. return $core.withContext(function($ctx1) {
  17517. var $1,$4,$3,$2;
  17518. $1=(
  17519. $ctx1.supercall = true,
  17520. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17521. $ctx1.supercall = false;
  17522. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17523. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17524. return $globals.HashedCollection._newFromPairs_([]);
  17525. }));
  17526. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17527. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17528. $2=$recv($3)._associations();
  17529. $recv($1)._addAliases_($2);
  17530. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17531. return [];
  17532. })));
  17533. return $recv($1)._yourself();
  17534. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17535. },
  17536. args: ["aJSObject"],
  17537. 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",
  17538. referencedClasses: ["Smalltalk"],
  17539. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17540. }),
  17541. $globals.TraitTransformation.a$cls);
  17542. $core.addMethod(
  17543. $core.method({
  17544. selector: "on:",
  17545. protocol: "instance creation",
  17546. fn: function (aTrait){
  17547. var self=this,$self=this;
  17548. return $core.withContext(function($ctx1) {
  17549. var $1;
  17550. $1=(
  17551. $ctx1.supercall = true,
  17552. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17553. $ctx1.supercall = false;
  17554. $recv($1)._trait_(aTrait);
  17555. return $recv($1)._yourself();
  17556. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17557. },
  17558. args: ["aTrait"],
  17559. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17560. referencedClasses: [],
  17561. messageSends: ["trait:", "new", "yourself"]
  17562. }),
  17563. $globals.TraitTransformation.a$cls);
  17564. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17565. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17566. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17567. $core.addMethod(
  17568. $core.method({
  17569. selector: "asTraitComposition",
  17570. protocol: "*Kernel-Classes",
  17571. fn: function (){
  17572. var self=this,$self=this;
  17573. return $core.withContext(function($ctx1) {
  17574. return $self._collect_((function(each){
  17575. return $core.withContext(function($ctx2) {
  17576. return $recv(each)._asTraitTransformation();
  17577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17578. }));
  17579. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17580. },
  17581. args: [],
  17582. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17583. referencedClasses: [],
  17584. messageSends: ["collect:", "asTraitTransformation"]
  17585. }),
  17586. $globals.Array);
  17587. });
  17588. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17589. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17590. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17591. $core.addPackage("Kernel-Methods");
  17592. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  17593. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17594. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17595. $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 | ... ] `";
  17596. $core.addMethod(
  17597. $core.method({
  17598. selector: "applyTo:arguments:",
  17599. protocol: "evaluating",
  17600. fn: function (anObject,aCollection){
  17601. var self=this,$self=this;
  17602. return $core.withContext(function($ctx1) {
  17603. return self.apply(anObject, aCollection);
  17604. return self;
  17605. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17606. },
  17607. args: ["anObject", "aCollection"],
  17608. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17609. referencedClasses: [],
  17610. messageSends: []
  17611. }),
  17612. $globals.BlockClosure);
  17613. $core.addMethod(
  17614. $core.method({
  17615. selector: "asCompiledMethod:",
  17616. protocol: "converting",
  17617. fn: function (aString){
  17618. var self=this,$self=this;
  17619. return $core.withContext(function($ctx1) {
  17620. return $core.method({selector:aString, fn:self});;
  17621. return self;
  17622. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17623. },
  17624. args: ["aString"],
  17625. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17626. referencedClasses: [],
  17627. messageSends: []
  17628. }),
  17629. $globals.BlockClosure);
  17630. $core.addMethod(
  17631. $core.method({
  17632. selector: "compiledSource",
  17633. protocol: "accessing",
  17634. fn: function (){
  17635. var self=this,$self=this;
  17636. return $core.withContext(function($ctx1) {
  17637. return self.toString();
  17638. return self;
  17639. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17640. },
  17641. args: [],
  17642. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17643. referencedClasses: [],
  17644. messageSends: []
  17645. }),
  17646. $globals.BlockClosure);
  17647. $core.addMethod(
  17648. $core.method({
  17649. selector: "currySelf",
  17650. protocol: "converting",
  17651. fn: function (){
  17652. var self=this,$self=this;
  17653. return $core.withContext(function($ctx1) {
  17654. return function () {
  17655. var args = [ this ];
  17656. args.push.apply(args, arguments);
  17657. return self.apply(null, args);
  17658. }
  17659. ;
  17660. return self;
  17661. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17662. },
  17663. args: [],
  17664. 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'>",
  17665. referencedClasses: [],
  17666. messageSends: []
  17667. }),
  17668. $globals.BlockClosure);
  17669. $core.addMethod(
  17670. $core.method({
  17671. selector: "ensure:",
  17672. protocol: "evaluating",
  17673. fn: function (aBlock){
  17674. var self=this,$self=this;
  17675. return $core.withContext(function($ctx1) {
  17676. try{return $self._value()}finally{aBlock._value()};
  17677. return self;
  17678. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17679. },
  17680. args: ["aBlock"],
  17681. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17682. referencedClasses: [],
  17683. messageSends: []
  17684. }),
  17685. $globals.BlockClosure);
  17686. $core.addMethod(
  17687. $core.method({
  17688. selector: "fork",
  17689. protocol: "timeout/interval",
  17690. fn: function (){
  17691. var self=this,$self=this;
  17692. return $core.withContext(function($ctx1) {
  17693. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17694. return self;
  17695. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17696. },
  17697. args: [],
  17698. source: "fork\x0a\x09ForkPool default fork: self",
  17699. referencedClasses: ["ForkPool"],
  17700. messageSends: ["fork:", "default"]
  17701. }),
  17702. $globals.BlockClosure);
  17703. $core.addMethod(
  17704. $core.method({
  17705. selector: "new",
  17706. protocol: "evaluating",
  17707. fn: function (){
  17708. var self=this,$self=this;
  17709. return $core.withContext(function($ctx1) {
  17710. return new self();
  17711. return self;
  17712. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17713. },
  17714. args: [],
  17715. 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()'>",
  17716. referencedClasses: [],
  17717. messageSends: []
  17718. }),
  17719. $globals.BlockClosure);
  17720. $core.addMethod(
  17721. $core.method({
  17722. selector: "newValue:",
  17723. protocol: "evaluating",
  17724. fn: function (anObject){
  17725. var self=this,$self=this;
  17726. return $core.withContext(function($ctx1) {
  17727. return $self._newWithValues_([anObject]);
  17728. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17729. },
  17730. args: ["anObject"],
  17731. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17732. referencedClasses: [],
  17733. messageSends: ["newWithValues:"]
  17734. }),
  17735. $globals.BlockClosure);
  17736. $core.addMethod(
  17737. $core.method({
  17738. selector: "newValue:value:",
  17739. protocol: "evaluating",
  17740. fn: function (anObject,anObject2){
  17741. var self=this,$self=this;
  17742. return $core.withContext(function($ctx1) {
  17743. return $self._newWithValues_([anObject,anObject2]);
  17744. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17745. },
  17746. args: ["anObject", "anObject2"],
  17747. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17748. referencedClasses: [],
  17749. messageSends: ["newWithValues:"]
  17750. }),
  17751. $globals.BlockClosure);
  17752. $core.addMethod(
  17753. $core.method({
  17754. selector: "newValue:value:value:",
  17755. protocol: "evaluating",
  17756. fn: function (anObject,anObject2,anObject3){
  17757. var self=this,$self=this;
  17758. return $core.withContext(function($ctx1) {
  17759. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17760. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17761. },
  17762. args: ["anObject", "anObject2", "anObject3"],
  17763. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17764. referencedClasses: [],
  17765. messageSends: ["newWithValues:"]
  17766. }),
  17767. $globals.BlockClosure);
  17768. $core.addMethod(
  17769. $core.method({
  17770. selector: "newWithValues:",
  17771. protocol: "evaluating",
  17772. fn: function (aCollection){
  17773. var self=this,$self=this;
  17774. return $core.withContext(function($ctx1) {
  17775. var object = Object.create(self.prototype);
  17776. var result = self.apply(object, aCollection);
  17777. return typeof result === "object" ? result : object;
  17778. ;
  17779. return self;
  17780. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17781. },
  17782. args: ["aCollection"],
  17783. 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'>",
  17784. referencedClasses: [],
  17785. messageSends: []
  17786. }),
  17787. $globals.BlockClosure);
  17788. $core.addMethod(
  17789. $core.method({
  17790. selector: "numArgs",
  17791. protocol: "accessing",
  17792. fn: function (){
  17793. var self=this,$self=this;
  17794. return $core.withContext(function($ctx1) {
  17795. return self.length;
  17796. return self;
  17797. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17798. },
  17799. args: [],
  17800. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17801. referencedClasses: [],
  17802. messageSends: []
  17803. }),
  17804. $globals.BlockClosure);
  17805. $core.addMethod(
  17806. $core.method({
  17807. selector: "on:do:",
  17808. protocol: "error handling",
  17809. fn: function (anErrorClass,aBlock){
  17810. var self=this,$self=this;
  17811. return $core.withContext(function($ctx1) {
  17812. var $1;
  17813. return $self._tryCatch_((function(error){
  17814. var smalltalkError;
  17815. return $core.withContext(function($ctx2) {
  17816. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17817. smalltalkError;
  17818. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17819. if($core.assert($1)){
  17820. return $recv(aBlock)._value_(smalltalkError);
  17821. } else {
  17822. return $recv(smalltalkError)._resignal();
  17823. }
  17824. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17825. }));
  17826. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17827. },
  17828. args: ["anErrorClass", "aBlock"],
  17829. 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 ] ]",
  17830. referencedClasses: ["Smalltalk"],
  17831. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  17832. }),
  17833. $globals.BlockClosure);
  17834. $core.addMethod(
  17835. $core.method({
  17836. selector: "receiver",
  17837. protocol: "accessing",
  17838. fn: function (){
  17839. var self=this,$self=this;
  17840. return nil;
  17841. },
  17842. args: [],
  17843. source: "receiver\x0a\x09^ nil",
  17844. referencedClasses: [],
  17845. messageSends: []
  17846. }),
  17847. $globals.BlockClosure);
  17848. $core.addMethod(
  17849. $core.method({
  17850. selector: "timeToRun",
  17851. protocol: "evaluating",
  17852. fn: function (){
  17853. var self=this,$self=this;
  17854. return $core.withContext(function($ctx1) {
  17855. return $recv($globals.Date)._millisecondsToRun_(self);
  17856. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17857. },
  17858. args: [],
  17859. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17860. referencedClasses: ["Date"],
  17861. messageSends: ["millisecondsToRun:"]
  17862. }),
  17863. $globals.BlockClosure);
  17864. $core.addMethod(
  17865. $core.method({
  17866. selector: "tryCatch:",
  17867. protocol: "error handling",
  17868. fn: function (aBlock){
  17869. var self=this,$self=this;
  17870. return $core.withContext(function($ctx1) {
  17871. try {
  17872. return $self._value();
  17873. } catch(error) {
  17874. // pass non-local returns undetected
  17875. if (Array.isArray(error) && error.length === 1) throw error;
  17876. return aBlock._value_(error);
  17877. }
  17878. ;
  17879. return self;
  17880. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17881. },
  17882. args: ["aBlock"],
  17883. 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'>",
  17884. referencedClasses: [],
  17885. messageSends: []
  17886. }),
  17887. $globals.BlockClosure);
  17888. $core.addMethod(
  17889. $core.method({
  17890. selector: "value",
  17891. protocol: "evaluating",
  17892. fn: function (){
  17893. var self=this,$self=this;
  17894. return $core.withContext(function($ctx1) {
  17895. return self();;
  17896. return self;
  17897. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17898. },
  17899. args: [],
  17900. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17901. referencedClasses: [],
  17902. messageSends: []
  17903. }),
  17904. $globals.BlockClosure);
  17905. $core.addMethod(
  17906. $core.method({
  17907. selector: "value:",
  17908. protocol: "evaluating",
  17909. fn: function (anArg){
  17910. var self=this,$self=this;
  17911. return $core.withContext(function($ctx1) {
  17912. return self(anArg);;
  17913. return self;
  17914. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17915. },
  17916. args: ["anArg"],
  17917. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17918. referencedClasses: [],
  17919. messageSends: []
  17920. }),
  17921. $globals.BlockClosure);
  17922. $core.addMethod(
  17923. $core.method({
  17924. selector: "value:value:",
  17925. protocol: "evaluating",
  17926. fn: function (firstArg,secondArg){
  17927. var self=this,$self=this;
  17928. return $core.withContext(function($ctx1) {
  17929. return self(firstArg, secondArg);;
  17930. return self;
  17931. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17932. },
  17933. args: ["firstArg", "secondArg"],
  17934. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17935. referencedClasses: [],
  17936. messageSends: []
  17937. }),
  17938. $globals.BlockClosure);
  17939. $core.addMethod(
  17940. $core.method({
  17941. selector: "value:value:value:",
  17942. protocol: "evaluating",
  17943. fn: function (firstArg,secondArg,thirdArg){
  17944. var self=this,$self=this;
  17945. return $core.withContext(function($ctx1) {
  17946. return self(firstArg, secondArg, thirdArg);;
  17947. return self;
  17948. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17949. },
  17950. args: ["firstArg", "secondArg", "thirdArg"],
  17951. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17952. referencedClasses: [],
  17953. messageSends: []
  17954. }),
  17955. $globals.BlockClosure);
  17956. $core.addMethod(
  17957. $core.method({
  17958. selector: "valueWithInterval:",
  17959. protocol: "timeout/interval",
  17960. fn: function (aNumber){
  17961. var self=this,$self=this;
  17962. return $core.withContext(function($ctx1) {
  17963. var interval = setInterval(self, aNumber);
  17964. return $globals.Timeout._on_(interval);
  17965. ;
  17966. return self;
  17967. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17968. },
  17969. args: ["aNumber"],
  17970. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17971. referencedClasses: [],
  17972. messageSends: []
  17973. }),
  17974. $globals.BlockClosure);
  17975. $core.addMethod(
  17976. $core.method({
  17977. selector: "valueWithPossibleArguments:",
  17978. protocol: "evaluating",
  17979. fn: function (aCollection){
  17980. var self=this,$self=this;
  17981. return $core.withContext(function($ctx1) {
  17982. return self.apply(null, aCollection);;
  17983. return self;
  17984. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17985. },
  17986. args: ["aCollection"],
  17987. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17988. referencedClasses: [],
  17989. messageSends: []
  17990. }),
  17991. $globals.BlockClosure);
  17992. $core.addMethod(
  17993. $core.method({
  17994. selector: "valueWithTimeout:",
  17995. protocol: "timeout/interval",
  17996. fn: function (aNumber){
  17997. var self=this,$self=this;
  17998. return $core.withContext(function($ctx1) {
  17999. var timeout = setTimeout(self, aNumber);
  18000. return $globals.Timeout._on_(timeout);
  18001. ;
  18002. return self;
  18003. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  18004. },
  18005. args: ["aNumber"],
  18006. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  18007. referencedClasses: [],
  18008. messageSends: []
  18009. }),
  18010. $globals.BlockClosure);
  18011. $core.addMethod(
  18012. $core.method({
  18013. selector: "whileFalse",
  18014. protocol: "controlling",
  18015. fn: function (){
  18016. var self=this,$self=this;
  18017. return $core.withContext(function($ctx1) {
  18018. $self._whileFalse_((function(){
  18019. }));
  18020. return self;
  18021. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  18022. },
  18023. args: [],
  18024. source: "whileFalse\x0a\x09self whileFalse: []",
  18025. referencedClasses: [],
  18026. messageSends: ["whileFalse:"]
  18027. }),
  18028. $globals.BlockClosure);
  18029. $core.addMethod(
  18030. $core.method({
  18031. selector: "whileFalse:",
  18032. protocol: "controlling",
  18033. fn: function (aBlock){
  18034. var self=this,$self=this;
  18035. return $core.withContext(function($ctx1) {
  18036. while(!$core.assert($self._value())) {aBlock._value()};
  18037. return self;
  18038. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  18039. },
  18040. args: ["aBlock"],
  18041. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  18042. referencedClasses: [],
  18043. messageSends: []
  18044. }),
  18045. $globals.BlockClosure);
  18046. $core.addMethod(
  18047. $core.method({
  18048. selector: "whileTrue",
  18049. protocol: "controlling",
  18050. fn: function (){
  18051. var self=this,$self=this;
  18052. return $core.withContext(function($ctx1) {
  18053. $self._whileTrue_((function(){
  18054. }));
  18055. return self;
  18056. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  18057. },
  18058. args: [],
  18059. source: "whileTrue\x0a\x09self whileTrue: []",
  18060. referencedClasses: [],
  18061. messageSends: ["whileTrue:"]
  18062. }),
  18063. $globals.BlockClosure);
  18064. $core.addMethod(
  18065. $core.method({
  18066. selector: "whileTrue:",
  18067. protocol: "controlling",
  18068. fn: function (aBlock){
  18069. var self=this,$self=this;
  18070. return $core.withContext(function($ctx1) {
  18071. while($core.assert($self._value())) {aBlock._value()};
  18072. return self;
  18073. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  18074. },
  18075. args: ["aBlock"],
  18076. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  18077. referencedClasses: [],
  18078. messageSends: []
  18079. }),
  18080. $globals.BlockClosure);
  18081. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  18082. $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";
  18083. $core.addMethod(
  18084. $core.method({
  18085. selector: "arguments",
  18086. protocol: "accessing",
  18087. fn: function (){
  18088. var self=this,$self=this;
  18089. return $core.withContext(function($ctx1) {
  18090. return self.args || [];
  18091. return self;
  18092. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  18093. },
  18094. args: [],
  18095. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  18096. referencedClasses: [],
  18097. messageSends: []
  18098. }),
  18099. $globals.CompiledMethod);
  18100. $core.addMethod(
  18101. $core.method({
  18102. selector: "browse",
  18103. protocol: "browsing",
  18104. fn: function (){
  18105. var self=this,$self=this;
  18106. return $core.withContext(function($ctx1) {
  18107. $recv($globals.Finder)._findMethod_(self);
  18108. return self;
  18109. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  18110. },
  18111. args: [],
  18112. source: "browse\x0a\x09Finder findMethod: self",
  18113. referencedClasses: ["Finder"],
  18114. messageSends: ["findMethod:"]
  18115. }),
  18116. $globals.CompiledMethod);
  18117. $core.addMethod(
  18118. $core.method({
  18119. selector: "category",
  18120. protocol: "accessing",
  18121. fn: function (){
  18122. var self=this,$self=this;
  18123. return $core.withContext(function($ctx1) {
  18124. return $self._protocol();
  18125. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  18126. },
  18127. args: [],
  18128. source: "category\x0a\x09^ self protocol",
  18129. referencedClasses: [],
  18130. messageSends: ["protocol"]
  18131. }),
  18132. $globals.CompiledMethod);
  18133. $core.addMethod(
  18134. $core.method({
  18135. selector: "defaultProtocol",
  18136. protocol: "defaults",
  18137. fn: function (){
  18138. var self=this,$self=this;
  18139. return "as yet unclassified";
  18140. },
  18141. args: [],
  18142. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18143. referencedClasses: [],
  18144. messageSends: []
  18145. }),
  18146. $globals.CompiledMethod);
  18147. $core.addMethod(
  18148. $core.method({
  18149. selector: "fn",
  18150. protocol: "accessing",
  18151. fn: function (){
  18152. var self=this,$self=this;
  18153. return $core.withContext(function($ctx1) {
  18154. return $self._basicAt_("fn");
  18155. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  18156. },
  18157. args: [],
  18158. source: "fn\x0a\x09^ self basicAt: 'fn'",
  18159. referencedClasses: [],
  18160. messageSends: ["basicAt:"]
  18161. }),
  18162. $globals.CompiledMethod);
  18163. $core.addMethod(
  18164. $core.method({
  18165. selector: "fn:",
  18166. protocol: "accessing",
  18167. fn: function (aBlock){
  18168. var self=this,$self=this;
  18169. return $core.withContext(function($ctx1) {
  18170. $self._basicAt_put_("fn",aBlock);
  18171. return self;
  18172. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18173. },
  18174. args: ["aBlock"],
  18175. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18176. referencedClasses: [],
  18177. messageSends: ["basicAt:put:"]
  18178. }),
  18179. $globals.CompiledMethod);
  18180. $core.addMethod(
  18181. $core.method({
  18182. selector: "isCompiledMethod",
  18183. protocol: "testing",
  18184. fn: function (){
  18185. var self=this,$self=this;
  18186. return true;
  18187. },
  18188. args: [],
  18189. source: "isCompiledMethod\x0a\x09^ true",
  18190. referencedClasses: [],
  18191. messageSends: []
  18192. }),
  18193. $globals.CompiledMethod);
  18194. $core.addMethod(
  18195. $core.method({
  18196. selector: "isOverridden",
  18197. protocol: "testing",
  18198. fn: function (){
  18199. var self=this,$self=this;
  18200. var selector;
  18201. return $core.withContext(function($ctx1) {
  18202. var $1;
  18203. var $early={};
  18204. try {
  18205. selector=$self._selector();
  18206. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18207. return $core.withContext(function($ctx2) {
  18208. $1=$recv(each)._includesSelector_(selector);
  18209. if($core.assert($1)){
  18210. throw $early=[true];
  18211. }
  18212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18213. }));
  18214. return false;
  18215. }
  18216. catch(e) {if(e===$early)return e[0]; throw e}
  18217. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18218. },
  18219. args: [],
  18220. 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",
  18221. referencedClasses: [],
  18222. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18223. }),
  18224. $globals.CompiledMethod);
  18225. $core.addMethod(
  18226. $core.method({
  18227. selector: "isOverride",
  18228. protocol: "testing",
  18229. fn: function (){
  18230. var self=this,$self=this;
  18231. var superclass;
  18232. return $core.withContext(function($ctx1) {
  18233. var $1,$2,$receiver;
  18234. $1=$self._methodClass();
  18235. $ctx1.sendIdx["methodClass"]=1;
  18236. superclass=$recv($1)._superclass();
  18237. $ctx1.sendIdx["superclass"]=1;
  18238. $2=superclass;
  18239. if(($receiver = $2) == null || $receiver.a$nil){
  18240. return false;
  18241. } else {
  18242. $2;
  18243. }
  18244. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18245. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18246. },
  18247. args: [],
  18248. 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",
  18249. referencedClasses: [],
  18250. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18251. }),
  18252. $globals.CompiledMethod);
  18253. $core.addMethod(
  18254. $core.method({
  18255. selector: "messageSends",
  18256. protocol: "accessing",
  18257. fn: function (){
  18258. var self=this,$self=this;
  18259. return $core.withContext(function($ctx1) {
  18260. return $self._basicAt_("messageSends");
  18261. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18262. },
  18263. args: [],
  18264. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18265. referencedClasses: [],
  18266. messageSends: ["basicAt:"]
  18267. }),
  18268. $globals.CompiledMethod);
  18269. $core.addMethod(
  18270. $core.method({
  18271. selector: "methodClass",
  18272. protocol: "accessing",
  18273. fn: function (){
  18274. var self=this,$self=this;
  18275. return $core.withContext(function($ctx1) {
  18276. return $self._basicAt_("owner");
  18277. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18278. },
  18279. args: [],
  18280. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18281. referencedClasses: [],
  18282. messageSends: ["basicAt:"]
  18283. }),
  18284. $globals.CompiledMethod);
  18285. $core.addMethod(
  18286. $core.method({
  18287. selector: "package",
  18288. protocol: "accessing",
  18289. fn: function (){
  18290. var self=this,$self=this;
  18291. return $core.withContext(function($ctx1) {
  18292. var $1,$receiver;
  18293. $1=$self._methodClass();
  18294. if(($receiver = $1) == null || $receiver.a$nil){
  18295. return $1;
  18296. } else {
  18297. var class_;
  18298. class_=$receiver;
  18299. return $recv(class_)._packageOfProtocol_($self._protocol());
  18300. }
  18301. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18302. },
  18303. args: [],
  18304. 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 ]",
  18305. referencedClasses: [],
  18306. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18307. }),
  18308. $globals.CompiledMethod);
  18309. $core.addMethod(
  18310. $core.method({
  18311. selector: "protocol",
  18312. protocol: "accessing",
  18313. fn: function (){
  18314. var self=this,$self=this;
  18315. return $core.withContext(function($ctx1) {
  18316. var $1,$receiver;
  18317. $1=$self._basicAt_("protocol");
  18318. if(($receiver = $1) == null || $receiver.a$nil){
  18319. return $self._defaultProtocol();
  18320. } else {
  18321. return $1;
  18322. }
  18323. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18324. },
  18325. args: [],
  18326. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18327. referencedClasses: [],
  18328. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18329. }),
  18330. $globals.CompiledMethod);
  18331. $core.addMethod(
  18332. $core.method({
  18333. selector: "protocol:",
  18334. protocol: "accessing",
  18335. fn: function (aString){
  18336. var self=this,$self=this;
  18337. var oldProtocol;
  18338. return $core.withContext(function($ctx1) {
  18339. var $1,$3,$2,$4,$receiver;
  18340. oldProtocol=$self._protocol();
  18341. $self._basicAt_put_("protocol",aString);
  18342. $1=$recv($globals.SystemAnnouncer)._current();
  18343. $3=$recv($globals.MethodMoved)._new();
  18344. $recv($3)._method_(self);
  18345. $recv($3)._oldProtocol_(oldProtocol);
  18346. $2=$recv($3)._yourself();
  18347. $recv($1)._announce_($2);
  18348. $4=$self._methodClass();
  18349. if(($receiver = $4) == null || $receiver.a$nil){
  18350. $4;
  18351. } else {
  18352. var methodClass;
  18353. methodClass=$receiver;
  18354. $recv($recv(methodClass)._organization())._addElement_(aString);
  18355. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18356. }
  18357. return self;
  18358. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18359. },
  18360. args: ["aString"],
  18361. 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 ]",
  18362. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18363. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18364. }),
  18365. $globals.CompiledMethod);
  18366. $core.addMethod(
  18367. $core.method({
  18368. selector: "referencedClasses",
  18369. protocol: "accessing",
  18370. fn: function (){
  18371. var self=this,$self=this;
  18372. return $core.withContext(function($ctx1) {
  18373. return $self._basicAt_("referencedClasses");
  18374. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18375. },
  18376. args: [],
  18377. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18378. referencedClasses: [],
  18379. messageSends: ["basicAt:"]
  18380. }),
  18381. $globals.CompiledMethod);
  18382. $core.addMethod(
  18383. $core.method({
  18384. selector: "selector",
  18385. protocol: "accessing",
  18386. fn: function (){
  18387. var self=this,$self=this;
  18388. return $core.withContext(function($ctx1) {
  18389. return $self._basicAt_("selector");
  18390. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18391. },
  18392. args: [],
  18393. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18394. referencedClasses: [],
  18395. messageSends: ["basicAt:"]
  18396. }),
  18397. $globals.CompiledMethod);
  18398. $core.addMethod(
  18399. $core.method({
  18400. selector: "selector:",
  18401. protocol: "accessing",
  18402. fn: function (aString){
  18403. var self=this,$self=this;
  18404. return $core.withContext(function($ctx1) {
  18405. $self._basicAt_put_("selector",aString);
  18406. return self;
  18407. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18408. },
  18409. args: ["aString"],
  18410. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18411. referencedClasses: [],
  18412. messageSends: ["basicAt:put:"]
  18413. }),
  18414. $globals.CompiledMethod);
  18415. $core.addMethod(
  18416. $core.method({
  18417. selector: "sendTo:arguments:",
  18418. protocol: "evaluating",
  18419. fn: function (anObject,aCollection){
  18420. var self=this,$self=this;
  18421. return $core.withContext(function($ctx1) {
  18422. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18423. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18424. },
  18425. args: ["anObject", "aCollection"],
  18426. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18427. referencedClasses: [],
  18428. messageSends: ["applyTo:arguments:", "fn"]
  18429. }),
  18430. $globals.CompiledMethod);
  18431. $core.addMethod(
  18432. $core.method({
  18433. selector: "source",
  18434. protocol: "accessing",
  18435. fn: function (){
  18436. var self=this,$self=this;
  18437. return $core.withContext(function($ctx1) {
  18438. var $1,$receiver;
  18439. $1=$self._basicAt_("source");
  18440. if(($receiver = $1) == null || $receiver.a$nil){
  18441. return "";
  18442. } else {
  18443. return $1;
  18444. }
  18445. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18446. },
  18447. args: [],
  18448. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18449. referencedClasses: [],
  18450. messageSends: ["ifNil:", "basicAt:"]
  18451. }),
  18452. $globals.CompiledMethod);
  18453. $core.addMethod(
  18454. $core.method({
  18455. selector: "source:",
  18456. protocol: "accessing",
  18457. fn: function (aString){
  18458. var self=this,$self=this;
  18459. return $core.withContext(function($ctx1) {
  18460. $self._basicAt_put_("source",aString);
  18461. return self;
  18462. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18463. },
  18464. args: ["aString"],
  18465. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18466. referencedClasses: [],
  18467. messageSends: ["basicAt:put:"]
  18468. }),
  18469. $globals.CompiledMethod);
  18470. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18471. $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`";
  18472. $core.addMethod(
  18473. $core.method({
  18474. selector: "addWorker",
  18475. protocol: "private",
  18476. fn: function (){
  18477. var self=this,$self=this;
  18478. return $core.withContext(function($ctx1) {
  18479. $recv($self["@worker"])._valueWithTimeout_((0));
  18480. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18481. return self;
  18482. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18483. },
  18484. args: [],
  18485. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18486. referencedClasses: [],
  18487. messageSends: ["valueWithTimeout:", "+"]
  18488. }),
  18489. $globals.ForkPool);
  18490. $core.addMethod(
  18491. $core.method({
  18492. selector: "defaultMaxPoolSize",
  18493. protocol: "defaults",
  18494. fn: function (){
  18495. var self=this,$self=this;
  18496. return $core.withContext(function($ctx1) {
  18497. return $recv($self._class())._defaultMaxPoolSize();
  18498. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18499. },
  18500. args: [],
  18501. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18502. referencedClasses: [],
  18503. messageSends: ["defaultMaxPoolSize", "class"]
  18504. }),
  18505. $globals.ForkPool);
  18506. $core.addMethod(
  18507. $core.method({
  18508. selector: "fork:",
  18509. protocol: "actions",
  18510. fn: function (aBlock){
  18511. var self=this,$self=this;
  18512. return $core.withContext(function($ctx1) {
  18513. var $1;
  18514. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18515. if($core.assert($1)){
  18516. $self._addWorker();
  18517. }
  18518. $recv($self["@queue"])._nextPut_(aBlock);
  18519. return self;
  18520. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18521. },
  18522. args: ["aBlock"],
  18523. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18524. referencedClasses: [],
  18525. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18526. }),
  18527. $globals.ForkPool);
  18528. $core.addMethod(
  18529. $core.method({
  18530. selector: "initialize",
  18531. protocol: "initialization",
  18532. fn: function (){
  18533. var self=this,$self=this;
  18534. return $core.withContext(function($ctx1) {
  18535. (
  18536. $ctx1.supercall = true,
  18537. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18538. $ctx1.supercall = false;
  18539. $self["@poolSize"]=(0);
  18540. $self["@queue"]=$recv($globals.Queue)._new();
  18541. $self["@worker"]=$self._makeWorker();
  18542. return self;
  18543. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18544. },
  18545. args: [],
  18546. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18547. referencedClasses: ["Queue"],
  18548. messageSends: ["initialize", "new", "makeWorker"]
  18549. }),
  18550. $globals.ForkPool);
  18551. $core.addMethod(
  18552. $core.method({
  18553. selector: "makeWorker",
  18554. protocol: "initialization",
  18555. fn: function (){
  18556. var self=this,$self=this;
  18557. var sentinel;
  18558. return $core.withContext(function($ctx1) {
  18559. var $1;
  18560. sentinel=$recv($globals.Object)._new();
  18561. return (function(){
  18562. var block;
  18563. return $core.withContext(function($ctx2) {
  18564. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18565. $self["@poolSize"];
  18566. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18567. return sentinel;
  18568. }));
  18569. block;
  18570. $1=$recv(block).__eq_eq(sentinel);
  18571. if(!$core.assert($1)){
  18572. return $recv((function(){
  18573. return $core.withContext(function($ctx3) {
  18574. return $recv(block)._value();
  18575. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18576. }))._ensure_((function(){
  18577. return $core.withContext(function($ctx3) {
  18578. return $self._addWorker();
  18579. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18580. }));
  18581. }
  18582. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18583. });
  18584. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18585. },
  18586. args: [],
  18587. 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 ] ]]",
  18588. referencedClasses: ["Object"],
  18589. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18590. }),
  18591. $globals.ForkPool);
  18592. $core.addMethod(
  18593. $core.method({
  18594. selector: "maxPoolSize",
  18595. protocol: "accessing",
  18596. fn: function (){
  18597. var self=this,$self=this;
  18598. return $core.withContext(function($ctx1) {
  18599. var $1,$receiver;
  18600. $1=$self["@maxPoolSize"];
  18601. if(($receiver = $1) == null || $receiver.a$nil){
  18602. return $self._defaultMaxPoolSize();
  18603. } else {
  18604. return $1;
  18605. }
  18606. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18607. },
  18608. args: [],
  18609. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18610. referencedClasses: [],
  18611. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18612. }),
  18613. $globals.ForkPool);
  18614. $core.addMethod(
  18615. $core.method({
  18616. selector: "maxPoolSize:",
  18617. protocol: "accessing",
  18618. fn: function (anInteger){
  18619. var self=this,$self=this;
  18620. $self["@maxPoolSize"]=anInteger;
  18621. return self;
  18622. },
  18623. args: ["anInteger"],
  18624. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18625. referencedClasses: [],
  18626. messageSends: []
  18627. }),
  18628. $globals.ForkPool);
  18629. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18630. $core.addMethod(
  18631. $core.method({
  18632. selector: "default",
  18633. protocol: "accessing",
  18634. fn: function (){
  18635. var self=this,$self=this;
  18636. return $core.withContext(function($ctx1) {
  18637. var $1,$receiver;
  18638. $1=$self["@default"];
  18639. if(($receiver = $1) == null || $receiver.a$nil){
  18640. $self["@default"]=$self._new();
  18641. return $self["@default"];
  18642. } else {
  18643. return $1;
  18644. }
  18645. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18646. },
  18647. args: [],
  18648. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18649. referencedClasses: [],
  18650. messageSends: ["ifNil:", "new"]
  18651. }),
  18652. $globals.ForkPool.a$cls);
  18653. $core.addMethod(
  18654. $core.method({
  18655. selector: "defaultMaxPoolSize",
  18656. protocol: "accessing",
  18657. fn: function (){
  18658. var self=this,$self=this;
  18659. return (100);
  18660. },
  18661. args: [],
  18662. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18663. referencedClasses: [],
  18664. messageSends: []
  18665. }),
  18666. $globals.ForkPool.a$cls);
  18667. $core.addMethod(
  18668. $core.method({
  18669. selector: "resetDefault",
  18670. protocol: "accessing",
  18671. fn: function (){
  18672. var self=this,$self=this;
  18673. $self["@default"]=nil;
  18674. return self;
  18675. },
  18676. args: [],
  18677. source: "resetDefault\x0a\x09default := nil",
  18678. referencedClasses: [],
  18679. messageSends: []
  18680. }),
  18681. $globals.ForkPool.a$cls);
  18682. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18683. $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.";
  18684. $core.addMethod(
  18685. $core.method({
  18686. selector: "arguments",
  18687. protocol: "accessing",
  18688. fn: function (){
  18689. var self=this,$self=this;
  18690. return $self["@arguments"];
  18691. },
  18692. args: [],
  18693. source: "arguments\x0a\x09^ arguments",
  18694. referencedClasses: [],
  18695. messageSends: []
  18696. }),
  18697. $globals.Message);
  18698. $core.addMethod(
  18699. $core.method({
  18700. selector: "arguments:",
  18701. protocol: "accessing",
  18702. fn: function (anArray){
  18703. var self=this,$self=this;
  18704. $self["@arguments"]=anArray;
  18705. return self;
  18706. },
  18707. args: ["anArray"],
  18708. source: "arguments: anArray\x0a\x09arguments := anArray",
  18709. referencedClasses: [],
  18710. messageSends: []
  18711. }),
  18712. $globals.Message);
  18713. $core.addMethod(
  18714. $core.method({
  18715. selector: "printOn:",
  18716. protocol: "printing",
  18717. fn: function (aStream){
  18718. var self=this,$self=this;
  18719. return $core.withContext(function($ctx1) {
  18720. (
  18721. $ctx1.supercall = true,
  18722. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18723. $ctx1.supercall = false;
  18724. $recv(aStream)._nextPutAll_("(");
  18725. $ctx1.sendIdx["nextPutAll:"]=1;
  18726. $recv(aStream)._nextPutAll_($self._selector());
  18727. $ctx1.sendIdx["nextPutAll:"]=2;
  18728. $recv(aStream)._nextPutAll_(")");
  18729. return self;
  18730. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18731. },
  18732. args: ["aStream"],
  18733. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18734. referencedClasses: [],
  18735. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18736. }),
  18737. $globals.Message);
  18738. $core.addMethod(
  18739. $core.method({
  18740. selector: "selector",
  18741. protocol: "accessing",
  18742. fn: function (){
  18743. var self=this,$self=this;
  18744. return $self["@selector"];
  18745. },
  18746. args: [],
  18747. source: "selector\x0a\x09^ selector",
  18748. referencedClasses: [],
  18749. messageSends: []
  18750. }),
  18751. $globals.Message);
  18752. $core.addMethod(
  18753. $core.method({
  18754. selector: "selector:",
  18755. protocol: "accessing",
  18756. fn: function (aString){
  18757. var self=this,$self=this;
  18758. $self["@selector"]=aString;
  18759. return self;
  18760. },
  18761. args: ["aString"],
  18762. source: "selector: aString\x0a\x09selector := aString",
  18763. referencedClasses: [],
  18764. messageSends: []
  18765. }),
  18766. $globals.Message);
  18767. $core.addMethod(
  18768. $core.method({
  18769. selector: "sendTo:",
  18770. protocol: "actions",
  18771. fn: function (anObject){
  18772. var self=this,$self=this;
  18773. return $core.withContext(function($ctx1) {
  18774. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18775. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18776. },
  18777. args: ["anObject"],
  18778. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18779. referencedClasses: [],
  18780. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18781. }),
  18782. $globals.Message);
  18783. $core.addMethod(
  18784. $core.method({
  18785. selector: "selector:arguments:",
  18786. protocol: "instance creation",
  18787. fn: function (aString,anArray){
  18788. var self=this,$self=this;
  18789. return $core.withContext(function($ctx1) {
  18790. var $1;
  18791. $1=$self._new();
  18792. $recv($1)._selector_(aString);
  18793. $recv($1)._arguments_(anArray);
  18794. return $recv($1)._yourself();
  18795. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18796. },
  18797. args: ["aString", "anArray"],
  18798. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18799. referencedClasses: [],
  18800. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18801. }),
  18802. $globals.Message.a$cls);
  18803. $core.addMethod(
  18804. $core.method({
  18805. selector: "selector:arguments:notUnderstoodBy:",
  18806. protocol: "dnu handling",
  18807. fn: function (aString,anArray,anObject){
  18808. var self=this,$self=this;
  18809. return $core.withContext(function($ctx1) {
  18810. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18811. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18812. },
  18813. args: ["aString", "anArray", "anObject"],
  18814. 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)",
  18815. referencedClasses: [],
  18816. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18817. }),
  18818. $globals.Message.a$cls);
  18819. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18820. $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.";
  18821. $core.addMethod(
  18822. $core.method({
  18823. selector: "arguments",
  18824. protocol: "accessing",
  18825. fn: function (){
  18826. var self=this,$self=this;
  18827. return $core.withContext(function($ctx1) {
  18828. return $recv($self["@message"])._arguments();
  18829. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18830. },
  18831. args: [],
  18832. source: "arguments\x0a\x09^ message arguments",
  18833. referencedClasses: [],
  18834. messageSends: ["arguments"]
  18835. }),
  18836. $globals.MessageSend);
  18837. $core.addMethod(
  18838. $core.method({
  18839. selector: "arguments:",
  18840. protocol: "accessing",
  18841. fn: function (aCollection){
  18842. var self=this,$self=this;
  18843. return $core.withContext(function($ctx1) {
  18844. $recv($self["@message"])._arguments_(aCollection);
  18845. return self;
  18846. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18847. },
  18848. args: ["aCollection"],
  18849. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18850. referencedClasses: [],
  18851. messageSends: ["arguments:"]
  18852. }),
  18853. $globals.MessageSend);
  18854. $core.addMethod(
  18855. $core.method({
  18856. selector: "initialize",
  18857. protocol: "initialization",
  18858. fn: function (){
  18859. var self=this,$self=this;
  18860. return $core.withContext(function($ctx1) {
  18861. (
  18862. $ctx1.supercall = true,
  18863. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18864. $ctx1.supercall = false;
  18865. $self["@message"]=$recv($globals.Message)._new();
  18866. return self;
  18867. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18868. },
  18869. args: [],
  18870. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18871. referencedClasses: ["Message"],
  18872. messageSends: ["initialize", "new"]
  18873. }),
  18874. $globals.MessageSend);
  18875. $core.addMethod(
  18876. $core.method({
  18877. selector: "printOn:",
  18878. protocol: "printing",
  18879. fn: function (aStream){
  18880. var self=this,$self=this;
  18881. return $core.withContext(function($ctx1) {
  18882. (
  18883. $ctx1.supercall = true,
  18884. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18885. $ctx1.supercall = false;
  18886. $recv(aStream)._nextPutAll_("(");
  18887. $ctx1.sendIdx["nextPutAll:"]=1;
  18888. $recv(aStream)._nextPutAll_($self._receiver());
  18889. $ctx1.sendIdx["nextPutAll:"]=2;
  18890. $recv(aStream)._nextPutAll_(" >> ");
  18891. $ctx1.sendIdx["nextPutAll:"]=3;
  18892. $recv(aStream)._nextPutAll_($self._selector());
  18893. $ctx1.sendIdx["nextPutAll:"]=4;
  18894. $recv(aStream)._nextPutAll_(")");
  18895. return self;
  18896. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18897. },
  18898. args: ["aStream"],
  18899. 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: ')'",
  18900. referencedClasses: [],
  18901. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18902. }),
  18903. $globals.MessageSend);
  18904. $core.addMethod(
  18905. $core.method({
  18906. selector: "receiver",
  18907. protocol: "accessing",
  18908. fn: function (){
  18909. var self=this,$self=this;
  18910. return $self["@receiver"];
  18911. },
  18912. args: [],
  18913. source: "receiver\x0a\x09^ receiver",
  18914. referencedClasses: [],
  18915. messageSends: []
  18916. }),
  18917. $globals.MessageSend);
  18918. $core.addMethod(
  18919. $core.method({
  18920. selector: "receiver:",
  18921. protocol: "accessing",
  18922. fn: function (anObject){
  18923. var self=this,$self=this;
  18924. $self["@receiver"]=anObject;
  18925. return self;
  18926. },
  18927. args: ["anObject"],
  18928. source: "receiver: anObject\x0a\x09receiver := anObject",
  18929. referencedClasses: [],
  18930. messageSends: []
  18931. }),
  18932. $globals.MessageSend);
  18933. $core.addMethod(
  18934. $core.method({
  18935. selector: "selector",
  18936. protocol: "accessing",
  18937. fn: function (){
  18938. var self=this,$self=this;
  18939. return $core.withContext(function($ctx1) {
  18940. return $recv($self["@message"])._selector();
  18941. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18942. },
  18943. args: [],
  18944. source: "selector\x0a\x09^ message selector",
  18945. referencedClasses: [],
  18946. messageSends: ["selector"]
  18947. }),
  18948. $globals.MessageSend);
  18949. $core.addMethod(
  18950. $core.method({
  18951. selector: "selector:",
  18952. protocol: "accessing",
  18953. fn: function (aString){
  18954. var self=this,$self=this;
  18955. return $core.withContext(function($ctx1) {
  18956. $recv($self["@message"])._selector_(aString);
  18957. return self;
  18958. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18959. },
  18960. args: ["aString"],
  18961. source: "selector: aString\x0a\x09message selector: aString",
  18962. referencedClasses: [],
  18963. messageSends: ["selector:"]
  18964. }),
  18965. $globals.MessageSend);
  18966. $core.addMethod(
  18967. $core.method({
  18968. selector: "value",
  18969. protocol: "evaluating",
  18970. fn: function (){
  18971. var self=this,$self=this;
  18972. return $core.withContext(function($ctx1) {
  18973. return $recv($self["@message"])._sendTo_($self._receiver());
  18974. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18975. },
  18976. args: [],
  18977. source: "value\x0a\x09^ message sendTo: self receiver",
  18978. referencedClasses: [],
  18979. messageSends: ["sendTo:", "receiver"]
  18980. }),
  18981. $globals.MessageSend);
  18982. $core.addMethod(
  18983. $core.method({
  18984. selector: "value:",
  18985. protocol: "evaluating",
  18986. fn: function (anObject){
  18987. var self=this,$self=this;
  18988. return $core.withContext(function($ctx1) {
  18989. var $1;
  18990. $1=$self["@message"];
  18991. $recv($1)._arguments_([anObject]);
  18992. return $recv($1)._sendTo_($self._receiver());
  18993. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18994. },
  18995. args: ["anObject"],
  18996. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18997. referencedClasses: [],
  18998. messageSends: ["arguments:", "sendTo:", "receiver"]
  18999. }),
  19000. $globals.MessageSend);
  19001. $core.addMethod(
  19002. $core.method({
  19003. selector: "value:value:",
  19004. protocol: "evaluating",
  19005. fn: function (firstArgument,secondArgument){
  19006. var self=this,$self=this;
  19007. return $core.withContext(function($ctx1) {
  19008. var $1;
  19009. $1=$self["@message"];
  19010. $recv($1)._arguments_([firstArgument,secondArgument]);
  19011. return $recv($1)._sendTo_($self._receiver());
  19012. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  19013. },
  19014. args: ["firstArgument", "secondArgument"],
  19015. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  19016. referencedClasses: [],
  19017. messageSends: ["arguments:", "sendTo:", "receiver"]
  19018. }),
  19019. $globals.MessageSend);
  19020. $core.addMethod(
  19021. $core.method({
  19022. selector: "value:value:value:",
  19023. protocol: "evaluating",
  19024. fn: function (firstArgument,secondArgument,thirdArgument){
  19025. var self=this,$self=this;
  19026. return $core.withContext(function($ctx1) {
  19027. var $1;
  19028. $1=$self["@message"];
  19029. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  19030. return $recv($1)._sendTo_($self._receiver());
  19031. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  19032. },
  19033. args: ["firstArgument", "secondArgument", "thirdArgument"],
  19034. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  19035. referencedClasses: [],
  19036. messageSends: ["arguments:", "sendTo:", "receiver"]
  19037. }),
  19038. $globals.MessageSend);
  19039. $core.addMethod(
  19040. $core.method({
  19041. selector: "valueWithPossibleArguments:",
  19042. protocol: "evaluating",
  19043. fn: function (aCollection){
  19044. var self=this,$self=this;
  19045. return $core.withContext(function($ctx1) {
  19046. $self._arguments_(aCollection);
  19047. return $self._value();
  19048. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  19049. },
  19050. args: ["aCollection"],
  19051. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  19052. referencedClasses: [],
  19053. messageSends: ["arguments:", "value"]
  19054. }),
  19055. $globals.MessageSend);
  19056. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  19057. $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`.";
  19058. $core.addMethod(
  19059. $core.method({
  19060. selector: "asString",
  19061. protocol: "converting",
  19062. fn: function (){
  19063. var self=this,$self=this;
  19064. return $core.withContext(function($ctx1) {
  19065. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  19066. $2=$self._isBlockContext();
  19067. if($core.assert($2)){
  19068. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  19069. $ctx1.sendIdx[","]=2;
  19070. $1=$recv($3).__comma(")");
  19071. $ctx1.sendIdx[","]=1;
  19072. } else {
  19073. var methodClass;
  19074. methodClass=$recv($self._method())._methodClass();
  19075. methodClass;
  19076. $5=methodClass;
  19077. $7=$self._receiver();
  19078. $ctx1.sendIdx["receiver"]=1;
  19079. $6=$recv($7)._class();
  19080. $ctx1.sendIdx["class"]=1;
  19081. $4=$recv($5).__eq($6);
  19082. if($core.assert($4)){
  19083. $11=$self._receiver();
  19084. $ctx1.sendIdx["receiver"]=2;
  19085. $10=$recv($11)._class();
  19086. $ctx1.sendIdx["class"]=2;
  19087. $9=$recv($10)._name();
  19088. $ctx1.sendIdx["name"]=1;
  19089. $8=$recv($9).__comma(" >> ");
  19090. $ctx1.sendIdx[","]=4;
  19091. $12=$self._selector();
  19092. $ctx1.sendIdx["selector"]=1;
  19093. $1=$recv($8).__comma($12);
  19094. $ctx1.sendIdx[","]=3;
  19095. } else {
  19096. $16=$recv($recv($self._receiver())._class())._name();
  19097. $ctx1.sendIdx["name"]=2;
  19098. $15=$recv($16).__comma("(");
  19099. $14=$recv($15).__comma($recv(methodClass)._name());
  19100. $ctx1.sendIdx[","]=7;
  19101. $13=$recv($14).__comma(") >> ");
  19102. $ctx1.sendIdx[","]=6;
  19103. $1=$recv($13).__comma($self._selector());
  19104. $ctx1.sendIdx[","]=5;
  19105. }
  19106. }
  19107. return $1;
  19108. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  19109. },
  19110. args: [],
  19111. 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 ] ]",
  19112. referencedClasses: [],
  19113. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  19114. }),
  19115. $globals.MethodContext);
  19116. $core.addMethod(
  19117. $core.method({
  19118. selector: "basicReceiver",
  19119. protocol: "accessing",
  19120. fn: function (){
  19121. var self=this,$self=this;
  19122. return $core.withContext(function($ctx1) {
  19123. return self.receiver;
  19124. return self;
  19125. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  19126. },
  19127. args: [],
  19128. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  19129. referencedClasses: [],
  19130. messageSends: []
  19131. }),
  19132. $globals.MethodContext);
  19133. $core.addMethod(
  19134. $core.method({
  19135. selector: "evaluatedSelector",
  19136. protocol: "accessing",
  19137. fn: function (){
  19138. var self=this,$self=this;
  19139. return $core.withContext(function($ctx1) {
  19140. return self.evaluatedSelector;
  19141. return self;
  19142. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  19143. },
  19144. args: [],
  19145. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  19146. referencedClasses: [],
  19147. messageSends: []
  19148. }),
  19149. $globals.MethodContext);
  19150. $core.addMethod(
  19151. $core.method({
  19152. selector: "findContextSuchThat:",
  19153. protocol: "accessing",
  19154. fn: function (testBlock){
  19155. var self=this,$self=this;
  19156. var context;
  19157. return $core.withContext(function($ctx1) {
  19158. var $1;
  19159. var $early={};
  19160. try {
  19161. context=self;
  19162. $recv((function(){
  19163. return $core.withContext(function($ctx2) {
  19164. return $recv(context)._isNil();
  19165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19166. }))._whileFalse_((function(){
  19167. return $core.withContext(function($ctx2) {
  19168. $1=$recv(testBlock)._value_(context);
  19169. if($core.assert($1)){
  19170. throw $early=[context];
  19171. }
  19172. context=$recv(context)._outerContext();
  19173. return context;
  19174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19175. }));
  19176. return nil;
  19177. }
  19178. catch(e) {if(e===$early)return e[0]; throw e}
  19179. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19180. },
  19181. args: ["testBlock"],
  19182. 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",
  19183. referencedClasses: [],
  19184. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19185. }),
  19186. $globals.MethodContext);
  19187. $core.addMethod(
  19188. $core.method({
  19189. selector: "home",
  19190. protocol: "accessing",
  19191. fn: function (){
  19192. var self=this,$self=this;
  19193. return $core.withContext(function($ctx1) {
  19194. return self.homeContext;
  19195. return self;
  19196. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19197. },
  19198. args: [],
  19199. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19200. referencedClasses: [],
  19201. messageSends: []
  19202. }),
  19203. $globals.MethodContext);
  19204. $core.addMethod(
  19205. $core.method({
  19206. selector: "index",
  19207. protocol: "accessing",
  19208. fn: function (){
  19209. var self=this,$self=this;
  19210. return $core.withContext(function($ctx1) {
  19211. return self.index || 0;
  19212. return self;
  19213. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19214. },
  19215. args: [],
  19216. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19217. referencedClasses: [],
  19218. messageSends: []
  19219. }),
  19220. $globals.MethodContext);
  19221. $core.addMethod(
  19222. $core.method({
  19223. selector: "isBlockContext",
  19224. protocol: "testing",
  19225. fn: function (){
  19226. var self=this,$self=this;
  19227. return $core.withContext(function($ctx1) {
  19228. return $recv($self._selector())._isNil();
  19229. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19230. },
  19231. args: [],
  19232. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19233. referencedClasses: [],
  19234. messageSends: ["isNil", "selector"]
  19235. }),
  19236. $globals.MethodContext);
  19237. $core.addMethod(
  19238. $core.method({
  19239. selector: "locals",
  19240. protocol: "accessing",
  19241. fn: function (){
  19242. var self=this,$self=this;
  19243. return $core.withContext(function($ctx1) {
  19244. return self.locals || {};
  19245. return self;
  19246. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19247. },
  19248. args: [],
  19249. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19250. referencedClasses: [],
  19251. messageSends: []
  19252. }),
  19253. $globals.MethodContext);
  19254. $core.addMethod(
  19255. $core.method({
  19256. selector: "method",
  19257. protocol: "accessing",
  19258. fn: function (){
  19259. var self=this,$self=this;
  19260. var method,lookupClass,receiverClass,supercall;
  19261. return $core.withContext(function($ctx1) {
  19262. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19263. $1=$self._methodContext();
  19264. $ctx1.sendIdx["methodContext"]=1;
  19265. if(($receiver = $1) == null || $receiver.a$nil){
  19266. return nil;
  19267. } else {
  19268. $1;
  19269. }
  19270. $3=$self._methodContext();
  19271. $ctx1.sendIdx["methodContext"]=2;
  19272. $2=$recv($3)._receiver();
  19273. receiverClass=$recv($2)._class();
  19274. $4=receiverClass;
  19275. $6=$self._methodContext();
  19276. $ctx1.sendIdx["methodContext"]=3;
  19277. $5=$recv($6)._selector();
  19278. $ctx1.sendIdx["selector"]=1;
  19279. method=$recv($4)._lookupSelector_($5);
  19280. $ctx1.sendIdx["lookupSelector:"]=1;
  19281. $7=$self._outerContext();
  19282. if(($receiver = $7) == null || $receiver.a$nil){
  19283. supercall=false;
  19284. } else {
  19285. var outer;
  19286. outer=$receiver;
  19287. supercall=$recv(outer)._supercall();
  19288. }
  19289. $8=supercall;
  19290. if($core.assert($8)){
  19291. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19292. } else {
  19293. return method;
  19294. }
  19295. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19296. },
  19297. args: [],
  19298. 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 ]",
  19299. referencedClasses: [],
  19300. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19301. }),
  19302. $globals.MethodContext);
  19303. $core.addMethod(
  19304. $core.method({
  19305. selector: "methodContext",
  19306. protocol: "accessing",
  19307. fn: function (){
  19308. var self=this,$self=this;
  19309. return $core.withContext(function($ctx1) {
  19310. var $1,$2,$receiver;
  19311. $1=$self._isBlockContext();
  19312. if(!$core.assert($1)){
  19313. return self;
  19314. }
  19315. $2=$self._outerContext();
  19316. if(($receiver = $2) == null || $receiver.a$nil){
  19317. return $2;
  19318. } else {
  19319. var outer;
  19320. outer=$receiver;
  19321. return $recv(outer)._methodContext();
  19322. }
  19323. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19324. },
  19325. args: [],
  19326. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19327. referencedClasses: [],
  19328. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19329. }),
  19330. $globals.MethodContext);
  19331. $core.addMethod(
  19332. $core.method({
  19333. selector: "outerContext",
  19334. protocol: "accessing",
  19335. fn: function (){
  19336. var self=this,$self=this;
  19337. return $core.withContext(function($ctx1) {
  19338. return self.outerContext || self.homeContext;
  19339. return self;
  19340. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19341. },
  19342. args: [],
  19343. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19344. referencedClasses: [],
  19345. messageSends: []
  19346. }),
  19347. $globals.MethodContext);
  19348. $core.addMethod(
  19349. $core.method({
  19350. selector: "printOn:",
  19351. protocol: "printing",
  19352. fn: function (aStream){
  19353. var self=this,$self=this;
  19354. return $core.withContext(function($ctx1) {
  19355. (
  19356. $ctx1.supercall = true,
  19357. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19358. $ctx1.supercall = false;
  19359. $recv(aStream)._nextPutAll_("(");
  19360. $ctx1.sendIdx["nextPutAll:"]=1;
  19361. $recv(aStream)._nextPutAll_($self._asString());
  19362. $ctx1.sendIdx["nextPutAll:"]=2;
  19363. $recv(aStream)._nextPutAll_(")");
  19364. return self;
  19365. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19366. },
  19367. args: ["aStream"],
  19368. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19369. referencedClasses: [],
  19370. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19371. }),
  19372. $globals.MethodContext);
  19373. $core.addMethod(
  19374. $core.method({
  19375. selector: "receiver",
  19376. protocol: "accessing",
  19377. fn: function (){
  19378. var self=this,$self=this;
  19379. return $core.withContext(function($ctx1) {
  19380. var $2,$1;
  19381. $1=$recv($self._isBlockContext())._and_((function(){
  19382. return $core.withContext(function($ctx2) {
  19383. $2=$self._outerContext();
  19384. $ctx2.sendIdx["outerContext"]=1;
  19385. return $recv($2)._notNil();
  19386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19387. }));
  19388. if($core.assert($1)){
  19389. return $recv($self._outerContext())._receiver();
  19390. } else {
  19391. return $self._basicReceiver();
  19392. }
  19393. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19394. },
  19395. args: [],
  19396. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19397. referencedClasses: [],
  19398. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19399. }),
  19400. $globals.MethodContext);
  19401. $core.addMethod(
  19402. $core.method({
  19403. selector: "selector",
  19404. protocol: "accessing",
  19405. fn: function (){
  19406. var self=this,$self=this;
  19407. return $core.withContext(function($ctx1) {
  19408. if(self.selector) {
  19409. return $core.js2st(self.selector);
  19410. } else {
  19411. return nil;
  19412. }
  19413. ;
  19414. return self;
  19415. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19416. },
  19417. args: [],
  19418. 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'>",
  19419. referencedClasses: [],
  19420. messageSends: []
  19421. }),
  19422. $globals.MethodContext);
  19423. $core.addMethod(
  19424. $core.method({
  19425. selector: "sendIndexAt:",
  19426. protocol: "accessing",
  19427. fn: function (aSelector){
  19428. var self=this,$self=this;
  19429. return $core.withContext(function($ctx1) {
  19430. return self.sendIdx[aSelector] || 0;
  19431. return self;
  19432. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19433. },
  19434. args: ["aSelector"],
  19435. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19436. referencedClasses: [],
  19437. messageSends: []
  19438. }),
  19439. $globals.MethodContext);
  19440. $core.addMethod(
  19441. $core.method({
  19442. selector: "sendIndexes",
  19443. protocol: "accessing",
  19444. fn: function (){
  19445. var self=this,$self=this;
  19446. return $core.withContext(function($ctx1) {
  19447. return self.sendIdx;
  19448. return self;
  19449. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19450. },
  19451. args: [],
  19452. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19453. referencedClasses: [],
  19454. messageSends: []
  19455. }),
  19456. $globals.MethodContext);
  19457. $core.addMethod(
  19458. $core.method({
  19459. selector: "stubHere",
  19460. protocol: "accessing",
  19461. fn: function (){
  19462. var self=this,$self=this;
  19463. return $core.withContext(function($ctx1) {
  19464. self.homeContext = undefined;
  19465. return self;
  19466. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19467. },
  19468. args: [],
  19469. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19470. referencedClasses: [],
  19471. messageSends: []
  19472. }),
  19473. $globals.MethodContext);
  19474. $core.addMethod(
  19475. $core.method({
  19476. selector: "stubToAtMost:",
  19477. protocol: "error handling",
  19478. fn: function (anInteger){
  19479. var self=this,$self=this;
  19480. var context;
  19481. return $core.withContext(function($ctx1) {
  19482. var $1,$2,$receiver;
  19483. context=self;
  19484. $recv(anInteger)._timesRepeat_((function(){
  19485. return $core.withContext(function($ctx2) {
  19486. $1=context;
  19487. if(($receiver = $1) == null || $receiver.a$nil){
  19488. context=$1;
  19489. } else {
  19490. context=$recv(context)._home();
  19491. }
  19492. return context;
  19493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19494. }));
  19495. $2=context;
  19496. if(($receiver = $2) == null || $receiver.a$nil){
  19497. $2;
  19498. } else {
  19499. $recv(context)._stubHere();
  19500. }
  19501. return self;
  19502. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19503. },
  19504. args: ["anInteger"],
  19505. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19506. referencedClasses: [],
  19507. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19508. }),
  19509. $globals.MethodContext);
  19510. $core.addMethod(
  19511. $core.method({
  19512. selector: "supercall",
  19513. protocol: "accessing",
  19514. fn: function (){
  19515. var self=this,$self=this;
  19516. return $core.withContext(function($ctx1) {
  19517. return self.supercall == true;
  19518. return self;
  19519. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19520. },
  19521. args: [],
  19522. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19523. referencedClasses: [],
  19524. messageSends: []
  19525. }),
  19526. $globals.MethodContext);
  19527. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19528. $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' ]";
  19529. $core.addMethod(
  19530. $core.method({
  19531. selector: "constructorNamed:",
  19532. protocol: "instance creation",
  19533. fn: function (aString){
  19534. var self=this,$self=this;
  19535. return $core.withContext(function($ctx1) {
  19536. var nativeFunc=$globals.Platform._globals()[aString];
  19537. return new nativeFunc();
  19538. ;
  19539. return self;
  19540. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19541. },
  19542. args: ["aString"],
  19543. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19544. referencedClasses: [],
  19545. messageSends: []
  19546. }),
  19547. $globals.NativeFunction.a$cls);
  19548. $core.addMethod(
  19549. $core.method({
  19550. selector: "constructorNamed:value:",
  19551. protocol: "instance creation",
  19552. fn: function (aString,anObject){
  19553. var self=this,$self=this;
  19554. return $core.withContext(function($ctx1) {
  19555. var nativeFunc=$globals.Platform._globals()[aString];
  19556. return new nativeFunc(anObject);
  19557. ;
  19558. return self;
  19559. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19560. },
  19561. args: ["aString", "anObject"],
  19562. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19563. referencedClasses: [],
  19564. messageSends: []
  19565. }),
  19566. $globals.NativeFunction.a$cls);
  19567. $core.addMethod(
  19568. $core.method({
  19569. selector: "constructorNamed:value:value:",
  19570. protocol: "instance creation",
  19571. fn: function (aString,anObject,anObject2){
  19572. var self=this,$self=this;
  19573. return $core.withContext(function($ctx1) {
  19574. var nativeFunc=$globals.Platform._globals[aString];
  19575. return new nativeFunc(anObject,anObject2);
  19576. ;
  19577. return self;
  19578. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19579. },
  19580. args: ["aString", "anObject", "anObject2"],
  19581. 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'>",
  19582. referencedClasses: [],
  19583. messageSends: []
  19584. }),
  19585. $globals.NativeFunction.a$cls);
  19586. $core.addMethod(
  19587. $core.method({
  19588. selector: "constructorNamed:value:value:value:",
  19589. protocol: "instance creation",
  19590. fn: function (aString,anObject,anObject2,anObject3){
  19591. var self=this,$self=this;
  19592. return $core.withContext(function($ctx1) {
  19593. var nativeFunc=$globals.Platform._globals[aString];
  19594. return new nativeFunc(anObject,anObject2, anObject3);
  19595. ;
  19596. return self;
  19597. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19598. },
  19599. args: ["aString", "anObject", "anObject2", "anObject3"],
  19600. 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'>",
  19601. referencedClasses: [],
  19602. messageSends: []
  19603. }),
  19604. $globals.NativeFunction.a$cls);
  19605. $core.addMethod(
  19606. $core.method({
  19607. selector: "constructorOf:",
  19608. protocol: "instance creation",
  19609. fn: function (nativeFunc){
  19610. var self=this,$self=this;
  19611. return $core.withContext(function($ctx1) {
  19612. return new nativeFunc();
  19613. ;
  19614. return self;
  19615. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19616. },
  19617. args: ["nativeFunc"],
  19618. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19619. referencedClasses: [],
  19620. messageSends: []
  19621. }),
  19622. $globals.NativeFunction.a$cls);
  19623. $core.addMethod(
  19624. $core.method({
  19625. selector: "constructorOf:value:",
  19626. protocol: "instance creation",
  19627. fn: function (nativeFunc,anObject){
  19628. var self=this,$self=this;
  19629. return $core.withContext(function($ctx1) {
  19630. return new nativeFunc(anObject);
  19631. ;
  19632. return self;
  19633. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19634. },
  19635. args: ["nativeFunc", "anObject"],
  19636. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19637. referencedClasses: [],
  19638. messageSends: []
  19639. }),
  19640. $globals.NativeFunction.a$cls);
  19641. $core.addMethod(
  19642. $core.method({
  19643. selector: "constructorOf:value:value:",
  19644. protocol: "instance creation",
  19645. fn: function (nativeFunc,anObject,anObject2){
  19646. var self=this,$self=this;
  19647. return $core.withContext(function($ctx1) {
  19648. return new nativeFunc(anObject,anObject2);
  19649. ;
  19650. return self;
  19651. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19652. },
  19653. args: ["nativeFunc", "anObject", "anObject2"],
  19654. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19655. referencedClasses: [],
  19656. messageSends: []
  19657. }),
  19658. $globals.NativeFunction.a$cls);
  19659. $core.addMethod(
  19660. $core.method({
  19661. selector: "constructorOf:value:value:value:",
  19662. protocol: "instance creation",
  19663. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19664. var self=this,$self=this;
  19665. return $core.withContext(function($ctx1) {
  19666. return new nativeFunc(anObject,anObject2, anObject3);
  19667. ;
  19668. return self;
  19669. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19670. },
  19671. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19672. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19673. referencedClasses: [],
  19674. messageSends: []
  19675. }),
  19676. $globals.NativeFunction.a$cls);
  19677. $core.addMethod(
  19678. $core.method({
  19679. selector: "exists:",
  19680. protocol: "testing",
  19681. fn: function (aString){
  19682. var self=this,$self=this;
  19683. return $core.withContext(function($ctx1) {
  19684. return $recv($globals.Platform)._includesGlobal_(aString);
  19685. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19686. },
  19687. args: ["aString"],
  19688. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19689. referencedClasses: ["Platform"],
  19690. messageSends: ["includesGlobal:"]
  19691. }),
  19692. $globals.NativeFunction.a$cls);
  19693. $core.addMethod(
  19694. $core.method({
  19695. selector: "functionNamed:",
  19696. protocol: "function calling",
  19697. fn: function (aString){
  19698. var self=this,$self=this;
  19699. return $core.withContext(function($ctx1) {
  19700. var nativeFunc=$globals.Platform._globals[aString];
  19701. return nativeFunc();
  19702. ;
  19703. return self;
  19704. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19705. },
  19706. args: ["aString"],
  19707. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19708. referencedClasses: [],
  19709. messageSends: []
  19710. }),
  19711. $globals.NativeFunction.a$cls);
  19712. $core.addMethod(
  19713. $core.method({
  19714. selector: "functionNamed:value:",
  19715. protocol: "function calling",
  19716. fn: function (aString,anObject){
  19717. var self=this,$self=this;
  19718. return $core.withContext(function($ctx1) {
  19719. var nativeFunc=$globals.Platform._globals()[aString];
  19720. return nativeFunc(anObject);
  19721. ;
  19722. return self;
  19723. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19724. },
  19725. args: ["aString", "anObject"],
  19726. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19727. referencedClasses: [],
  19728. messageSends: []
  19729. }),
  19730. $globals.NativeFunction.a$cls);
  19731. $core.addMethod(
  19732. $core.method({
  19733. selector: "functionNamed:value:value:",
  19734. protocol: "function calling",
  19735. fn: function (aString,anObject,anObject2){
  19736. var self=this,$self=this;
  19737. return $core.withContext(function($ctx1) {
  19738. var nativeFunc=$globals.Platform._globals()[aString];
  19739. return nativeFunc(anObject,anObject2);
  19740. ;
  19741. return self;
  19742. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19743. },
  19744. args: ["aString", "anObject", "anObject2"],
  19745. 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'>",
  19746. referencedClasses: [],
  19747. messageSends: []
  19748. }),
  19749. $globals.NativeFunction.a$cls);
  19750. $core.addMethod(
  19751. $core.method({
  19752. selector: "functionNamed:value:value:value:",
  19753. protocol: "function calling",
  19754. fn: function (aString,anObject,anObject2,anObject3){
  19755. var self=this,$self=this;
  19756. return $core.withContext(function($ctx1) {
  19757. var nativeFunc=$globals.Platform._globals()[aString];
  19758. return nativeFunc(anObject,anObject2, anObject3);
  19759. ;
  19760. return self;
  19761. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19762. },
  19763. args: ["aString", "anObject", "anObject2", "anObject3"],
  19764. 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'>",
  19765. referencedClasses: [],
  19766. messageSends: []
  19767. }),
  19768. $globals.NativeFunction.a$cls);
  19769. $core.addMethod(
  19770. $core.method({
  19771. selector: "functionNamed:valueWithArgs:",
  19772. protocol: "function calling",
  19773. fn: function (aString,args){
  19774. var self=this,$self=this;
  19775. return $core.withContext(function($ctx1) {
  19776. var nativeFunc=$globals.Platform._globals()[aString];
  19777. return Function.prototype.apply.call(nativeFunc, null, args);
  19778. ;
  19779. return self;
  19780. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19781. },
  19782. args: ["aString", "args"],
  19783. 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'>",
  19784. referencedClasses: [],
  19785. messageSends: []
  19786. }),
  19787. $globals.NativeFunction.a$cls);
  19788. $core.addMethod(
  19789. $core.method({
  19790. selector: "functionOf:",
  19791. protocol: "function calling",
  19792. fn: function (nativeFunc){
  19793. var self=this,$self=this;
  19794. return $core.withContext(function($ctx1) {
  19795. return nativeFunc();
  19796. ;
  19797. return self;
  19798. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19799. },
  19800. args: ["nativeFunc"],
  19801. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19802. referencedClasses: [],
  19803. messageSends: []
  19804. }),
  19805. $globals.NativeFunction.a$cls);
  19806. $core.addMethod(
  19807. $core.method({
  19808. selector: "functionOf:value:",
  19809. protocol: "function calling",
  19810. fn: function (nativeFunc,anObject){
  19811. var self=this,$self=this;
  19812. return $core.withContext(function($ctx1) {
  19813. return nativeFunc(anObject);
  19814. ;
  19815. return self;
  19816. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19817. },
  19818. args: ["nativeFunc", "anObject"],
  19819. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19820. referencedClasses: [],
  19821. messageSends: []
  19822. }),
  19823. $globals.NativeFunction.a$cls);
  19824. $core.addMethod(
  19825. $core.method({
  19826. selector: "functionOf:value:value:",
  19827. protocol: "function calling",
  19828. fn: function (nativeFunc,anObject,anObject2){
  19829. var self=this,$self=this;
  19830. return $core.withContext(function($ctx1) {
  19831. return nativeFunc(anObject,anObject2);
  19832. ;
  19833. return self;
  19834. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19835. },
  19836. args: ["nativeFunc", "anObject", "anObject2"],
  19837. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19838. referencedClasses: [],
  19839. messageSends: []
  19840. }),
  19841. $globals.NativeFunction.a$cls);
  19842. $core.addMethod(
  19843. $core.method({
  19844. selector: "functionOf:value:value:value:",
  19845. protocol: "function calling",
  19846. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19847. var self=this,$self=this;
  19848. return $core.withContext(function($ctx1) {
  19849. return nativeFunc(anObject,anObject2, anObject3);
  19850. ;
  19851. return self;
  19852. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19853. },
  19854. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19855. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19856. referencedClasses: [],
  19857. messageSends: []
  19858. }),
  19859. $globals.NativeFunction.a$cls);
  19860. $core.addMethod(
  19861. $core.method({
  19862. selector: "functionOf:valueWithArgs:",
  19863. protocol: "function calling",
  19864. fn: function (nativeFunc,args){
  19865. var self=this,$self=this;
  19866. return $core.withContext(function($ctx1) {
  19867. return Function.prototype.apply.call(nativeFunc, null, args);
  19868. ;
  19869. return self;
  19870. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19871. },
  19872. args: ["nativeFunc", "args"],
  19873. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19874. referencedClasses: [],
  19875. messageSends: []
  19876. }),
  19877. $globals.NativeFunction.a$cls);
  19878. $core.addMethod(
  19879. $core.method({
  19880. selector: "isNativeFunction:",
  19881. protocol: "testing",
  19882. fn: function (anObject){
  19883. var self=this,$self=this;
  19884. return $core.withContext(function($ctx1) {
  19885. return typeof anObject === "function";
  19886. return self;
  19887. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19888. },
  19889. args: ["anObject"],
  19890. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19891. referencedClasses: [],
  19892. messageSends: []
  19893. }),
  19894. $globals.NativeFunction.a$cls);
  19895. $core.addMethod(
  19896. $core.method({
  19897. selector: "methodOf:this:",
  19898. protocol: "method calling",
  19899. fn: function (nativeFunc,thisObject){
  19900. var self=this,$self=this;
  19901. return $core.withContext(function($ctx1) {
  19902. return Function.prototype.call.call(nativeFunc, thisObject);
  19903. ;
  19904. return self;
  19905. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19906. },
  19907. args: ["nativeFunc", "thisObject"],
  19908. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19909. referencedClasses: [],
  19910. messageSends: []
  19911. }),
  19912. $globals.NativeFunction.a$cls);
  19913. $core.addMethod(
  19914. $core.method({
  19915. selector: "methodOf:this:value:",
  19916. protocol: "method calling",
  19917. fn: function (nativeFunc,thisObject,anObject){
  19918. var self=this,$self=this;
  19919. return $core.withContext(function($ctx1) {
  19920. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19921. ;
  19922. return self;
  19923. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19924. },
  19925. args: ["nativeFunc", "thisObject", "anObject"],
  19926. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19927. referencedClasses: [],
  19928. messageSends: []
  19929. }),
  19930. $globals.NativeFunction.a$cls);
  19931. $core.addMethod(
  19932. $core.method({
  19933. selector: "methodOf:this:value:value:",
  19934. protocol: "method calling",
  19935. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19936. var self=this,$self=this;
  19937. return $core.withContext(function($ctx1) {
  19938. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19939. ;
  19940. return self;
  19941. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19942. },
  19943. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19944. 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'>",
  19945. referencedClasses: [],
  19946. messageSends: []
  19947. }),
  19948. $globals.NativeFunction.a$cls);
  19949. $core.addMethod(
  19950. $core.method({
  19951. selector: "methodOf:this:value:value:value:",
  19952. protocol: "method calling",
  19953. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19954. var self=this,$self=this;
  19955. return $core.withContext(function($ctx1) {
  19956. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19957. ;
  19958. return self;
  19959. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19960. },
  19961. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19962. 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'>",
  19963. referencedClasses: [],
  19964. messageSends: []
  19965. }),
  19966. $globals.NativeFunction.a$cls);
  19967. $core.addMethod(
  19968. $core.method({
  19969. selector: "methodOf:this:valueWithArgs:",
  19970. protocol: "method calling",
  19971. fn: function (nativeFunc,thisObject,args){
  19972. var self=this,$self=this;
  19973. return $core.withContext(function($ctx1) {
  19974. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19975. ;
  19976. return self;
  19977. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19978. },
  19979. args: ["nativeFunc", "thisObject", "args"],
  19980. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19981. referencedClasses: [],
  19982. messageSends: []
  19983. }),
  19984. $globals.NativeFunction.a$cls);
  19985. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19986. $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.";
  19987. $core.addMethod(
  19988. $core.method({
  19989. selector: "clearInterval",
  19990. protocol: "timeout/interval",
  19991. fn: function (){
  19992. var self=this,$self=this;
  19993. return $core.withContext(function($ctx1) {
  19994. var interval = $self["@rawTimeout"];
  19995. clearInterval(interval);
  19996. ;
  19997. return self;
  19998. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19999. },
  20000. args: [],
  20001. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  20002. referencedClasses: [],
  20003. messageSends: []
  20004. }),
  20005. $globals.Timeout);
  20006. $core.addMethod(
  20007. $core.method({
  20008. selector: "clearTimeout",
  20009. protocol: "timeout/interval",
  20010. fn: function (){
  20011. var self=this,$self=this;
  20012. return $core.withContext(function($ctx1) {
  20013. var timeout = $self["@rawTimeout"];
  20014. clearTimeout(timeout);
  20015. ;
  20016. return self;
  20017. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  20018. },
  20019. args: [],
  20020. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  20021. referencedClasses: [],
  20022. messageSends: []
  20023. }),
  20024. $globals.Timeout);
  20025. $core.addMethod(
  20026. $core.method({
  20027. selector: "rawTimeout:",
  20028. protocol: "accessing",
  20029. fn: function (anObject){
  20030. var self=this,$self=this;
  20031. $self["@rawTimeout"]=anObject;
  20032. return self;
  20033. },
  20034. args: ["anObject"],
  20035. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  20036. referencedClasses: [],
  20037. messageSends: []
  20038. }),
  20039. $globals.Timeout);
  20040. $core.addMethod(
  20041. $core.method({
  20042. selector: "on:",
  20043. protocol: "instance creation",
  20044. fn: function (anObject){
  20045. var self=this,$self=this;
  20046. return $core.withContext(function($ctx1) {
  20047. var $1;
  20048. $1=$self._new();
  20049. $recv($1)._rawTimeout_(anObject);
  20050. return $recv($1)._yourself();
  20051. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  20052. },
  20053. args: ["anObject"],
  20054. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  20055. referencedClasses: [],
  20056. messageSends: ["rawTimeout:", "new", "yourself"]
  20057. }),
  20058. $globals.Timeout.a$cls);
  20059. });
  20060. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20061. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20062. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20063. $core.addPackage("Kernel-Dag");
  20064. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  20065. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20066. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  20067. $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:`.";
  20068. $core.addMethod(
  20069. $core.method({
  20070. selector: "value:",
  20071. protocol: "evaluating",
  20072. fn: function (anObject){
  20073. var self=this,$self=this;
  20074. return $core.withContext(function($ctx1) {
  20075. return $self._visit_(anObject);
  20076. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  20077. },
  20078. args: ["anObject"],
  20079. source: "value: anObject\x0a\x09^ self visit: anObject",
  20080. referencedClasses: [],
  20081. messageSends: ["visit:"]
  20082. }),
  20083. $globals.AbstractDagVisitor);
  20084. $core.addMethod(
  20085. $core.method({
  20086. selector: "visit:",
  20087. protocol: "visiting",
  20088. fn: function (aNode){
  20089. var self=this,$self=this;
  20090. return $core.withContext(function($ctx1) {
  20091. return $recv(aNode)._acceptDagVisitor_(self);
  20092. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20093. },
  20094. args: ["aNode"],
  20095. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  20096. referencedClasses: [],
  20097. messageSends: ["acceptDagVisitor:"]
  20098. }),
  20099. $globals.AbstractDagVisitor);
  20100. $core.addMethod(
  20101. $core.method({
  20102. selector: "visitAll:",
  20103. protocol: "visiting",
  20104. fn: function (aCollection){
  20105. var self=this,$self=this;
  20106. return $core.withContext(function($ctx1) {
  20107. return $recv(aCollection)._collect_((function(each){
  20108. return $core.withContext(function($ctx2) {
  20109. return $self._visit_(each);
  20110. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20111. }));
  20112. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  20113. },
  20114. args: ["aCollection"],
  20115. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20116. referencedClasses: [],
  20117. messageSends: ["collect:", "visit:"]
  20118. }),
  20119. $globals.AbstractDagVisitor);
  20120. $core.addMethod(
  20121. $core.method({
  20122. selector: "visitAllChildren:",
  20123. protocol: "visiting",
  20124. fn: function (aDagNode){
  20125. var self=this,$self=this;
  20126. return $core.withContext(function($ctx1) {
  20127. return $self._visitAll_($recv(aDagNode)._dagChildren());
  20128. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  20129. },
  20130. args: ["aDagNode"],
  20131. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  20132. referencedClasses: [],
  20133. messageSends: ["visitAll:", "dagChildren"]
  20134. }),
  20135. $globals.AbstractDagVisitor);
  20136. $core.addMethod(
  20137. $core.method({
  20138. selector: "visitDagNode:",
  20139. protocol: "visiting",
  20140. fn: function (aNode){
  20141. var self=this,$self=this;
  20142. return $core.withContext(function($ctx1) {
  20143. $self._subclassResponsibility();
  20144. return self;
  20145. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20146. },
  20147. args: ["aNode"],
  20148. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20149. referencedClasses: [],
  20150. messageSends: ["subclassResponsibility"]
  20151. }),
  20152. $globals.AbstractDagVisitor);
  20153. $core.addMethod(
  20154. $core.method({
  20155. selector: "visitDagNodeVariantRedux:",
  20156. protocol: "visiting",
  20157. fn: function (aNode){
  20158. var self=this,$self=this;
  20159. var newChildren,oldChildren;
  20160. return $core.withContext(function($ctx1) {
  20161. var $2,$3,$1,$4,$5;
  20162. var $early={};
  20163. try {
  20164. oldChildren=$recv(aNode)._dagChildren();
  20165. newChildren=$self._visitAllChildren_(aNode);
  20166. $2=$recv(oldChildren)._size();
  20167. $ctx1.sendIdx["size"]=1;
  20168. $3=$recv(newChildren)._size();
  20169. $ctx1.sendIdx["size"]=2;
  20170. $1=$recv($2).__eq($3);
  20171. if($core.assert($1)){
  20172. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  20173. return $core.withContext(function($ctx2) {
  20174. $4=$recv(oldChildren)._at_(i);
  20175. $ctx2.sendIdx["at:"]=1;
  20176. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20177. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20178. }),(function(){
  20179. throw $early=[aNode];
  20180. }));
  20181. }
  20182. $5=$recv(aNode)._copy();
  20183. $recv($5)._dagChildren_(newChildren);
  20184. return $recv($5)._yourself();
  20185. }
  20186. catch(e) {if(e===$early)return e[0]; throw e}
  20187. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20188. },
  20189. args: ["aNode"],
  20190. 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",
  20191. referencedClasses: [],
  20192. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20193. }),
  20194. $globals.AbstractDagVisitor);
  20195. $core.addMethod(
  20196. $core.method({
  20197. selector: "visitDagNodeVariantSimple:",
  20198. protocol: "visiting",
  20199. fn: function (aNode){
  20200. var self=this,$self=this;
  20201. return $core.withContext(function($ctx1) {
  20202. $self._visitAllChildren_(aNode);
  20203. return aNode;
  20204. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20205. },
  20206. args: ["aNode"],
  20207. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20208. referencedClasses: [],
  20209. messageSends: ["visitAllChildren:"]
  20210. }),
  20211. $globals.AbstractDagVisitor);
  20212. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20213. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20214. $core.addMethod(
  20215. $core.method({
  20216. selector: "initialize",
  20217. protocol: "initialization",
  20218. fn: function (){
  20219. var self=this,$self=this;
  20220. return $core.withContext(function($ctx1) {
  20221. (
  20222. $ctx1.supercall = true,
  20223. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20224. $ctx1.supercall = false;
  20225. $self["@path"]=[];
  20226. return self;
  20227. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20228. },
  20229. args: [],
  20230. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20231. referencedClasses: [],
  20232. messageSends: ["initialize"]
  20233. }),
  20234. $globals.PathDagVisitor);
  20235. $core.addMethod(
  20236. $core.method({
  20237. selector: "path",
  20238. protocol: "accessing",
  20239. fn: function (){
  20240. var self=this,$self=this;
  20241. return $self["@path"];
  20242. },
  20243. args: [],
  20244. source: "path\x0a\x09^ path",
  20245. referencedClasses: [],
  20246. messageSends: []
  20247. }),
  20248. $globals.PathDagVisitor);
  20249. $core.addMethod(
  20250. $core.method({
  20251. selector: "visit:",
  20252. protocol: "visiting",
  20253. fn: function (aNode){
  20254. var self=this,$self=this;
  20255. var oldPath,result;
  20256. return $core.withContext(function($ctx1) {
  20257. result=aNode;
  20258. oldPath=$self["@path"];
  20259. $recv((function(){
  20260. return $core.withContext(function($ctx2) {
  20261. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20262. $self["@path"];
  20263. result=(
  20264. $ctx2.supercall = true,
  20265. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20266. $ctx2.supercall = false;
  20267. return result;
  20268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20269. }))._ensure_((function(){
  20270. $self["@path"]=oldPath;
  20271. return $self["@path"];
  20272. }));
  20273. return result;
  20274. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20275. },
  20276. args: ["aNode"],
  20277. 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",
  20278. referencedClasses: [],
  20279. messageSends: ["ensure:", ",", "visit:"]
  20280. }),
  20281. $globals.PathDagVisitor);
  20282. $core.addMethod(
  20283. $core.method({
  20284. selector: "visitDagNodeVariantRedux:",
  20285. protocol: "visiting",
  20286. fn: function (aNode){
  20287. var self=this,$self=this;
  20288. var newNode;
  20289. return $core.withContext(function($ctx1) {
  20290. var $1;
  20291. newNode=(
  20292. $ctx1.supercall = true,
  20293. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20294. $ctx1.supercall = false;
  20295. $1=$recv(aNode).__eq_eq(newNode);
  20296. if(!$core.assert($1)){
  20297. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20298. }
  20299. return newNode;
  20300. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20301. },
  20302. args: ["aNode"],
  20303. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20304. referencedClasses: [],
  20305. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20306. }),
  20307. $globals.PathDagVisitor);
  20308. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20309. $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).";
  20310. $core.addMethod(
  20311. $core.method({
  20312. selector: "acceptDagVisitor:",
  20313. protocol: "visiting",
  20314. fn: function (aVisitor){
  20315. var self=this,$self=this;
  20316. return $core.withContext(function($ctx1) {
  20317. return $recv(aVisitor)._visitDagNode_(self);
  20318. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20319. },
  20320. args: ["aVisitor"],
  20321. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20322. referencedClasses: [],
  20323. messageSends: ["visitDagNode:"]
  20324. }),
  20325. $globals.DagNode);
  20326. $core.addMethod(
  20327. $core.method({
  20328. selector: "allDagChildren",
  20329. protocol: "accessing",
  20330. fn: function (){
  20331. var self=this,$self=this;
  20332. var allNodes;
  20333. return $core.withContext(function($ctx1) {
  20334. var $1;
  20335. $1=$self._dagChildren();
  20336. $ctx1.sendIdx["dagChildren"]=1;
  20337. allNodes=$recv($1)._asSet();
  20338. $recv($self._dagChildren())._do_((function(each){
  20339. return $core.withContext(function($ctx2) {
  20340. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20341. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20342. }));
  20343. return allNodes;
  20344. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20345. },
  20346. args: [],
  20347. 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",
  20348. referencedClasses: [],
  20349. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20350. }),
  20351. $globals.DagNode);
  20352. $core.addMethod(
  20353. $core.method({
  20354. selector: "dagChildren",
  20355. protocol: "accessing",
  20356. fn: function (){
  20357. var self=this,$self=this;
  20358. return $core.withContext(function($ctx1) {
  20359. $self._subclassResponsibility();
  20360. return self;
  20361. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20362. },
  20363. args: [],
  20364. source: "dagChildren\x0a\x09self subclassResponsibility",
  20365. referencedClasses: [],
  20366. messageSends: ["subclassResponsibility"]
  20367. }),
  20368. $globals.DagNode);
  20369. $core.addMethod(
  20370. $core.method({
  20371. selector: "dagChildren:",
  20372. protocol: "accessing",
  20373. fn: function (aCollection){
  20374. var self=this,$self=this;
  20375. return $core.withContext(function($ctx1) {
  20376. $self._subclassResponsibility();
  20377. return self;
  20378. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20379. },
  20380. args: ["aCollection"],
  20381. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20382. referencedClasses: [],
  20383. messageSends: ["subclassResponsibility"]
  20384. }),
  20385. $globals.DagNode);
  20386. $core.addMethod(
  20387. $core.method({
  20388. selector: "isDagNode",
  20389. protocol: "testing",
  20390. fn: function (){
  20391. var self=this,$self=this;
  20392. return true;
  20393. },
  20394. args: [],
  20395. source: "isDagNode\x0a\x09^ true",
  20396. referencedClasses: [],
  20397. messageSends: []
  20398. }),
  20399. $globals.DagNode);
  20400. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20401. $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.";
  20402. $core.addMethod(
  20403. $core.method({
  20404. selector: "addDagChild:",
  20405. protocol: "accessing",
  20406. fn: function (aDagNode){
  20407. var self=this,$self=this;
  20408. return $core.withContext(function($ctx1) {
  20409. $recv($self._dagChildren())._add_(aDagNode);
  20410. return self;
  20411. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20412. },
  20413. args: ["aDagNode"],
  20414. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20415. referencedClasses: [],
  20416. messageSends: ["add:", "dagChildren"]
  20417. }),
  20418. $globals.DagParentNode);
  20419. $core.addMethod(
  20420. $core.method({
  20421. selector: "dagChildren",
  20422. protocol: "accessing",
  20423. fn: function (){
  20424. var self=this,$self=this;
  20425. return $core.withContext(function($ctx1) {
  20426. var $1,$receiver;
  20427. $1=$self["@nodes"];
  20428. if(($receiver = $1) == null || $receiver.a$nil){
  20429. $self["@nodes"]=$recv($globals.Array)._new();
  20430. return $self["@nodes"];
  20431. } else {
  20432. return $1;
  20433. }
  20434. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20435. },
  20436. args: [],
  20437. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20438. referencedClasses: ["Array"],
  20439. messageSends: ["ifNil:", "new"]
  20440. }),
  20441. $globals.DagParentNode);
  20442. $core.addMethod(
  20443. $core.method({
  20444. selector: "dagChildren:",
  20445. protocol: "accessing",
  20446. fn: function (aCollection){
  20447. var self=this,$self=this;
  20448. $self["@nodes"]=aCollection;
  20449. return self;
  20450. },
  20451. args: ["aCollection"],
  20452. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20453. referencedClasses: [],
  20454. messageSends: []
  20455. }),
  20456. $globals.DagParentNode);
  20457. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20458. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20459. $core.addMethod(
  20460. $core.method({
  20461. selector: "dagChildren",
  20462. protocol: "accessing",
  20463. fn: function (){
  20464. var self=this,$self=this;
  20465. return [];
  20466. },
  20467. args: [],
  20468. source: "dagChildren\x0a\x09^ #()",
  20469. referencedClasses: [],
  20470. messageSends: []
  20471. }),
  20472. $globals.DagSink);
  20473. $core.addMethod(
  20474. $core.method({
  20475. selector: "dagChildren:",
  20476. protocol: "accessing",
  20477. fn: function (aCollection){
  20478. var self=this,$self=this;
  20479. return $core.withContext(function($ctx1) {
  20480. $recv(aCollection)._ifNotEmpty_((function(){
  20481. return $core.withContext(function($ctx2) {
  20482. return $self._error_("A DagSink cannot have children.");
  20483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20484. }));
  20485. return self;
  20486. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20487. },
  20488. args: ["aCollection"],
  20489. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20490. referencedClasses: [],
  20491. messageSends: ["ifNotEmpty:", "error:"]
  20492. }),
  20493. $globals.DagSink);
  20494. $core.addMethod(
  20495. $core.method({
  20496. selector: "isDagNode",
  20497. protocol: "*Kernel-Dag",
  20498. fn: function (){
  20499. var self=this,$self=this;
  20500. return false;
  20501. },
  20502. args: [],
  20503. source: "isDagNode\x0a\x09^ false",
  20504. referencedClasses: [],
  20505. messageSends: []
  20506. }),
  20507. $globals.Object);
  20508. });
  20509. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20510. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20511. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20512. $core.addPackage("Kernel-Exceptions");
  20513. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20514. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20515. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20516. $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.";
  20517. $core.addMethod(
  20518. $core.method({
  20519. selector: "beHandled",
  20520. protocol: "accessing",
  20521. fn: function (){
  20522. var self=this,$self=this;
  20523. return $core.withContext(function($ctx1) {
  20524. self.amberHandled = true;
  20525. return self;
  20526. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20527. },
  20528. args: [],
  20529. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20530. referencedClasses: [],
  20531. messageSends: []
  20532. }),
  20533. $globals.Error);
  20534. $core.addMethod(
  20535. $core.method({
  20536. selector: "beUnhandled",
  20537. protocol: "accessing",
  20538. fn: function (){
  20539. var self=this,$self=this;
  20540. return $core.withContext(function($ctx1) {
  20541. self.amberHandled = false;
  20542. return self;
  20543. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20544. },
  20545. args: [],
  20546. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20547. referencedClasses: [],
  20548. messageSends: []
  20549. }),
  20550. $globals.Error);
  20551. $core.addMethod(
  20552. $core.method({
  20553. selector: "context",
  20554. protocol: "accessing",
  20555. fn: function (){
  20556. var self=this,$self=this;
  20557. return $core.withContext(function($ctx1) {
  20558. return self.context;
  20559. return self;
  20560. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20561. },
  20562. args: [],
  20563. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20564. referencedClasses: [],
  20565. messageSends: []
  20566. }),
  20567. $globals.Error);
  20568. $core.addMethod(
  20569. $core.method({
  20570. selector: "initialize",
  20571. protocol: "initialization",
  20572. fn: function (){
  20573. var self=this,$self=this;
  20574. return $core.withContext(function($ctx1) {
  20575. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20576. return self;
  20577. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20578. },
  20579. args: [],
  20580. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20581. referencedClasses: [],
  20582. messageSends: ["messageText:", ",", "name", "class"]
  20583. }),
  20584. $globals.Error);
  20585. $core.addMethod(
  20586. $core.method({
  20587. selector: "isSmalltalkError",
  20588. protocol: "testing",
  20589. fn: function (){
  20590. var self=this,$self=this;
  20591. return $core.withContext(function($ctx1) {
  20592. return self.smalltalkError === true;
  20593. return self;
  20594. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20595. },
  20596. args: [],
  20597. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20598. referencedClasses: [],
  20599. messageSends: []
  20600. }),
  20601. $globals.Error);
  20602. $core.addMethod(
  20603. $core.method({
  20604. selector: "jsStack",
  20605. protocol: "accessing",
  20606. fn: function (){
  20607. var self=this,$self=this;
  20608. return $core.withContext(function($ctx1) {
  20609. return self.stack;
  20610. return self;
  20611. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20612. },
  20613. args: [],
  20614. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20615. referencedClasses: [],
  20616. messageSends: []
  20617. }),
  20618. $globals.Error);
  20619. $core.addMethod(
  20620. $core.method({
  20621. selector: "messageText",
  20622. protocol: "accessing",
  20623. fn: function (){
  20624. var self=this,$self=this;
  20625. return $self["@messageText"];
  20626. },
  20627. args: [],
  20628. source: "messageText\x0a\x09^ messageText",
  20629. referencedClasses: [],
  20630. messageSends: []
  20631. }),
  20632. $globals.Error);
  20633. $core.addMethod(
  20634. $core.method({
  20635. selector: "messageText:",
  20636. protocol: "accessing",
  20637. fn: function (aString){
  20638. var self=this,$self=this;
  20639. $self["@messageText"]=aString;
  20640. return self;
  20641. },
  20642. args: ["aString"],
  20643. source: "messageText: aString\x0a\x09messageText := aString",
  20644. referencedClasses: [],
  20645. messageSends: []
  20646. }),
  20647. $globals.Error);
  20648. $core.addMethod(
  20649. $core.method({
  20650. selector: "resignal",
  20651. protocol: "signaling",
  20652. fn: function (){
  20653. var self=this,$self=this;
  20654. return $core.withContext(function($ctx1) {
  20655. self.amberHandled = false;
  20656. throw(self);
  20657. ;
  20658. return self;
  20659. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20660. },
  20661. args: [],
  20662. 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'>",
  20663. referencedClasses: [],
  20664. messageSends: []
  20665. }),
  20666. $globals.Error);
  20667. $core.addMethod(
  20668. $core.method({
  20669. selector: "signal",
  20670. protocol: "signaling",
  20671. fn: function (){
  20672. var self=this,$self=this;
  20673. return $core.withContext(function($ctx1) {
  20674. self.amberHandled = false;
  20675. self.context = $core.getThisContext();
  20676. self.smalltalkError = true;
  20677. throw self;
  20678. ;
  20679. return self;
  20680. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20681. },
  20682. args: [],
  20683. 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'>",
  20684. referencedClasses: [],
  20685. messageSends: []
  20686. }),
  20687. $globals.Error);
  20688. $core.addMethod(
  20689. $core.method({
  20690. selector: "signal:",
  20691. protocol: "signaling",
  20692. fn: function (aString){
  20693. var self=this,$self=this;
  20694. return $core.withContext(function($ctx1) {
  20695. $self._messageText_(aString);
  20696. $self._signal();
  20697. return self;
  20698. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20699. },
  20700. args: ["aString"],
  20701. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20702. referencedClasses: [],
  20703. messageSends: ["messageText:", "signal"]
  20704. }),
  20705. $globals.Error);
  20706. $core.addMethod(
  20707. $core.method({
  20708. selector: "signalerContext",
  20709. protocol: "accessing",
  20710. fn: function (){
  20711. var self=this,$self=this;
  20712. return $core.withContext(function($ctx1) {
  20713. return $self._signalerContextFrom_($self._context());
  20714. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20715. },
  20716. args: [],
  20717. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20718. referencedClasses: [],
  20719. messageSends: ["signalerContextFrom:", "context"]
  20720. }),
  20721. $globals.Error);
  20722. $core.addMethod(
  20723. $core.method({
  20724. selector: "signalerContextFrom:",
  20725. protocol: "accessing",
  20726. fn: function (aContext){
  20727. var self=this,$self=this;
  20728. return $core.withContext(function($ctx1) {
  20729. var $3,$2,$1;
  20730. return $recv(aContext)._findContextSuchThat_((function(context){
  20731. return $core.withContext(function($ctx2) {
  20732. $3=$recv(context)._receiver();
  20733. $ctx2.sendIdx["receiver"]=1;
  20734. $2=$recv($3).__eq_eq(self);
  20735. $ctx2.sendIdx["=="]=1;
  20736. $1=$recv($2)._or_((function(){
  20737. return $core.withContext(function($ctx3) {
  20738. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20739. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20740. }));
  20741. return $recv($1)._not();
  20742. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20743. }));
  20744. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20745. },
  20746. args: ["aContext"],
  20747. 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 ]",
  20748. referencedClasses: [],
  20749. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20750. }),
  20751. $globals.Error);
  20752. $core.addMethod(
  20753. $core.method({
  20754. selector: "wasHandled",
  20755. protocol: "testing",
  20756. fn: function (){
  20757. var self=this,$self=this;
  20758. return $core.withContext(function($ctx1) {
  20759. return self.amberHandled || false;
  20760. return self;
  20761. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20762. },
  20763. args: [],
  20764. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20765. referencedClasses: [],
  20766. messageSends: []
  20767. }),
  20768. $globals.Error);
  20769. $core.addMethod(
  20770. $core.method({
  20771. selector: "classTag",
  20772. protocol: "accessing",
  20773. fn: function (){
  20774. var self=this,$self=this;
  20775. return "exception";
  20776. },
  20777. args: [],
  20778. 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'",
  20779. referencedClasses: [],
  20780. messageSends: []
  20781. }),
  20782. $globals.Error.a$cls);
  20783. $core.addMethod(
  20784. $core.method({
  20785. selector: "signal",
  20786. protocol: "instance creation",
  20787. fn: function (){
  20788. var self=this,$self=this;
  20789. return $core.withContext(function($ctx1) {
  20790. return $recv($self._new())._signal();
  20791. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20792. },
  20793. args: [],
  20794. source: "signal\x0a\x09^ self new signal",
  20795. referencedClasses: [],
  20796. messageSends: ["signal", "new"]
  20797. }),
  20798. $globals.Error.a$cls);
  20799. $core.addMethod(
  20800. $core.method({
  20801. selector: "signal:",
  20802. protocol: "instance creation",
  20803. fn: function (aString){
  20804. var self=this,$self=this;
  20805. return $core.withContext(function($ctx1) {
  20806. return $recv($self._new())._signal_(aString);
  20807. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20808. },
  20809. args: ["aString"],
  20810. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20811. referencedClasses: [],
  20812. messageSends: ["signal:", "new"]
  20813. }),
  20814. $globals.Error.a$cls);
  20815. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20816. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20817. $core.addMethod(
  20818. $core.method({
  20819. selector: "messageText",
  20820. protocol: "accessing",
  20821. fn: function (){
  20822. var self=this,$self=this;
  20823. return "Halt encountered";
  20824. },
  20825. args: [],
  20826. source: "messageText\x0a\x09^ 'Halt encountered'",
  20827. referencedClasses: [],
  20828. messageSends: []
  20829. }),
  20830. $globals.Halt);
  20831. $core.addMethod(
  20832. $core.method({
  20833. selector: "signalerContextFrom:",
  20834. protocol: "accessing",
  20835. fn: function (aContext){
  20836. var self=this,$self=this;
  20837. return $core.withContext(function($ctx1) {
  20838. var $3,$2,$1;
  20839. return $recv(aContext)._findContextSuchThat_((function(context){
  20840. return $core.withContext(function($ctx2) {
  20841. $3=$recv(context)._receiver();
  20842. $ctx2.sendIdx["receiver"]=1;
  20843. $2=$recv($3).__eq_eq(self);
  20844. $ctx2.sendIdx["=="]=1;
  20845. $1=$recv($2)._or_((function(){
  20846. return $core.withContext(function($ctx3) {
  20847. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20848. return $core.withContext(function($ctx4) {
  20849. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20850. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20851. }));
  20852. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20853. }));
  20854. $ctx2.sendIdx["or:"]=1;
  20855. return $recv($1)._not();
  20856. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20857. }));
  20858. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20859. },
  20860. args: ["aContext"],
  20861. 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 ]",
  20862. referencedClasses: [],
  20863. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20864. }),
  20865. $globals.Halt);
  20866. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20867. $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:`";
  20868. $core.addMethod(
  20869. $core.method({
  20870. selector: "context:",
  20871. protocol: "accessing",
  20872. fn: function (aMethodContext){
  20873. var self=this,$self=this;
  20874. return $core.withContext(function($ctx1) {
  20875. self.context = aMethodContext;
  20876. return self;
  20877. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20878. },
  20879. args: ["aMethodContext"],
  20880. 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'>",
  20881. referencedClasses: [],
  20882. messageSends: []
  20883. }),
  20884. $globals.JavaScriptException);
  20885. $core.addMethod(
  20886. $core.method({
  20887. selector: "exception",
  20888. protocol: "accessing",
  20889. fn: function (){
  20890. var self=this,$self=this;
  20891. return $self["@exception"];
  20892. },
  20893. args: [],
  20894. source: "exception\x0a\x09^ exception",
  20895. referencedClasses: [],
  20896. messageSends: []
  20897. }),
  20898. $globals.JavaScriptException);
  20899. $core.addMethod(
  20900. $core.method({
  20901. selector: "exception:",
  20902. protocol: "accessing",
  20903. fn: function (anException){
  20904. var self=this,$self=this;
  20905. $self["@exception"]=anException;
  20906. return self;
  20907. },
  20908. args: ["anException"],
  20909. source: "exception: anException\x0a\x09exception := anException",
  20910. referencedClasses: [],
  20911. messageSends: []
  20912. }),
  20913. $globals.JavaScriptException);
  20914. $core.addMethod(
  20915. $core.method({
  20916. selector: "messageText",
  20917. protocol: "accessing",
  20918. fn: function (){
  20919. var self=this,$self=this;
  20920. return $core.withContext(function($ctx1) {
  20921. return "JavaScript exception: " + $self["@exception"].toString();
  20922. return self;
  20923. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20924. },
  20925. args: [],
  20926. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20927. referencedClasses: [],
  20928. messageSends: []
  20929. }),
  20930. $globals.JavaScriptException);
  20931. $core.addMethod(
  20932. $core.method({
  20933. selector: "shouldBeStubbed",
  20934. protocol: "testing",
  20935. fn: function (){
  20936. var self=this,$self=this;
  20937. return $core.withContext(function($ctx1) {
  20938. return $self["@exception"] instanceof RangeError;
  20939. return self;
  20940. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20941. },
  20942. args: [],
  20943. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20944. referencedClasses: [],
  20945. messageSends: []
  20946. }),
  20947. $globals.JavaScriptException);
  20948. $core.addMethod(
  20949. $core.method({
  20950. selector: "wrap",
  20951. protocol: "error handling",
  20952. fn: function (){
  20953. var self=this,$self=this;
  20954. return $core.withContext(function($ctx1) {
  20955. var $1;
  20956. $recv((function(){
  20957. return $core.withContext(function($ctx2) {
  20958. return $self._signal();
  20959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20960. }))._tryCatch_((function(){
  20961. return $core.withContext(function($ctx2) {
  20962. $1=$self._shouldBeStubbed();
  20963. if($core.assert($1)){
  20964. return $recv($self._context())._stubToAtMost_((100));
  20965. }
  20966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20967. }));
  20968. return self;
  20969. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20970. },
  20971. args: [],
  20972. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20973. referencedClasses: [],
  20974. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20975. }),
  20976. $globals.JavaScriptException);
  20977. $core.addMethod(
  20978. $core.method({
  20979. selector: "on:",
  20980. protocol: "instance creation",
  20981. fn: function (anException){
  20982. var self=this,$self=this;
  20983. return $core.withContext(function($ctx1) {
  20984. var $1;
  20985. $1=$self._new();
  20986. $recv($1)._exception_(anException);
  20987. return $recv($1)._yourself();
  20988. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20989. },
  20990. args: ["anException"],
  20991. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20992. referencedClasses: [],
  20993. messageSends: ["exception:", "new", "yourself"]
  20994. }),
  20995. $globals.JavaScriptException.a$cls);
  20996. $core.addMethod(
  20997. $core.method({
  20998. selector: "on:context:",
  20999. protocol: "instance creation",
  21000. fn: function (anException,aMethodContext){
  21001. var self=this,$self=this;
  21002. return $core.withContext(function($ctx1) {
  21003. var $1;
  21004. $1=$self._new();
  21005. $recv($1)._exception_(anException);
  21006. $recv($1)._context_(aMethodContext);
  21007. return $recv($1)._yourself();
  21008. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  21009. },
  21010. args: ["anException", "aMethodContext"],
  21011. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  21012. referencedClasses: [],
  21013. messageSends: ["exception:", "new", "context:", "yourself"]
  21014. }),
  21015. $globals.JavaScriptException.a$cls);
  21016. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  21017. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  21018. $core.addMethod(
  21019. $core.method({
  21020. selector: "message",
  21021. protocol: "accessing",
  21022. fn: function (){
  21023. var self=this,$self=this;
  21024. return $self["@message"];
  21025. },
  21026. args: [],
  21027. source: "message\x0a\x09^ message",
  21028. referencedClasses: [],
  21029. messageSends: []
  21030. }),
  21031. $globals.MessageNotUnderstood);
  21032. $core.addMethod(
  21033. $core.method({
  21034. selector: "message:",
  21035. protocol: "accessing",
  21036. fn: function (aMessage){
  21037. var self=this,$self=this;
  21038. $self["@message"]=aMessage;
  21039. return self;
  21040. },
  21041. args: ["aMessage"],
  21042. source: "message: aMessage\x0a\x09message := aMessage",
  21043. referencedClasses: [],
  21044. messageSends: []
  21045. }),
  21046. $globals.MessageNotUnderstood);
  21047. $core.addMethod(
  21048. $core.method({
  21049. selector: "messageText",
  21050. protocol: "accessing",
  21051. fn: function (){
  21052. var self=this,$self=this;
  21053. return $core.withContext(function($ctx1) {
  21054. var $1;
  21055. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  21056. $ctx1.sendIdx[","]=1;
  21057. return $1;
  21058. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  21059. },
  21060. args: [],
  21061. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  21062. referencedClasses: [],
  21063. messageSends: [",", "asString", "receiver", "selector", "message"]
  21064. }),
  21065. $globals.MessageNotUnderstood);
  21066. $core.addMethod(
  21067. $core.method({
  21068. selector: "receiver",
  21069. protocol: "accessing",
  21070. fn: function (){
  21071. var self=this,$self=this;
  21072. return $self["@receiver"];
  21073. },
  21074. args: [],
  21075. source: "receiver\x0a\x09^ receiver",
  21076. referencedClasses: [],
  21077. messageSends: []
  21078. }),
  21079. $globals.MessageNotUnderstood);
  21080. $core.addMethod(
  21081. $core.method({
  21082. selector: "receiver:",
  21083. protocol: "accessing",
  21084. fn: function (anObject){
  21085. var self=this,$self=this;
  21086. $self["@receiver"]=anObject;
  21087. return self;
  21088. },
  21089. args: ["anObject"],
  21090. source: "receiver: anObject\x0a\x09receiver := anObject",
  21091. referencedClasses: [],
  21092. messageSends: []
  21093. }),
  21094. $globals.MessageNotUnderstood);
  21095. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  21096. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  21097. $core.addMethod(
  21098. $core.method({
  21099. selector: "object",
  21100. protocol: "accessing",
  21101. fn: function (){
  21102. var self=this,$self=this;
  21103. return $self["@object"];
  21104. },
  21105. args: [],
  21106. source: "object\x0a\x09^ object",
  21107. referencedClasses: [],
  21108. messageSends: []
  21109. }),
  21110. $globals.NonBooleanReceiver);
  21111. $core.addMethod(
  21112. $core.method({
  21113. selector: "object:",
  21114. protocol: "accessing",
  21115. fn: function (anObject){
  21116. var self=this,$self=this;
  21117. $self["@object"]=anObject;
  21118. return self;
  21119. },
  21120. args: ["anObject"],
  21121. source: "object: anObject\x0a\x09object := anObject",
  21122. referencedClasses: [],
  21123. messageSends: []
  21124. }),
  21125. $globals.NonBooleanReceiver);
  21126. $core.addMethod(
  21127. $core.method({
  21128. selector: "signalOn:",
  21129. protocol: "instance creation",
  21130. fn: function (anObject){
  21131. var self=this,$self=this;
  21132. return $core.withContext(function($ctx1) {
  21133. var $1;
  21134. $1=$self._new();
  21135. $recv($1)._object_(anObject);
  21136. return $recv($1)._signal();
  21137. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  21138. },
  21139. args: ["anObject"],
  21140. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  21141. referencedClasses: [],
  21142. messageSends: ["object:", "new", "signal"]
  21143. }),
  21144. $globals.NonBooleanReceiver.a$cls);
  21145. });
  21146. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21147. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21148. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21149. $core.addPackage("Kernel-Promises");
  21150. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  21151. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21152. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21153. $core.addMethod(
  21154. $core.method({
  21155. selector: "all:",
  21156. protocol: "composites",
  21157. fn: function (aCollection){
  21158. var self=this,$self=this;
  21159. return $core.withContext(function($ctx1) {
  21160. return Promise.all($recv(aCollection)._asArray());
  21161. return self;
  21162. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21163. },
  21164. args: ["aCollection"],
  21165. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21166. referencedClasses: [],
  21167. messageSends: []
  21168. }),
  21169. $globals.Promise.a$cls);
  21170. $core.addMethod(
  21171. $core.method({
  21172. selector: "any:",
  21173. protocol: "composites",
  21174. fn: function (aCollection){
  21175. var self=this,$self=this;
  21176. return $core.withContext(function($ctx1) {
  21177. return Promise.race($recv(aCollection)._asArray());
  21178. return self;
  21179. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21180. },
  21181. args: ["aCollection"],
  21182. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21183. referencedClasses: [],
  21184. messageSends: []
  21185. }),
  21186. $globals.Promise.a$cls);
  21187. $core.addMethod(
  21188. $core.method({
  21189. selector: "forBlock:",
  21190. protocol: "instance creation",
  21191. fn: function (aBlock){
  21192. var self=this,$self=this;
  21193. return $core.withContext(function($ctx1) {
  21194. return $recv($self._new())._then_(aBlock);
  21195. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21196. },
  21197. args: ["aBlock"],
  21198. 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",
  21199. referencedClasses: [],
  21200. messageSends: ["then:", "new"]
  21201. }),
  21202. $globals.Promise.a$cls);
  21203. $core.addMethod(
  21204. $core.method({
  21205. selector: "new",
  21206. protocol: "instance creation",
  21207. fn: function (){
  21208. var self=this,$self=this;
  21209. return $core.withContext(function($ctx1) {
  21210. return Promise.resolve();
  21211. return self;
  21212. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21213. },
  21214. args: [],
  21215. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21216. referencedClasses: [],
  21217. messageSends: []
  21218. }),
  21219. $globals.Promise.a$cls);
  21220. $core.addMethod(
  21221. $core.method({
  21222. selector: "new:",
  21223. protocol: "instance creation",
  21224. fn: function (aBlock){
  21225. var self=this,$self=this;
  21226. return $core.withContext(function($ctx1) {
  21227. return new Promise(function (resolve, reject) {
  21228. var model = {value: resolve, signal: reject};
  21229. aBlock._value_(model);
  21230. });
  21231. return self;
  21232. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21233. },
  21234. args: ["aBlock"],
  21235. 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})'>",
  21236. referencedClasses: [],
  21237. messageSends: []
  21238. }),
  21239. $globals.Promise.a$cls);
  21240. $core.addMethod(
  21241. $core.method({
  21242. selector: "signal:",
  21243. protocol: "instance creation",
  21244. fn: function (anObject){
  21245. var self=this,$self=this;
  21246. return $core.withContext(function($ctx1) {
  21247. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21248. return self;
  21249. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21250. },
  21251. args: ["anObject"],
  21252. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21253. referencedClasses: [],
  21254. messageSends: []
  21255. }),
  21256. $globals.Promise.a$cls);
  21257. $core.addMethod(
  21258. $core.method({
  21259. selector: "value:",
  21260. protocol: "instance creation",
  21261. fn: function (anObject){
  21262. var self=this,$self=this;
  21263. return $core.withContext(function($ctx1) {
  21264. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21265. return self;
  21266. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21267. },
  21268. args: ["anObject"],
  21269. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21270. referencedClasses: [],
  21271. messageSends: []
  21272. }),
  21273. $globals.Promise.a$cls);
  21274. $core.addTrait("TThenable", "Kernel-Promises");
  21275. $core.addMethod(
  21276. $core.method({
  21277. selector: "catch:",
  21278. protocol: "promises",
  21279. fn: function (aBlock){
  21280. var self=this,$self=this;
  21281. return $core.withContext(function($ctx1) {
  21282. return self.then(null, function (err) {return $core.seamless(function () {
  21283. return aBlock._value_(err);
  21284. })});
  21285. return self;
  21286. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21287. },
  21288. args: ["aBlock"],
  21289. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21290. referencedClasses: [],
  21291. messageSends: []
  21292. }),
  21293. $globals.TThenable);
  21294. $core.addMethod(
  21295. $core.method({
  21296. selector: "on:do:",
  21297. protocol: "promises",
  21298. fn: function (aClass,aBlock){
  21299. var self=this,$self=this;
  21300. return $core.withContext(function($ctx1) {
  21301. return self.then(null, function (err) {return $core.seamless(function () {
  21302. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21303. else throw err;
  21304. })});
  21305. return self;
  21306. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21307. },
  21308. args: ["aClass", "aBlock"],
  21309. 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})})'>",
  21310. referencedClasses: [],
  21311. messageSends: []
  21312. }),
  21313. $globals.TThenable);
  21314. $core.addMethod(
  21315. $core.method({
  21316. selector: "on:do:catch:",
  21317. protocol: "promises",
  21318. fn: function (aClass,aBlock,anotherBlock){
  21319. var self=this,$self=this;
  21320. return $core.withContext(function($ctx1) {
  21321. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21322. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21323. },
  21324. args: ["aClass", "aBlock", "anotherBlock"],
  21325. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21326. referencedClasses: [],
  21327. messageSends: ["catch:", "on:do:"]
  21328. }),
  21329. $globals.TThenable);
  21330. $core.addMethod(
  21331. $core.method({
  21332. selector: "then:",
  21333. protocol: "promises",
  21334. fn: function (aBlockOrArray){
  21335. var self=this,$self=this;
  21336. return $core.withContext(function($ctx1) {
  21337. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21338. return array.reduce(function (soFar, aBlock) {
  21339. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21340. function (result) {return $core.seamless(function () {
  21341. if (Array.isArray(result)) {
  21342. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21343. } else {
  21344. return aBlock._value_(result);
  21345. }
  21346. })} :
  21347. function (result) {return $core.seamless(function () {
  21348. return aBlock._value_(result);
  21349. })}
  21350. );
  21351. }, self);
  21352. return self;
  21353. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21354. },
  21355. args: ["aBlockOrArray"],
  21356. 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)'>",
  21357. referencedClasses: [],
  21358. messageSends: []
  21359. }),
  21360. $globals.TThenable);
  21361. $core.addMethod(
  21362. $core.method({
  21363. selector: "then:catch:",
  21364. protocol: "promises",
  21365. fn: function (aBlockOrArray,anotherBlock){
  21366. var self=this,$self=this;
  21367. return $core.withContext(function($ctx1) {
  21368. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21369. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21370. },
  21371. args: ["aBlockOrArray", "anotherBlock"],
  21372. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21373. referencedClasses: [],
  21374. messageSends: ["catch:", "then:"]
  21375. }),
  21376. $globals.TThenable);
  21377. $core.addMethod(
  21378. $core.method({
  21379. selector: "then:on:do:",
  21380. protocol: "promises",
  21381. fn: function (aBlockOrArray,aClass,aBlock){
  21382. var self=this,$self=this;
  21383. return $core.withContext(function($ctx1) {
  21384. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21385. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21386. },
  21387. args: ["aBlockOrArray", "aClass", "aBlock"],
  21388. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21389. referencedClasses: [],
  21390. messageSends: ["on:do:", "then:"]
  21391. }),
  21392. $globals.TThenable);
  21393. $core.addMethod(
  21394. $core.method({
  21395. selector: "then:on:do:catch:",
  21396. protocol: "promises",
  21397. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21398. var self=this,$self=this;
  21399. return $core.withContext(function($ctx1) {
  21400. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21401. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21402. },
  21403. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21404. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21405. referencedClasses: [],
  21406. messageSends: ["catch:", "on:do:", "then:"]
  21407. }),
  21408. $globals.TThenable);
  21409. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21410. });
  21411. 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";
  21412. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21413. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21414. $core.addPackage("Kernel-Infrastructure");
  21415. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  21416. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21417. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21418. $core.addMethod(
  21419. $core.method({
  21420. selector: "initializeClasses",
  21421. protocol: "initialization",
  21422. fn: function (){
  21423. var self=this,$self=this;
  21424. return $core.withContext(function($ctx1) {
  21425. var $1;
  21426. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21427. return $core.withContext(function($ctx2) {
  21428. $1=$recv(each).__eq($globals.SmalltalkImage);
  21429. if(!$core.assert($1)){
  21430. return $recv(each)._initialize();
  21431. }
  21432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21433. }));
  21434. return self;
  21435. }, function($ctx1) {$ctx1.fill(self,"initializeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21436. },
  21437. args: [],
  21438. source: "initializeClasses\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09each = SmalltalkImage ifFalse: [ each initialize ] ]",
  21439. referencedClasses: ["Smalltalk", "SmalltalkImage"],
  21440. messageSends: ["do:", "classes", "ifFalse:", "=", "initialize"]
  21441. }),
  21442. $globals.AmberBootstrapInitialization.a$cls);
  21443. $core.addMethod(
  21444. $core.method({
  21445. selector: "organizeClasses",
  21446. protocol: "organization",
  21447. fn: function (){
  21448. var self=this,$self=this;
  21449. return $core.withContext(function($ctx1) {
  21450. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21451. return $core.withContext(function($ctx2) {
  21452. return $recv(each)._enterOrganization();
  21453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21454. }));
  21455. return self;
  21456. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21457. },
  21458. args: [],
  21459. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21460. referencedClasses: ["Smalltalk"],
  21461. messageSends: ["do:", "classes", "enterOrganization"]
  21462. }),
  21463. $globals.AmberBootstrapInitialization.a$cls);
  21464. $core.addMethod(
  21465. $core.method({
  21466. selector: "organizeMethods",
  21467. protocol: "organization",
  21468. fn: function (){
  21469. var self=this,$self=this;
  21470. return $core.withContext(function($ctx1) {
  21471. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21472. return $core.withContext(function($ctx2) {
  21473. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21474. return $core.withContext(function($ctx3) {
  21475. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21476. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21477. }));
  21478. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21479. }));
  21480. $ctx1.sendIdx["do:"]=1;
  21481. return self;
  21482. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21483. },
  21484. args: [],
  21485. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21486. referencedClasses: ["Smalltalk"],
  21487. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21488. }),
  21489. $globals.AmberBootstrapInitialization.a$cls);
  21490. $core.addMethod(
  21491. $core.method({
  21492. selector: "run",
  21493. protocol: "public api",
  21494. fn: function (){
  21495. var self=this,$self=this;
  21496. return $core.withContext(function($ctx1) {
  21497. $recv($globals.SmalltalkImage)._initialize();
  21498. $recv($globals.Smalltalk)._adoptPackageDictionary();
  21499. $self._organizeClasses();
  21500. $self._organizeMethods();
  21501. $self._initializeClasses();
  21502. return self;
  21503. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21504. },
  21505. args: [],
  21506. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09Smalltalk adoptPackageDictionary.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods;\x0a\x09\x09initializeClasses",
  21507. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21508. messageSends: ["initialize", "adoptPackageDictionary", "organizeClasses", "organizeMethods", "initializeClasses"]
  21509. }),
  21510. $globals.AmberBootstrapInitialization.a$cls);
  21511. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21512. $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`.";
  21513. $core.addMethod(
  21514. $core.method({
  21515. selector: "=",
  21516. protocol: "comparing",
  21517. fn: function (anObject){
  21518. var self=this,$self=this;
  21519. return $core.withContext(function($ctx1) {
  21520. var $2,$1;
  21521. $2=$recv(anObject)._class();
  21522. $ctx1.sendIdx["class"]=1;
  21523. $1=$recv($2).__eq_eq($self._class());
  21524. if(!$core.assert($1)){
  21525. return false;
  21526. }
  21527. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21528. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21529. },
  21530. args: ["anObject"],
  21531. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21532. referencedClasses: ["JSObjectProxy"],
  21533. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21534. }),
  21535. $globals.JSObjectProxy);
  21536. $core.addMethod(
  21537. $core.method({
  21538. selector: "asJavaScriptObject",
  21539. protocol: "converting",
  21540. fn: function (){
  21541. var self=this,$self=this;
  21542. return $self["@jsObject"];
  21543. },
  21544. args: [],
  21545. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21546. referencedClasses: [],
  21547. messageSends: []
  21548. }),
  21549. $globals.JSObjectProxy);
  21550. $core.addMethod(
  21551. $core.method({
  21552. selector: "at:",
  21553. protocol: "accessing",
  21554. fn: function (aString){
  21555. var self=this,$self=this;
  21556. return $core.withContext(function($ctx1) {
  21557. return $self['@jsObject'][aString];
  21558. return self;
  21559. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21560. },
  21561. args: ["aString"],
  21562. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21563. referencedClasses: [],
  21564. messageSends: []
  21565. }),
  21566. $globals.JSObjectProxy);
  21567. $core.addMethod(
  21568. $core.method({
  21569. selector: "at:ifAbsent:",
  21570. protocol: "accessing",
  21571. fn: function (aString,aBlock){
  21572. var self=this,$self=this;
  21573. return $core.withContext(function($ctx1) {
  21574. var obj = $self['@jsObject'];
  21575. return aString in obj ? obj[aString] : aBlock._value();
  21576. ;
  21577. return self;
  21578. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21579. },
  21580. args: ["aString", "aBlock"],
  21581. 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'>",
  21582. referencedClasses: [],
  21583. messageSends: []
  21584. }),
  21585. $globals.JSObjectProxy);
  21586. $core.addMethod(
  21587. $core.method({
  21588. selector: "at:ifPresent:",
  21589. protocol: "accessing",
  21590. fn: function (aString,aBlock){
  21591. var self=this,$self=this;
  21592. return $core.withContext(function($ctx1) {
  21593. var obj = $self['@jsObject'];
  21594. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21595. ;
  21596. return self;
  21597. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21598. },
  21599. args: ["aString", "aBlock"],
  21600. 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'>",
  21601. referencedClasses: [],
  21602. messageSends: []
  21603. }),
  21604. $globals.JSObjectProxy);
  21605. $core.addMethod(
  21606. $core.method({
  21607. selector: "at:ifPresent:ifAbsent:",
  21608. protocol: "accessing",
  21609. fn: function (aString,aBlock,anotherBlock){
  21610. var self=this,$self=this;
  21611. return $core.withContext(function($ctx1) {
  21612. var obj = $self['@jsObject'];
  21613. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21614. ;
  21615. return self;
  21616. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21617. },
  21618. args: ["aString", "aBlock", "anotherBlock"],
  21619. 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'>",
  21620. referencedClasses: [],
  21621. messageSends: []
  21622. }),
  21623. $globals.JSObjectProxy);
  21624. $core.addMethod(
  21625. $core.method({
  21626. selector: "at:put:",
  21627. protocol: "accessing",
  21628. fn: function (aString,anObject){
  21629. var self=this,$self=this;
  21630. return $core.withContext(function($ctx1) {
  21631. return $self['@jsObject'][aString] = anObject;
  21632. return self;
  21633. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21634. },
  21635. args: ["aString", "anObject"],
  21636. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21637. referencedClasses: [],
  21638. messageSends: []
  21639. }),
  21640. $globals.JSObjectProxy);
  21641. $core.addMethod(
  21642. $core.method({
  21643. selector: "catch:",
  21644. protocol: "promises",
  21645. fn: function (aBlock){
  21646. var self=this,$self=this;
  21647. return $core.withContext(function($ctx1) {
  21648. var $1,$2;
  21649. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21650. if($core.assert($1)){
  21651. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21652. } else {
  21653. $2=(
  21654. $ctx1.supercall = true,
  21655. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21656. $ctx1.supercall = false;
  21657. return $2;
  21658. }
  21659. return self;
  21660. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21661. },
  21662. args: ["aBlock"],
  21663. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21664. referencedClasses: ["NativeFunction", "TThenable"],
  21665. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21666. }),
  21667. $globals.JSObjectProxy);
  21668. $core.addMethod(
  21669. $core.method({
  21670. selector: "doesNotUnderstand:",
  21671. protocol: "proxy",
  21672. fn: function (aMessage){
  21673. var self=this,$self=this;
  21674. return $core.withContext(function($ctx1) {
  21675. var $1,$receiver;
  21676. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21677. if(($receiver = $1) == null || $receiver.a$nil){
  21678. return (
  21679. $ctx1.supercall = true,
  21680. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21681. $ctx1.supercall = false;
  21682. } else {
  21683. var jsSelector;
  21684. jsSelector=$receiver;
  21685. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21686. }
  21687. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21688. },
  21689. args: ["aMessage"],
  21690. 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 ]",
  21691. referencedClasses: ["JSObjectProxy"],
  21692. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21693. }),
  21694. $globals.JSObjectProxy);
  21695. $core.addMethod(
  21696. $core.method({
  21697. selector: "in:",
  21698. protocol: "accessing",
  21699. fn: function (aValuable){
  21700. var self=this,$self=this;
  21701. return $core.withContext(function($ctx1) {
  21702. return $recv(aValuable)._value_($self["@jsObject"]);
  21703. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21704. },
  21705. args: ["aValuable"],
  21706. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21707. referencedClasses: [],
  21708. messageSends: ["value:"]
  21709. }),
  21710. $globals.JSObjectProxy);
  21711. $core.addMethod(
  21712. $core.method({
  21713. selector: "jsObject",
  21714. protocol: "accessing",
  21715. fn: function (){
  21716. var self=this,$self=this;
  21717. return $self["@jsObject"];
  21718. },
  21719. args: [],
  21720. source: "jsObject\x0a\x09^ jsObject",
  21721. referencedClasses: [],
  21722. messageSends: []
  21723. }),
  21724. $globals.JSObjectProxy);
  21725. $core.addMethod(
  21726. $core.method({
  21727. selector: "keysAndValuesDo:",
  21728. protocol: "enumerating",
  21729. fn: function (aBlock){
  21730. var self=this,$self=this;
  21731. return $core.withContext(function($ctx1) {
  21732. var o = $self['@jsObject'];
  21733. for(var i in o) {
  21734. aBlock._value_value_(i, o[i]);
  21735. }
  21736. ;
  21737. return self;
  21738. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21739. },
  21740. args: ["aBlock"],
  21741. 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'>",
  21742. referencedClasses: [],
  21743. messageSends: []
  21744. }),
  21745. $globals.JSObjectProxy);
  21746. $core.addMethod(
  21747. $core.method({
  21748. selector: "on:do:",
  21749. protocol: "promises",
  21750. fn: function (aClass,aBlock){
  21751. var self=this,$self=this;
  21752. return $core.withContext(function($ctx1) {
  21753. var $1,$2;
  21754. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21755. if($core.assert($1)){
  21756. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21757. } else {
  21758. $2=(
  21759. $ctx1.supercall = true,
  21760. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21761. $ctx1.supercall = false;
  21762. return $2;
  21763. }
  21764. return self;
  21765. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21766. },
  21767. args: ["aClass", "aBlock"],
  21768. 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 ]",
  21769. referencedClasses: ["NativeFunction", "TThenable"],
  21770. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21771. }),
  21772. $globals.JSObjectProxy);
  21773. $core.addMethod(
  21774. $core.method({
  21775. selector: "printOn:",
  21776. protocol: "printing",
  21777. fn: function (aStream){
  21778. var self=this,$self=this;
  21779. return $core.withContext(function($ctx1) {
  21780. $recv(aStream)._nextPutAll_($self._printString());
  21781. return self;
  21782. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21783. },
  21784. args: ["aStream"],
  21785. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21786. referencedClasses: [],
  21787. messageSends: ["nextPutAll:", "printString"]
  21788. }),
  21789. $globals.JSObjectProxy);
  21790. $core.addMethod(
  21791. $core.method({
  21792. selector: "printString",
  21793. protocol: "printing",
  21794. fn: function (){
  21795. var self=this,$self=this;
  21796. return $core.withContext(function($ctx1) {
  21797. var js = $self['@jsObject'];
  21798. return js.toString
  21799. ? js.toString()
  21800. : Object.prototype.toString.call(js)
  21801. ;
  21802. return self;
  21803. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21804. },
  21805. args: [],
  21806. 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'>",
  21807. referencedClasses: [],
  21808. messageSends: []
  21809. }),
  21810. $globals.JSObjectProxy);
  21811. $core.addMethod(
  21812. $core.method({
  21813. selector: "putOn:",
  21814. protocol: "streaming",
  21815. fn: function (aStream){
  21816. var self=this,$self=this;
  21817. return $core.withContext(function($ctx1) {
  21818. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21819. return self;
  21820. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21821. },
  21822. args: ["aStream"],
  21823. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21824. referencedClasses: [],
  21825. messageSends: ["nextPutJSObject:"]
  21826. }),
  21827. $globals.JSObjectProxy);
  21828. $core.addMethod(
  21829. $core.method({
  21830. selector: "then:",
  21831. protocol: "promises",
  21832. fn: function (aBlockOrArray){
  21833. var self=this,$self=this;
  21834. return $core.withContext(function($ctx1) {
  21835. var $1,$2;
  21836. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21837. if($core.assert($1)){
  21838. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21839. } else {
  21840. $2=(
  21841. $ctx1.supercall = true,
  21842. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21843. $ctx1.supercall = false;
  21844. return $2;
  21845. }
  21846. return self;
  21847. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21848. },
  21849. args: ["aBlockOrArray"],
  21850. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21851. referencedClasses: ["NativeFunction", "TThenable"],
  21852. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21853. }),
  21854. $globals.JSObjectProxy);
  21855. $core.addMethod(
  21856. $core.method({
  21857. selector: "addObjectVariablesTo:ofProxy:",
  21858. protocol: "proxy",
  21859. fn: function (aDictionary,aProxy){
  21860. var self=this,$self=this;
  21861. return $core.withContext(function($ctx1) {
  21862. var jsObject = aProxy['@jsObject'];
  21863. for(var i in jsObject) {
  21864. aDictionary._at_put_(i, jsObject[i]);
  21865. }
  21866. ;
  21867. return self;
  21868. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21869. },
  21870. args: ["aDictionary", "aProxy"],
  21871. 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'>",
  21872. referencedClasses: [],
  21873. messageSends: []
  21874. }),
  21875. $globals.JSObjectProxy.a$cls);
  21876. $core.addMethod(
  21877. $core.method({
  21878. selector: "compareJSObjectOfProxy:withProxy:",
  21879. protocol: "proxy",
  21880. fn: function (aProxy,anotherProxy){
  21881. var self=this,$self=this;
  21882. return $core.withContext(function($ctx1) {
  21883. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21884. return aProxy["@jsObject"] === anotherJSObject;
  21885. return self;
  21886. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21887. },
  21888. args: ["aProxy", "anotherProxy"],
  21889. 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'>",
  21890. referencedClasses: [],
  21891. messageSends: []
  21892. }),
  21893. $globals.JSObjectProxy.a$cls);
  21894. $core.addMethod(
  21895. $core.method({
  21896. selector: "forwardMessage:withArguments:ofProxy:",
  21897. protocol: "proxy",
  21898. fn: function (aString,anArray,aProxy){
  21899. var self=this,$self=this;
  21900. return $core.withContext(function($ctx1) {
  21901. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21902. ;
  21903. return self;
  21904. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21905. },
  21906. args: ["aString", "anArray", "aProxy"],
  21907. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21908. referencedClasses: [],
  21909. messageSends: []
  21910. }),
  21911. $globals.JSObjectProxy.a$cls);
  21912. $core.addMethod(
  21913. $core.method({
  21914. selector: "jsObject:ofProxy:",
  21915. protocol: "proxy",
  21916. fn: function (aJSObject,aProxy){
  21917. var self=this,$self=this;
  21918. return $core.withContext(function($ctx1) {
  21919. aProxy['@jsObject'] = aJSObject;
  21920. return self;
  21921. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21922. },
  21923. args: ["aJSObject", "aProxy"],
  21924. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21925. referencedClasses: [],
  21926. messageSends: []
  21927. }),
  21928. $globals.JSObjectProxy.a$cls);
  21929. $core.addMethod(
  21930. $core.method({
  21931. selector: "lookupProperty:ofProxy:",
  21932. protocol: "proxy",
  21933. fn: function (aString,aProxy){
  21934. var self=this,$self=this;
  21935. return $core.withContext(function($ctx1) {
  21936. return aString in aProxy._jsObject() ? aString : nil;
  21937. return self;
  21938. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21939. },
  21940. args: ["aString", "aProxy"],
  21941. 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'>",
  21942. referencedClasses: [],
  21943. messageSends: []
  21944. }),
  21945. $globals.JSObjectProxy.a$cls);
  21946. $core.addMethod(
  21947. $core.method({
  21948. selector: "on:",
  21949. protocol: "instance creation",
  21950. fn: function (aJSObject){
  21951. var self=this,$self=this;
  21952. var instance;
  21953. return $core.withContext(function($ctx1) {
  21954. instance=$self._new();
  21955. $self._jsObject_ofProxy_(aJSObject,instance);
  21956. return instance;
  21957. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21958. },
  21959. args: ["aJSObject"],
  21960. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21961. referencedClasses: [],
  21962. messageSends: ["new", "jsObject:ofProxy:"]
  21963. }),
  21964. $globals.JSObjectProxy.a$cls);
  21965. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21966. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21967. $core.addMethod(
  21968. $core.method({
  21969. selector: "addElement:",
  21970. protocol: "accessing",
  21971. fn: function (anObject){
  21972. var self=this,$self=this;
  21973. return $core.withContext(function($ctx1) {
  21974. $recv($self._elements())._add_(anObject);
  21975. return self;
  21976. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21977. },
  21978. args: ["anObject"],
  21979. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21980. referencedClasses: [],
  21981. messageSends: ["add:", "elements"]
  21982. }),
  21983. $globals.Organizer);
  21984. $core.addMethod(
  21985. $core.method({
  21986. selector: "elements",
  21987. protocol: "accessing",
  21988. fn: function (){
  21989. var self=this,$self=this;
  21990. return $self["@elements"];
  21991. },
  21992. args: [],
  21993. source: "elements\x0a\x09^ elements",
  21994. referencedClasses: [],
  21995. messageSends: []
  21996. }),
  21997. $globals.Organizer);
  21998. $core.addMethod(
  21999. $core.method({
  22000. selector: "initialize",
  22001. protocol: "initialization",
  22002. fn: function (){
  22003. var self=this,$self=this;
  22004. return $core.withContext(function($ctx1) {
  22005. (
  22006. $ctx1.supercall = true,
  22007. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22008. $ctx1.supercall = false;
  22009. $self["@elements"]=$recv($globals.Set)._new();
  22010. return self;
  22011. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  22012. },
  22013. args: [],
  22014. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  22015. referencedClasses: ["Set"],
  22016. messageSends: ["initialize", "new"]
  22017. }),
  22018. $globals.Organizer);
  22019. $core.addMethod(
  22020. $core.method({
  22021. selector: "removeElement:",
  22022. protocol: "accessing",
  22023. fn: function (anObject){
  22024. var self=this,$self=this;
  22025. return $core.withContext(function($ctx1) {
  22026. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  22027. }));
  22028. return self;
  22029. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  22030. },
  22031. args: ["anObject"],
  22032. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  22033. referencedClasses: [],
  22034. messageSends: ["remove:ifAbsent:", "elements"]
  22035. }),
  22036. $globals.Organizer);
  22037. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  22038. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  22039. $core.addMethod(
  22040. $core.method({
  22041. selector: "addElement:",
  22042. protocol: "accessing",
  22043. fn: function (aString){
  22044. var self=this,$self=this;
  22045. return $core.withContext(function($ctx1) {
  22046. var $1,$3,$2;
  22047. (
  22048. $ctx1.supercall = true,
  22049. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  22050. $ctx1.supercall = false;
  22051. $1=$recv($globals.SystemAnnouncer)._current();
  22052. $3=$recv($globals.ProtocolAdded)._new();
  22053. $recv($3)._protocol_(aString);
  22054. $recv($3)._theClass_($self._theClass());
  22055. $2=$recv($3)._yourself();
  22056. $recv($1)._announce_($2);
  22057. return self;
  22058. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  22059. },
  22060. args: ["aString"],
  22061. 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)",
  22062. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  22063. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22064. }),
  22065. $globals.ClassOrganizer);
  22066. $core.addMethod(
  22067. $core.method({
  22068. selector: "removeElement:",
  22069. protocol: "accessing",
  22070. fn: function (aString){
  22071. var self=this,$self=this;
  22072. return $core.withContext(function($ctx1) {
  22073. var $1,$3,$2;
  22074. (
  22075. $ctx1.supercall = true,
  22076. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  22077. $ctx1.supercall = false;
  22078. $1=$recv($globals.SystemAnnouncer)._current();
  22079. $3=$recv($globals.ProtocolRemoved)._new();
  22080. $recv($3)._protocol_(aString);
  22081. $recv($3)._theClass_($self._theClass());
  22082. $2=$recv($3)._yourself();
  22083. $recv($1)._announce_($2);
  22084. return self;
  22085. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  22086. },
  22087. args: ["aString"],
  22088. 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)",
  22089. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  22090. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22091. }),
  22092. $globals.ClassOrganizer);
  22093. $core.addMethod(
  22094. $core.method({
  22095. selector: "theClass",
  22096. protocol: "accessing",
  22097. fn: function (){
  22098. var self=this,$self=this;
  22099. return $self["@traitOrBehavior"];
  22100. },
  22101. args: [],
  22102. source: "theClass\x0a\x09^ traitOrBehavior",
  22103. referencedClasses: [],
  22104. messageSends: []
  22105. }),
  22106. $globals.ClassOrganizer);
  22107. $core.addMethod(
  22108. $core.method({
  22109. selector: "theClass:",
  22110. protocol: "accessing",
  22111. fn: function (aClass){
  22112. var self=this,$self=this;
  22113. $self["@traitOrBehavior"]=aClass;
  22114. return self;
  22115. },
  22116. args: ["aClass"],
  22117. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22118. referencedClasses: [],
  22119. messageSends: []
  22120. }),
  22121. $globals.ClassOrganizer);
  22122. $core.addMethod(
  22123. $core.method({
  22124. selector: "on:",
  22125. protocol: "instance creation",
  22126. fn: function (aClass){
  22127. var self=this,$self=this;
  22128. return $core.withContext(function($ctx1) {
  22129. var $1;
  22130. $1=$self._new();
  22131. $recv($1)._theClass_(aClass);
  22132. return $recv($1)._yourself();
  22133. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22134. },
  22135. args: ["aClass"],
  22136. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22137. referencedClasses: [],
  22138. messageSends: ["theClass:", "new", "yourself"]
  22139. }),
  22140. $globals.ClassOrganizer.a$cls);
  22141. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22142. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22143. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  22144. $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'";
  22145. $core.addMethod(
  22146. $core.method({
  22147. selector: "basicTransport",
  22148. protocol: "private",
  22149. fn: function (){
  22150. var self=this,$self=this;
  22151. return $self["@basicTransport"];
  22152. },
  22153. args: [],
  22154. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22155. referencedClasses: [],
  22156. messageSends: []
  22157. }),
  22158. $globals.Package);
  22159. $core.addMethod(
  22160. $core.method({
  22161. selector: "beClean",
  22162. protocol: "accessing",
  22163. fn: function (){
  22164. var self=this,$self=this;
  22165. return $core.withContext(function($ctx1) {
  22166. var $1,$3,$2;
  22167. $self["@dirty"]=false;
  22168. $1=$recv($globals.SystemAnnouncer)._current();
  22169. $3=$recv($globals.PackageClean)._new();
  22170. $recv($3)._package_(self);
  22171. $2=$recv($3)._yourself();
  22172. $recv($1)._announce_($2);
  22173. return self;
  22174. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22175. },
  22176. args: [],
  22177. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22178. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22179. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22180. }),
  22181. $globals.Package);
  22182. $core.addMethod(
  22183. $core.method({
  22184. selector: "beDirty",
  22185. protocol: "accessing",
  22186. fn: function (){
  22187. var self=this,$self=this;
  22188. return $core.withContext(function($ctx1) {
  22189. var $1,$3,$2;
  22190. $self["@dirty"]=true;
  22191. $1=$recv($globals.SystemAnnouncer)._current();
  22192. $3=$recv($globals.PackageDirty)._new();
  22193. $recv($3)._package_(self);
  22194. $2=$recv($3)._yourself();
  22195. $recv($1)._announce_($2);
  22196. return self;
  22197. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22198. },
  22199. args: [],
  22200. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22201. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22202. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22203. }),
  22204. $globals.Package);
  22205. $core.addMethod(
  22206. $core.method({
  22207. selector: "classTemplate",
  22208. protocol: "accessing",
  22209. fn: function (){
  22210. var self=this,$self=this;
  22211. return $core.withContext(function($ctx1) {
  22212. return $recv($globals.String)._streamContents_((function(stream){
  22213. return $core.withContext(function($ctx2) {
  22214. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22215. $ctx2.sendIdx["write:"]=1;
  22216. $recv(stream)._lf();
  22217. $ctx2.sendIdx["lf"]=1;
  22218. $recv(stream)._tab();
  22219. $ctx2.sendIdx["tab"]=1;
  22220. $recv(stream)._write_("instanceVariableNames: ''");
  22221. $ctx2.sendIdx["write:"]=2;
  22222. $recv(stream)._lf();
  22223. $recv(stream)._tab();
  22224. $recv(stream)._write_("package: ");
  22225. return $recv(stream)._print_($self._name());
  22226. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22227. }));
  22228. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22229. },
  22230. args: [],
  22231. 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 ]",
  22232. referencedClasses: ["String"],
  22233. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22234. }),
  22235. $globals.Package);
  22236. $core.addMethod(
  22237. $core.method({
  22238. selector: "classes",
  22239. protocol: "classes",
  22240. fn: function (){
  22241. var self=this,$self=this;
  22242. return $core.withContext(function($ctx1) {
  22243. return $recv($recv($self._organization())._elements())._copy();
  22244. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22245. },
  22246. args: [],
  22247. source: "classes\x0a\x09^ self organization elements copy",
  22248. referencedClasses: [],
  22249. messageSends: ["copy", "elements", "organization"]
  22250. }),
  22251. $globals.Package);
  22252. $core.addMethod(
  22253. $core.method({
  22254. selector: "definition",
  22255. protocol: "accessing",
  22256. fn: function (){
  22257. var self=this,$self=this;
  22258. return $core.withContext(function($ctx1) {
  22259. var $1;
  22260. return $recv($globals.String)._streamContents_((function(stream){
  22261. return $core.withContext(function($ctx2) {
  22262. $1=$recv($self._class())._name();
  22263. $ctx2.sendIdx["name"]=1;
  22264. $recv(stream)._write_($1);
  22265. $ctx2.sendIdx["write:"]=1;
  22266. $recv(stream)._lf();
  22267. $ctx2.sendIdx["lf"]=1;
  22268. $recv(stream)._tab();
  22269. $ctx2.sendIdx["tab"]=1;
  22270. $recv(stream)._write_("named: ");
  22271. $ctx2.sendIdx["write:"]=2;
  22272. $recv(stream)._print_($self._name());
  22273. $recv(stream)._lf();
  22274. $ctx2.sendIdx["lf"]=2;
  22275. $recv(stream)._tab();
  22276. $ctx2.sendIdx["tab"]=2;
  22277. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22278. $ctx2.sendIdx["write:"]=3;
  22279. $recv(stream)._lf();
  22280. $recv(stream)._tab();
  22281. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22282. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22283. }));
  22284. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22285. },
  22286. args: [],
  22287. 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. ')' } ]",
  22288. referencedClasses: ["String"],
  22289. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22290. }),
  22291. $globals.Package);
  22292. $core.addMethod(
  22293. $core.method({
  22294. selector: "eval:",
  22295. protocol: "evaluating",
  22296. fn: function (aString){
  22297. var self=this,$self=this;
  22298. return $core.withContext(function($ctx1) {
  22299. var $1,$receiver;
  22300. $1=$self["@evalBlock"];
  22301. if(($receiver = $1) == null || $receiver.a$nil){
  22302. return $recv($globals.Compiler)._eval_(aString);
  22303. } else {
  22304. return $recv($self["@evalBlock"])._value_(aString);
  22305. }
  22306. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22307. },
  22308. args: ["aString"],
  22309. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22310. referencedClasses: ["Compiler"],
  22311. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22312. }),
  22313. $globals.Package);
  22314. $core.addMethod(
  22315. $core.method({
  22316. selector: "evalBlock",
  22317. protocol: "accessing",
  22318. fn: function (){
  22319. var self=this,$self=this;
  22320. return $self["@evalBlock"];
  22321. },
  22322. args: [],
  22323. source: "evalBlock\x0a\x09^ evalBlock",
  22324. referencedClasses: [],
  22325. messageSends: []
  22326. }),
  22327. $globals.Package);
  22328. $core.addMethod(
  22329. $core.method({
  22330. selector: "evalBlock:",
  22331. protocol: "accessing",
  22332. fn: function (aBlock){
  22333. var self=this,$self=this;
  22334. $self["@evalBlock"]=aBlock;
  22335. return self;
  22336. },
  22337. args: ["aBlock"],
  22338. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22339. referencedClasses: [],
  22340. messageSends: []
  22341. }),
  22342. $globals.Package);
  22343. $core.addMethod(
  22344. $core.method({
  22345. selector: "imports",
  22346. protocol: "accessing",
  22347. fn: function (){
  22348. var self=this,$self=this;
  22349. return $core.withContext(function($ctx1) {
  22350. var $1,$receiver;
  22351. $1=$self["@imports"];
  22352. if(($receiver = $1) == null || $receiver.a$nil){
  22353. $self._imports_([]);
  22354. return $self["@imports"];
  22355. } else {
  22356. return $1;
  22357. }
  22358. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22359. },
  22360. args: [],
  22361. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22362. referencedClasses: [],
  22363. messageSends: ["ifNil:", "imports:"]
  22364. }),
  22365. $globals.Package);
  22366. $core.addMethod(
  22367. $core.method({
  22368. selector: "imports:",
  22369. protocol: "accessing",
  22370. fn: function (anArray){
  22371. var self=this,$self=this;
  22372. return $core.withContext(function($ctx1) {
  22373. $self._validateImports_(anArray);
  22374. $self["@imports"]=$recv(anArray)._asSet();
  22375. return self;
  22376. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22377. },
  22378. args: ["anArray"],
  22379. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22380. referencedClasses: [],
  22381. messageSends: ["validateImports:", "asSet"]
  22382. }),
  22383. $globals.Package);
  22384. $core.addMethod(
  22385. $core.method({
  22386. selector: "importsAsJson",
  22387. protocol: "converting",
  22388. fn: function (){
  22389. var self=this,$self=this;
  22390. return $core.withContext(function($ctx1) {
  22391. var $1;
  22392. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22393. return $core.withContext(function($ctx2) {
  22394. $1=$recv(each)._isString();
  22395. if($core.assert($1)){
  22396. return each;
  22397. } else {
  22398. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22399. $ctx2.sendIdx[","]=1;
  22400. }
  22401. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22402. }));
  22403. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22404. },
  22405. args: [],
  22406. 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 ]]",
  22407. referencedClasses: [],
  22408. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22409. }),
  22410. $globals.Package);
  22411. $core.addMethod(
  22412. $core.method({
  22413. selector: "importsDefinition",
  22414. protocol: "accessing",
  22415. fn: function (){
  22416. var self=this,$self=this;
  22417. return $core.withContext(function($ctx1) {
  22418. return $recv($globals.String)._streamContents_((function(stream){
  22419. return $core.withContext(function($ctx2) {
  22420. $recv(stream)._write_("{");
  22421. $ctx2.sendIdx["write:"]=1;
  22422. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22423. return $core.withContext(function($ctx3) {
  22424. return $recv(stream)._print_(each);
  22425. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22426. }),(function(){
  22427. return $core.withContext(function($ctx3) {
  22428. return $recv(stream)._write_(". ");
  22429. $ctx3.sendIdx["write:"]=2;
  22430. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22431. }));
  22432. return $recv(stream)._write_("}");
  22433. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22434. }));
  22435. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22436. },
  22437. args: [],
  22438. 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: '}' ]",
  22439. referencedClasses: ["String"],
  22440. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22441. }),
  22442. $globals.Package);
  22443. $core.addMethod(
  22444. $core.method({
  22445. selector: "importsFromJson:",
  22446. protocol: "converting",
  22447. fn: function (anArray){
  22448. var self=this,$self=this;
  22449. return $core.withContext(function($ctx1) {
  22450. var $1;
  22451. return $recv(anArray)._collect_((function(each){
  22452. var split;
  22453. return $core.withContext(function($ctx2) {
  22454. split=$recv(each)._tokenize_("=");
  22455. split;
  22456. $1=$recv($recv(split)._size()).__eq((1));
  22457. if($core.assert($1)){
  22458. return $recv(split)._first();
  22459. $ctx2.sendIdx["first"]=1;
  22460. } else {
  22461. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22462. }
  22463. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22464. }));
  22465. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22466. },
  22467. args: ["anArray"],
  22468. 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 ]]",
  22469. referencedClasses: [],
  22470. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22471. }),
  22472. $globals.Package);
  22473. $core.addMethod(
  22474. $core.method({
  22475. selector: "initialize",
  22476. protocol: "initialization",
  22477. fn: function (){
  22478. var self=this,$self=this;
  22479. return $core.withContext(function($ctx1) {
  22480. (
  22481. $ctx1.supercall = true,
  22482. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22483. $ctx1.supercall = false;
  22484. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22485. $self["@evalBlock"]=nil;
  22486. $self["@dirty"]=nil;
  22487. $self["@imports"]=nil;
  22488. $self["@transport"]=nil;
  22489. return self;
  22490. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22491. },
  22492. args: [],
  22493. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  22494. referencedClasses: ["PackageOrganizer"],
  22495. messageSends: ["initialize", "new"]
  22496. }),
  22497. $globals.Package);
  22498. $core.addMethod(
  22499. $core.method({
  22500. selector: "isDirty",
  22501. protocol: "testing",
  22502. fn: function (){
  22503. var self=this,$self=this;
  22504. return $core.withContext(function($ctx1) {
  22505. var $1,$receiver;
  22506. $1=$self["@dirty"];
  22507. if(($receiver = $1) == null || $receiver.a$nil){
  22508. return false;
  22509. } else {
  22510. return $1;
  22511. }
  22512. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22513. },
  22514. args: [],
  22515. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22516. referencedClasses: [],
  22517. messageSends: ["ifNil:"]
  22518. }),
  22519. $globals.Package);
  22520. $core.addMethod(
  22521. $core.method({
  22522. selector: "isPackage",
  22523. protocol: "testing",
  22524. fn: function (){
  22525. var self=this,$self=this;
  22526. return true;
  22527. },
  22528. args: [],
  22529. source: "isPackage\x0a\x09^ true",
  22530. referencedClasses: [],
  22531. messageSends: []
  22532. }),
  22533. $globals.Package);
  22534. $core.addMethod(
  22535. $core.method({
  22536. selector: "javaScriptDescriptor:",
  22537. protocol: "accessing",
  22538. fn: function (anObject){
  22539. var self=this,$self=this;
  22540. var basicEval,basicImports;
  22541. return $core.withContext(function($ctx1) {
  22542. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22543. return $core.withContext(function($ctx2) {
  22544. return nil._asJavaScriptObject();
  22545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22546. }));
  22547. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22548. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22549. return [];
  22550. }));
  22551. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22552. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22553. }));
  22554. $self._evalBlock_(basicEval);
  22555. $self._imports_($self._importsFromJson_(basicImports));
  22556. return self;
  22557. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22558. },
  22559. args: ["anObject"],
  22560. 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)",
  22561. referencedClasses: [],
  22562. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  22563. }),
  22564. $globals.Package);
  22565. $core.addMethod(
  22566. $core.method({
  22567. selector: "loadDependencies",
  22568. protocol: "dependencies",
  22569. fn: function (){
  22570. var self=this,$self=this;
  22571. var classes,packages;
  22572. return $core.withContext(function($ctx1) {
  22573. var $1;
  22574. classes=$self._loadDependencyClasses();
  22575. $1=$recv($recv(classes)._collect_((function(each){
  22576. return $core.withContext(function($ctx2) {
  22577. return $recv(each)._package();
  22578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22579. })))._asSet();
  22580. $recv($1)._remove_ifAbsent_(self,(function(){
  22581. }));
  22582. return $recv($1)._yourself();
  22583. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22584. },
  22585. args: [],
  22586. 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",
  22587. referencedClasses: [],
  22588. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22589. }),
  22590. $globals.Package);
  22591. $core.addMethod(
  22592. $core.method({
  22593. selector: "loadDependencyClasses",
  22594. protocol: "dependencies",
  22595. fn: function (){
  22596. var self=this,$self=this;
  22597. var starCategoryName;
  22598. return $core.withContext(function($ctx1) {
  22599. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22600. starCategoryName="*".__comma($self._name());
  22601. $ctx1.sendIdx[","]=1;
  22602. $3=$self._classes();
  22603. $ctx1.sendIdx["classes"]=1;
  22604. $2=$recv($3)._collect_((function(each){
  22605. return $core.withContext(function($ctx2) {
  22606. return $recv(each)._superclass();
  22607. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22608. }));
  22609. $ctx1.sendIdx["collect:"]=1;
  22610. $1=$recv($2)._asSet();
  22611. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22612. return $core.withContext(function($ctx2) {
  22613. $5=$recv(each)._protocols();
  22614. $ctx2.sendIdx["protocols"]=1;
  22615. $7=$recv(each)._theMetaClass();
  22616. if(($receiver = $7) == null || $receiver.a$nil){
  22617. $6=[];
  22618. } else {
  22619. var meta;
  22620. meta=$receiver;
  22621. $6=$recv(meta)._protocols();
  22622. }
  22623. $4=$recv($5).__comma($6);
  22624. return $recv($4)._includes_(starCategoryName);
  22625. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22626. })));
  22627. $ctx1.sendIdx["addAll:"]=1;
  22628. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22629. return $core.withContext(function($ctx2) {
  22630. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22631. return $core.withContext(function($ctx3) {
  22632. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22633. return $core.withContext(function($ctx4) {
  22634. return $recv(eachTT)._trait();
  22635. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22636. })));
  22637. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22638. }));
  22639. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22640. })));
  22641. $recv($1)._remove_ifAbsent_(nil,(function(){
  22642. }));
  22643. return $recv($1)._yourself();
  22644. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22645. },
  22646. args: [],
  22647. 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",
  22648. referencedClasses: ["Smalltalk", "Array"],
  22649. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22650. }),
  22651. $globals.Package);
  22652. $core.addMethod(
  22653. $core.method({
  22654. selector: "name",
  22655. protocol: "accessing",
  22656. fn: function (){
  22657. var self=this,$self=this;
  22658. return $self["@name"];
  22659. },
  22660. args: [],
  22661. source: "name\x0a\x09^ name",
  22662. referencedClasses: [],
  22663. messageSends: []
  22664. }),
  22665. $globals.Package);
  22666. $core.addMethod(
  22667. $core.method({
  22668. selector: "name:",
  22669. protocol: "accessing",
  22670. fn: function (aString){
  22671. var self=this,$self=this;
  22672. $self["@name"]=aString;
  22673. return self;
  22674. },
  22675. args: ["aString"],
  22676. source: "name: aString\x0a\x09name := aString",
  22677. referencedClasses: [],
  22678. messageSends: []
  22679. }),
  22680. $globals.Package);
  22681. $core.addMethod(
  22682. $core.method({
  22683. selector: "organization",
  22684. protocol: "accessing",
  22685. fn: function (){
  22686. var self=this,$self=this;
  22687. return $self["@organization"];
  22688. },
  22689. args: [],
  22690. source: "organization\x0a\x09^ organization",
  22691. referencedClasses: [],
  22692. messageSends: []
  22693. }),
  22694. $globals.Package);
  22695. $core.addMethod(
  22696. $core.method({
  22697. selector: "printOn:",
  22698. protocol: "printing",
  22699. fn: function (aStream){
  22700. var self=this,$self=this;
  22701. return $core.withContext(function($ctx1) {
  22702. (
  22703. $ctx1.supercall = true,
  22704. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22705. $ctx1.supercall = false;
  22706. $recv(aStream)._nextPutAll_(" (");
  22707. $ctx1.sendIdx["nextPutAll:"]=1;
  22708. $recv(aStream)._nextPutAll_($self._name());
  22709. $ctx1.sendIdx["nextPutAll:"]=2;
  22710. $recv(aStream)._nextPutAll_(")");
  22711. return self;
  22712. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22713. },
  22714. args: ["aStream"],
  22715. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22716. referencedClasses: [],
  22717. messageSends: ["printOn:", "nextPutAll:", "name"]
  22718. }),
  22719. $globals.Package);
  22720. $core.addMethod(
  22721. $core.method({
  22722. selector: "setupClasses",
  22723. protocol: "classes",
  22724. fn: function (){
  22725. var self=this,$self=this;
  22726. return $core.withContext(function($ctx1) {
  22727. $recv($self._classes())._do_((function(each){
  22728. return $core.withContext(function($ctx2) {
  22729. return $recv(each)._initialize();
  22730. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22731. }));
  22732. return self;
  22733. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22734. },
  22735. args: [],
  22736. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22737. referencedClasses: [],
  22738. messageSends: ["do:", "classes", "initialize"]
  22739. }),
  22740. $globals.Package);
  22741. $core.addMethod(
  22742. $core.method({
  22743. selector: "sortedClasses",
  22744. protocol: "classes",
  22745. fn: function (){
  22746. var self=this,$self=this;
  22747. return $core.withContext(function($ctx1) {
  22748. return $recv($self._class())._sortedClasses_($self._classes());
  22749. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22750. },
  22751. args: [],
  22752. 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",
  22753. referencedClasses: [],
  22754. messageSends: ["sortedClasses:", "class", "classes"]
  22755. }),
  22756. $globals.Package);
  22757. $core.addMethod(
  22758. $core.method({
  22759. selector: "sortedImportsAsArray",
  22760. protocol: "private",
  22761. fn: function (){
  22762. var self=this,$self=this;
  22763. return $core.withContext(function($ctx1) {
  22764. var $3,$2,$4,$1,$6,$5,$7;
  22765. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22766. return $core.withContext(function($ctx2) {
  22767. $3=$recv(a)._isString();
  22768. $ctx2.sendIdx["isString"]=1;
  22769. $2=$recv($3)._not();
  22770. $4=$recv(b)._isString();
  22771. $ctx2.sendIdx["isString"]=2;
  22772. $1=$recv($2).__and($4);
  22773. return $recv($1)._or_((function(){
  22774. return $core.withContext(function($ctx3) {
  22775. $6=$recv(a)._isString();
  22776. $ctx3.sendIdx["isString"]=3;
  22777. $5=$recv($6).__eq($recv(b)._isString());
  22778. return $recv($5)._and_((function(){
  22779. return $core.withContext(function($ctx4) {
  22780. $7=$recv(a)._value();
  22781. $ctx4.sendIdx["value"]=1;
  22782. return $recv($7).__lt_eq($recv(b)._value());
  22783. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22784. }));
  22785. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22786. }));
  22787. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22788. }));
  22789. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22790. },
  22791. args: [],
  22792. 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 ]]]",
  22793. referencedClasses: [],
  22794. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22795. }),
  22796. $globals.Package);
  22797. $core.addMethod(
  22798. $core.method({
  22799. selector: "traitCompositions",
  22800. protocol: "dependencies",
  22801. fn: function (){
  22802. var self=this,$self=this;
  22803. var traitCompositions;
  22804. return $core.withContext(function($ctx1) {
  22805. var $1,$2,$3,$receiver;
  22806. traitCompositions=$recv($globals.Dictionary)._new();
  22807. $recv($self._classes())._do_((function(each){
  22808. return $core.withContext(function($ctx2) {
  22809. $1=traitCompositions;
  22810. $2=$recv(each)._traitComposition();
  22811. $ctx2.sendIdx["traitComposition"]=1;
  22812. $recv($1)._at_put_(each,$2);
  22813. $ctx2.sendIdx["at:put:"]=1;
  22814. $3=$recv(each)._theMetaClass();
  22815. if(($receiver = $3) == null || $receiver.a$nil){
  22816. return $3;
  22817. } else {
  22818. var meta;
  22819. meta=$receiver;
  22820. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22821. }
  22822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22823. }));
  22824. return $recv(traitCompositions)._reject_((function(each){
  22825. return $core.withContext(function($ctx2) {
  22826. return $recv(each)._isEmpty();
  22827. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22828. }));
  22829. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22830. },
  22831. args: [],
  22832. 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 ]",
  22833. referencedClasses: ["Dictionary"],
  22834. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22835. }),
  22836. $globals.Package);
  22837. $core.addMethod(
  22838. $core.method({
  22839. selector: "transport",
  22840. protocol: "accessing",
  22841. fn: function (){
  22842. var self=this,$self=this;
  22843. return $core.withContext(function($ctx1) {
  22844. var $1,$receiver;
  22845. $1=$self["@transport"];
  22846. if(($receiver = $1) == null || $receiver.a$nil){
  22847. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22848. return $self["@transport"];
  22849. } else {
  22850. return $1;
  22851. }
  22852. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22853. },
  22854. args: [],
  22855. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22856. referencedClasses: ["PackageTransport"],
  22857. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22858. }),
  22859. $globals.Package);
  22860. $core.addMethod(
  22861. $core.method({
  22862. selector: "transport:",
  22863. protocol: "accessing",
  22864. fn: function (aPackageTransport){
  22865. var self=this,$self=this;
  22866. return $core.withContext(function($ctx1) {
  22867. $self["@transport"]=aPackageTransport;
  22868. $recv(aPackageTransport)._package_(self);
  22869. return self;
  22870. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22871. },
  22872. args: ["aPackageTransport"],
  22873. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22874. referencedClasses: [],
  22875. messageSends: ["package:"]
  22876. }),
  22877. $globals.Package);
  22878. $core.addMethod(
  22879. $core.method({
  22880. selector: "validateImports:",
  22881. protocol: "validation",
  22882. fn: function (aCollection){
  22883. var self=this,$self=this;
  22884. return $core.withContext(function($ctx1) {
  22885. var $1,$2,$5,$4,$3,$6;
  22886. $recv(aCollection)._do_((function(import_){
  22887. return $core.withContext(function($ctx2) {
  22888. $1=$recv(import_)._isString();
  22889. $ctx2.sendIdx["isString"]=1;
  22890. if(!$core.assert($1)){
  22891. $2=$recv(import_)._respondsTo_("key");
  22892. if(!$core.assert($2)){
  22893. $self._error_("Imports must be Strings or Associations");
  22894. $ctx2.sendIdx["error:"]=1;
  22895. }
  22896. $5=$recv(import_)._key();
  22897. $ctx2.sendIdx["key"]=1;
  22898. $4=$recv($5)._isString();
  22899. $ctx2.sendIdx["isString"]=2;
  22900. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22901. if(!$core.assert($3)){
  22902. $self._error_("Key and value must be Strings");
  22903. $ctx2.sendIdx["error:"]=2;
  22904. }
  22905. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22906. if(!$core.assert($6)){
  22907. return $self._error_("Keys must be identifiers");
  22908. }
  22909. }
  22910. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22911. }));
  22912. return self;
  22913. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22914. },
  22915. args: ["aCollection"],
  22916. 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' ]]]",
  22917. referencedClasses: [],
  22918. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22919. }),
  22920. $globals.Package);
  22921. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22922. $core.addMethod(
  22923. $core.method({
  22924. selector: "named:",
  22925. protocol: "accessing",
  22926. fn: function (aPackageName){
  22927. var self=this,$self=this;
  22928. return $core.withContext(function($ctx1) {
  22929. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22930. return $core.withContext(function($ctx2) {
  22931. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22933. }));
  22934. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22935. },
  22936. args: ["aPackageName"],
  22937. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22938. referencedClasses: ["Smalltalk"],
  22939. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22940. }),
  22941. $globals.Package.a$cls);
  22942. $core.addMethod(
  22943. $core.method({
  22944. selector: "named:ifAbsent:",
  22945. protocol: "accessing",
  22946. fn: function (aPackageName,aBlock){
  22947. var self=this,$self=this;
  22948. return $core.withContext(function($ctx1) {
  22949. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22950. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22951. },
  22952. args: ["aPackageName", "aBlock"],
  22953. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22954. referencedClasses: ["Smalltalk"],
  22955. messageSends: ["packageAt:ifAbsent:"]
  22956. }),
  22957. $globals.Package.a$cls);
  22958. $core.addMethod(
  22959. $core.method({
  22960. selector: "named:imports:transport:",
  22961. protocol: "accessing",
  22962. fn: function (aPackageName,anArray,aTransport){
  22963. var self=this,$self=this;
  22964. var pkg;
  22965. return $core.withContext(function($ctx1) {
  22966. pkg=$self._named_(aPackageName);
  22967. $recv(pkg)._imports_(anArray);
  22968. $recv(pkg)._transport_(aTransport);
  22969. return pkg;
  22970. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22971. },
  22972. args: ["aPackageName", "anArray", "aTransport"],
  22973. 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",
  22974. referencedClasses: [],
  22975. messageSends: ["named:", "imports:", "transport:"]
  22976. }),
  22977. $globals.Package.a$cls);
  22978. $core.addMethod(
  22979. $core.method({
  22980. selector: "named:javaScriptDescriptor:",
  22981. protocol: "instance creation",
  22982. fn: function (aString,anObject){
  22983. var self=this,$self=this;
  22984. var pkg;
  22985. return $core.withContext(function($ctx1) {
  22986. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  22987. $recv(pkg)._javaScriptDescriptor_(anObject);
  22988. return pkg;
  22989. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  22990. },
  22991. args: ["aString", "anObject"],
  22992. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  22993. referencedClasses: ["Smalltalk"],
  22994. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22995. }),
  22996. $globals.Package.a$cls);
  22997. $core.addMethod(
  22998. $core.method({
  22999. selector: "named:transport:",
  23000. protocol: "accessing",
  23001. fn: function (aPackageName,aTransport){
  23002. var self=this,$self=this;
  23003. var pkg;
  23004. return $core.withContext(function($ctx1) {
  23005. pkg=$self._named_(aPackageName);
  23006. $recv(pkg)._transport_(aTransport);
  23007. return pkg;
  23008. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  23009. },
  23010. args: ["aPackageName", "aTransport"],
  23011. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  23012. referencedClasses: [],
  23013. messageSends: ["named:", "transport:"]
  23014. }),
  23015. $globals.Package.a$cls);
  23016. $core.addMethod(
  23017. $core.method({
  23018. selector: "new:",
  23019. protocol: "instance creation",
  23020. fn: function (aString){
  23021. var self=this,$self=this;
  23022. return $core.withContext(function($ctx1) {
  23023. var $1;
  23024. $1=$recv($globals.Package)._new();
  23025. $recv($1)._name_(aString);
  23026. return $recv($1)._yourself();
  23027. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  23028. },
  23029. args: ["aString"],
  23030. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  23031. referencedClasses: ["Package"],
  23032. messageSends: ["name:", "new", "yourself"]
  23033. }),
  23034. $globals.Package.a$cls);
  23035. $core.addMethod(
  23036. $core.method({
  23037. selector: "sortedClasses:",
  23038. protocol: "sorting",
  23039. fn: function (classes){
  23040. var self=this,$self=this;
  23041. var children,others,nodes,expandedClasses;
  23042. return $core.withContext(function($ctx1) {
  23043. var $1,$3,$2;
  23044. children=[];
  23045. others=[];
  23046. $recv(classes)._do_((function(each){
  23047. return $core.withContext(function($ctx2) {
  23048. $1=$recv(classes)._includes_($recv(each)._superclass());
  23049. if($core.assert($1)){
  23050. return $recv(others)._add_(each);
  23051. } else {
  23052. return $recv(children)._add_(each);
  23053. $ctx2.sendIdx["add:"]=1;
  23054. }
  23055. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23056. }));
  23057. $ctx1.sendIdx["do:"]=1;
  23058. nodes=$recv(children)._collect_((function(each){
  23059. return $core.withContext(function($ctx2) {
  23060. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  23061. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  23062. }));
  23063. nodes=$recv(nodes)._sorted_((function(a,b){
  23064. return $core.withContext(function($ctx2) {
  23065. $3=$recv(a)._theClass();
  23066. $ctx2.sendIdx["theClass"]=1;
  23067. $2=$recv($3)._name();
  23068. $ctx2.sendIdx["name"]=1;
  23069. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  23070. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  23071. }));
  23072. expandedClasses=$recv($globals.Array)._new();
  23073. $recv(nodes)._do_((function(aNode){
  23074. return $core.withContext(function($ctx2) {
  23075. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  23076. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  23077. }));
  23078. return expandedClasses;
  23079. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  23080. },
  23081. args: ["classes"],
  23082. 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",
  23083. referencedClasses: ["ClassSorterNode", "Array"],
  23084. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  23085. }),
  23086. $globals.Package.a$cls);
  23087. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  23088. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23089. $core.addMethod(
  23090. $core.method({
  23091. selector: "announcer",
  23092. protocol: "accessing",
  23093. fn: function (){
  23094. var self=this,$self=this;
  23095. return $core.withContext(function($ctx1) {
  23096. return $recv($globals.SystemAnnouncer)._current();
  23097. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23098. },
  23099. args: [],
  23100. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23101. referencedClasses: ["SystemAnnouncer"],
  23102. messageSends: ["current"]
  23103. }),
  23104. $globals.PackageStateObserver);
  23105. $core.addMethod(
  23106. $core.method({
  23107. selector: "observeSystem",
  23108. protocol: "actions",
  23109. fn: function (){
  23110. var self=this,$self=this;
  23111. return $core.withContext(function($ctx1) {
  23112. var $1;
  23113. $1=$self._announcer();
  23114. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23115. $ctx1.sendIdx["on:send:to:"]=1;
  23116. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23117. $ctx1.sendIdx["on:send:to:"]=2;
  23118. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23119. $ctx1.sendIdx["on:send:to:"]=3;
  23120. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23121. return self;
  23122. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23123. },
  23124. args: [],
  23125. 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",
  23126. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23127. messageSends: ["on:send:to:", "announcer"]
  23128. }),
  23129. $globals.PackageStateObserver);
  23130. $core.addMethod(
  23131. $core.method({
  23132. selector: "onClassModification:",
  23133. protocol: "reactions",
  23134. fn: function (anAnnouncement){
  23135. var self=this,$self=this;
  23136. return $core.withContext(function($ctx1) {
  23137. var $1,$receiver;
  23138. $1=$recv(anAnnouncement)._theClass();
  23139. if(($receiver = $1) == null || $receiver.a$nil){
  23140. $1;
  23141. } else {
  23142. var theClass;
  23143. theClass=$receiver;
  23144. $recv($recv(theClass)._package())._beDirty();
  23145. }
  23146. return self;
  23147. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23148. },
  23149. args: ["anAnnouncement"],
  23150. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23151. referencedClasses: [],
  23152. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23153. }),
  23154. $globals.PackageStateObserver);
  23155. $core.addMethod(
  23156. $core.method({
  23157. selector: "onMethodModification:",
  23158. protocol: "reactions",
  23159. fn: function (anAnnouncement){
  23160. var self=this,$self=this;
  23161. return $core.withContext(function($ctx1) {
  23162. var $1,$receiver;
  23163. $1=$recv($recv(anAnnouncement)._method())._package();
  23164. if(($receiver = $1) == null || $receiver.a$nil){
  23165. $1;
  23166. } else {
  23167. var package_;
  23168. package_=$receiver;
  23169. $recv(package_)._beDirty();
  23170. }
  23171. return self;
  23172. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23173. },
  23174. args: ["anAnnouncement"],
  23175. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23176. referencedClasses: [],
  23177. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23178. }),
  23179. $globals.PackageStateObserver);
  23180. $core.addMethod(
  23181. $core.method({
  23182. selector: "onPackageAdded:",
  23183. protocol: "reactions",
  23184. fn: function (anAnnouncement){
  23185. var self=this,$self=this;
  23186. return $core.withContext(function($ctx1) {
  23187. $recv($recv(anAnnouncement)._package())._beDirty();
  23188. return self;
  23189. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23190. },
  23191. args: ["anAnnouncement"],
  23192. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23193. referencedClasses: [],
  23194. messageSends: ["beDirty", "package"]
  23195. }),
  23196. $globals.PackageStateObserver);
  23197. $core.addMethod(
  23198. $core.method({
  23199. selector: "onProtocolModification:",
  23200. protocol: "reactions",
  23201. fn: function (anAnnouncement){
  23202. var self=this,$self=this;
  23203. return $core.withContext(function($ctx1) {
  23204. var $1,$receiver;
  23205. $1=$recv(anAnnouncement)._package();
  23206. if(($receiver = $1) == null || $receiver.a$nil){
  23207. $1;
  23208. } else {
  23209. var package_;
  23210. package_=$receiver;
  23211. $recv(package_)._beDirty();
  23212. }
  23213. return self;
  23214. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23215. },
  23216. args: ["anAnnouncement"],
  23217. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23218. referencedClasses: [],
  23219. messageSends: ["ifNotNil:", "package", "beDirty"]
  23220. }),
  23221. $globals.PackageStateObserver);
  23222. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23223. $core.addMethod(
  23224. $core.method({
  23225. selector: "current",
  23226. protocol: "accessing",
  23227. fn: function (){
  23228. var self=this,$self=this;
  23229. return $core.withContext(function($ctx1) {
  23230. var $1,$receiver;
  23231. $1=$self["@current"];
  23232. if(($receiver = $1) == null || $receiver.a$nil){
  23233. $self["@current"]=$self._new();
  23234. return $self["@current"];
  23235. } else {
  23236. return $1;
  23237. }
  23238. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23239. },
  23240. args: [],
  23241. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23242. referencedClasses: [],
  23243. messageSends: ["ifNil:", "new"]
  23244. }),
  23245. $globals.PackageStateObserver.a$cls);
  23246. $core.addMethod(
  23247. $core.method({
  23248. selector: "initialize",
  23249. protocol: "initialization",
  23250. fn: function (){
  23251. var self=this,$self=this;
  23252. return $core.withContext(function($ctx1) {
  23253. $recv($self._current())._observeSystem();
  23254. return self;
  23255. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23256. },
  23257. args: [],
  23258. source: "initialize\x0a\x09self current observeSystem",
  23259. referencedClasses: [],
  23260. messageSends: ["observeSystem", "current"]
  23261. }),
  23262. $globals.PackageStateObserver.a$cls);
  23263. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23264. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23265. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23266. $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`";
  23267. $core.addMethod(
  23268. $core.method({
  23269. selector: "defaultValue",
  23270. protocol: "accessing",
  23271. fn: function (){
  23272. var self=this,$self=this;
  23273. return $self["@defaultValue"];
  23274. },
  23275. args: [],
  23276. source: "defaultValue\x0a\x09^ defaultValue",
  23277. referencedClasses: [],
  23278. messageSends: []
  23279. }),
  23280. $globals.Setting);
  23281. $core.addMethod(
  23282. $core.method({
  23283. selector: "defaultValue:",
  23284. protocol: "accessing",
  23285. fn: function (aStringifiableObject){
  23286. var self=this,$self=this;
  23287. $self["@defaultValue"]=aStringifiableObject;
  23288. return self;
  23289. },
  23290. args: ["aStringifiableObject"],
  23291. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23292. referencedClasses: [],
  23293. messageSends: []
  23294. }),
  23295. $globals.Setting);
  23296. $core.addMethod(
  23297. $core.method({
  23298. selector: "key",
  23299. protocol: "accessing",
  23300. fn: function (){
  23301. var self=this,$self=this;
  23302. return $self["@key"];
  23303. },
  23304. args: [],
  23305. source: "key\x0a\x09^ key",
  23306. referencedClasses: [],
  23307. messageSends: []
  23308. }),
  23309. $globals.Setting);
  23310. $core.addMethod(
  23311. $core.method({
  23312. selector: "key:",
  23313. protocol: "accessing",
  23314. fn: function (aString){
  23315. var self=this,$self=this;
  23316. $self["@key"]=aString;
  23317. return self;
  23318. },
  23319. args: ["aString"],
  23320. source: "key: aString\x0a\x09key := aString",
  23321. referencedClasses: [],
  23322. messageSends: []
  23323. }),
  23324. $globals.Setting);
  23325. $core.addMethod(
  23326. $core.method({
  23327. selector: "value",
  23328. protocol: "accessing",
  23329. fn: function (){
  23330. var self=this,$self=this;
  23331. return $core.withContext(function($ctx1) {
  23332. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23333. return $core.withContext(function($ctx2) {
  23334. return $self._defaultValue();
  23335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23336. }));
  23337. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23338. },
  23339. args: [],
  23340. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23341. referencedClasses: ["Smalltalk"],
  23342. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23343. }),
  23344. $globals.Setting);
  23345. $core.addMethod(
  23346. $core.method({
  23347. selector: "value:",
  23348. protocol: "accessing",
  23349. fn: function (aStringifiableObject){
  23350. var self=this,$self=this;
  23351. return $core.withContext(function($ctx1) {
  23352. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23353. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23354. },
  23355. args: ["aStringifiableObject"],
  23356. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23357. referencedClasses: ["Smalltalk"],
  23358. messageSends: ["at:put:", "settings", "key"]
  23359. }),
  23360. $globals.Setting);
  23361. $core.addMethod(
  23362. $core.method({
  23363. selector: "at:ifAbsent:",
  23364. protocol: "instance creation",
  23365. fn: function (aString,aDefaultValue){
  23366. var self=this,$self=this;
  23367. return $core.withContext(function($ctx1) {
  23368. var $1;
  23369. $1=(
  23370. $ctx1.supercall = true,
  23371. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23372. $ctx1.supercall = false;
  23373. $recv($1)._key_(aString);
  23374. $recv($1)._defaultValue_(aDefaultValue);
  23375. return $recv($1)._yourself();
  23376. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23377. },
  23378. args: ["aString", "aDefaultValue"],
  23379. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23380. referencedClasses: [],
  23381. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23382. }),
  23383. $globals.Setting.a$cls);
  23384. $core.addMethod(
  23385. $core.method({
  23386. selector: "new",
  23387. protocol: "instance creation",
  23388. fn: function (){
  23389. var self=this,$self=this;
  23390. return $core.withContext(function($ctx1) {
  23391. $self._shouldNotImplement();
  23392. return self;
  23393. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23394. },
  23395. args: [],
  23396. source: "new\x0a\x09self shouldNotImplement",
  23397. referencedClasses: [],
  23398. messageSends: ["shouldNotImplement"]
  23399. }),
  23400. $globals.Setting.a$cls);
  23401. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23402. $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.";
  23403. $core.addMethod(
  23404. $core.method({
  23405. selector: "addGlobalJsVariable:",
  23406. protocol: "globals",
  23407. fn: function (aString){
  23408. var self=this,$self=this;
  23409. return $core.withContext(function($ctx1) {
  23410. $recv($self._globalJsVariables())._add_(aString);
  23411. return self;
  23412. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23413. },
  23414. args: ["aString"],
  23415. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23416. referencedClasses: [],
  23417. messageSends: ["add:", "globalJsVariables"]
  23418. }),
  23419. $globals.SmalltalkImage);
  23420. $core.addMethod(
  23421. $core.method({
  23422. selector: "adoptPackageDictionary",
  23423. protocol: "private",
  23424. fn: function (){
  23425. var self=this,$self=this;
  23426. return $core.withContext(function($ctx1) {
  23427. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23428. return $core.withContext(function($ctx2) {
  23429. return $recv($globals.Package)._named_javaScriptDescriptor_(key,value);
  23430. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23431. }));
  23432. return self;
  23433. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDictionary",{},$globals.SmalltalkImage)});
  23434. },
  23435. args: [],
  23436. source: "adoptPackageDictionary\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value | Package named: key javaScriptDescriptor: value ]",
  23437. referencedClasses: ["Package"],
  23438. messageSends: ["keysAndValuesDo:", "packageDescriptors", "core", "named:javaScriptDescriptor:"]
  23439. }),
  23440. $globals.SmalltalkImage);
  23441. $core.addMethod(
  23442. $core.method({
  23443. selector: "amdRequire",
  23444. protocol: "accessing amd",
  23445. fn: function (){
  23446. var self=this,$self=this;
  23447. return $core.withContext(function($ctx1) {
  23448. return $recv($self._core())._at_("amdRequire");
  23449. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23450. },
  23451. args: [],
  23452. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23453. referencedClasses: [],
  23454. messageSends: ["at:", "core"]
  23455. }),
  23456. $globals.SmalltalkImage);
  23457. $core.addMethod(
  23458. $core.method({
  23459. selector: "asSmalltalkException:",
  23460. protocol: "error handling",
  23461. fn: function (anObject){
  23462. var self=this,$self=this;
  23463. return $core.withContext(function($ctx1) {
  23464. var $1;
  23465. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23466. return $core.withContext(function($ctx2) {
  23467. return $recv(anObject)._isKindOf_($globals.Error);
  23468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23469. }));
  23470. if($core.assert($1)){
  23471. return anObject;
  23472. } else {
  23473. return $recv($globals.JavaScriptException)._on_(anObject);
  23474. }
  23475. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23476. },
  23477. args: ["anObject"],
  23478. 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 ]",
  23479. referencedClasses: ["Error", "JavaScriptException"],
  23480. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23481. }),
  23482. $globals.SmalltalkImage);
  23483. $core.addMethod(
  23484. $core.method({
  23485. selector: "basicCreatePackage:",
  23486. protocol: "private",
  23487. fn: function (packageName){
  23488. var self=this,$self=this;
  23489. return $core.withContext(function($ctx1) {
  23490. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23491. return $core.withContext(function($ctx2) {
  23492. return $recv($globals.Package)._new_(packageName);
  23493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23494. }));
  23495. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23496. },
  23497. args: ["packageName"],
  23498. 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 ]",
  23499. referencedClasses: ["Package"],
  23500. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23501. }),
  23502. $globals.SmalltalkImage);
  23503. $core.addMethod(
  23504. $core.method({
  23505. selector: "basicParse:",
  23506. protocol: "private",
  23507. fn: function (aString){
  23508. var self=this,$self=this;
  23509. return $core.withContext(function($ctx1) {
  23510. return $recv($globals.SmalltalkParser)._parse_(aString);
  23511. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23512. },
  23513. args: ["aString"],
  23514. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23515. referencedClasses: ["SmalltalkParser"],
  23516. messageSends: ["parse:"]
  23517. }),
  23518. $globals.SmalltalkImage);
  23519. $core.addMethod(
  23520. $core.method({
  23521. selector: "cancelOptOut:",
  23522. protocol: "accessing",
  23523. fn: function (anObject){
  23524. var self=this,$self=this;
  23525. return $core.withContext(function($ctx1) {
  23526. delete anObject.klass; delete anObject.a$cls;;
  23527. return self;
  23528. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23529. },
  23530. args: ["anObject"],
  23531. 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;'>",
  23532. referencedClasses: [],
  23533. messageSends: []
  23534. }),
  23535. $globals.SmalltalkImage);
  23536. $core.addMethod(
  23537. $core.method({
  23538. selector: "classes",
  23539. protocol: "classes",
  23540. fn: function (){
  23541. var self=this,$self=this;
  23542. return $core.withContext(function($ctx1) {
  23543. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23544. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23545. },
  23546. args: [],
  23547. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23548. referencedClasses: [],
  23549. messageSends: ["copy", "traitsOrClasses", "core"]
  23550. }),
  23551. $globals.SmalltalkImage);
  23552. $core.addMethod(
  23553. $core.method({
  23554. selector: "core",
  23555. protocol: "accessing",
  23556. fn: function (){
  23557. var self=this,$self=this;
  23558. return $core.withContext(function($ctx1) {
  23559. return $core;
  23560. return self;
  23561. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23562. },
  23563. args: [],
  23564. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23565. referencedClasses: [],
  23566. messageSends: []
  23567. }),
  23568. $globals.SmalltalkImage);
  23569. $core.addMethod(
  23570. $core.method({
  23571. selector: "createPackage:",
  23572. protocol: "packages",
  23573. fn: function (packageName){
  23574. var self=this,$self=this;
  23575. var package_,announcement;
  23576. return $core.withContext(function($ctx1) {
  23577. var $1;
  23578. package_=$self._basicCreatePackage_(packageName);
  23579. $1=$recv($globals.PackageAdded)._new();
  23580. $recv($1)._package_(package_);
  23581. announcement=$recv($1)._yourself();
  23582. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23583. return package_;
  23584. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23585. },
  23586. args: ["packageName"],
  23587. 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",
  23588. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23589. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23590. }),
  23591. $globals.SmalltalkImage);
  23592. $core.addMethod(
  23593. $core.method({
  23594. selector: "defaultAmdNamespace",
  23595. protocol: "accessing amd",
  23596. fn: function (){
  23597. var self=this,$self=this;
  23598. return $core.withContext(function($ctx1) {
  23599. return "transport.defaultAmdNamespace"._settingValue();
  23600. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23601. },
  23602. args: [],
  23603. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23604. referencedClasses: [],
  23605. messageSends: ["settingValue"]
  23606. }),
  23607. $globals.SmalltalkImage);
  23608. $core.addMethod(
  23609. $core.method({
  23610. selector: "defaultAmdNamespace:",
  23611. protocol: "accessing amd",
  23612. fn: function (aString){
  23613. var self=this,$self=this;
  23614. return $core.withContext(function($ctx1) {
  23615. "transport.defaultAmdNamespace"._settingValue_(aString);
  23616. return self;
  23617. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23618. },
  23619. args: ["aString"],
  23620. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23621. referencedClasses: [],
  23622. messageSends: ["settingValue:"]
  23623. }),
  23624. $globals.SmalltalkImage);
  23625. $core.addMethod(
  23626. $core.method({
  23627. selector: "deleteClass:",
  23628. protocol: "private",
  23629. fn: function (aClass){
  23630. var self=this,$self=this;
  23631. return $core.withContext(function($ctx1) {
  23632. $core.removeClass(aClass);
  23633. return self;
  23634. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23635. },
  23636. args: ["aClass"],
  23637. 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)'>",
  23638. referencedClasses: [],
  23639. messageSends: []
  23640. }),
  23641. $globals.SmalltalkImage);
  23642. $core.addMethod(
  23643. $core.method({
  23644. selector: "deleteGlobalJsVariable:",
  23645. protocol: "globals",
  23646. fn: function (aString){
  23647. var self=this,$self=this;
  23648. return $core.withContext(function($ctx1) {
  23649. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23650. }));
  23651. return self;
  23652. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23653. },
  23654. args: ["aString"],
  23655. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23656. referencedClasses: [],
  23657. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23658. }),
  23659. $globals.SmalltalkImage);
  23660. $core.addMethod(
  23661. $core.method({
  23662. selector: "existsJsGlobal:",
  23663. protocol: "testing",
  23664. fn: function (aString){
  23665. var self=this,$self=this;
  23666. return $core.withContext(function($ctx1) {
  23667. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23668. return $recv($globals.Platform)._includesGlobal_(aString);
  23669. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23670. },
  23671. args: ["aString"],
  23672. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23673. referencedClasses: ["Platform"],
  23674. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23675. }),
  23676. $globals.SmalltalkImage);
  23677. $core.addMethod(
  23678. $core.method({
  23679. selector: "globalJsVariables",
  23680. protocol: "globals",
  23681. fn: function (){
  23682. var self=this,$self=this;
  23683. return $core.withContext(function($ctx1) {
  23684. var $1,$receiver;
  23685. $1=$self["@globalJsVariables"];
  23686. if(($receiver = $1) == null || $receiver.a$nil){
  23687. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23688. return $self["@globalJsVariables"];
  23689. } else {
  23690. return $1;
  23691. }
  23692. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23693. },
  23694. args: [],
  23695. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23696. referencedClasses: [],
  23697. messageSends: ["ifNil:"]
  23698. }),
  23699. $globals.SmalltalkImage);
  23700. $core.addMethod(
  23701. $core.method({
  23702. selector: "globals",
  23703. protocol: "accessing",
  23704. fn: function (){
  23705. var self=this,$self=this;
  23706. return $core.withContext(function($ctx1) {
  23707. return $globals;
  23708. return self;
  23709. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23710. },
  23711. args: [],
  23712. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23713. referencedClasses: [],
  23714. messageSends: []
  23715. }),
  23716. $globals.SmalltalkImage);
  23717. $core.addMethod(
  23718. $core.method({
  23719. selector: "includesKey:",
  23720. protocol: "accessing",
  23721. fn: function (aKey){
  23722. var self=this,$self=this;
  23723. return $core.withContext(function($ctx1) {
  23724. return $core.hasOwnProperty(aKey);
  23725. return self;
  23726. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23727. },
  23728. args: ["aKey"],
  23729. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23730. referencedClasses: [],
  23731. messageSends: []
  23732. }),
  23733. $globals.SmalltalkImage);
  23734. $core.addMethod(
  23735. $core.method({
  23736. selector: "isSmalltalkObject:",
  23737. protocol: "testing",
  23738. fn: function (anObject){
  23739. var self=this,$self=this;
  23740. return $core.withContext(function($ctx1) {
  23741. return anObject.a$cls != null;
  23742. return self;
  23743. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23744. },
  23745. args: ["anObject"],
  23746. 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'>",
  23747. referencedClasses: [],
  23748. messageSends: []
  23749. }),
  23750. $globals.SmalltalkImage);
  23751. $core.addMethod(
  23752. $core.method({
  23753. selector: "optOut:",
  23754. protocol: "accessing",
  23755. fn: function (anObject){
  23756. var self=this,$self=this;
  23757. return $core.withContext(function($ctx1) {
  23758. anObject.klass = null; anObject.a$cls = null;
  23759. return self;
  23760. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23761. },
  23762. args: ["anObject"],
  23763. 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'>",
  23764. referencedClasses: [],
  23765. messageSends: []
  23766. }),
  23767. $globals.SmalltalkImage);
  23768. $core.addMethod(
  23769. $core.method({
  23770. selector: "packageAt:",
  23771. protocol: "packages",
  23772. fn: function (packageName){
  23773. var self=this,$self=this;
  23774. return $core.withContext(function($ctx1) {
  23775. $self._deprecatedAPI_("Use #packageAt:ifAbsent: directly.");
  23776. return $self._packageAt_ifAbsent_(packageName,(function(){
  23777. }));
  23778. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  23779. },
  23780. args: ["packageName"],
  23781. source: "packageAt: packageName\x0a\x09self deprecatedAPI: 'Use #packageAt:ifAbsent: directly.'.\x0a\x09^ self packageAt: packageName ifAbsent: []",
  23782. referencedClasses: [],
  23783. messageSends: ["deprecatedAPI:", "packageAt:ifAbsent:"]
  23784. }),
  23785. $globals.SmalltalkImage);
  23786. $core.addMethod(
  23787. $core.method({
  23788. selector: "packageAt:ifAbsent:",
  23789. protocol: "packages",
  23790. fn: function (packageName,aBlock){
  23791. var self=this,$self=this;
  23792. return $core.withContext(function($ctx1) {
  23793. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23794. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23795. },
  23796. args: ["packageName", "aBlock"],
  23797. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23798. referencedClasses: [],
  23799. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23800. }),
  23801. $globals.SmalltalkImage);
  23802. $core.addMethod(
  23803. $core.method({
  23804. selector: "packageAt:ifPresent:",
  23805. protocol: "packages",
  23806. fn: function (packageName,aBlock){
  23807. var self=this,$self=this;
  23808. return $core.withContext(function($ctx1) {
  23809. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23810. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23811. },
  23812. args: ["packageName", "aBlock"],
  23813. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23814. referencedClasses: [],
  23815. messageSends: ["at:ifPresent:", "packageDictionary"]
  23816. }),
  23817. $globals.SmalltalkImage);
  23818. $core.addMethod(
  23819. $core.method({
  23820. selector: "packageDictionary",
  23821. protocol: "packages",
  23822. fn: function (){
  23823. var self=this,$self=this;
  23824. return $core.withContext(function($ctx1) {
  23825. var $1,$receiver;
  23826. $1=$self["@packageDictionary"];
  23827. if(($receiver = $1) == null || $receiver.a$nil){
  23828. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23829. return $self["@packageDictionary"];
  23830. } else {
  23831. return $1;
  23832. }
  23833. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23834. },
  23835. args: [],
  23836. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23837. referencedClasses: ["Dictionary"],
  23838. messageSends: ["ifNil:", "new"]
  23839. }),
  23840. $globals.SmalltalkImage);
  23841. $core.addMethod(
  23842. $core.method({
  23843. selector: "packages",
  23844. protocol: "packages",
  23845. fn: function (){
  23846. var self=this,$self=this;
  23847. return $core.withContext(function($ctx1) {
  23848. return $recv($recv($self._packageDictionary())._values())._copy();
  23849. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23850. },
  23851. args: [],
  23852. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23853. referencedClasses: [],
  23854. messageSends: ["copy", "values", "packageDictionary"]
  23855. }),
  23856. $globals.SmalltalkImage);
  23857. $core.addMethod(
  23858. $core.method({
  23859. selector: "parse:",
  23860. protocol: "accessing",
  23861. fn: function (aString){
  23862. var self=this,$self=this;
  23863. var result;
  23864. return $core.withContext(function($ctx1) {
  23865. var $1;
  23866. $recv((function(){
  23867. return $core.withContext(function($ctx2) {
  23868. result=$self._basicParse_(aString);
  23869. return result;
  23870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23871. }))._tryCatch_((function(ex){
  23872. return $core.withContext(function($ctx2) {
  23873. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23874. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23875. }));
  23876. $1=result;
  23877. $recv($1)._source_(aString);
  23878. return $recv($1)._yourself();
  23879. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23880. },
  23881. args: ["aString"],
  23882. 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",
  23883. referencedClasses: [],
  23884. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23885. }),
  23886. $globals.SmalltalkImage);
  23887. $core.addMethod(
  23888. $core.method({
  23889. selector: "parseError:parsing:",
  23890. protocol: "error handling",
  23891. fn: function (anException,aString){
  23892. var self=this,$self=this;
  23893. var pos;
  23894. return $core.withContext(function($ctx1) {
  23895. var $1,$2,$6,$5,$4,$3;
  23896. $1=$recv(anException)._basicAt_("location");
  23897. $ctx1.sendIdx["basicAt:"]=1;
  23898. pos=$recv($1)._start();
  23899. $2=$recv($globals.ParseError)._new();
  23900. $6=$recv("Parse error on line ".__comma($recv(pos)._line())).__comma(" column ");
  23901. $ctx1.sendIdx[","]=4;
  23902. $5=$recv($6).__comma($recv(pos)._column());
  23903. $ctx1.sendIdx[","]=3;
  23904. $4=$recv($5).__comma(" : Unexpected character ");
  23905. $ctx1.sendIdx[","]=2;
  23906. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23907. $ctx1.sendIdx[","]=1;
  23908. return $recv($2)._messageText_($3);
  23909. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString,pos:pos},$globals.SmalltalkImage)});
  23910. },
  23911. args: ["anException", "aString"],
  23912. source: "parseError: anException parsing: aString\x0a\x09| pos |\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')",
  23913. referencedClasses: ["ParseError"],
  23914. messageSends: ["start", "basicAt:", "messageText:", "new", ",", "line", "column"]
  23915. }),
  23916. $globals.SmalltalkImage);
  23917. $core.addMethod(
  23918. $core.method({
  23919. selector: "pseudoVariableNames",
  23920. protocol: "accessing",
  23921. fn: function (){
  23922. var self=this,$self=this;
  23923. return ["self", "super", "nil", "true", "false", "thisContext"];
  23924. },
  23925. args: [],
  23926. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23927. referencedClasses: [],
  23928. messageSends: []
  23929. }),
  23930. $globals.SmalltalkImage);
  23931. $core.addMethod(
  23932. $core.method({
  23933. selector: "readJSObject:",
  23934. protocol: "accessing",
  23935. fn: function (anObject){
  23936. var self=this,$self=this;
  23937. return $core.withContext(function($ctx1) {
  23938. return $core.readJSObject(anObject);
  23939. return self;
  23940. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23941. },
  23942. args: ["anObject"],
  23943. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23944. referencedClasses: [],
  23945. messageSends: []
  23946. }),
  23947. $globals.SmalltalkImage);
  23948. $core.addMethod(
  23949. $core.method({
  23950. selector: "removeClass:",
  23951. protocol: "classes",
  23952. fn: function (aClass){
  23953. var self=this,$self=this;
  23954. return $core.withContext(function($ctx1) {
  23955. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23956. $1=$recv(aClass)._isMetaclass();
  23957. if($core.assert($1)){
  23958. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23959. $ctx1.sendIdx[","]=1;
  23960. $self._error_($2);
  23961. $ctx1.sendIdx["error:"]=1;
  23962. }
  23963. $recv(aClass)._allSubclassesDo_((function(subclass){
  23964. return $core.withContext(function($ctx2) {
  23965. $5=$recv(aClass)._name();
  23966. $ctx2.sendIdx["name"]=1;
  23967. $4=$recv($5).__comma(" has a subclass: ");
  23968. $ctx2.sendIdx[","]=3;
  23969. $6=$recv(subclass)._name();
  23970. $ctx2.sendIdx["name"]=2;
  23971. $3=$recv($4).__comma($6);
  23972. $ctx2.sendIdx[","]=2;
  23973. return $self._error_($3);
  23974. $ctx2.sendIdx["error:"]=2;
  23975. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23976. }));
  23977. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23978. return $core.withContext(function($ctx2) {
  23979. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23981. }));
  23982. $self._deleteClass_(aClass);
  23983. $recv(aClass)._setTraitComposition_([]);
  23984. $ctx1.sendIdx["setTraitComposition:"]=1;
  23985. $7=$recv(aClass)._theMetaClass();
  23986. if(($receiver = $7) == null || $receiver.a$nil){
  23987. $7;
  23988. } else {
  23989. var meta;
  23990. meta=$receiver;
  23991. $recv(meta)._setTraitComposition_([]);
  23992. }
  23993. $8=$recv($globals.SystemAnnouncer)._current();
  23994. $10=$recv($globals.ClassRemoved)._new();
  23995. $recv($10)._theClass_(aClass);
  23996. $9=$recv($10)._yourself();
  23997. $recv($8)._announce_($9);
  23998. return self;
  23999. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  24000. },
  24001. args: ["aClass"],
  24002. 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)",
  24003. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  24004. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  24005. }),
  24006. $globals.SmalltalkImage);
  24007. $core.addMethod(
  24008. $core.method({
  24009. selector: "removePackage:",
  24010. protocol: "packages",
  24011. fn: function (packageName){
  24012. var self=this,$self=this;
  24013. var pkg;
  24014. return $core.withContext(function($ctx1) {
  24015. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24016. return $core.withContext(function($ctx2) {
  24017. return $self._error_("Missing package: ".__comma(packageName));
  24018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24019. }));
  24020. $recv($recv(pkg)._classes())._do_((function(each){
  24021. return $core.withContext(function($ctx2) {
  24022. return $self._removeClass_(each);
  24023. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24024. }));
  24025. $recv($self._packageDictionary())._removeKey_(packageName);
  24026. return self;
  24027. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  24028. },
  24029. args: ["packageName"],
  24030. 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",
  24031. referencedClasses: [],
  24032. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  24033. }),
  24034. $globals.SmalltalkImage);
  24035. $core.addMethod(
  24036. $core.method({
  24037. selector: "renamePackage:to:",
  24038. protocol: "packages",
  24039. fn: function (packageName,newName){
  24040. var self=this,$self=this;
  24041. var pkg;
  24042. return $core.withContext(function($ctx1) {
  24043. var $1,$2,$3;
  24044. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24045. return $core.withContext(function($ctx2) {
  24046. $1="Missing package: ".__comma(packageName);
  24047. $ctx2.sendIdx[","]=1;
  24048. return $self._error_($1);
  24049. $ctx2.sendIdx["error:"]=1;
  24050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24051. }));
  24052. $self._packageAt_ifPresent_(newName,(function(){
  24053. return $core.withContext(function($ctx2) {
  24054. return $self._error_("Already exists a package called: ".__comma(newName));
  24055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  24056. }));
  24057. $2=pkg;
  24058. $recv($2)._name_(newName);
  24059. $recv($2)._beDirty();
  24060. $3=$self._packageDictionary();
  24061. $recv($3)._at_put_(newName,pkg);
  24062. $recv($3)._removeKey_(packageName);
  24063. return self;
  24064. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24065. },
  24066. args: ["packageName", "newName"],
  24067. 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",
  24068. referencedClasses: [],
  24069. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24070. }),
  24071. $globals.SmalltalkImage);
  24072. $core.addMethod(
  24073. $core.method({
  24074. selector: "reservedWords",
  24075. protocol: "accessing",
  24076. fn: function (){
  24077. var self=this,$self=this;
  24078. 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"];
  24079. },
  24080. args: [],
  24081. 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)",
  24082. referencedClasses: [],
  24083. messageSends: []
  24084. }),
  24085. $globals.SmalltalkImage);
  24086. $core.addMethod(
  24087. $core.method({
  24088. selector: "settings",
  24089. protocol: "accessing",
  24090. fn: function (){
  24091. var self=this,$self=this;
  24092. return $globals.SmalltalkSettings;
  24093. },
  24094. args: [],
  24095. source: "settings\x0a\x09^ SmalltalkSettings",
  24096. referencedClasses: ["SmalltalkSettings"],
  24097. messageSends: []
  24098. }),
  24099. $globals.SmalltalkImage);
  24100. $core.addMethod(
  24101. $core.method({
  24102. selector: "version",
  24103. protocol: "accessing",
  24104. fn: function (){
  24105. var self=this,$self=this;
  24106. return "0.21.0";
  24107. },
  24108. args: [],
  24109. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.21.0'",
  24110. referencedClasses: [],
  24111. messageSends: []
  24112. }),
  24113. $globals.SmalltalkImage);
  24114. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24115. $core.addMethod(
  24116. $core.method({
  24117. selector: "current",
  24118. protocol: "instance creation",
  24119. fn: function (){
  24120. var self=this,$self=this;
  24121. return $core.withContext(function($ctx1) {
  24122. var $1,$receiver;
  24123. $1=$self["@current"];
  24124. if(($receiver = $1) == null || $receiver.a$nil){
  24125. $self["@current"]=(
  24126. $ctx1.supercall = true,
  24127. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24128. $ctx1.supercall = false;
  24129. return $self["@current"];
  24130. } else {
  24131. $self._deprecatedAPI();
  24132. return $self["@current"];
  24133. }
  24134. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24135. },
  24136. args: [],
  24137. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24138. referencedClasses: [],
  24139. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24140. }),
  24141. $globals.SmalltalkImage.a$cls);
  24142. $core.addMethod(
  24143. $core.method({
  24144. selector: "initialize",
  24145. protocol: "initialization",
  24146. fn: function (){
  24147. var self=this,$self=this;
  24148. var st;
  24149. return $core.withContext(function($ctx1) {
  24150. st=$self._current();
  24151. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24152. return self;
  24153. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24154. },
  24155. args: [],
  24156. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24157. referencedClasses: [],
  24158. messageSends: ["current", "at:put:", "globals"]
  24159. }),
  24160. $globals.SmalltalkImage.a$cls);
  24161. $core.addMethod(
  24162. $core.method({
  24163. selector: "new",
  24164. protocol: "instance creation",
  24165. fn: function (){
  24166. var self=this,$self=this;
  24167. return $core.withContext(function($ctx1) {
  24168. $self._shouldNotImplement();
  24169. return self;
  24170. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24171. },
  24172. args: [],
  24173. source: "new\x0a\x09self shouldNotImplement",
  24174. referencedClasses: [],
  24175. messageSends: ["shouldNotImplement"]
  24176. }),
  24177. $globals.SmalltalkImage.a$cls);
  24178. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24179. $core.addMethod(
  24180. $core.method({
  24181. selector: "nextPutJSObject:",
  24182. protocol: "*Kernel-Infrastructure",
  24183. fn: function (aJSObject){
  24184. var self=this,$self=this;
  24185. return $core.withContext(function($ctx1) {
  24186. $self._nextPut_(aJSObject);
  24187. return self;
  24188. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24189. },
  24190. args: ["aJSObject"],
  24191. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24192. referencedClasses: [],
  24193. messageSends: ["nextPut:"]
  24194. }),
  24195. $globals.ProtoStream);
  24196. $core.addMethod(
  24197. $core.method({
  24198. selector: "asJavaScriptPropertyName",
  24199. protocol: "*Kernel-Infrastructure",
  24200. fn: function (){
  24201. var self=this,$self=this;
  24202. return $core.withContext(function($ctx1) {
  24203. return $core.st2prop(self);
  24204. return self;
  24205. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24206. },
  24207. args: [],
  24208. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24209. referencedClasses: [],
  24210. messageSends: []
  24211. }),
  24212. $globals.String);
  24213. $core.addMethod(
  24214. $core.method({
  24215. selector: "asSetting",
  24216. protocol: "*Kernel-Infrastructure",
  24217. fn: function (){
  24218. var self=this,$self=this;
  24219. return $core.withContext(function($ctx1) {
  24220. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24221. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24222. },
  24223. args: [],
  24224. 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",
  24225. referencedClasses: ["Setting"],
  24226. messageSends: ["at:ifAbsent:"]
  24227. }),
  24228. $globals.String);
  24229. $core.addMethod(
  24230. $core.method({
  24231. selector: "asSettingIfAbsent:",
  24232. protocol: "*Kernel-Infrastructure",
  24233. fn: function (aDefaultValue){
  24234. var self=this,$self=this;
  24235. return $core.withContext(function($ctx1) {
  24236. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24237. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24238. },
  24239. args: ["aDefaultValue"],
  24240. 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",
  24241. referencedClasses: ["Setting"],
  24242. messageSends: ["at:ifAbsent:"]
  24243. }),
  24244. $globals.String);
  24245. $core.addMethod(
  24246. $core.method({
  24247. selector: "settingValue",
  24248. protocol: "*Kernel-Infrastructure",
  24249. fn: function (){
  24250. var self=this,$self=this;
  24251. return $core.withContext(function($ctx1) {
  24252. return $recv($self._asSetting())._value();
  24253. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24254. },
  24255. args: [],
  24256. source: "settingValue\x0a\x09^ self asSetting value",
  24257. referencedClasses: [],
  24258. messageSends: ["value", "asSetting"]
  24259. }),
  24260. $globals.String);
  24261. $core.addMethod(
  24262. $core.method({
  24263. selector: "settingValue:",
  24264. protocol: "*Kernel-Infrastructure",
  24265. fn: function (aValue){
  24266. var self=this,$self=this;
  24267. return $core.withContext(function($ctx1) {
  24268. return $recv($self._asSetting())._value_(aValue);
  24269. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24270. },
  24271. args: ["aValue"],
  24272. 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",
  24273. referencedClasses: [],
  24274. messageSends: ["value:", "asSetting"]
  24275. }),
  24276. $globals.String);
  24277. $core.addMethod(
  24278. $core.method({
  24279. selector: "settingValueIfAbsent:",
  24280. protocol: "*Kernel-Infrastructure",
  24281. fn: function (aDefaultValue){
  24282. var self=this,$self=this;
  24283. return $core.withContext(function($ctx1) {
  24284. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24285. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24286. },
  24287. args: ["aDefaultValue"],
  24288. 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",
  24289. referencedClasses: [],
  24290. messageSends: ["value", "asSettingIfAbsent:"]
  24291. }),
  24292. $globals.String);
  24293. });
  24294. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24295. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24296. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24297. $core.addPackage("Kernel-Announcements");
  24298. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  24299. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24300. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24301. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24302. $core.addMethod(
  24303. $core.method({
  24304. selector: "announcementClass",
  24305. protocol: "accessing",
  24306. fn: function (){
  24307. var self=this,$self=this;
  24308. return $self["@announcementClass"];
  24309. },
  24310. args: [],
  24311. source: "announcementClass\x0a\x09^ announcementClass",
  24312. referencedClasses: [],
  24313. messageSends: []
  24314. }),
  24315. $globals.AnnouncementSubscription);
  24316. $core.addMethod(
  24317. $core.method({
  24318. selector: "announcementClass:",
  24319. protocol: "accessing",
  24320. fn: function (aClass){
  24321. var self=this,$self=this;
  24322. $self["@announcementClass"]=aClass;
  24323. return self;
  24324. },
  24325. args: ["aClass"],
  24326. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  24327. referencedClasses: [],
  24328. messageSends: []
  24329. }),
  24330. $globals.AnnouncementSubscription);
  24331. $core.addMethod(
  24332. $core.method({
  24333. selector: "deliver:",
  24334. protocol: "announcing",
  24335. fn: function (anAnnouncement){
  24336. var self=this,$self=this;
  24337. return $core.withContext(function($ctx1) {
  24338. var $1;
  24339. $1=$self._handlesAnnouncement_(anAnnouncement);
  24340. if($core.assert($1)){
  24341. $recv($self._valuable())._value_(anAnnouncement);
  24342. }
  24343. return self;
  24344. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24345. },
  24346. args: ["anAnnouncement"],
  24347. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24348. referencedClasses: [],
  24349. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24350. }),
  24351. $globals.AnnouncementSubscription);
  24352. $core.addMethod(
  24353. $core.method({
  24354. selector: "handlesAnnouncement:",
  24355. protocol: "announcing",
  24356. fn: function (anAnnouncement){
  24357. var self=this,$self=this;
  24358. return $core.withContext(function($ctx1) {
  24359. var $2,$3,$1,$receiver;
  24360. $2=$recv($globals.Smalltalk)._globals();
  24361. $ctx1.sendIdx["globals"]=1;
  24362. $3=$recv($self._announcementClass())._name();
  24363. $ctx1.sendIdx["name"]=1;
  24364. $1=$recv($2)._at_($3);
  24365. $ctx1.sendIdx["at:"]=1;
  24366. if(($receiver = $1) == null || $receiver.a$nil){
  24367. return false;
  24368. } else {
  24369. var class_;
  24370. class_=$receiver;
  24371. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  24372. }
  24373. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24374. },
  24375. args: ["anAnnouncement"],
  24376. 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 ]",
  24377. referencedClasses: ["Smalltalk"],
  24378. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  24379. }),
  24380. $globals.AnnouncementSubscription);
  24381. $core.addMethod(
  24382. $core.method({
  24383. selector: "receiver",
  24384. protocol: "accessing",
  24385. fn: function (){
  24386. var self=this,$self=this;
  24387. return $core.withContext(function($ctx1) {
  24388. return $recv($self._valuable())._receiver();
  24389. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24390. },
  24391. args: [],
  24392. source: "receiver\x0a\x09^ self valuable receiver",
  24393. referencedClasses: [],
  24394. messageSends: ["receiver", "valuable"]
  24395. }),
  24396. $globals.AnnouncementSubscription);
  24397. $core.addMethod(
  24398. $core.method({
  24399. selector: "valuable",
  24400. protocol: "accessing",
  24401. fn: function (){
  24402. var self=this,$self=this;
  24403. return $self["@valuable"];
  24404. },
  24405. args: [],
  24406. source: "valuable\x0a\x09^ valuable",
  24407. referencedClasses: [],
  24408. messageSends: []
  24409. }),
  24410. $globals.AnnouncementSubscription);
  24411. $core.addMethod(
  24412. $core.method({
  24413. selector: "valuable:",
  24414. protocol: "accessing",
  24415. fn: function (aValuable){
  24416. var self=this,$self=this;
  24417. $self["@valuable"]=aValuable;
  24418. return self;
  24419. },
  24420. args: ["aValuable"],
  24421. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24422. referencedClasses: [],
  24423. messageSends: []
  24424. }),
  24425. $globals.AnnouncementSubscription);
  24426. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24427. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24428. $core.addMethod(
  24429. $core.method({
  24430. selector: "receiver",
  24431. protocol: "accessing",
  24432. fn: function (){
  24433. var self=this,$self=this;
  24434. return $self["@receiver"];
  24435. },
  24436. args: [],
  24437. source: "receiver\x0a\x09^ receiver",
  24438. referencedClasses: [],
  24439. messageSends: []
  24440. }),
  24441. $globals.AnnouncementValuable);
  24442. $core.addMethod(
  24443. $core.method({
  24444. selector: "receiver:",
  24445. protocol: "accessing",
  24446. fn: function (anObject){
  24447. var self=this,$self=this;
  24448. $self["@receiver"]=anObject;
  24449. return self;
  24450. },
  24451. args: ["anObject"],
  24452. source: "receiver: anObject\x0a\x09receiver := anObject",
  24453. referencedClasses: [],
  24454. messageSends: []
  24455. }),
  24456. $globals.AnnouncementValuable);
  24457. $core.addMethod(
  24458. $core.method({
  24459. selector: "valuable",
  24460. protocol: "accessing",
  24461. fn: function (){
  24462. var self=this,$self=this;
  24463. return $self["@valuable"];
  24464. },
  24465. args: [],
  24466. source: "valuable\x0a\x09^ valuable",
  24467. referencedClasses: [],
  24468. messageSends: []
  24469. }),
  24470. $globals.AnnouncementValuable);
  24471. $core.addMethod(
  24472. $core.method({
  24473. selector: "valuable:",
  24474. protocol: "accessing",
  24475. fn: function (anObject){
  24476. var self=this,$self=this;
  24477. $self["@valuable"]=anObject;
  24478. return self;
  24479. },
  24480. args: ["anObject"],
  24481. source: "valuable: anObject\x0a\x09valuable := anObject",
  24482. referencedClasses: [],
  24483. messageSends: []
  24484. }),
  24485. $globals.AnnouncementValuable);
  24486. $core.addMethod(
  24487. $core.method({
  24488. selector: "value",
  24489. protocol: "evaluating",
  24490. fn: function (){
  24491. var self=this,$self=this;
  24492. return $core.withContext(function($ctx1) {
  24493. return $recv($self._valuable())._value();
  24494. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24495. },
  24496. args: [],
  24497. source: "value\x0a\x09^ self valuable value",
  24498. referencedClasses: [],
  24499. messageSends: ["value", "valuable"]
  24500. }),
  24501. $globals.AnnouncementValuable);
  24502. $core.addMethod(
  24503. $core.method({
  24504. selector: "value:",
  24505. protocol: "evaluating",
  24506. fn: function (anObject){
  24507. var self=this,$self=this;
  24508. return $core.withContext(function($ctx1) {
  24509. return $recv($self._valuable())._value_(anObject);
  24510. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24511. },
  24512. args: ["anObject"],
  24513. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24514. referencedClasses: [],
  24515. messageSends: ["value:", "valuable"]
  24516. }),
  24517. $globals.AnnouncementValuable);
  24518. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24519. $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' ].";
  24520. $core.addMethod(
  24521. $core.method({
  24522. selector: "announce:",
  24523. protocol: "announcing",
  24524. fn: function (anAnnouncement){
  24525. var self=this,$self=this;
  24526. return $core.withContext(function($ctx1) {
  24527. $recv($self["@subscriptions"])._do_((function(each){
  24528. return $core.withContext(function($ctx2) {
  24529. return $recv(each)._deliver_(anAnnouncement);
  24530. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24531. }));
  24532. return self;
  24533. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24534. },
  24535. args: ["anAnnouncement"],
  24536. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24537. referencedClasses: [],
  24538. messageSends: ["do:", "deliver:"]
  24539. }),
  24540. $globals.Announcer);
  24541. $core.addMethod(
  24542. $core.method({
  24543. selector: "initialize",
  24544. protocol: "initialization",
  24545. fn: function (){
  24546. var self=this,$self=this;
  24547. return $core.withContext(function($ctx1) {
  24548. (
  24549. $ctx1.supercall = true,
  24550. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24551. $ctx1.supercall = false;
  24552. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24553. return self;
  24554. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24555. },
  24556. args: [],
  24557. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24558. referencedClasses: ["OrderedCollection"],
  24559. messageSends: ["initialize", "new"]
  24560. }),
  24561. $globals.Announcer);
  24562. $core.addMethod(
  24563. $core.method({
  24564. selector: "on:do:",
  24565. protocol: "subscribing",
  24566. fn: function (aClass,aBlock){
  24567. var self=this,$self=this;
  24568. return $core.withContext(function($ctx1) {
  24569. $self._on_do_for_(aClass,aBlock,nil);
  24570. return self;
  24571. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24572. },
  24573. args: ["aClass", "aBlock"],
  24574. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24575. referencedClasses: [],
  24576. messageSends: ["on:do:for:"]
  24577. }),
  24578. $globals.Announcer);
  24579. $core.addMethod(
  24580. $core.method({
  24581. selector: "on:do:for:",
  24582. protocol: "subscribing",
  24583. fn: function (aClass,aBlock,aReceiver){
  24584. var self=this,$self=this;
  24585. return $core.withContext(function($ctx1) {
  24586. var $1,$3,$5,$6,$4,$2;
  24587. $1=$self["@subscriptions"];
  24588. $3=$recv($globals.AnnouncementSubscription)._new();
  24589. $ctx1.sendIdx["new"]=1;
  24590. $5=$recv($globals.AnnouncementValuable)._new();
  24591. $recv($5)._valuable_(aBlock);
  24592. $recv($5)._receiver_(aReceiver);
  24593. $6=$recv($5)._yourself();
  24594. $ctx1.sendIdx["yourself"]=1;
  24595. $4=$6;
  24596. $recv($3)._valuable_($4);
  24597. $ctx1.sendIdx["valuable:"]=1;
  24598. $recv($3)._announcementClass_(aClass);
  24599. $2=$recv($3)._yourself();
  24600. $recv($1)._add_($2);
  24601. return self;
  24602. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24603. },
  24604. args: ["aClass", "aBlock", "aReceiver"],
  24605. 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)",
  24606. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24607. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24608. }),
  24609. $globals.Announcer);
  24610. $core.addMethod(
  24611. $core.method({
  24612. selector: "on:doOnce:",
  24613. protocol: "subscribing",
  24614. fn: function (aClass,aBlock){
  24615. var self=this,$self=this;
  24616. var subscription;
  24617. return $core.withContext(function($ctx1) {
  24618. var $1;
  24619. $1=$recv($globals.AnnouncementSubscription)._new();
  24620. $recv($1)._announcementClass_(aClass);
  24621. subscription=$recv($1)._yourself();
  24622. $recv(subscription)._valuable_((function(ann){
  24623. return $core.withContext(function($ctx2) {
  24624. $recv($self["@subscriptions"])._remove_(subscription);
  24625. return $recv(aBlock)._value_(ann);
  24626. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24627. }));
  24628. $recv($self["@subscriptions"])._add_(subscription);
  24629. return self;
  24630. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24631. },
  24632. args: ["aClass", "aBlock"],
  24633. 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",
  24634. referencedClasses: ["AnnouncementSubscription"],
  24635. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24636. }),
  24637. $globals.Announcer);
  24638. $core.addMethod(
  24639. $core.method({
  24640. selector: "on:send:to:",
  24641. protocol: "subscribing",
  24642. fn: function (aClass,aSelector,anObject){
  24643. var self=this,$self=this;
  24644. return $core.withContext(function($ctx1) {
  24645. var $1,$3,$5,$6,$4,$2;
  24646. $1=$self["@subscriptions"];
  24647. $3=$recv($globals.AnnouncementSubscription)._new();
  24648. $ctx1.sendIdx["new"]=1;
  24649. $5=$recv($globals.MessageSend)._new();
  24650. $recv($5)._receiver_(anObject);
  24651. $recv($5)._selector_(aSelector);
  24652. $6=$recv($5)._yourself();
  24653. $ctx1.sendIdx["yourself"]=1;
  24654. $4=$6;
  24655. $recv($3)._valuable_($4);
  24656. $recv($3)._announcementClass_(aClass);
  24657. $2=$recv($3)._yourself();
  24658. $recv($1)._add_($2);
  24659. return self;
  24660. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24661. },
  24662. args: ["aClass", "aSelector", "anObject"],
  24663. 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)",
  24664. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24665. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24666. }),
  24667. $globals.Announcer);
  24668. $core.addMethod(
  24669. $core.method({
  24670. selector: "unsubscribe:",
  24671. protocol: "subscribing",
  24672. fn: function (anObject){
  24673. var self=this,$self=this;
  24674. return $core.withContext(function($ctx1) {
  24675. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24676. return $core.withContext(function($ctx2) {
  24677. return $recv($recv(each)._receiver()).__eq(anObject);
  24678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24679. }));
  24680. return self;
  24681. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24682. },
  24683. args: ["anObject"],
  24684. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24685. referencedClasses: [],
  24686. messageSends: ["reject:", "=", "receiver"]
  24687. }),
  24688. $globals.Announcer);
  24689. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24690. $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`";
  24691. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24692. $core.addMethod(
  24693. $core.method({
  24694. selector: "current",
  24695. protocol: "accessing",
  24696. fn: function (){
  24697. var self=this,$self=this;
  24698. return $core.withContext(function($ctx1) {
  24699. var $1,$receiver;
  24700. $1=$self["@current"];
  24701. if(($receiver = $1) == null || $receiver.a$nil){
  24702. $self["@current"]=(
  24703. $ctx1.supercall = true,
  24704. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24705. $ctx1.supercall = false;
  24706. return $self["@current"];
  24707. } else {
  24708. return $1;
  24709. }
  24710. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24711. },
  24712. args: [],
  24713. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24714. referencedClasses: [],
  24715. messageSends: ["ifNil:", "new"]
  24716. }),
  24717. $globals.SystemAnnouncer.a$cls);
  24718. $core.addMethod(
  24719. $core.method({
  24720. selector: "new",
  24721. protocol: "instance creation",
  24722. fn: function (){
  24723. var self=this,$self=this;
  24724. return $core.withContext(function($ctx1) {
  24725. $self._shouldNotImplement();
  24726. return self;
  24727. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24728. },
  24729. args: [],
  24730. source: "new\x0a\x09self shouldNotImplement",
  24731. referencedClasses: [],
  24732. messageSends: ["shouldNotImplement"]
  24733. }),
  24734. $globals.SystemAnnouncer.a$cls);
  24735. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24736. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24737. $core.addMethod(
  24738. $core.method({
  24739. selector: "classTag",
  24740. protocol: "accessing",
  24741. fn: function (){
  24742. var self=this,$self=this;
  24743. return "announcement";
  24744. },
  24745. args: [],
  24746. 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'",
  24747. referencedClasses: [],
  24748. messageSends: []
  24749. }),
  24750. $globals.SystemAnnouncement.a$cls);
  24751. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24752. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24753. $core.addMethod(
  24754. $core.method({
  24755. selector: "theClass",
  24756. protocol: "accessing",
  24757. fn: function (){
  24758. var self=this,$self=this;
  24759. return $self["@theClass"];
  24760. },
  24761. args: [],
  24762. source: "theClass\x0a\x09^ theClass",
  24763. referencedClasses: [],
  24764. messageSends: []
  24765. }),
  24766. $globals.ClassAnnouncement);
  24767. $core.addMethod(
  24768. $core.method({
  24769. selector: "theClass:",
  24770. protocol: "accessing",
  24771. fn: function (aClass){
  24772. var self=this,$self=this;
  24773. $self["@theClass"]=aClass;
  24774. return self;
  24775. },
  24776. args: ["aClass"],
  24777. source: "theClass: aClass\x0a\x09theClass := aClass",
  24778. referencedClasses: [],
  24779. messageSends: []
  24780. }),
  24781. $globals.ClassAnnouncement);
  24782. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24783. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24784. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24785. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24786. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24787. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24788. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24789. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24790. $core.addMethod(
  24791. $core.method({
  24792. selector: "oldClass",
  24793. protocol: "accessing",
  24794. fn: function (){
  24795. var self=this,$self=this;
  24796. return $self["@oldClass"];
  24797. },
  24798. args: [],
  24799. source: "oldClass\x0a\x09^ oldClass",
  24800. referencedClasses: [],
  24801. messageSends: []
  24802. }),
  24803. $globals.ClassMigrated);
  24804. $core.addMethod(
  24805. $core.method({
  24806. selector: "oldClass:",
  24807. protocol: "accessing",
  24808. fn: function (aClass){
  24809. var self=this,$self=this;
  24810. $self["@oldClass"]=aClass;
  24811. return self;
  24812. },
  24813. args: ["aClass"],
  24814. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24815. referencedClasses: [],
  24816. messageSends: []
  24817. }),
  24818. $globals.ClassMigrated);
  24819. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24820. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24821. $core.addMethod(
  24822. $core.method({
  24823. selector: "oldPackage",
  24824. protocol: "accessing",
  24825. fn: function (){
  24826. var self=this,$self=this;
  24827. return $self["@oldPackage"];
  24828. },
  24829. args: [],
  24830. source: "oldPackage\x0a\x09^ oldPackage",
  24831. referencedClasses: [],
  24832. messageSends: []
  24833. }),
  24834. $globals.ClassMoved);
  24835. $core.addMethod(
  24836. $core.method({
  24837. selector: "oldPackage:",
  24838. protocol: "accessing",
  24839. fn: function (aPackage){
  24840. var self=this,$self=this;
  24841. $self["@oldPackage"]=aPackage;
  24842. return self;
  24843. },
  24844. args: ["aPackage"],
  24845. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24846. referencedClasses: [],
  24847. messageSends: []
  24848. }),
  24849. $globals.ClassMoved);
  24850. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24851. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24852. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24853. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24854. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24855. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24856. $core.addMethod(
  24857. $core.method({
  24858. selector: "method",
  24859. protocol: "accessing",
  24860. fn: function (){
  24861. var self=this,$self=this;
  24862. return $self["@method"];
  24863. },
  24864. args: [],
  24865. source: "method\x0a\x09^ method",
  24866. referencedClasses: [],
  24867. messageSends: []
  24868. }),
  24869. $globals.MethodAnnouncement);
  24870. $core.addMethod(
  24871. $core.method({
  24872. selector: "method:",
  24873. protocol: "accessing",
  24874. fn: function (aCompiledMethod){
  24875. var self=this,$self=this;
  24876. $self["@method"]=aCompiledMethod;
  24877. return self;
  24878. },
  24879. args: ["aCompiledMethod"],
  24880. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24881. referencedClasses: [],
  24882. messageSends: []
  24883. }),
  24884. $globals.MethodAnnouncement);
  24885. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24886. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24887. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24888. $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.";
  24889. $core.addMethod(
  24890. $core.method({
  24891. selector: "oldMethod",
  24892. protocol: "accessing",
  24893. fn: function (){
  24894. var self=this,$self=this;
  24895. return $self["@oldMethod"];
  24896. },
  24897. args: [],
  24898. source: "oldMethod\x0a\x09^ oldMethod",
  24899. referencedClasses: [],
  24900. messageSends: []
  24901. }),
  24902. $globals.MethodModified);
  24903. $core.addMethod(
  24904. $core.method({
  24905. selector: "oldMethod:",
  24906. protocol: "accessing",
  24907. fn: function (aMethod){
  24908. var self=this,$self=this;
  24909. $self["@oldMethod"]=aMethod;
  24910. return self;
  24911. },
  24912. args: ["aMethod"],
  24913. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24914. referencedClasses: [],
  24915. messageSends: []
  24916. }),
  24917. $globals.MethodModified);
  24918. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24919. $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.";
  24920. $core.addMethod(
  24921. $core.method({
  24922. selector: "oldProtocol",
  24923. protocol: "accessing",
  24924. fn: function (){
  24925. var self=this,$self=this;
  24926. return $self["@oldProtocol"];
  24927. },
  24928. args: [],
  24929. source: "oldProtocol\x0a\x09^ oldProtocol",
  24930. referencedClasses: [],
  24931. messageSends: []
  24932. }),
  24933. $globals.MethodMoved);
  24934. $core.addMethod(
  24935. $core.method({
  24936. selector: "oldProtocol:",
  24937. protocol: "accessing",
  24938. fn: function (aString){
  24939. var self=this,$self=this;
  24940. $self["@oldProtocol"]=aString;
  24941. return self;
  24942. },
  24943. args: ["aString"],
  24944. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24945. referencedClasses: [],
  24946. messageSends: []
  24947. }),
  24948. $globals.MethodMoved);
  24949. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24950. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24951. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24952. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24953. $core.addMethod(
  24954. $core.method({
  24955. selector: "package",
  24956. protocol: "accessing",
  24957. fn: function (){
  24958. var self=this,$self=this;
  24959. return $self["@package"];
  24960. },
  24961. args: [],
  24962. source: "package\x0a\x09^ package",
  24963. referencedClasses: [],
  24964. messageSends: []
  24965. }),
  24966. $globals.PackageAnnouncement);
  24967. $core.addMethod(
  24968. $core.method({
  24969. selector: "package:",
  24970. protocol: "accessing",
  24971. fn: function (aPackage){
  24972. var self=this,$self=this;
  24973. $self["@package"]=aPackage;
  24974. return self;
  24975. },
  24976. args: ["aPackage"],
  24977. source: "package: aPackage\x0a\x09package := aPackage",
  24978. referencedClasses: [],
  24979. messageSends: []
  24980. }),
  24981. $globals.PackageAnnouncement);
  24982. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24983. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  24984. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24985. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  24986. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24987. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  24988. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  24989. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  24990. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  24991. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  24992. $core.addMethod(
  24993. $core.method({
  24994. selector: "package",
  24995. protocol: "accessing",
  24996. fn: function (){
  24997. var self=this,$self=this;
  24998. return $core.withContext(function($ctx1) {
  24999. var $1,$receiver;
  25000. $1=$self._theClass();
  25001. if(($receiver = $1) == null || $receiver.a$nil){
  25002. return $1;
  25003. } else {
  25004. var class_;
  25005. class_=$receiver;
  25006. return $recv(class_)._packageOfProtocol_($self._protocol());
  25007. }
  25008. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  25009. },
  25010. args: [],
  25011. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  25012. referencedClasses: [],
  25013. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25014. }),
  25015. $globals.ProtocolAnnouncement);
  25016. $core.addMethod(
  25017. $core.method({
  25018. selector: "protocol",
  25019. protocol: "accessing",
  25020. fn: function (){
  25021. var self=this,$self=this;
  25022. return $self["@protocol"];
  25023. },
  25024. args: [],
  25025. source: "protocol\x0a\x09^ protocol",
  25026. referencedClasses: [],
  25027. messageSends: []
  25028. }),
  25029. $globals.ProtocolAnnouncement);
  25030. $core.addMethod(
  25031. $core.method({
  25032. selector: "protocol:",
  25033. protocol: "accessing",
  25034. fn: function (aString){
  25035. var self=this,$self=this;
  25036. $self["@protocol"]=aString;
  25037. return self;
  25038. },
  25039. args: ["aString"],
  25040. source: "protocol: aString\x0a\x09protocol := aString",
  25041. referencedClasses: [],
  25042. messageSends: []
  25043. }),
  25044. $globals.ProtocolAnnouncement);
  25045. $core.addMethod(
  25046. $core.method({
  25047. selector: "theClass",
  25048. protocol: "accessing",
  25049. fn: function (){
  25050. var self=this,$self=this;
  25051. return $self["@theClass"];
  25052. },
  25053. args: [],
  25054. source: "theClass\x0a\x09^ theClass",
  25055. referencedClasses: [],
  25056. messageSends: []
  25057. }),
  25058. $globals.ProtocolAnnouncement);
  25059. $core.addMethod(
  25060. $core.method({
  25061. selector: "theClass:",
  25062. protocol: "accessing",
  25063. fn: function (aClass){
  25064. var self=this,$self=this;
  25065. $self["@theClass"]=aClass;
  25066. return self;
  25067. },
  25068. args: ["aClass"],
  25069. source: "theClass: aClass\x0a\x09theClass := aClass",
  25070. referencedClasses: [],
  25071. messageSends: []
  25072. }),
  25073. $globals.ProtocolAnnouncement);
  25074. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25075. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25076. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25077. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25078. });
  25079. 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";
  25080. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25081. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25082. $core.addPackage("Platform-Services");
  25083. ($core.packageDescriptors||$core.packages)["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  25084. ($core.packageDescriptors||$core.packages)["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25085. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25086. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25087. $core.addMethod(
  25088. $core.method({
  25089. selector: "handleError:",
  25090. protocol: "error handling",
  25091. fn: function (anError){
  25092. var self=this,$self=this;
  25093. return $core.withContext(function($ctx1) {
  25094. var $1,$receiver;
  25095. $1=$recv(anError)._context();
  25096. $ctx1.sendIdx["context"]=1;
  25097. if(($receiver = $1) == null || $receiver.a$nil){
  25098. $1;
  25099. } else {
  25100. $self._logErrorContext_($recv(anError)._context());
  25101. }
  25102. $self._logError_(anError);
  25103. return self;
  25104. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25105. },
  25106. args: ["anError"],
  25107. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25108. referencedClasses: [],
  25109. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25110. }),
  25111. $globals.ConsoleErrorHandler);
  25112. $core.addMethod(
  25113. $core.method({
  25114. selector: "log:",
  25115. protocol: "private",
  25116. fn: function (aString){
  25117. var self=this,$self=this;
  25118. return $core.withContext(function($ctx1) {
  25119. $recv(console)._log_(aString);
  25120. return self;
  25121. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25122. },
  25123. args: ["aString"],
  25124. source: "log: aString\x0a\x09console log: aString",
  25125. referencedClasses: [],
  25126. messageSends: ["log:"]
  25127. }),
  25128. $globals.ConsoleErrorHandler);
  25129. $core.addMethod(
  25130. $core.method({
  25131. selector: "logContext:",
  25132. protocol: "private",
  25133. fn: function (aContext){
  25134. var self=this,$self=this;
  25135. return $core.withContext(function($ctx1) {
  25136. var $1,$receiver;
  25137. $1=$recv(aContext)._home();
  25138. $ctx1.sendIdx["home"]=1;
  25139. if(($receiver = $1) == null || $receiver.a$nil){
  25140. $1;
  25141. } else {
  25142. $self._logContext_($recv(aContext)._home());
  25143. }
  25144. $self._log_($recv(aContext)._asString());
  25145. return self;
  25146. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25147. },
  25148. args: ["aContext"],
  25149. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25150. referencedClasses: [],
  25151. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25152. }),
  25153. $globals.ConsoleErrorHandler);
  25154. $core.addMethod(
  25155. $core.method({
  25156. selector: "logError:",
  25157. protocol: "private",
  25158. fn: function (anError){
  25159. var self=this,$self=this;
  25160. return $core.withContext(function($ctx1) {
  25161. $self._log_($recv(anError)._messageText());
  25162. return self;
  25163. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25164. },
  25165. args: ["anError"],
  25166. source: "logError: anError\x0a\x09self log: anError messageText",
  25167. referencedClasses: [],
  25168. messageSends: ["log:", "messageText"]
  25169. }),
  25170. $globals.ConsoleErrorHandler);
  25171. $core.addMethod(
  25172. $core.method({
  25173. selector: "logErrorContext:",
  25174. protocol: "private",
  25175. fn: function (aContext){
  25176. var self=this,$self=this;
  25177. return $core.withContext(function($ctx1) {
  25178. var $1,$receiver;
  25179. if(($receiver = aContext) == null || $receiver.a$nil){
  25180. aContext;
  25181. } else {
  25182. $1=$recv(aContext)._home();
  25183. $ctx1.sendIdx["home"]=1;
  25184. if(($receiver = $1) == null || $receiver.a$nil){
  25185. $1;
  25186. } else {
  25187. $self._logContext_($recv(aContext)._home());
  25188. }
  25189. }
  25190. return self;
  25191. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25192. },
  25193. args: ["aContext"],
  25194. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25195. referencedClasses: [],
  25196. messageSends: ["ifNotNil:", "home", "logContext:"]
  25197. }),
  25198. $globals.ConsoleErrorHandler);
  25199. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25200. $core.addMethod(
  25201. $core.method({
  25202. selector: "initialize",
  25203. protocol: "initialization",
  25204. fn: function (){
  25205. var self=this,$self=this;
  25206. return $core.withContext(function($ctx1) {
  25207. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25208. return self;
  25209. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25210. },
  25211. args: [],
  25212. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25213. referencedClasses: ["ErrorHandler"],
  25214. messageSends: ["registerIfNone:", "new"]
  25215. }),
  25216. $globals.ConsoleErrorHandler.a$cls);
  25217. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25218. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25219. $core.addMethod(
  25220. $core.method({
  25221. selector: "clear",
  25222. protocol: "printing",
  25223. fn: function (){
  25224. var self=this,$self=this;
  25225. return self;
  25226. },
  25227. args: [],
  25228. source: "clear\x0a\x09\x22no op\x22",
  25229. referencedClasses: [],
  25230. messageSends: []
  25231. }),
  25232. $globals.ConsoleTranscript);
  25233. $core.addMethod(
  25234. $core.method({
  25235. selector: "cr",
  25236. protocol: "printing",
  25237. fn: function (){
  25238. var self=this,$self=this;
  25239. return self;
  25240. },
  25241. args: [],
  25242. source: "cr\x0a\x09\x22no op\x22",
  25243. referencedClasses: [],
  25244. messageSends: []
  25245. }),
  25246. $globals.ConsoleTranscript);
  25247. $core.addMethod(
  25248. $core.method({
  25249. selector: "open",
  25250. protocol: "actions",
  25251. fn: function (){
  25252. var self=this,$self=this;
  25253. return self;
  25254. },
  25255. args: [],
  25256. source: "open",
  25257. referencedClasses: [],
  25258. messageSends: []
  25259. }),
  25260. $globals.ConsoleTranscript);
  25261. $core.addMethod(
  25262. $core.method({
  25263. selector: "show:",
  25264. protocol: "printing",
  25265. fn: function (anObject){
  25266. var self=this,$self=this;
  25267. return $core.withContext(function($ctx1) {
  25268. console.log(String($recv(anObject)._asString()));
  25269. return self;
  25270. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25271. },
  25272. args: ["anObject"],
  25273. 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()))'>",
  25274. referencedClasses: [],
  25275. messageSends: []
  25276. }),
  25277. $globals.ConsoleTranscript);
  25278. $core.addMethod(
  25279. $core.method({
  25280. selector: "initialize",
  25281. protocol: "initialization",
  25282. fn: function (){
  25283. var self=this,$self=this;
  25284. return $core.withContext(function($ctx1) {
  25285. $recv($globals.Transcript)._registerIfNone_($self._new());
  25286. return self;
  25287. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25288. },
  25289. args: [],
  25290. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25291. referencedClasses: ["Transcript"],
  25292. messageSends: ["registerIfNone:", "new"]
  25293. }),
  25294. $globals.ConsoleTranscript.a$cls);
  25295. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25296. $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.";
  25297. $core.addMethod(
  25298. $core.method({
  25299. selector: "addInstVarNamed:to:",
  25300. protocol: "compiling",
  25301. fn: function (aString,aClass){
  25302. var self=this,$self=this;
  25303. return $core.withContext(function($ctx1) {
  25304. var $1,$2,$3,$5,$4;
  25305. $1=$self._classBuilder();
  25306. $2=$recv(aClass)._superclass();
  25307. $3=$recv(aClass)._name();
  25308. $ctx1.sendIdx["name"]=1;
  25309. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  25310. $recv($5)._add_(aString);
  25311. $4=$recv($5)._yourself();
  25312. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  25313. return self;
  25314. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  25315. },
  25316. args: ["aString", "aClass"],
  25317. source: "addInstVarNamed: aString to: aClass\x0a\x09self classBuilder\x0a\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09named: aClass name \x0a\x09\x09instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)\x0a\x09\x09package: aClass package name",
  25318. referencedClasses: [],
  25319. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  25320. }),
  25321. $globals.Environment);
  25322. $core.addMethod(
  25323. $core.method({
  25324. selector: "allSelectors",
  25325. protocol: "accessing",
  25326. fn: function (){
  25327. var self=this,$self=this;
  25328. return $core.withContext(function($ctx1) {
  25329. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25330. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25331. },
  25332. args: [],
  25333. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25334. referencedClasses: ["Smalltalk"],
  25335. messageSends: ["allSelectors", "core"]
  25336. }),
  25337. $globals.Environment);
  25338. $core.addMethod(
  25339. $core.method({
  25340. selector: "availableClassNames",
  25341. protocol: "accessing",
  25342. fn: function (){
  25343. var self=this,$self=this;
  25344. return $core.withContext(function($ctx1) {
  25345. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25346. return $core.withContext(function($ctx2) {
  25347. return $recv(each)._name();
  25348. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25349. }));
  25350. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25351. },
  25352. args: [],
  25353. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25354. referencedClasses: ["Smalltalk"],
  25355. messageSends: ["collect:", "classes", "name"]
  25356. }),
  25357. $globals.Environment);
  25358. $core.addMethod(
  25359. $core.method({
  25360. selector: "availablePackageNames",
  25361. protocol: "accessing",
  25362. fn: function (){
  25363. var self=this,$self=this;
  25364. return $core.withContext(function($ctx1) {
  25365. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25366. return $core.withContext(function($ctx2) {
  25367. return $recv(each)._name();
  25368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25369. }));
  25370. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25371. },
  25372. args: [],
  25373. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25374. referencedClasses: ["Smalltalk"],
  25375. messageSends: ["collect:", "packages", "name"]
  25376. }),
  25377. $globals.Environment);
  25378. $core.addMethod(
  25379. $core.method({
  25380. selector: "availableProtocolsFor:",
  25381. protocol: "accessing",
  25382. fn: function (aClass){
  25383. var self=this,$self=this;
  25384. var protocols;
  25385. return $core.withContext(function($ctx1) {
  25386. var $1,$receiver;
  25387. protocols=$recv(aClass)._protocols();
  25388. $1=$recv(aClass)._superclass();
  25389. $ctx1.sendIdx["superclass"]=1;
  25390. if(($receiver = $1) == null || $receiver.a$nil){
  25391. $1;
  25392. } else {
  25393. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25394. }
  25395. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25396. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25397. },
  25398. args: ["aClass"],
  25399. 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",
  25400. referencedClasses: [],
  25401. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25402. }),
  25403. $globals.Environment);
  25404. $core.addMethod(
  25405. $core.method({
  25406. selector: "classBuilder",
  25407. protocol: "accessing",
  25408. fn: function (){
  25409. var self=this,$self=this;
  25410. return $core.withContext(function($ctx1) {
  25411. return $recv($globals.ClassBuilder)._new();
  25412. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25413. },
  25414. args: [],
  25415. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25416. referencedClasses: ["ClassBuilder"],
  25417. messageSends: ["new"]
  25418. }),
  25419. $globals.Environment);
  25420. $core.addMethod(
  25421. $core.method({
  25422. selector: "classNamed:",
  25423. protocol: "accessing",
  25424. fn: function (aString){
  25425. var self=this,$self=this;
  25426. return $core.withContext(function($ctx1) {
  25427. var $1,$receiver;
  25428. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25429. if(($receiver = $1) == null || $receiver.a$nil){
  25430. return $self._error_("Invalid class name");
  25431. } else {
  25432. return $1;
  25433. }
  25434. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25435. },
  25436. args: ["aString"],
  25437. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25438. referencedClasses: ["Smalltalk"],
  25439. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25440. }),
  25441. $globals.Environment);
  25442. $core.addMethod(
  25443. $core.method({
  25444. selector: "classes",
  25445. protocol: "accessing",
  25446. fn: function (){
  25447. var self=this,$self=this;
  25448. return $core.withContext(function($ctx1) {
  25449. return $recv($globals.Smalltalk)._classes();
  25450. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25451. },
  25452. args: [],
  25453. source: "classes\x0a\x09^ Smalltalk classes",
  25454. referencedClasses: ["Smalltalk"],
  25455. messageSends: ["classes"]
  25456. }),
  25457. $globals.Environment);
  25458. $core.addMethod(
  25459. $core.method({
  25460. selector: "commitPackage:onSuccess:onError:",
  25461. protocol: "actions",
  25462. fn: function (aPackage,aBlock,anotherBlock){
  25463. var self=this,$self=this;
  25464. return $core.withContext(function($ctx1) {
  25465. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25466. return self;
  25467. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25468. },
  25469. args: ["aPackage", "aBlock", "anotherBlock"],
  25470. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25471. referencedClasses: [],
  25472. messageSends: ["commitOnSuccess:onError:", "transport"]
  25473. }),
  25474. $globals.Environment);
  25475. $core.addMethod(
  25476. $core.method({
  25477. selector: "compileClassComment:for:",
  25478. protocol: "compiling",
  25479. fn: function (aString,aClass){
  25480. var self=this,$self=this;
  25481. return $core.withContext(function($ctx1) {
  25482. $recv(aClass)._comment_(aString);
  25483. return self;
  25484. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25485. },
  25486. args: ["aString", "aClass"],
  25487. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25488. referencedClasses: [],
  25489. messageSends: ["comment:"]
  25490. }),
  25491. $globals.Environment);
  25492. $core.addMethod(
  25493. $core.method({
  25494. selector: "compileClassDefinition:",
  25495. protocol: "compiling",
  25496. fn: function (aString){
  25497. var self=this,$self=this;
  25498. return $core.withContext(function($ctx1) {
  25499. $recv((function(){
  25500. return $core.withContext(function($ctx2) {
  25501. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25503. }))._on_do_($globals.Error,(function(error){
  25504. return $core.withContext(function($ctx2) {
  25505. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25506. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25507. }));
  25508. return self;
  25509. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25510. },
  25511. args: ["aString"],
  25512. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25513. referencedClasses: ["DoIt", "Error", "Terminal"],
  25514. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25515. }),
  25516. $globals.Environment);
  25517. $core.addMethod(
  25518. $core.method({
  25519. selector: "compileMethod:for:protocol:",
  25520. protocol: "compiling",
  25521. fn: function (sourceCode,class_,protocol){
  25522. var self=this,$self=this;
  25523. return $core.withContext(function($ctx1) {
  25524. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25525. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25526. },
  25527. args: ["sourceCode", "class", "protocol"],
  25528. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25529. referencedClasses: [],
  25530. messageSends: ["compile:protocol:"]
  25531. }),
  25532. $globals.Environment);
  25533. $core.addMethod(
  25534. $core.method({
  25535. selector: "copyClass:to:",
  25536. protocol: "actions",
  25537. fn: function (aClass,aClassName){
  25538. var self=this,$self=this;
  25539. return $core.withContext(function($ctx1) {
  25540. var $1,$2,$receiver;
  25541. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25542. if(($receiver = $1) == null || $receiver.a$nil){
  25543. $1;
  25544. } else {
  25545. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25546. $ctx1.sendIdx[","]=1;
  25547. $self._error_($2);
  25548. }
  25549. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25550. return self;
  25551. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25552. },
  25553. args: ["aClass", "aClassName"],
  25554. 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",
  25555. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25556. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25557. }),
  25558. $globals.Environment);
  25559. $core.addMethod(
  25560. $core.method({
  25561. selector: "doItReceiver",
  25562. protocol: "accessing",
  25563. fn: function (){
  25564. var self=this,$self=this;
  25565. return $core.withContext(function($ctx1) {
  25566. return $recv($globals.DoIt)._new();
  25567. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25568. },
  25569. args: [],
  25570. source: "doItReceiver\x0a\x09^ DoIt new",
  25571. referencedClasses: ["DoIt"],
  25572. messageSends: ["new"]
  25573. }),
  25574. $globals.Environment);
  25575. $core.addMethod(
  25576. $core.method({
  25577. selector: "evaluate:for:",
  25578. protocol: "evaluating",
  25579. fn: function (aString,anObject){
  25580. var self=this,$self=this;
  25581. return $core.withContext(function($ctx1) {
  25582. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25583. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25584. },
  25585. args: ["aString", "anObject"],
  25586. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25587. referencedClasses: ["Evaluator"],
  25588. messageSends: ["evaluate:for:"]
  25589. }),
  25590. $globals.Environment);
  25591. $core.addMethod(
  25592. $core.method({
  25593. selector: "evaluate:on:do:",
  25594. protocol: "error handling",
  25595. fn: function (aBlock,anErrorClass,exceptionBlock){
  25596. var self=this,$self=this;
  25597. return $core.withContext(function($ctx1) {
  25598. var $1;
  25599. $recv(aBlock)._tryCatch_((function(exception){
  25600. return $core.withContext(function($ctx2) {
  25601. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25602. if($core.assert($1)){
  25603. return $recv(exceptionBlock)._value_(exception);
  25604. } else {
  25605. return $recv(exception)._resignal();
  25606. }
  25607. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25608. }));
  25609. return self;
  25610. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25611. },
  25612. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25613. 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 ] ]",
  25614. referencedClasses: [],
  25615. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  25616. }),
  25617. $globals.Environment);
  25618. $core.addMethod(
  25619. $core.method({
  25620. selector: "inspect:",
  25621. protocol: "actions",
  25622. fn: function (anObject){
  25623. var self=this,$self=this;
  25624. return $core.withContext(function($ctx1) {
  25625. $recv($globals.Inspector)._inspect_(anObject);
  25626. return self;
  25627. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25628. },
  25629. args: ["anObject"],
  25630. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25631. referencedClasses: ["Inspector"],
  25632. messageSends: ["inspect:"]
  25633. }),
  25634. $globals.Environment);
  25635. $core.addMethod(
  25636. $core.method({
  25637. selector: "moveClass:toPackage:",
  25638. protocol: "actions",
  25639. fn: function (aClass,aPackageName){
  25640. var self=this,$self=this;
  25641. var package_;
  25642. return $core.withContext(function($ctx1) {
  25643. var $1,$2,$receiver;
  25644. package_=$recv($globals.Package)._named_(aPackageName);
  25645. $1=package_;
  25646. if(($receiver = $1) == null || $receiver.a$nil){
  25647. $self._error_("Invalid package name");
  25648. } else {
  25649. $1;
  25650. }
  25651. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25652. if($core.assert($2)){
  25653. return self;
  25654. }
  25655. $recv(aClass)._package_(package_);
  25656. $recv(aClass)._recompile();
  25657. return self;
  25658. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25659. },
  25660. args: ["aClass", "aPackageName"],
  25661. 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",
  25662. referencedClasses: ["Package"],
  25663. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25664. }),
  25665. $globals.Environment);
  25666. $core.addMethod(
  25667. $core.method({
  25668. selector: "moveMethod:toClass:",
  25669. protocol: "actions",
  25670. fn: function (aMethod,aClassName){
  25671. var self=this,$self=this;
  25672. var destinationClass;
  25673. return $core.withContext(function($ctx1) {
  25674. var $2,$3,$1,$5,$4;
  25675. destinationClass=$self._classNamed_(aClassName);
  25676. $2=destinationClass;
  25677. $3=$recv(aMethod)._methodClass();
  25678. $ctx1.sendIdx["methodClass"]=1;
  25679. $1=$recv($2).__eq_eq($3);
  25680. if($core.assert($1)){
  25681. return self;
  25682. }
  25683. $5=$recv(aMethod)._methodClass();
  25684. $ctx1.sendIdx["methodClass"]=2;
  25685. $4=$recv($5)._isMetaclass();
  25686. if($core.assert($4)){
  25687. destinationClass=$recv(destinationClass)._theMetaClass();
  25688. destinationClass;
  25689. }
  25690. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25691. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25692. return self;
  25693. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25694. },
  25695. args: ["aMethod", "aClassName"],
  25696. 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",
  25697. referencedClasses: [],
  25698. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25699. }),
  25700. $globals.Environment);
  25701. $core.addMethod(
  25702. $core.method({
  25703. selector: "moveMethod:toProtocol:",
  25704. protocol: "actions",
  25705. fn: function (aMethod,aProtocol){
  25706. var self=this,$self=this;
  25707. return $core.withContext(function($ctx1) {
  25708. $recv(aMethod)._protocol_(aProtocol);
  25709. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25710. return self;
  25711. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25712. },
  25713. args: ["aMethod", "aProtocol"],
  25714. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25715. referencedClasses: [],
  25716. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25717. }),
  25718. $globals.Environment);
  25719. $core.addMethod(
  25720. $core.method({
  25721. selector: "packages",
  25722. protocol: "accessing",
  25723. fn: function (){
  25724. var self=this,$self=this;
  25725. return $core.withContext(function($ctx1) {
  25726. return $recv($globals.Smalltalk)._packages();
  25727. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25728. },
  25729. args: [],
  25730. source: "packages\x0a\x09^ Smalltalk packages",
  25731. referencedClasses: ["Smalltalk"],
  25732. messageSends: ["packages"]
  25733. }),
  25734. $globals.Environment);
  25735. $core.addMethod(
  25736. $core.method({
  25737. selector: "registerErrorHandler:",
  25738. protocol: "services",
  25739. fn: function (anErrorHandler){
  25740. var self=this,$self=this;
  25741. return $core.withContext(function($ctx1) {
  25742. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25743. return self;
  25744. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25745. },
  25746. args: ["anErrorHandler"],
  25747. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25748. referencedClasses: ["ErrorHandler"],
  25749. messageSends: ["register:"]
  25750. }),
  25751. $globals.Environment);
  25752. $core.addMethod(
  25753. $core.method({
  25754. selector: "registerFinder:",
  25755. protocol: "services",
  25756. fn: function (aFinder){
  25757. var self=this,$self=this;
  25758. return $core.withContext(function($ctx1) {
  25759. $recv($globals.Finder)._register_(aFinder);
  25760. return self;
  25761. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25762. },
  25763. args: ["aFinder"],
  25764. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25765. referencedClasses: ["Finder"],
  25766. messageSends: ["register:"]
  25767. }),
  25768. $globals.Environment);
  25769. $core.addMethod(
  25770. $core.method({
  25771. selector: "registerInspector:",
  25772. protocol: "services",
  25773. fn: function (anInspector){
  25774. var self=this,$self=this;
  25775. return $core.withContext(function($ctx1) {
  25776. $recv($globals.Inspector)._register_(anInspector);
  25777. return self;
  25778. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25779. },
  25780. args: ["anInspector"],
  25781. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25782. referencedClasses: ["Inspector"],
  25783. messageSends: ["register:"]
  25784. }),
  25785. $globals.Environment);
  25786. $core.addMethod(
  25787. $core.method({
  25788. selector: "registerProgressHandler:",
  25789. protocol: "services",
  25790. fn: function (aProgressHandler){
  25791. var self=this,$self=this;
  25792. return $core.withContext(function($ctx1) {
  25793. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25794. return self;
  25795. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25796. },
  25797. args: ["aProgressHandler"],
  25798. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25799. referencedClasses: ["ProgressHandler"],
  25800. messageSends: ["register:"]
  25801. }),
  25802. $globals.Environment);
  25803. $core.addMethod(
  25804. $core.method({
  25805. selector: "registerTranscript:",
  25806. protocol: "services",
  25807. fn: function (aTranscript){
  25808. var self=this,$self=this;
  25809. return $core.withContext(function($ctx1) {
  25810. $recv($globals.Transcript)._register_(aTranscript);
  25811. return self;
  25812. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25813. },
  25814. args: ["aTranscript"],
  25815. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25816. referencedClasses: ["Transcript"],
  25817. messageSends: ["register:"]
  25818. }),
  25819. $globals.Environment);
  25820. $core.addMethod(
  25821. $core.method({
  25822. selector: "removeClass:",
  25823. protocol: "actions",
  25824. fn: function (aClass){
  25825. var self=this,$self=this;
  25826. return $core.withContext(function($ctx1) {
  25827. $recv($globals.Smalltalk)._removeClass_(aClass);
  25828. return self;
  25829. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25830. },
  25831. args: ["aClass"],
  25832. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25833. referencedClasses: ["Smalltalk"],
  25834. messageSends: ["removeClass:"]
  25835. }),
  25836. $globals.Environment);
  25837. $core.addMethod(
  25838. $core.method({
  25839. selector: "removeMethod:",
  25840. protocol: "actions",
  25841. fn: function (aMethod){
  25842. var self=this,$self=this;
  25843. return $core.withContext(function($ctx1) {
  25844. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25845. return self;
  25846. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25847. },
  25848. args: ["aMethod"],
  25849. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25850. referencedClasses: [],
  25851. messageSends: ["removeCompiledMethod:", "methodClass"]
  25852. }),
  25853. $globals.Environment);
  25854. $core.addMethod(
  25855. $core.method({
  25856. selector: "removeProtocol:from:",
  25857. protocol: "actions",
  25858. fn: function (aString,aClass){
  25859. var self=this,$self=this;
  25860. return $core.withContext(function($ctx1) {
  25861. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25862. return $core.withContext(function($ctx2) {
  25863. return $recv(aClass)._removeCompiledMethod_(each);
  25864. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25865. }));
  25866. return self;
  25867. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25868. },
  25869. args: ["aString", "aClass"],
  25870. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25871. referencedClasses: [],
  25872. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25873. }),
  25874. $globals.Environment);
  25875. $core.addMethod(
  25876. $core.method({
  25877. selector: "renameClass:to:",
  25878. protocol: "actions",
  25879. fn: function (aClass,aClassName){
  25880. var self=this,$self=this;
  25881. return $core.withContext(function($ctx1) {
  25882. var $1,$2,$receiver;
  25883. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25884. if(($receiver = $1) == null || $receiver.a$nil){
  25885. $1;
  25886. } else {
  25887. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25888. $ctx1.sendIdx[","]=1;
  25889. $self._error_($2);
  25890. }
  25891. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25892. return self;
  25893. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25894. },
  25895. args: ["aClass", "aClassName"],
  25896. 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",
  25897. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25898. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25899. }),
  25900. $globals.Environment);
  25901. $core.addMethod(
  25902. $core.method({
  25903. selector: "renamePackage:to:",
  25904. protocol: "actions",
  25905. fn: function (aPackageName,aNewPackageName){
  25906. var self=this,$self=this;
  25907. return $core.withContext(function($ctx1) {
  25908. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25909. return self;
  25910. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25911. },
  25912. args: ["aPackageName", "aNewPackageName"],
  25913. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25914. referencedClasses: ["Smalltalk"],
  25915. messageSends: ["renamePackage:to:"]
  25916. }),
  25917. $globals.Environment);
  25918. $core.addMethod(
  25919. $core.method({
  25920. selector: "renameProtocol:to:in:",
  25921. protocol: "actions",
  25922. fn: function (aString,anotherString,aClass){
  25923. var self=this,$self=this;
  25924. return $core.withContext(function($ctx1) {
  25925. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25926. return $core.withContext(function($ctx2) {
  25927. return $recv(each)._protocol_(anotherString);
  25928. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25929. }));
  25930. return self;
  25931. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25932. },
  25933. args: ["aString", "anotherString", "aClass"],
  25934. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25935. referencedClasses: [],
  25936. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25937. }),
  25938. $globals.Environment);
  25939. $core.addMethod(
  25940. $core.method({
  25941. selector: "setClassCommentOf:to:",
  25942. protocol: "actions",
  25943. fn: function (aClass,aString){
  25944. var self=this,$self=this;
  25945. return $core.withContext(function($ctx1) {
  25946. $recv(aClass)._comment_(aString);
  25947. return self;
  25948. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25949. },
  25950. args: ["aClass", "aString"],
  25951. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25952. referencedClasses: [],
  25953. messageSends: ["comment:"]
  25954. }),
  25955. $globals.Environment);
  25956. $core.addMethod(
  25957. $core.method({
  25958. selector: "systemAnnouncer",
  25959. protocol: "accessing",
  25960. fn: function (){
  25961. var self=this,$self=this;
  25962. return $core.withContext(function($ctx1) {
  25963. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  25964. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  25965. },
  25966. args: [],
  25967. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  25968. referencedClasses: ["Smalltalk"],
  25969. messageSends: ["current", "at:", "globals"]
  25970. }),
  25971. $globals.Environment);
  25972. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  25973. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  25974. $core.addMethod(
  25975. $core.method({
  25976. selector: "do:on:displaying:",
  25977. protocol: "progress handling",
  25978. fn: function (aBlock,aCollection,aString){
  25979. var self=this,$self=this;
  25980. return $core.withContext(function($ctx1) {
  25981. $recv(aCollection)._do_(aBlock);
  25982. return self;
  25983. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  25984. },
  25985. args: ["aBlock", "aCollection", "aString"],
  25986. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  25987. referencedClasses: [],
  25988. messageSends: ["do:"]
  25989. }),
  25990. $globals.NullProgressHandler);
  25991. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  25992. $core.addMethod(
  25993. $core.method({
  25994. selector: "initialize",
  25995. protocol: "initialization",
  25996. fn: function (){
  25997. var self=this,$self=this;
  25998. return $core.withContext(function($ctx1) {
  25999. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  26000. return self;
  26001. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  26002. },
  26003. args: [],
  26004. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  26005. referencedClasses: ["ProgressHandler"],
  26006. messageSends: ["registerIfNone:", "new"]
  26007. }),
  26008. $globals.NullProgressHandler.a$cls);
  26009. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26010. $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.";
  26011. $globals.Service.a$cls.iVarNames = ["current"];
  26012. $core.addMethod(
  26013. $core.method({
  26014. selector: "current",
  26015. protocol: "accessing",
  26016. fn: function (){
  26017. var self=this,$self=this;
  26018. return $self["@current"];
  26019. },
  26020. args: [],
  26021. source: "current\x0a\x09^ current",
  26022. referencedClasses: [],
  26023. messageSends: []
  26024. }),
  26025. $globals.Service.a$cls);
  26026. $core.addMethod(
  26027. $core.method({
  26028. selector: "new",
  26029. protocol: "instance creation",
  26030. fn: function (){
  26031. var self=this,$self=this;
  26032. return $core.withContext(function($ctx1) {
  26033. $self._shouldNotImplement();
  26034. return self;
  26035. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  26036. },
  26037. args: [],
  26038. source: "new\x0a\x09self shouldNotImplement",
  26039. referencedClasses: [],
  26040. messageSends: ["shouldNotImplement"]
  26041. }),
  26042. $globals.Service.a$cls);
  26043. $core.addMethod(
  26044. $core.method({
  26045. selector: "register:",
  26046. protocol: "registration",
  26047. fn: function (anObject){
  26048. var self=this,$self=this;
  26049. $self["@current"]=anObject;
  26050. return self;
  26051. },
  26052. args: ["anObject"],
  26053. source: "register: anObject\x0a\x09current := anObject",
  26054. referencedClasses: [],
  26055. messageSends: []
  26056. }),
  26057. $globals.Service.a$cls);
  26058. $core.addMethod(
  26059. $core.method({
  26060. selector: "registerIfNone:",
  26061. protocol: "registration",
  26062. fn: function (anObject){
  26063. var self=this,$self=this;
  26064. return $core.withContext(function($ctx1) {
  26065. var $1,$receiver;
  26066. $1=$self._current();
  26067. if(($receiver = $1) == null || $receiver.a$nil){
  26068. $self._register_(anObject);
  26069. } else {
  26070. $1;
  26071. }
  26072. return self;
  26073. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26074. },
  26075. args: ["anObject"],
  26076. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26077. referencedClasses: [],
  26078. messageSends: ["ifNil:", "current", "register:"]
  26079. }),
  26080. $globals.Service.a$cls);
  26081. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26082. $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.";
  26083. $core.addMethod(
  26084. $core.method({
  26085. selector: "handleError:",
  26086. protocol: "error handling",
  26087. fn: function (anError){
  26088. var self=this,$self=this;
  26089. return $core.withContext(function($ctx1) {
  26090. var $1;
  26091. $1=$recv((function(){
  26092. return $core.withContext(function($ctx2) {
  26093. return $recv(anError)._isSmalltalkError();
  26094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26095. }))._tryCatch_((function(){
  26096. return false;
  26097. }));
  26098. if($core.assert($1)){
  26099. $self._handleUnhandledError_(anError);
  26100. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26101. } else {
  26102. var smalltalkError;
  26103. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26104. smalltalkError;
  26105. $recv(smalltalkError)._wrap();
  26106. $self._handleUnhandledError_(smalltalkError);
  26107. }
  26108. return self;
  26109. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26110. },
  26111. args: ["anError"],
  26112. 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 ]",
  26113. referencedClasses: ["JavaScriptException"],
  26114. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26115. }),
  26116. $globals.ErrorHandler.a$cls);
  26117. $core.addMethod(
  26118. $core.method({
  26119. selector: "handleUnhandledError:",
  26120. protocol: "error handling",
  26121. fn: function (anError){
  26122. var self=this,$self=this;
  26123. return $core.withContext(function($ctx1) {
  26124. var $1;
  26125. $1=$recv(anError)._wasHandled();
  26126. if(!$core.assert($1)){
  26127. $recv($self._current())._handleError_(anError);
  26128. $recv(anError)._beHandled();
  26129. }
  26130. return self;
  26131. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26132. },
  26133. args: ["anError"],
  26134. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26135. referencedClasses: [],
  26136. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26137. }),
  26138. $globals.ErrorHandler.a$cls);
  26139. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26140. $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.";
  26141. $core.addMethod(
  26142. $core.method({
  26143. selector: "findClass:",
  26144. protocol: "finding",
  26145. fn: function (aClass){
  26146. var self=this,$self=this;
  26147. return $core.withContext(function($ctx1) {
  26148. return $recv($self._current())._findClass_(aClass);
  26149. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26150. },
  26151. args: ["aClass"],
  26152. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26153. referencedClasses: [],
  26154. messageSends: ["findClass:", "current"]
  26155. }),
  26156. $globals.Finder.a$cls);
  26157. $core.addMethod(
  26158. $core.method({
  26159. selector: "findMethod:",
  26160. protocol: "finding",
  26161. fn: function (aCompiledMethod){
  26162. var self=this,$self=this;
  26163. return $core.withContext(function($ctx1) {
  26164. return $recv($self._current())._findMethod_(aCompiledMethod);
  26165. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26166. },
  26167. args: ["aCompiledMethod"],
  26168. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26169. referencedClasses: [],
  26170. messageSends: ["findMethod:", "current"]
  26171. }),
  26172. $globals.Finder.a$cls);
  26173. $core.addMethod(
  26174. $core.method({
  26175. selector: "findString:",
  26176. protocol: "finding",
  26177. fn: function (aString){
  26178. var self=this,$self=this;
  26179. return $core.withContext(function($ctx1) {
  26180. return $recv($self._current())._findString_(aString);
  26181. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26182. },
  26183. args: ["aString"],
  26184. source: "findString: aString\x0a\x09^ self current findString: aString",
  26185. referencedClasses: [],
  26186. messageSends: ["findString:", "current"]
  26187. }),
  26188. $globals.Finder.a$cls);
  26189. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26190. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26191. $core.addMethod(
  26192. $core.method({
  26193. selector: "inspect:",
  26194. protocol: "inspecting",
  26195. fn: function (anObject){
  26196. var self=this,$self=this;
  26197. return $core.withContext(function($ctx1) {
  26198. return $recv($self._current())._inspect_(anObject);
  26199. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26200. },
  26201. args: ["anObject"],
  26202. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26203. referencedClasses: [],
  26204. messageSends: ["inspect:", "current"]
  26205. }),
  26206. $globals.Inspector.a$cls);
  26207. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26208. $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";
  26209. $core.addMethod(
  26210. $core.method({
  26211. selector: "globals",
  26212. protocol: "accessing",
  26213. fn: function (){
  26214. var self=this,$self=this;
  26215. return $core.withContext(function($ctx1) {
  26216. return $recv($self._current())._globals();
  26217. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26218. },
  26219. args: [],
  26220. source: "globals\x0a\x09^ self current globals",
  26221. referencedClasses: [],
  26222. messageSends: ["globals", "current"]
  26223. }),
  26224. $globals.Platform.a$cls);
  26225. $core.addMethod(
  26226. $core.method({
  26227. selector: "includesGlobal:",
  26228. protocol: "testing",
  26229. fn: function (aString){
  26230. var self=this,$self=this;
  26231. return $core.withContext(function($ctx1) {
  26232. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26233. return true;
  26234. }),(function(){
  26235. return false;
  26236. }));
  26237. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26238. },
  26239. args: ["aString"],
  26240. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26241. referencedClasses: [],
  26242. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26243. }),
  26244. $globals.Platform.a$cls);
  26245. $core.addMethod(
  26246. $core.method({
  26247. selector: "newXhr",
  26248. protocol: "accessing",
  26249. fn: function (){
  26250. var self=this,$self=this;
  26251. return $core.withContext(function($ctx1) {
  26252. return $recv($self._current())._newXhr();
  26253. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26254. },
  26255. args: [],
  26256. source: "newXhr\x0a\x09^ self current newXhr",
  26257. referencedClasses: [],
  26258. messageSends: ["newXhr", "current"]
  26259. }),
  26260. $globals.Platform.a$cls);
  26261. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26262. $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`.";
  26263. $core.addMethod(
  26264. $core.method({
  26265. selector: "do:on:displaying:",
  26266. protocol: "progress handling",
  26267. fn: function (aBlock,aCollection,aString){
  26268. var self=this,$self=this;
  26269. return $core.withContext(function($ctx1) {
  26270. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26271. return self;
  26272. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26273. },
  26274. args: ["aBlock", "aCollection", "aString"],
  26275. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26276. referencedClasses: [],
  26277. messageSends: ["do:on:displaying:", "current"]
  26278. }),
  26279. $globals.ProgressHandler.a$cls);
  26280. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26281. $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:'.";
  26282. $core.addMethod(
  26283. $core.method({
  26284. selector: "alert:",
  26285. protocol: "dialogs",
  26286. fn: function (aString){
  26287. var self=this,$self=this;
  26288. return $core.withContext(function($ctx1) {
  26289. return $recv($self._current())._alert_(aString);
  26290. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26291. },
  26292. args: ["aString"],
  26293. source: "alert: aString\x0a\x09^ self current alert: aString",
  26294. referencedClasses: [],
  26295. messageSends: ["alert:", "current"]
  26296. }),
  26297. $globals.Terminal.a$cls);
  26298. $core.addMethod(
  26299. $core.method({
  26300. selector: "confirm:",
  26301. protocol: "dialogs",
  26302. fn: function (aString){
  26303. var self=this,$self=this;
  26304. return $core.withContext(function($ctx1) {
  26305. return $recv($self._current())._confirm_(aString);
  26306. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26307. },
  26308. args: ["aString"],
  26309. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26310. referencedClasses: [],
  26311. messageSends: ["confirm:", "current"]
  26312. }),
  26313. $globals.Terminal.a$cls);
  26314. $core.addMethod(
  26315. $core.method({
  26316. selector: "prompt:",
  26317. protocol: "dialogs",
  26318. fn: function (aString){
  26319. var self=this,$self=this;
  26320. return $core.withContext(function($ctx1) {
  26321. return $recv($self._current())._prompt_(aString);
  26322. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26323. },
  26324. args: ["aString"],
  26325. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26326. referencedClasses: [],
  26327. messageSends: ["prompt:", "current"]
  26328. }),
  26329. $globals.Terminal.a$cls);
  26330. $core.addMethod(
  26331. $core.method({
  26332. selector: "prompt:default:",
  26333. protocol: "dialogs",
  26334. fn: function (aString,defaultString){
  26335. var self=this,$self=this;
  26336. return $core.withContext(function($ctx1) {
  26337. return $recv($self._current())._prompt_default_(aString,defaultString);
  26338. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26339. },
  26340. args: ["aString", "defaultString"],
  26341. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26342. referencedClasses: [],
  26343. messageSends: ["prompt:default:", "current"]
  26344. }),
  26345. $globals.Terminal.a$cls);
  26346. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26347. $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.";
  26348. $core.addMethod(
  26349. $core.method({
  26350. selector: "clear",
  26351. protocol: "printing",
  26352. fn: function (){
  26353. var self=this,$self=this;
  26354. return $core.withContext(function($ctx1) {
  26355. $recv($self._current())._clear();
  26356. return self;
  26357. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26358. },
  26359. args: [],
  26360. source: "clear\x0a\x09self current clear",
  26361. referencedClasses: [],
  26362. messageSends: ["clear", "current"]
  26363. }),
  26364. $globals.Transcript.a$cls);
  26365. $core.addMethod(
  26366. $core.method({
  26367. selector: "cr",
  26368. protocol: "printing",
  26369. fn: function (){
  26370. var self=this,$self=this;
  26371. return $core.withContext(function($ctx1) {
  26372. $recv($self._current())._show_($recv($globals.String)._cr());
  26373. return self;
  26374. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26375. },
  26376. args: [],
  26377. source: "cr\x0a\x09self current show: String cr",
  26378. referencedClasses: ["String"],
  26379. messageSends: ["show:", "current", "cr"]
  26380. }),
  26381. $globals.Transcript.a$cls);
  26382. $core.addMethod(
  26383. $core.method({
  26384. selector: "inspect:",
  26385. protocol: "printing",
  26386. fn: function (anObject){
  26387. var self=this,$self=this;
  26388. return $core.withContext(function($ctx1) {
  26389. $self._show_(anObject);
  26390. return self;
  26391. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26392. },
  26393. args: ["anObject"],
  26394. source: "inspect: anObject\x0a\x09self show: anObject",
  26395. referencedClasses: [],
  26396. messageSends: ["show:"]
  26397. }),
  26398. $globals.Transcript.a$cls);
  26399. $core.addMethod(
  26400. $core.method({
  26401. selector: "open",
  26402. protocol: "instance creation",
  26403. fn: function (){
  26404. var self=this,$self=this;
  26405. return $core.withContext(function($ctx1) {
  26406. $recv($self._current())._open();
  26407. return self;
  26408. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26409. },
  26410. args: [],
  26411. source: "open\x0a\x09self current open",
  26412. referencedClasses: [],
  26413. messageSends: ["open", "current"]
  26414. }),
  26415. $globals.Transcript.a$cls);
  26416. $core.addMethod(
  26417. $core.method({
  26418. selector: "show:",
  26419. protocol: "printing",
  26420. fn: function (anObject){
  26421. var self=this,$self=this;
  26422. return $core.withContext(function($ctx1) {
  26423. $recv($self._current())._show_(anObject);
  26424. return self;
  26425. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26426. },
  26427. args: ["anObject"],
  26428. source: "show: anObject\x0a\x09self current show: anObject",
  26429. referencedClasses: [],
  26430. messageSends: ["show:", "current"]
  26431. }),
  26432. $globals.Transcript.a$cls);
  26433. $core.addMethod(
  26434. $core.method({
  26435. selector: "inspectOn:",
  26436. protocol: "*Platform-Services",
  26437. fn: function (anInspector){
  26438. var self=this,$self=this;
  26439. var variables;
  26440. return $core.withContext(function($ctx1) {
  26441. variables=$recv($globals.Dictionary)._new();
  26442. $recv(variables)._at_put_("#self",self);
  26443. $ctx1.sendIdx["at:put:"]=1;
  26444. $recv(variables)._at_put_("#keys",$self._keys());
  26445. $ctx1.sendIdx["at:put:"]=2;
  26446. $self._keysAndValuesDo_((function(key,value){
  26447. return $core.withContext(function($ctx2) {
  26448. return $recv(variables)._at_put_(key,value);
  26449. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26450. }));
  26451. $recv(anInspector)._setLabel_($self._printString());
  26452. $recv(anInspector)._setVariables_(variables);
  26453. return self;
  26454. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26455. },
  26456. args: ["anInspector"],
  26457. 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",
  26458. referencedClasses: ["Dictionary"],
  26459. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26460. }),
  26461. $globals.AssociativeCollection);
  26462. $core.addMethod(
  26463. $core.method({
  26464. selector: "inspectOn:",
  26465. protocol: "*Platform-Services",
  26466. fn: function (anInspector){
  26467. var self=this,$self=this;
  26468. var variables;
  26469. return $core.withContext(function($ctx1) {
  26470. variables=$recv($globals.Dictionary)._new();
  26471. $recv(variables)._at_put_("#self",self);
  26472. $ctx1.sendIdx["at:put:"]=1;
  26473. $self._withIndexDo_((function(each,i){
  26474. return $core.withContext(function($ctx2) {
  26475. return $recv(variables)._at_put_(i,each);
  26476. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26477. }));
  26478. $recv(anInspector)._setLabel_($self._printString());
  26479. $recv(anInspector)._setVariables_(variables);
  26480. return self;
  26481. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26482. },
  26483. args: ["anInspector"],
  26484. 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",
  26485. referencedClasses: ["Dictionary"],
  26486. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26487. }),
  26488. $globals.Collection);
  26489. $core.addMethod(
  26490. $core.method({
  26491. selector: "inspectOn:",
  26492. protocol: "*Platform-Services",
  26493. fn: function (anInspector){
  26494. var self=this,$self=this;
  26495. var variables;
  26496. return $core.withContext(function($ctx1) {
  26497. variables=$recv($globals.Dictionary)._new();
  26498. $recv(variables)._at_put_("#self",self);
  26499. $ctx1.sendIdx["at:put:"]=1;
  26500. $recv(variables)._at_put_("#year",$self._year());
  26501. $ctx1.sendIdx["at:put:"]=2;
  26502. $recv(variables)._at_put_("#month",$self._month());
  26503. $ctx1.sendIdx["at:put:"]=3;
  26504. $recv(variables)._at_put_("#day",$self._day());
  26505. $ctx1.sendIdx["at:put:"]=4;
  26506. $recv(variables)._at_put_("#hours",$self._hours());
  26507. $ctx1.sendIdx["at:put:"]=5;
  26508. $recv(variables)._at_put_("#minutes",$self._minutes());
  26509. $ctx1.sendIdx["at:put:"]=6;
  26510. $recv(variables)._at_put_("#seconds",$self._seconds());
  26511. $ctx1.sendIdx["at:put:"]=7;
  26512. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26513. $recv(anInspector)._setLabel_($self._printString());
  26514. $recv(anInspector)._setVariables_(variables);
  26515. return self;
  26516. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26517. },
  26518. args: ["anInspector"],
  26519. 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",
  26520. referencedClasses: ["Dictionary"],
  26521. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26522. }),
  26523. $globals.Date);
  26524. $core.addMethod(
  26525. $core.method({
  26526. selector: "inspectOn:",
  26527. protocol: "*Platform-Services",
  26528. fn: function (anInspector){
  26529. var self=this,$self=this;
  26530. var variables;
  26531. return $core.withContext(function($ctx1) {
  26532. variables=$recv($globals.Dictionary)._new();
  26533. $recv(variables)._at_put_("#self",$self._jsObject());
  26534. $recv(anInspector)._setLabel_($self._printString());
  26535. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26536. $recv(anInspector)._setVariables_(variables);
  26537. return self;
  26538. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26539. },
  26540. args: ["anInspector"],
  26541. 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",
  26542. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26543. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26544. }),
  26545. $globals.JSObjectProxy);
  26546. $core.addMethod(
  26547. $core.method({
  26548. selector: "inspectOn:",
  26549. protocol: "*Platform-Services",
  26550. fn: function (anInspector){
  26551. var self=this,$self=this;
  26552. var variables;
  26553. return $core.withContext(function($ctx1) {
  26554. variables=$recv($globals.Dictionary)._new();
  26555. $recv(variables)._at_put_("#self",self);
  26556. $ctx1.sendIdx["at:put:"]=1;
  26557. $recv(variables)._at_put_("#home",$self._home());
  26558. $ctx1.sendIdx["at:put:"]=2;
  26559. $recv(variables)._at_put_("#receiver",$self._receiver());
  26560. $ctx1.sendIdx["at:put:"]=3;
  26561. $recv(variables)._at_put_("#selector",$self._selector());
  26562. $ctx1.sendIdx["at:put:"]=4;
  26563. $recv(variables)._at_put_("#locals",$self._locals());
  26564. $ctx1.sendIdx["at:put:"]=5;
  26565. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26566. return $core.withContext(function($ctx2) {
  26567. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26568. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26569. }));
  26570. $recv(anInspector)._setLabel_($self._printString());
  26571. $recv(anInspector)._setVariables_(variables);
  26572. return self;
  26573. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26574. },
  26575. args: ["anInspector"],
  26576. 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",
  26577. referencedClasses: ["Dictionary"],
  26578. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26579. }),
  26580. $globals.MethodContext);
  26581. $core.addMethod(
  26582. $core.method({
  26583. selector: "inspectOn:",
  26584. protocol: "*Platform-Services",
  26585. fn: function (anInspector){
  26586. var self=this,$self=this;
  26587. var variables;
  26588. return $core.withContext(function($ctx1) {
  26589. variables=$recv($globals.Dictionary)._new();
  26590. $recv(variables)._at_put_("#self",self);
  26591. $ctx1.sendIdx["at:put:"]=1;
  26592. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26593. return $core.withContext(function($ctx2) {
  26594. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26595. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26596. }));
  26597. $recv(anInspector)._setLabel_($self._printString());
  26598. $recv(anInspector)._setVariables_(variables);
  26599. return self;
  26600. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26601. },
  26602. args: ["anInspector"],
  26603. 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",
  26604. referencedClasses: ["Dictionary"],
  26605. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26606. }),
  26607. $globals.Object);
  26608. $core.addMethod(
  26609. $core.method({
  26610. selector: "do:displayingProgress:",
  26611. protocol: "*Platform-Services",
  26612. fn: function (aBlock,aString){
  26613. var self=this,$self=this;
  26614. return $core.withContext(function($ctx1) {
  26615. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26616. return self;
  26617. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26618. },
  26619. args: ["aBlock", "aString"],
  26620. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26621. referencedClasses: ["ProgressHandler"],
  26622. messageSends: ["do:on:displaying:"]
  26623. }),
  26624. $globals.SequenceableCollection);
  26625. $core.addMethod(
  26626. $core.method({
  26627. selector: "inspectOn:",
  26628. protocol: "*Platform-Services",
  26629. fn: function (anInspector){
  26630. var self=this,$self=this;
  26631. var variables,i;
  26632. return $core.withContext(function($ctx1) {
  26633. variables=$recv($globals.Dictionary)._new();
  26634. $recv(variables)._at_put_("#self",self);
  26635. $ctx1.sendIdx["at:put:"]=1;
  26636. i=(1);
  26637. $self._do_((function(each){
  26638. return $core.withContext(function($ctx2) {
  26639. $recv(variables)._at_put_(i,each);
  26640. i=$recv(i).__plus((1));
  26641. return i;
  26642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26643. }));
  26644. $recv(anInspector)._setLabel_($self._printString());
  26645. $recv(anInspector)._setVariables_(variables);
  26646. return self;
  26647. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26648. },
  26649. args: ["anInspector"],
  26650. 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",
  26651. referencedClasses: ["Dictionary"],
  26652. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26653. }),
  26654. $globals.Set);
  26655. $core.addMethod(
  26656. $core.method({
  26657. selector: "inspectOn:",
  26658. protocol: "*Platform-Services",
  26659. fn: function (anInspector){
  26660. var self=this,$self=this;
  26661. var label;
  26662. return $core.withContext(function($ctx1) {
  26663. var $3,$2,$1,$5,$4;
  26664. (
  26665. $ctx1.supercall = true,
  26666. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26667. $ctx1.supercall = false;
  26668. $3=$self._printString();
  26669. $ctx1.sendIdx["printString"]=1;
  26670. $2=$recv($3)._size();
  26671. $1=$recv($2).__gt((30));
  26672. if($core.assert($1)){
  26673. $5=$self._printString();
  26674. $ctx1.sendIdx["printString"]=2;
  26675. $4=$recv($5)._copyFrom_to_((1),(30));
  26676. label=$recv($4).__comma("...'");
  26677. label;
  26678. } else {
  26679. label=$self._printString();
  26680. label;
  26681. }
  26682. $recv(anInspector)._setLabel_(label);
  26683. return self;
  26684. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26685. },
  26686. args: ["anInspector"],
  26687. 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",
  26688. referencedClasses: [],
  26689. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26690. }),
  26691. $globals.String);
  26692. });
  26693. define('amber/deploy',[
  26694. './helpers',
  26695. './boot', // pre-fetch, dep of ./helpers
  26696. // --- packages of the core Amber begin here ---
  26697. 'amber_core/Kernel-Helpers',
  26698. 'amber_core/Kernel-Objects',
  26699. 'amber_core/Kernel-Classes',
  26700. 'amber_core/Kernel-Methods',
  26701. 'amber_core/Kernel-Collections',
  26702. 'amber_core/Kernel-Dag',
  26703. 'amber_core/Kernel-Infrastructure',
  26704. 'amber_core/Kernel-Promises',
  26705. 'amber_core/Kernel-Exceptions',
  26706. 'amber_core/Kernel-Announcements',
  26707. 'amber_core/Platform-Services',
  26708. // --- packages of the core Amber end here ---
  26709. ], function (amber) {
  26710. return amber;
  26711. });
  26712. // jshint ignore:start
  26713. define('amber/parser',['./boot'], function($boot) {
  26714. var $globals = $boot.globals;
  26715. $globals.SmalltalkParser = (function() {
  26716. "use strict";
  26717. /*
  26718. * Generated by PEG.js 0.9.0.
  26719. *
  26720. * http://pegjs.org/
  26721. */
  26722. function peg$subclass(child, parent) {
  26723. function ctor() { this.constructor = child; }
  26724. ctor.prototype = parent.prototype;
  26725. child.prototype = new ctor();
  26726. }
  26727. function peg$SyntaxError(message, expected, found, location) {
  26728. this.message = message;
  26729. this.expected = expected;
  26730. this.found = found;
  26731. this.location = location;
  26732. this.name = "SyntaxError";
  26733. if (typeof Error.captureStackTrace === "function") {
  26734. Error.captureStackTrace(this, peg$SyntaxError);
  26735. }
  26736. }
  26737. peg$subclass(peg$SyntaxError, Error);
  26738. function peg$parse(input) {
  26739. var options = arguments.length > 1 ? arguments[1] : {},
  26740. parser = this,
  26741. peg$FAILED = {},
  26742. peg$startRuleFunctions = { start: peg$parsestart },
  26743. peg$startRuleFunction = peg$parsestart,
  26744. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26745. 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]" },
  26746. peg$c2 = "\"",
  26747. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26748. peg$c4 = /^[^"]/,
  26749. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26750. peg$c6 = ".",
  26751. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26752. peg$c8 = /^[a-zA-Z]/,
  26753. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26754. peg$c10 = /^[a-zA-Z0-9]/,
  26755. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26756. peg$c12 = ":",
  26757. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26758. peg$c14 = /^[A-Z]/,
  26759. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26760. peg$c16 = function(val) {
  26761. return $globals.ValueNode._new()
  26762. ._location_(location())
  26763. ._source_(text())
  26764. ._value_(val);
  26765. },
  26766. peg$c17 = "'",
  26767. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26768. peg$c19 = "''",
  26769. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26770. peg$c21 = function() {return '\'';},
  26771. peg$c22 = /^[^']/,
  26772. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26773. peg$c24 = function(val) {return val.join('');},
  26774. peg$c25 = "$",
  26775. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26776. peg$c27 = { type: "any", description: "any character" },
  26777. peg$c28 = function(char) {
  26778. return $globals.ValueNode._new()
  26779. ._location_(location())
  26780. ._source_(text())
  26781. ._value_(char);
  26782. },
  26783. peg$c29 = "#",
  26784. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26785. peg$c31 = function(rest) {return rest;},
  26786. peg$c32 = "e",
  26787. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26788. peg$c34 = function(n) {return parseFloat(n);},
  26789. peg$c35 = "-",
  26790. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26791. peg$c37 = "16r",
  26792. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26793. peg$c39 = /^[0-9a-fA-F]/,
  26794. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26795. peg$c41 = function(neg, num) {
  26796. return parseInt(((neg || '') + num), 16);
  26797. },
  26798. peg$c42 = /^[0-9]/,
  26799. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26800. peg$c44 = function(n) {return parseFloat(n, 10);},
  26801. peg$c45 = function(n) {return parseInt(n, 10);},
  26802. peg$c46 = "#(",
  26803. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26804. peg$c48 = ")",
  26805. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26806. peg$c50 = function(rest) {
  26807. return rest
  26808. ._location_(location())
  26809. ._source_(text());
  26810. },
  26811. peg$c51 = "(",
  26812. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26813. peg$c53 = function(lit) {return lit._value();},
  26814. peg$c54 = function(lits) {
  26815. return $globals.ValueNode._new()
  26816. ._value_(lits);
  26817. },
  26818. peg$c55 = "{",
  26819. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26820. peg$c57 = "}",
  26821. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26822. peg$c59 = function(expressions) {
  26823. return $globals.DynamicArrayNode._new()
  26824. ._location_(location())
  26825. ._source_(text())
  26826. ._dagChildren_(expressions || []);
  26827. },
  26828. peg$c60 = "#{",
  26829. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26830. peg$c62 = function(expressions) {
  26831. return $globals.DynamicDictionaryNode._new()
  26832. ._location_(location())
  26833. ._source_(text())
  26834. ._dagChildren_(expressions || []);
  26835. },
  26836. peg$c63 = "true",
  26837. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26838. peg$c65 = function() {return true;},
  26839. peg$c66 = "false",
  26840. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26841. peg$c68 = function() {return false;},
  26842. peg$c69 = "nil",
  26843. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26844. peg$c71 = function() {return null;},
  26845. peg$c72 = function(identifier) {
  26846. return $globals.VariableNode._new()
  26847. ._location_(location())
  26848. ._source_(text())
  26849. ._value_(identifier);
  26850. },
  26851. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26852. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26853. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26854. peg$c76 = function(pairs) {
  26855. var selector = '';
  26856. var params = [];
  26857. for(var i = 0; i < pairs.length; i++) {
  26858. selector += pairs[i].key;
  26859. params.push(pairs[i].arg);
  26860. }
  26861. return [selector, params];
  26862. },
  26863. peg$c77 = function(selector, arg) {
  26864. return [selector, [arg]];
  26865. },
  26866. peg$c78 = function(selector) {return [selector, []];},
  26867. peg$c79 = function(expression) {
  26868. return expression;
  26869. },
  26870. peg$c80 = function(first, others) {
  26871. return [first].concat(others);
  26872. },
  26873. peg$c81 = ":=",
  26874. peg$c82 = { type: "literal", value: ":=", description: "\":=\"" },
  26875. peg$c83 = function(variable, expression) {
  26876. return $globals.AssignmentNode._new()
  26877. ._location_(location())
  26878. ._source_(text())
  26879. ._left_(variable)
  26880. ._right_(expression);
  26881. },
  26882. peg$c84 = "^",
  26883. peg$c85 = { type: "literal", value: "^", description: "\"^\"" },
  26884. peg$c86 = function(expression) {
  26885. return $globals.ReturnNode._new()
  26886. ._location_(location())
  26887. ._source_(text())
  26888. ._dagChildren_([expression]);
  26889. },
  26890. peg$c87 = "|",
  26891. peg$c88 = { type: "literal", value: "|", description: "\"|\"" },
  26892. peg$c89 = function(variable) {return variable;},
  26893. peg$c90 = function(vars) {
  26894. return vars;
  26895. },
  26896. peg$c91 = function(param) {return param;},
  26897. peg$c92 = function(params) {
  26898. return params;
  26899. },
  26900. peg$c93 = function(ret) {return [ret];},
  26901. peg$c94 = function(exps, ret) {
  26902. var expressions = exps;
  26903. expressions.push(ret);
  26904. return expressions;
  26905. },
  26906. peg$c95 = function(expressions) {return expressions || [];},
  26907. peg$c96 = function(js) {return js;},
  26908. peg$c97 = function(temps, statements) {
  26909. return $globals.SequenceNode._new()
  26910. ._location_(location())
  26911. ._source_(text())
  26912. ._temps_(temps || [])
  26913. ._dagChildren_(statements || []);
  26914. },
  26915. peg$c98 = "[",
  26916. peg$c99 = { type: "literal", value: "[", description: "\"[\"" },
  26917. peg$c100 = "]",
  26918. peg$c101 = { type: "literal", value: "]", description: "\"]\"" },
  26919. peg$c102 = function(params, sequence) {
  26920. return $globals.BlockNode._new()
  26921. ._location_(location())
  26922. ._source_(text())
  26923. ._parameters_(params || [])
  26924. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26925. },
  26926. peg$c103 = function(selector) {
  26927. return $globals.SendNode._new()
  26928. ._location_(location())
  26929. ._source_(text())
  26930. ._selector_(selector);
  26931. },
  26932. peg$c104 = function(receiver, tail) {
  26933. return receiver._withTail_(tail);
  26934. },
  26935. peg$c105 = function(selector, arg) {
  26936. return $globals.SendNode._new()
  26937. ._location_(location())
  26938. ._source_(text())
  26939. ._selector_(selector)
  26940. ._arguments_([arg]);
  26941. },
  26942. peg$c106 = function(pairs) {
  26943. var selector = '';
  26944. var args = [];
  26945. for(var i = 0; i < pairs.length; i++) {
  26946. selector += pairs[i].key;
  26947. args.push(pairs[i].arg);
  26948. }
  26949. return $globals.SendNode._new()
  26950. ._location_(location())
  26951. ._source_(text())
  26952. ._selector_(selector)
  26953. ._arguments_(args);
  26954. },
  26955. peg$c107 = function(receiver, tail) {
  26956. return tail ? receiver._withTail_([tail]) : receiver;
  26957. },
  26958. peg$c108 = function(send) {return send._isSendNode();},
  26959. peg$c109 = ";",
  26960. peg$c110 = { type: "literal", value: ";", description: "\";\"" },
  26961. peg$c111 = function(send, mess) {return mess;},
  26962. peg$c112 = function(send, messages) {
  26963. messages.unshift(send);
  26964. return $globals.CascadeNode._new()
  26965. ._location_(location())
  26966. ._source_(text())
  26967. ._dagChildren_(messages);
  26968. },
  26969. peg$c113 = "<",
  26970. peg$c114 = { type: "literal", value: "<", description: "\"<\"" },
  26971. peg$c115 = ">>",
  26972. peg$c116 = { type: "literal", value: ">>", description: "\">>\"" },
  26973. peg$c117 = function() {return '>';},
  26974. peg$c118 = /^[^>]/,
  26975. peg$c119 = { type: "class", value: "[^>]", description: "[^>]" },
  26976. peg$c120 = ">",
  26977. peg$c121 = { type: "literal", value: ">", description: "\">\"" },
  26978. peg$c122 = function(val) {return !/^\s*inlineJS/.test(val.join(''));},
  26979. peg$c123 = function(val) {
  26980. console.warn('Use of <...js code...> is deprecated, in:\n' + val.join(''));
  26981. return $globals.JSStatementNode._new()
  26982. ._location_(location())
  26983. ._source_(val.join(''))
  26984. },
  26985. peg$c124 = "inlineJS:",
  26986. peg$c125 = { type: "literal", value: "inlineJS:", description: "\"inlineJS:\"" },
  26987. peg$c126 = function(val) {
  26988. return $globals.JSStatementNode._new()
  26989. ._location_(location())
  26990. ._source_(val)
  26991. },
  26992. peg$c127 = function(pattern, sequence) {
  26993. return $globals.MethodNode._new()
  26994. ._location_(location())
  26995. ._source_(text())
  26996. ._selector_(pattern[0])
  26997. ._arguments_(pattern[1])
  26998. ._dagChildren_([sequence]);
  26999. },
  27000. peg$c128 = function(send) { return send._isSendNode() && send._selector() === '->' },
  27001. peg$c129 = function(send) {
  27002. return [send._receiver(), send._arguments()[0]];
  27003. },
  27004. peg$c130 = function(first, others) {
  27005. return first.concat.apply(first, others);
  27006. },
  27007. peg$currPos = 0,
  27008. peg$savedPos = 0,
  27009. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  27010. peg$maxFailPos = 0,
  27011. peg$maxFailExpected = [],
  27012. peg$silentFails = 0,
  27013. peg$resultsCache = {},
  27014. peg$result;
  27015. if ("startRule" in options) {
  27016. if (!(options.startRule in peg$startRuleFunctions)) {
  27017. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27018. }
  27019. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27020. }
  27021. function text() {
  27022. return input.substring(peg$savedPos, peg$currPos);
  27023. }
  27024. function location() {
  27025. return peg$computeLocation(peg$savedPos, peg$currPos);
  27026. }
  27027. function expected(description) {
  27028. throw peg$buildException(
  27029. null,
  27030. [{ type: "other", description: description }],
  27031. input.substring(peg$savedPos, peg$currPos),
  27032. peg$computeLocation(peg$savedPos, peg$currPos)
  27033. );
  27034. }
  27035. function error(message) {
  27036. throw peg$buildException(
  27037. message,
  27038. null,
  27039. input.substring(peg$savedPos, peg$currPos),
  27040. peg$computeLocation(peg$savedPos, peg$currPos)
  27041. );
  27042. }
  27043. function peg$computePosDetails(pos) {
  27044. var details = peg$posDetailsCache[pos],
  27045. p, ch;
  27046. if (details) {
  27047. return details;
  27048. } else {
  27049. p = pos - 1;
  27050. while (!peg$posDetailsCache[p]) {
  27051. p--;
  27052. }
  27053. details = peg$posDetailsCache[p];
  27054. details = {
  27055. line: details.line,
  27056. column: details.column,
  27057. seenCR: details.seenCR
  27058. };
  27059. while (p < pos) {
  27060. ch = input.charAt(p);
  27061. if (ch === "\n") {
  27062. if (!details.seenCR) { details.line++; }
  27063. details.column = 1;
  27064. details.seenCR = false;
  27065. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27066. details.line++;
  27067. details.column = 1;
  27068. details.seenCR = true;
  27069. } else {
  27070. details.column++;
  27071. details.seenCR = false;
  27072. }
  27073. p++;
  27074. }
  27075. peg$posDetailsCache[pos] = details;
  27076. return details;
  27077. }
  27078. }
  27079. function peg$computeLocation(startPos, endPos) {
  27080. var startPosDetails = peg$computePosDetails(startPos),
  27081. endPosDetails = peg$computePosDetails(endPos);
  27082. return {
  27083. start: {
  27084. offset: startPos,
  27085. line: startPosDetails.line,
  27086. column: startPosDetails.column
  27087. },
  27088. end: {
  27089. offset: endPos,
  27090. line: endPosDetails.line,
  27091. column: endPosDetails.column
  27092. }
  27093. };
  27094. }
  27095. function peg$fail(expected) {
  27096. if (peg$currPos < peg$maxFailPos) { return; }
  27097. if (peg$currPos > peg$maxFailPos) {
  27098. peg$maxFailPos = peg$currPos;
  27099. peg$maxFailExpected = [];
  27100. }
  27101. peg$maxFailExpected.push(expected);
  27102. }
  27103. function peg$buildException(message, expected, found, location) {
  27104. function cleanupExpected(expected) {
  27105. var i = 1;
  27106. expected.sort(function(a, b) {
  27107. if (a.description < b.description) {
  27108. return -1;
  27109. } else if (a.description > b.description) {
  27110. return 1;
  27111. } else {
  27112. return 0;
  27113. }
  27114. });
  27115. while (i < expected.length) {
  27116. if (expected[i - 1] === expected[i]) {
  27117. expected.splice(i, 1);
  27118. } else {
  27119. i++;
  27120. }
  27121. }
  27122. }
  27123. function buildMessage(expected, found) {
  27124. function stringEscape(s) {
  27125. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27126. return s
  27127. .replace(/\\/g, '\\\\')
  27128. .replace(/"/g, '\\"')
  27129. .replace(/\x08/g, '\\b')
  27130. .replace(/\t/g, '\\t')
  27131. .replace(/\n/g, '\\n')
  27132. .replace(/\f/g, '\\f')
  27133. .replace(/\r/g, '\\r')
  27134. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27135. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27136. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27137. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27138. }
  27139. var expectedDescs = new Array(expected.length),
  27140. expectedDesc, foundDesc, i;
  27141. for (i = 0; i < expected.length; i++) {
  27142. expectedDescs[i] = expected[i].description;
  27143. }
  27144. expectedDesc = expected.length > 1
  27145. ? expectedDescs.slice(0, -1).join(", ")
  27146. + " or "
  27147. + expectedDescs[expected.length - 1]
  27148. : expectedDescs[0];
  27149. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27150. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27151. }
  27152. if (expected !== null) {
  27153. cleanupExpected(expected);
  27154. }
  27155. return new peg$SyntaxError(
  27156. message !== null ? message : buildMessage(expected, found),
  27157. expected,
  27158. found,
  27159. location
  27160. );
  27161. }
  27162. function peg$parsestart() {
  27163. var s0;
  27164. var key = peg$currPos * 63 + 0,
  27165. cached = peg$resultsCache[key];
  27166. if (cached) {
  27167. peg$currPos = cached.nextPos;
  27168. return cached.result;
  27169. }
  27170. s0 = peg$parsemethod();
  27171. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27172. return s0;
  27173. }
  27174. function peg$parseseparator() {
  27175. var s0, s1;
  27176. var key = peg$currPos * 63 + 1,
  27177. cached = peg$resultsCache[key];
  27178. if (cached) {
  27179. peg$currPos = cached.nextPos;
  27180. return cached.result;
  27181. }
  27182. s0 = [];
  27183. if (peg$c0.test(input.charAt(peg$currPos))) {
  27184. s1 = input.charAt(peg$currPos);
  27185. peg$currPos++;
  27186. } else {
  27187. s1 = peg$FAILED;
  27188. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27189. }
  27190. if (s1 !== peg$FAILED) {
  27191. while (s1 !== peg$FAILED) {
  27192. s0.push(s1);
  27193. if (peg$c0.test(input.charAt(peg$currPos))) {
  27194. s1 = input.charAt(peg$currPos);
  27195. peg$currPos++;
  27196. } else {
  27197. s1 = peg$FAILED;
  27198. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27199. }
  27200. }
  27201. } else {
  27202. s0 = peg$FAILED;
  27203. }
  27204. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27205. return s0;
  27206. }
  27207. function peg$parsecomments() {
  27208. var s0, s1, s2, s3, s4;
  27209. var key = peg$currPos * 63 + 2,
  27210. cached = peg$resultsCache[key];
  27211. if (cached) {
  27212. peg$currPos = cached.nextPos;
  27213. return cached.result;
  27214. }
  27215. s0 = [];
  27216. s1 = peg$currPos;
  27217. if (input.charCodeAt(peg$currPos) === 34) {
  27218. s2 = peg$c2;
  27219. peg$currPos++;
  27220. } else {
  27221. s2 = peg$FAILED;
  27222. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27223. }
  27224. if (s2 !== peg$FAILED) {
  27225. s3 = [];
  27226. if (peg$c4.test(input.charAt(peg$currPos))) {
  27227. s4 = input.charAt(peg$currPos);
  27228. peg$currPos++;
  27229. } else {
  27230. s4 = peg$FAILED;
  27231. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27232. }
  27233. while (s4 !== peg$FAILED) {
  27234. s3.push(s4);
  27235. if (peg$c4.test(input.charAt(peg$currPos))) {
  27236. s4 = input.charAt(peg$currPos);
  27237. peg$currPos++;
  27238. } else {
  27239. s4 = peg$FAILED;
  27240. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27241. }
  27242. }
  27243. if (s3 !== peg$FAILED) {
  27244. if (input.charCodeAt(peg$currPos) === 34) {
  27245. s4 = peg$c2;
  27246. peg$currPos++;
  27247. } else {
  27248. s4 = peg$FAILED;
  27249. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27250. }
  27251. if (s4 !== peg$FAILED) {
  27252. s2 = [s2, s3, s4];
  27253. s1 = s2;
  27254. } else {
  27255. peg$currPos = s1;
  27256. s1 = peg$FAILED;
  27257. }
  27258. } else {
  27259. peg$currPos = s1;
  27260. s1 = peg$FAILED;
  27261. }
  27262. } else {
  27263. peg$currPos = s1;
  27264. s1 = peg$FAILED;
  27265. }
  27266. if (s1 !== peg$FAILED) {
  27267. while (s1 !== peg$FAILED) {
  27268. s0.push(s1);
  27269. s1 = peg$currPos;
  27270. if (input.charCodeAt(peg$currPos) === 34) {
  27271. s2 = peg$c2;
  27272. peg$currPos++;
  27273. } else {
  27274. s2 = peg$FAILED;
  27275. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27276. }
  27277. if (s2 !== peg$FAILED) {
  27278. s3 = [];
  27279. if (peg$c4.test(input.charAt(peg$currPos))) {
  27280. s4 = input.charAt(peg$currPos);
  27281. peg$currPos++;
  27282. } else {
  27283. s4 = peg$FAILED;
  27284. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27285. }
  27286. while (s4 !== peg$FAILED) {
  27287. s3.push(s4);
  27288. if (peg$c4.test(input.charAt(peg$currPos))) {
  27289. s4 = input.charAt(peg$currPos);
  27290. peg$currPos++;
  27291. } else {
  27292. s4 = peg$FAILED;
  27293. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27294. }
  27295. }
  27296. if (s3 !== peg$FAILED) {
  27297. if (input.charCodeAt(peg$currPos) === 34) {
  27298. s4 = peg$c2;
  27299. peg$currPos++;
  27300. } else {
  27301. s4 = peg$FAILED;
  27302. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27303. }
  27304. if (s4 !== peg$FAILED) {
  27305. s2 = [s2, s3, s4];
  27306. s1 = s2;
  27307. } else {
  27308. peg$currPos = s1;
  27309. s1 = peg$FAILED;
  27310. }
  27311. } else {
  27312. peg$currPos = s1;
  27313. s1 = peg$FAILED;
  27314. }
  27315. } else {
  27316. peg$currPos = s1;
  27317. s1 = peg$FAILED;
  27318. }
  27319. }
  27320. } else {
  27321. s0 = peg$FAILED;
  27322. }
  27323. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27324. return s0;
  27325. }
  27326. function peg$parsews() {
  27327. var s0, s1;
  27328. var key = peg$currPos * 63 + 3,
  27329. cached = peg$resultsCache[key];
  27330. if (cached) {
  27331. peg$currPos = cached.nextPos;
  27332. return cached.result;
  27333. }
  27334. s0 = [];
  27335. s1 = peg$parseseparator();
  27336. if (s1 === peg$FAILED) {
  27337. s1 = peg$parsecomments();
  27338. }
  27339. while (s1 !== peg$FAILED) {
  27340. s0.push(s1);
  27341. s1 = peg$parseseparator();
  27342. if (s1 === peg$FAILED) {
  27343. s1 = peg$parsecomments();
  27344. }
  27345. }
  27346. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27347. return s0;
  27348. }
  27349. function peg$parsemaybeDotsWs() {
  27350. var s0, s1;
  27351. var key = peg$currPos * 63 + 4,
  27352. cached = peg$resultsCache[key];
  27353. if (cached) {
  27354. peg$currPos = cached.nextPos;
  27355. return cached.result;
  27356. }
  27357. s0 = [];
  27358. if (input.charCodeAt(peg$currPos) === 46) {
  27359. s1 = peg$c6;
  27360. peg$currPos++;
  27361. } else {
  27362. s1 = peg$FAILED;
  27363. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27364. }
  27365. if (s1 === peg$FAILED) {
  27366. s1 = peg$parseseparator();
  27367. if (s1 === peg$FAILED) {
  27368. s1 = peg$parsecomments();
  27369. }
  27370. }
  27371. while (s1 !== peg$FAILED) {
  27372. s0.push(s1);
  27373. if (input.charCodeAt(peg$currPos) === 46) {
  27374. s1 = peg$c6;
  27375. peg$currPos++;
  27376. } else {
  27377. s1 = peg$FAILED;
  27378. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27379. }
  27380. if (s1 === peg$FAILED) {
  27381. s1 = peg$parseseparator();
  27382. if (s1 === peg$FAILED) {
  27383. s1 = peg$parsecomments();
  27384. }
  27385. }
  27386. }
  27387. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27388. return s0;
  27389. }
  27390. function peg$parsesomeDotsWs() {
  27391. var s0, s1, s2, s3;
  27392. var key = peg$currPos * 63 + 5,
  27393. cached = peg$resultsCache[key];
  27394. if (cached) {
  27395. peg$currPos = cached.nextPos;
  27396. return cached.result;
  27397. }
  27398. s0 = peg$currPos;
  27399. s1 = peg$parsews();
  27400. if (s1 !== peg$FAILED) {
  27401. if (input.charCodeAt(peg$currPos) === 46) {
  27402. s2 = peg$c6;
  27403. peg$currPos++;
  27404. } else {
  27405. s2 = peg$FAILED;
  27406. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27407. }
  27408. if (s2 !== peg$FAILED) {
  27409. s3 = peg$parsemaybeDotsWs();
  27410. if (s3 !== peg$FAILED) {
  27411. s1 = [s1, s2, s3];
  27412. s0 = s1;
  27413. } else {
  27414. peg$currPos = s0;
  27415. s0 = peg$FAILED;
  27416. }
  27417. } else {
  27418. peg$currPos = s0;
  27419. s0 = peg$FAILED;
  27420. }
  27421. } else {
  27422. peg$currPos = s0;
  27423. s0 = peg$FAILED;
  27424. }
  27425. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27426. return s0;
  27427. }
  27428. function peg$parseidentifier() {
  27429. var s0, s1, s2, s3, s4;
  27430. var key = peg$currPos * 63 + 6,
  27431. cached = peg$resultsCache[key];
  27432. if (cached) {
  27433. peg$currPos = cached.nextPos;
  27434. return cached.result;
  27435. }
  27436. s0 = peg$currPos;
  27437. s1 = peg$currPos;
  27438. if (peg$c8.test(input.charAt(peg$currPos))) {
  27439. s2 = input.charAt(peg$currPos);
  27440. peg$currPos++;
  27441. } else {
  27442. s2 = peg$FAILED;
  27443. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27444. }
  27445. if (s2 !== peg$FAILED) {
  27446. s3 = [];
  27447. if (peg$c10.test(input.charAt(peg$currPos))) {
  27448. s4 = input.charAt(peg$currPos);
  27449. peg$currPos++;
  27450. } else {
  27451. s4 = peg$FAILED;
  27452. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27453. }
  27454. while (s4 !== peg$FAILED) {
  27455. s3.push(s4);
  27456. if (peg$c10.test(input.charAt(peg$currPos))) {
  27457. s4 = input.charAt(peg$currPos);
  27458. peg$currPos++;
  27459. } else {
  27460. s4 = peg$FAILED;
  27461. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27462. }
  27463. }
  27464. if (s3 !== peg$FAILED) {
  27465. s2 = [s2, s3];
  27466. s1 = s2;
  27467. } else {
  27468. peg$currPos = s1;
  27469. s1 = peg$FAILED;
  27470. }
  27471. } else {
  27472. peg$currPos = s1;
  27473. s1 = peg$FAILED;
  27474. }
  27475. if (s1 !== peg$FAILED) {
  27476. s0 = input.substring(s0, peg$currPos);
  27477. } else {
  27478. s0 = s1;
  27479. }
  27480. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27481. return s0;
  27482. }
  27483. function peg$parsekeyword() {
  27484. var s0, s1, s2, s3;
  27485. var key = peg$currPos * 63 + 7,
  27486. cached = peg$resultsCache[key];
  27487. if (cached) {
  27488. peg$currPos = cached.nextPos;
  27489. return cached.result;
  27490. }
  27491. s0 = peg$currPos;
  27492. s1 = peg$currPos;
  27493. s2 = peg$parseidentifier();
  27494. if (s2 !== peg$FAILED) {
  27495. if (input.charCodeAt(peg$currPos) === 58) {
  27496. s3 = peg$c12;
  27497. peg$currPos++;
  27498. } else {
  27499. s3 = peg$FAILED;
  27500. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27501. }
  27502. if (s3 !== peg$FAILED) {
  27503. s2 = [s2, s3];
  27504. s1 = s2;
  27505. } else {
  27506. peg$currPos = s1;
  27507. s1 = peg$FAILED;
  27508. }
  27509. } else {
  27510. peg$currPos = s1;
  27511. s1 = peg$FAILED;
  27512. }
  27513. if (s1 !== peg$FAILED) {
  27514. s0 = input.substring(s0, peg$currPos);
  27515. } else {
  27516. s0 = s1;
  27517. }
  27518. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27519. return s0;
  27520. }
  27521. function peg$parseclassName() {
  27522. var s0, s1, s2, s3, s4;
  27523. var key = peg$currPos * 63 + 8,
  27524. cached = peg$resultsCache[key];
  27525. if (cached) {
  27526. peg$currPos = cached.nextPos;
  27527. return cached.result;
  27528. }
  27529. s0 = peg$currPos;
  27530. s1 = peg$currPos;
  27531. if (peg$c14.test(input.charAt(peg$currPos))) {
  27532. s2 = input.charAt(peg$currPos);
  27533. peg$currPos++;
  27534. } else {
  27535. s2 = peg$FAILED;
  27536. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27537. }
  27538. if (s2 !== peg$FAILED) {
  27539. s3 = [];
  27540. if (peg$c10.test(input.charAt(peg$currPos))) {
  27541. s4 = input.charAt(peg$currPos);
  27542. peg$currPos++;
  27543. } else {
  27544. s4 = peg$FAILED;
  27545. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27546. }
  27547. while (s4 !== peg$FAILED) {
  27548. s3.push(s4);
  27549. if (peg$c10.test(input.charAt(peg$currPos))) {
  27550. s4 = input.charAt(peg$currPos);
  27551. peg$currPos++;
  27552. } else {
  27553. s4 = peg$FAILED;
  27554. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27555. }
  27556. }
  27557. if (s3 !== peg$FAILED) {
  27558. s2 = [s2, s3];
  27559. s1 = s2;
  27560. } else {
  27561. peg$currPos = s1;
  27562. s1 = peg$FAILED;
  27563. }
  27564. } else {
  27565. peg$currPos = s1;
  27566. s1 = peg$FAILED;
  27567. }
  27568. if (s1 !== peg$FAILED) {
  27569. s0 = input.substring(s0, peg$currPos);
  27570. } else {
  27571. s0 = s1;
  27572. }
  27573. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27574. return s0;
  27575. }
  27576. function peg$parsestring() {
  27577. var s0, s1;
  27578. var key = peg$currPos * 63 + 9,
  27579. cached = peg$resultsCache[key];
  27580. if (cached) {
  27581. peg$currPos = cached.nextPos;
  27582. return cached.result;
  27583. }
  27584. s0 = peg$currPos;
  27585. s1 = peg$parserawString();
  27586. if (s1 !== peg$FAILED) {
  27587. peg$savedPos = s0;
  27588. s1 = peg$c16(s1);
  27589. }
  27590. s0 = s1;
  27591. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27592. return s0;
  27593. }
  27594. function peg$parserawString() {
  27595. var s0, s1, s2, s3, s4;
  27596. var key = peg$currPos * 63 + 10,
  27597. cached = peg$resultsCache[key];
  27598. if (cached) {
  27599. peg$currPos = cached.nextPos;
  27600. return cached.result;
  27601. }
  27602. s0 = peg$currPos;
  27603. if (input.charCodeAt(peg$currPos) === 39) {
  27604. s1 = peg$c17;
  27605. peg$currPos++;
  27606. } else {
  27607. s1 = peg$FAILED;
  27608. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27609. }
  27610. if (s1 !== peg$FAILED) {
  27611. s2 = [];
  27612. s3 = peg$currPos;
  27613. if (input.substr(peg$currPos, 2) === peg$c19) {
  27614. s4 = peg$c19;
  27615. peg$currPos += 2;
  27616. } else {
  27617. s4 = peg$FAILED;
  27618. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27619. }
  27620. if (s4 !== peg$FAILED) {
  27621. peg$savedPos = s3;
  27622. s4 = peg$c21();
  27623. }
  27624. s3 = s4;
  27625. if (s3 === peg$FAILED) {
  27626. if (peg$c22.test(input.charAt(peg$currPos))) {
  27627. s3 = input.charAt(peg$currPos);
  27628. peg$currPos++;
  27629. } else {
  27630. s3 = peg$FAILED;
  27631. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27632. }
  27633. }
  27634. while (s3 !== peg$FAILED) {
  27635. s2.push(s3);
  27636. s3 = peg$currPos;
  27637. if (input.substr(peg$currPos, 2) === peg$c19) {
  27638. s4 = peg$c19;
  27639. peg$currPos += 2;
  27640. } else {
  27641. s4 = peg$FAILED;
  27642. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27643. }
  27644. if (s4 !== peg$FAILED) {
  27645. peg$savedPos = s3;
  27646. s4 = peg$c21();
  27647. }
  27648. s3 = s4;
  27649. if (s3 === peg$FAILED) {
  27650. if (peg$c22.test(input.charAt(peg$currPos))) {
  27651. s3 = input.charAt(peg$currPos);
  27652. peg$currPos++;
  27653. } else {
  27654. s3 = peg$FAILED;
  27655. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27656. }
  27657. }
  27658. }
  27659. if (s2 !== peg$FAILED) {
  27660. if (input.charCodeAt(peg$currPos) === 39) {
  27661. s3 = peg$c17;
  27662. peg$currPos++;
  27663. } else {
  27664. s3 = peg$FAILED;
  27665. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27666. }
  27667. if (s3 !== peg$FAILED) {
  27668. peg$savedPos = s0;
  27669. s1 = peg$c24(s2);
  27670. s0 = s1;
  27671. } else {
  27672. peg$currPos = s0;
  27673. s0 = peg$FAILED;
  27674. }
  27675. } else {
  27676. peg$currPos = s0;
  27677. s0 = peg$FAILED;
  27678. }
  27679. } else {
  27680. peg$currPos = s0;
  27681. s0 = peg$FAILED;
  27682. }
  27683. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27684. return s0;
  27685. }
  27686. function peg$parsecharacter() {
  27687. var s0, s1, s2;
  27688. var key = peg$currPos * 63 + 11,
  27689. cached = peg$resultsCache[key];
  27690. if (cached) {
  27691. peg$currPos = cached.nextPos;
  27692. return cached.result;
  27693. }
  27694. s0 = peg$currPos;
  27695. if (input.charCodeAt(peg$currPos) === 36) {
  27696. s1 = peg$c25;
  27697. peg$currPos++;
  27698. } else {
  27699. s1 = peg$FAILED;
  27700. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27701. }
  27702. if (s1 !== peg$FAILED) {
  27703. if (input.length > peg$currPos) {
  27704. s2 = input.charAt(peg$currPos);
  27705. peg$currPos++;
  27706. } else {
  27707. s2 = peg$FAILED;
  27708. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27709. }
  27710. if (s2 !== peg$FAILED) {
  27711. peg$savedPos = s0;
  27712. s1 = peg$c28(s2);
  27713. s0 = s1;
  27714. } else {
  27715. peg$currPos = s0;
  27716. s0 = peg$FAILED;
  27717. }
  27718. } else {
  27719. peg$currPos = s0;
  27720. s0 = peg$FAILED;
  27721. }
  27722. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27723. return s0;
  27724. }
  27725. function peg$parsesymbol() {
  27726. var s0, s1, s2;
  27727. var key = peg$currPos * 63 + 12,
  27728. cached = peg$resultsCache[key];
  27729. if (cached) {
  27730. peg$currPos = cached.nextPos;
  27731. return cached.result;
  27732. }
  27733. s0 = peg$currPos;
  27734. if (input.charCodeAt(peg$currPos) === 35) {
  27735. s1 = peg$c29;
  27736. peg$currPos++;
  27737. } else {
  27738. s1 = peg$FAILED;
  27739. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27740. }
  27741. if (s1 !== peg$FAILED) {
  27742. s2 = peg$parsebareSymbol();
  27743. if (s2 !== peg$FAILED) {
  27744. peg$savedPos = s0;
  27745. s1 = peg$c31(s2);
  27746. s0 = s1;
  27747. } else {
  27748. peg$currPos = s0;
  27749. s0 = peg$FAILED;
  27750. }
  27751. } else {
  27752. peg$currPos = s0;
  27753. s0 = peg$FAILED;
  27754. }
  27755. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27756. return s0;
  27757. }
  27758. function peg$parsebareSymbol() {
  27759. var s0, s1, s2, s3;
  27760. var key = peg$currPos * 63 + 13,
  27761. cached = peg$resultsCache[key];
  27762. if (cached) {
  27763. peg$currPos = cached.nextPos;
  27764. return cached.result;
  27765. }
  27766. s0 = peg$currPos;
  27767. s1 = peg$currPos;
  27768. s2 = [];
  27769. s3 = peg$parsekeyword();
  27770. if (s3 !== peg$FAILED) {
  27771. while (s3 !== peg$FAILED) {
  27772. s2.push(s3);
  27773. s3 = peg$parsekeyword();
  27774. }
  27775. } else {
  27776. s2 = peg$FAILED;
  27777. }
  27778. if (s2 !== peg$FAILED) {
  27779. s1 = input.substring(s1, peg$currPos);
  27780. } else {
  27781. s1 = s2;
  27782. }
  27783. if (s1 === peg$FAILED) {
  27784. s1 = peg$parsebinarySelector();
  27785. if (s1 === peg$FAILED) {
  27786. s1 = peg$parseidentifier();
  27787. if (s1 === peg$FAILED) {
  27788. s1 = peg$parserawString();
  27789. }
  27790. }
  27791. }
  27792. if (s1 !== peg$FAILED) {
  27793. peg$savedPos = s0;
  27794. s1 = peg$c16(s1);
  27795. }
  27796. s0 = s1;
  27797. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27798. return s0;
  27799. }
  27800. function peg$parsenumber() {
  27801. var s0, s1;
  27802. var key = peg$currPos * 63 + 14,
  27803. cached = peg$resultsCache[key];
  27804. if (cached) {
  27805. peg$currPos = cached.nextPos;
  27806. return cached.result;
  27807. }
  27808. s0 = peg$currPos;
  27809. s1 = peg$parserawNumber();
  27810. if (s1 !== peg$FAILED) {
  27811. peg$savedPos = s0;
  27812. s1 = peg$c16(s1);
  27813. }
  27814. s0 = s1;
  27815. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27816. return s0;
  27817. }
  27818. function peg$parserawNumber() {
  27819. var s0;
  27820. var key = peg$currPos * 63 + 15,
  27821. cached = peg$resultsCache[key];
  27822. if (cached) {
  27823. peg$currPos = cached.nextPos;
  27824. return cached.result;
  27825. }
  27826. s0 = peg$parsenumberExp();
  27827. if (s0 === peg$FAILED) {
  27828. s0 = peg$parsehex();
  27829. if (s0 === peg$FAILED) {
  27830. s0 = peg$parsefloat();
  27831. if (s0 === peg$FAILED) {
  27832. s0 = peg$parseinteger();
  27833. }
  27834. }
  27835. }
  27836. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27837. return s0;
  27838. }
  27839. function peg$parsenumberExp() {
  27840. var s0, s1, s2, s3, s4, s5;
  27841. var key = peg$currPos * 63 + 16,
  27842. cached = peg$resultsCache[key];
  27843. if (cached) {
  27844. peg$currPos = cached.nextPos;
  27845. return cached.result;
  27846. }
  27847. s0 = peg$currPos;
  27848. s1 = peg$currPos;
  27849. s2 = peg$currPos;
  27850. s3 = peg$parsefloat();
  27851. if (s3 === peg$FAILED) {
  27852. s3 = peg$parseinteger();
  27853. }
  27854. if (s3 !== peg$FAILED) {
  27855. if (input.charCodeAt(peg$currPos) === 101) {
  27856. s4 = peg$c32;
  27857. peg$currPos++;
  27858. } else {
  27859. s4 = peg$FAILED;
  27860. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27861. }
  27862. if (s4 !== peg$FAILED) {
  27863. s5 = peg$parseinteger();
  27864. if (s5 !== peg$FAILED) {
  27865. s3 = [s3, s4, s5];
  27866. s2 = s3;
  27867. } else {
  27868. peg$currPos = s2;
  27869. s2 = peg$FAILED;
  27870. }
  27871. } else {
  27872. peg$currPos = s2;
  27873. s2 = peg$FAILED;
  27874. }
  27875. } else {
  27876. peg$currPos = s2;
  27877. s2 = peg$FAILED;
  27878. }
  27879. if (s2 !== peg$FAILED) {
  27880. s1 = input.substring(s1, peg$currPos);
  27881. } else {
  27882. s1 = s2;
  27883. }
  27884. if (s1 !== peg$FAILED) {
  27885. peg$savedPos = s0;
  27886. s1 = peg$c34(s1);
  27887. }
  27888. s0 = s1;
  27889. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27890. return s0;
  27891. }
  27892. function peg$parsehex() {
  27893. var s0, s1, s2, s3, s4, s5;
  27894. var key = peg$currPos * 63 + 17,
  27895. cached = peg$resultsCache[key];
  27896. if (cached) {
  27897. peg$currPos = cached.nextPos;
  27898. return cached.result;
  27899. }
  27900. s0 = peg$currPos;
  27901. if (input.charCodeAt(peg$currPos) === 45) {
  27902. s1 = peg$c35;
  27903. peg$currPos++;
  27904. } else {
  27905. s1 = peg$FAILED;
  27906. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27907. }
  27908. if (s1 === peg$FAILED) {
  27909. s1 = null;
  27910. }
  27911. if (s1 !== peg$FAILED) {
  27912. if (input.substr(peg$currPos, 3) === peg$c37) {
  27913. s2 = peg$c37;
  27914. peg$currPos += 3;
  27915. } else {
  27916. s2 = peg$FAILED;
  27917. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27918. }
  27919. if (s2 !== peg$FAILED) {
  27920. s3 = peg$currPos;
  27921. s4 = [];
  27922. if (peg$c39.test(input.charAt(peg$currPos))) {
  27923. s5 = input.charAt(peg$currPos);
  27924. peg$currPos++;
  27925. } else {
  27926. s5 = peg$FAILED;
  27927. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27928. }
  27929. if (s5 !== peg$FAILED) {
  27930. while (s5 !== peg$FAILED) {
  27931. s4.push(s5);
  27932. if (peg$c39.test(input.charAt(peg$currPos))) {
  27933. s5 = input.charAt(peg$currPos);
  27934. peg$currPos++;
  27935. } else {
  27936. s5 = peg$FAILED;
  27937. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27938. }
  27939. }
  27940. } else {
  27941. s4 = peg$FAILED;
  27942. }
  27943. if (s4 !== peg$FAILED) {
  27944. s3 = input.substring(s3, peg$currPos);
  27945. } else {
  27946. s3 = s4;
  27947. }
  27948. if (s3 !== peg$FAILED) {
  27949. peg$savedPos = s0;
  27950. s1 = peg$c41(s1, s3);
  27951. s0 = s1;
  27952. } else {
  27953. peg$currPos = s0;
  27954. s0 = peg$FAILED;
  27955. }
  27956. } else {
  27957. peg$currPos = s0;
  27958. s0 = peg$FAILED;
  27959. }
  27960. } else {
  27961. peg$currPos = s0;
  27962. s0 = peg$FAILED;
  27963. }
  27964. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27965. return s0;
  27966. }
  27967. function peg$parsefloat() {
  27968. var s0, s1, s2, s3, s4, s5, s6, s7;
  27969. var key = peg$currPos * 63 + 18,
  27970. cached = peg$resultsCache[key];
  27971. if (cached) {
  27972. peg$currPos = cached.nextPos;
  27973. return cached.result;
  27974. }
  27975. s0 = peg$currPos;
  27976. s1 = peg$currPos;
  27977. s2 = peg$currPos;
  27978. if (input.charCodeAt(peg$currPos) === 45) {
  27979. s3 = peg$c35;
  27980. peg$currPos++;
  27981. } else {
  27982. s3 = peg$FAILED;
  27983. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27984. }
  27985. if (s3 === peg$FAILED) {
  27986. s3 = null;
  27987. }
  27988. if (s3 !== peg$FAILED) {
  27989. s4 = [];
  27990. if (peg$c42.test(input.charAt(peg$currPos))) {
  27991. s5 = input.charAt(peg$currPos);
  27992. peg$currPos++;
  27993. } else {
  27994. s5 = peg$FAILED;
  27995. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  27996. }
  27997. if (s5 !== peg$FAILED) {
  27998. while (s5 !== peg$FAILED) {
  27999. s4.push(s5);
  28000. if (peg$c42.test(input.charAt(peg$currPos))) {
  28001. s5 = input.charAt(peg$currPos);
  28002. peg$currPos++;
  28003. } else {
  28004. s5 = peg$FAILED;
  28005. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28006. }
  28007. }
  28008. } else {
  28009. s4 = peg$FAILED;
  28010. }
  28011. if (s4 !== peg$FAILED) {
  28012. if (input.charCodeAt(peg$currPos) === 46) {
  28013. s5 = peg$c6;
  28014. peg$currPos++;
  28015. } else {
  28016. s5 = peg$FAILED;
  28017. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28018. }
  28019. if (s5 !== peg$FAILED) {
  28020. s6 = [];
  28021. if (peg$c42.test(input.charAt(peg$currPos))) {
  28022. s7 = input.charAt(peg$currPos);
  28023. peg$currPos++;
  28024. } else {
  28025. s7 = peg$FAILED;
  28026. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28027. }
  28028. if (s7 !== peg$FAILED) {
  28029. while (s7 !== peg$FAILED) {
  28030. s6.push(s7);
  28031. if (peg$c42.test(input.charAt(peg$currPos))) {
  28032. s7 = input.charAt(peg$currPos);
  28033. peg$currPos++;
  28034. } else {
  28035. s7 = peg$FAILED;
  28036. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28037. }
  28038. }
  28039. } else {
  28040. s6 = peg$FAILED;
  28041. }
  28042. if (s6 !== peg$FAILED) {
  28043. s3 = [s3, s4, s5, s6];
  28044. s2 = s3;
  28045. } else {
  28046. peg$currPos = s2;
  28047. s2 = peg$FAILED;
  28048. }
  28049. } else {
  28050. peg$currPos = s2;
  28051. s2 = peg$FAILED;
  28052. }
  28053. } else {
  28054. peg$currPos = s2;
  28055. s2 = peg$FAILED;
  28056. }
  28057. } else {
  28058. peg$currPos = s2;
  28059. s2 = peg$FAILED;
  28060. }
  28061. if (s2 !== peg$FAILED) {
  28062. s1 = input.substring(s1, peg$currPos);
  28063. } else {
  28064. s1 = s2;
  28065. }
  28066. if (s1 !== peg$FAILED) {
  28067. peg$savedPos = s0;
  28068. s1 = peg$c44(s1);
  28069. }
  28070. s0 = s1;
  28071. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28072. return s0;
  28073. }
  28074. function peg$parseinteger() {
  28075. var s0, s1, s2, s3, s4, s5;
  28076. var key = peg$currPos * 63 + 19,
  28077. cached = peg$resultsCache[key];
  28078. if (cached) {
  28079. peg$currPos = cached.nextPos;
  28080. return cached.result;
  28081. }
  28082. s0 = peg$currPos;
  28083. s1 = peg$currPos;
  28084. s2 = peg$currPos;
  28085. if (input.charCodeAt(peg$currPos) === 45) {
  28086. s3 = peg$c35;
  28087. peg$currPos++;
  28088. } else {
  28089. s3 = peg$FAILED;
  28090. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28091. }
  28092. if (s3 === peg$FAILED) {
  28093. s3 = null;
  28094. }
  28095. if (s3 !== peg$FAILED) {
  28096. s4 = [];
  28097. if (peg$c42.test(input.charAt(peg$currPos))) {
  28098. s5 = input.charAt(peg$currPos);
  28099. peg$currPos++;
  28100. } else {
  28101. s5 = peg$FAILED;
  28102. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28103. }
  28104. if (s5 !== peg$FAILED) {
  28105. while (s5 !== peg$FAILED) {
  28106. s4.push(s5);
  28107. if (peg$c42.test(input.charAt(peg$currPos))) {
  28108. s5 = input.charAt(peg$currPos);
  28109. peg$currPos++;
  28110. } else {
  28111. s5 = peg$FAILED;
  28112. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28113. }
  28114. }
  28115. } else {
  28116. s4 = peg$FAILED;
  28117. }
  28118. if (s4 !== peg$FAILED) {
  28119. s3 = [s3, s4];
  28120. s2 = s3;
  28121. } else {
  28122. peg$currPos = s2;
  28123. s2 = peg$FAILED;
  28124. }
  28125. } else {
  28126. peg$currPos = s2;
  28127. s2 = peg$FAILED;
  28128. }
  28129. if (s2 !== peg$FAILED) {
  28130. s1 = input.substring(s1, peg$currPos);
  28131. } else {
  28132. s1 = s2;
  28133. }
  28134. if (s1 !== peg$FAILED) {
  28135. peg$savedPos = s0;
  28136. s1 = peg$c45(s1);
  28137. }
  28138. s0 = s1;
  28139. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28140. return s0;
  28141. }
  28142. function peg$parseliteralArray() {
  28143. var s0, s1, s2, s3, s4;
  28144. var key = peg$currPos * 63 + 20,
  28145. cached = peg$resultsCache[key];
  28146. if (cached) {
  28147. peg$currPos = cached.nextPos;
  28148. return cached.result;
  28149. }
  28150. s0 = peg$currPos;
  28151. if (input.substr(peg$currPos, 2) === peg$c46) {
  28152. s1 = peg$c46;
  28153. peg$currPos += 2;
  28154. } else {
  28155. s1 = peg$FAILED;
  28156. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28157. }
  28158. if (s1 !== peg$FAILED) {
  28159. s2 = peg$parsewsLiteralArrayContents();
  28160. if (s2 !== peg$FAILED) {
  28161. s3 = peg$parsews();
  28162. if (s3 !== peg$FAILED) {
  28163. if (input.charCodeAt(peg$currPos) === 41) {
  28164. s4 = peg$c48;
  28165. peg$currPos++;
  28166. } else {
  28167. s4 = peg$FAILED;
  28168. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28169. }
  28170. if (s4 !== peg$FAILED) {
  28171. peg$savedPos = s0;
  28172. s1 = peg$c50(s2);
  28173. s0 = s1;
  28174. } else {
  28175. peg$currPos = s0;
  28176. s0 = peg$FAILED;
  28177. }
  28178. } else {
  28179. peg$currPos = s0;
  28180. s0 = peg$FAILED;
  28181. }
  28182. } else {
  28183. peg$currPos = s0;
  28184. s0 = peg$FAILED;
  28185. }
  28186. } else {
  28187. peg$currPos = s0;
  28188. s0 = peg$FAILED;
  28189. }
  28190. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28191. return s0;
  28192. }
  28193. function peg$parsebareLiteralArray() {
  28194. var s0, s1, s2, s3, s4;
  28195. var key = peg$currPos * 63 + 21,
  28196. cached = peg$resultsCache[key];
  28197. if (cached) {
  28198. peg$currPos = cached.nextPos;
  28199. return cached.result;
  28200. }
  28201. s0 = peg$currPos;
  28202. if (input.charCodeAt(peg$currPos) === 40) {
  28203. s1 = peg$c51;
  28204. peg$currPos++;
  28205. } else {
  28206. s1 = peg$FAILED;
  28207. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28208. }
  28209. if (s1 !== peg$FAILED) {
  28210. s2 = peg$parsewsLiteralArrayContents();
  28211. if (s2 !== peg$FAILED) {
  28212. s3 = peg$parsews();
  28213. if (s3 !== peg$FAILED) {
  28214. if (input.charCodeAt(peg$currPos) === 41) {
  28215. s4 = peg$c48;
  28216. peg$currPos++;
  28217. } else {
  28218. s4 = peg$FAILED;
  28219. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28220. }
  28221. if (s4 !== peg$FAILED) {
  28222. peg$savedPos = s0;
  28223. s1 = peg$c50(s2);
  28224. s0 = s1;
  28225. } else {
  28226. peg$currPos = s0;
  28227. s0 = peg$FAILED;
  28228. }
  28229. } else {
  28230. peg$currPos = s0;
  28231. s0 = peg$FAILED;
  28232. }
  28233. } else {
  28234. peg$currPos = s0;
  28235. s0 = peg$FAILED;
  28236. }
  28237. } else {
  28238. peg$currPos = s0;
  28239. s0 = peg$FAILED;
  28240. }
  28241. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28242. return s0;
  28243. }
  28244. function peg$parseliteralArrayElement() {
  28245. var s0;
  28246. var key = peg$currPos * 63 + 22,
  28247. cached = peg$resultsCache[key];
  28248. if (cached) {
  28249. peg$currPos = cached.nextPos;
  28250. return cached.result;
  28251. }
  28252. s0 = peg$parseparseTimeLiteral();
  28253. if (s0 === peg$FAILED) {
  28254. s0 = peg$parsebareLiteralArray();
  28255. if (s0 === peg$FAILED) {
  28256. s0 = peg$parsebareSymbol();
  28257. }
  28258. }
  28259. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28260. return s0;
  28261. }
  28262. function peg$parsewsLiteralArrayContents() {
  28263. var s0, s1, s2, s3, s4;
  28264. var key = peg$currPos * 63 + 23,
  28265. cached = peg$resultsCache[key];
  28266. if (cached) {
  28267. peg$currPos = cached.nextPos;
  28268. return cached.result;
  28269. }
  28270. s0 = peg$currPos;
  28271. s1 = [];
  28272. s2 = peg$currPos;
  28273. s3 = peg$parsews();
  28274. if (s3 !== peg$FAILED) {
  28275. s4 = peg$parseliteralArrayElement();
  28276. if (s4 !== peg$FAILED) {
  28277. peg$savedPos = s2;
  28278. s3 = peg$c53(s4);
  28279. s2 = s3;
  28280. } else {
  28281. peg$currPos = s2;
  28282. s2 = peg$FAILED;
  28283. }
  28284. } else {
  28285. peg$currPos = s2;
  28286. s2 = peg$FAILED;
  28287. }
  28288. while (s2 !== peg$FAILED) {
  28289. s1.push(s2);
  28290. s2 = peg$currPos;
  28291. s3 = peg$parsews();
  28292. if (s3 !== peg$FAILED) {
  28293. s4 = peg$parseliteralArrayElement();
  28294. if (s4 !== peg$FAILED) {
  28295. peg$savedPos = s2;
  28296. s3 = peg$c53(s4);
  28297. s2 = s3;
  28298. } else {
  28299. peg$currPos = s2;
  28300. s2 = peg$FAILED;
  28301. }
  28302. } else {
  28303. peg$currPos = s2;
  28304. s2 = peg$FAILED;
  28305. }
  28306. }
  28307. if (s1 !== peg$FAILED) {
  28308. peg$savedPos = s0;
  28309. s1 = peg$c54(s1);
  28310. }
  28311. s0 = s1;
  28312. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28313. return s0;
  28314. }
  28315. function peg$parsedynamicArray() {
  28316. var s0, s1, s2, s3, s4;
  28317. var key = peg$currPos * 63 + 24,
  28318. cached = peg$resultsCache[key];
  28319. if (cached) {
  28320. peg$currPos = cached.nextPos;
  28321. return cached.result;
  28322. }
  28323. s0 = peg$currPos;
  28324. if (input.charCodeAt(peg$currPos) === 123) {
  28325. s1 = peg$c55;
  28326. peg$currPos++;
  28327. } else {
  28328. s1 = peg$FAILED;
  28329. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28330. }
  28331. if (s1 !== peg$FAILED) {
  28332. s2 = peg$parsewsExpressions();
  28333. if (s2 === peg$FAILED) {
  28334. s2 = null;
  28335. }
  28336. if (s2 !== peg$FAILED) {
  28337. s3 = peg$parsemaybeDotsWs();
  28338. if (s3 !== peg$FAILED) {
  28339. if (input.charCodeAt(peg$currPos) === 125) {
  28340. s4 = peg$c57;
  28341. peg$currPos++;
  28342. } else {
  28343. s4 = peg$FAILED;
  28344. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28345. }
  28346. if (s4 !== peg$FAILED) {
  28347. peg$savedPos = s0;
  28348. s1 = peg$c59(s2);
  28349. s0 = s1;
  28350. } else {
  28351. peg$currPos = s0;
  28352. s0 = peg$FAILED;
  28353. }
  28354. } else {
  28355. peg$currPos = s0;
  28356. s0 = peg$FAILED;
  28357. }
  28358. } else {
  28359. peg$currPos = s0;
  28360. s0 = peg$FAILED;
  28361. }
  28362. } else {
  28363. peg$currPos = s0;
  28364. s0 = peg$FAILED;
  28365. }
  28366. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28367. return s0;
  28368. }
  28369. function peg$parsedynamicDictionary() {
  28370. var s0, s1, s2, s3, s4;
  28371. var key = peg$currPos * 63 + 25,
  28372. cached = peg$resultsCache[key];
  28373. if (cached) {
  28374. peg$currPos = cached.nextPos;
  28375. return cached.result;
  28376. }
  28377. s0 = peg$currPos;
  28378. if (input.substr(peg$currPos, 2) === peg$c60) {
  28379. s1 = peg$c60;
  28380. peg$currPos += 2;
  28381. } else {
  28382. s1 = peg$FAILED;
  28383. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28384. }
  28385. if (s1 !== peg$FAILED) {
  28386. s2 = peg$parsewsAssociations();
  28387. if (s2 === peg$FAILED) {
  28388. s2 = null;
  28389. }
  28390. if (s2 !== peg$FAILED) {
  28391. s3 = peg$parsemaybeDotsWs();
  28392. if (s3 !== peg$FAILED) {
  28393. if (input.charCodeAt(peg$currPos) === 125) {
  28394. s4 = peg$c57;
  28395. peg$currPos++;
  28396. } else {
  28397. s4 = peg$FAILED;
  28398. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28399. }
  28400. if (s4 !== peg$FAILED) {
  28401. peg$savedPos = s0;
  28402. s1 = peg$c62(s2);
  28403. s0 = s1;
  28404. } else {
  28405. peg$currPos = s0;
  28406. s0 = peg$FAILED;
  28407. }
  28408. } else {
  28409. peg$currPos = s0;
  28410. s0 = peg$FAILED;
  28411. }
  28412. } else {
  28413. peg$currPos = s0;
  28414. s0 = peg$FAILED;
  28415. }
  28416. } else {
  28417. peg$currPos = s0;
  28418. s0 = peg$FAILED;
  28419. }
  28420. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28421. return s0;
  28422. }
  28423. function peg$parsepseudoVariable() {
  28424. var s0, s1, s2;
  28425. var key = peg$currPos * 63 + 26,
  28426. cached = peg$resultsCache[key];
  28427. if (cached) {
  28428. peg$currPos = cached.nextPos;
  28429. return cached.result;
  28430. }
  28431. s0 = peg$currPos;
  28432. s1 = peg$currPos;
  28433. if (input.substr(peg$currPos, 4) === peg$c63) {
  28434. s2 = peg$c63;
  28435. peg$currPos += 4;
  28436. } else {
  28437. s2 = peg$FAILED;
  28438. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28439. }
  28440. if (s2 !== peg$FAILED) {
  28441. peg$savedPos = s1;
  28442. s2 = peg$c65();
  28443. }
  28444. s1 = s2;
  28445. if (s1 === peg$FAILED) {
  28446. s1 = peg$currPos;
  28447. if (input.substr(peg$currPos, 5) === peg$c66) {
  28448. s2 = peg$c66;
  28449. peg$currPos += 5;
  28450. } else {
  28451. s2 = peg$FAILED;
  28452. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28453. }
  28454. if (s2 !== peg$FAILED) {
  28455. peg$savedPos = s1;
  28456. s2 = peg$c68();
  28457. }
  28458. s1 = s2;
  28459. if (s1 === peg$FAILED) {
  28460. s1 = peg$currPos;
  28461. if (input.substr(peg$currPos, 3) === peg$c69) {
  28462. s2 = peg$c69;
  28463. peg$currPos += 3;
  28464. } else {
  28465. s2 = peg$FAILED;
  28466. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28467. }
  28468. if (s2 !== peg$FAILED) {
  28469. peg$savedPos = s1;
  28470. s2 = peg$c71();
  28471. }
  28472. s1 = s2;
  28473. }
  28474. }
  28475. if (s1 !== peg$FAILED) {
  28476. peg$savedPos = s0;
  28477. s1 = peg$c16(s1);
  28478. }
  28479. s0 = s1;
  28480. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28481. return s0;
  28482. }
  28483. function peg$parseparseTimeLiteral() {
  28484. var s0;
  28485. var key = peg$currPos * 63 + 27,
  28486. cached = peg$resultsCache[key];
  28487. if (cached) {
  28488. peg$currPos = cached.nextPos;
  28489. return cached.result;
  28490. }
  28491. s0 = peg$parsepseudoVariable();
  28492. if (s0 === peg$FAILED) {
  28493. s0 = peg$parsenumber();
  28494. if (s0 === peg$FAILED) {
  28495. s0 = peg$parseliteralArray();
  28496. if (s0 === peg$FAILED) {
  28497. s0 = peg$parsestring();
  28498. if (s0 === peg$FAILED) {
  28499. s0 = peg$parsesymbol();
  28500. if (s0 === peg$FAILED) {
  28501. s0 = peg$parsecharacter();
  28502. }
  28503. }
  28504. }
  28505. }
  28506. }
  28507. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28508. return s0;
  28509. }
  28510. function peg$parseruntimeLiteral() {
  28511. var s0;
  28512. var key = peg$currPos * 63 + 28,
  28513. cached = peg$resultsCache[key];
  28514. if (cached) {
  28515. peg$currPos = cached.nextPos;
  28516. return cached.result;
  28517. }
  28518. s0 = peg$parsedynamicDictionary();
  28519. if (s0 === peg$FAILED) {
  28520. s0 = peg$parsedynamicArray();
  28521. if (s0 === peg$FAILED) {
  28522. s0 = peg$parseblock();
  28523. }
  28524. }
  28525. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28526. return s0;
  28527. }
  28528. function peg$parseliteral() {
  28529. var s0;
  28530. var key = peg$currPos * 63 + 29,
  28531. cached = peg$resultsCache[key];
  28532. if (cached) {
  28533. peg$currPos = cached.nextPos;
  28534. return cached.result;
  28535. }
  28536. s0 = peg$parseruntimeLiteral();
  28537. if (s0 === peg$FAILED) {
  28538. s0 = peg$parseparseTimeLiteral();
  28539. }
  28540. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28541. return s0;
  28542. }
  28543. function peg$parsevariable() {
  28544. var s0, s1;
  28545. var key = peg$currPos * 63 + 30,
  28546. cached = peg$resultsCache[key];
  28547. if (cached) {
  28548. peg$currPos = cached.nextPos;
  28549. return cached.result;
  28550. }
  28551. s0 = peg$currPos;
  28552. s1 = peg$parseidentifier();
  28553. if (s1 !== peg$FAILED) {
  28554. peg$savedPos = s0;
  28555. s1 = peg$c72(s1);
  28556. }
  28557. s0 = s1;
  28558. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28559. return s0;
  28560. }
  28561. function peg$parsebinarySelector() {
  28562. var s0, s1, s2;
  28563. var key = peg$currPos * 63 + 31,
  28564. cached = peg$resultsCache[key];
  28565. if (cached) {
  28566. peg$currPos = cached.nextPos;
  28567. return cached.result;
  28568. }
  28569. s0 = peg$currPos;
  28570. s1 = [];
  28571. if (peg$c73.test(input.charAt(peg$currPos))) {
  28572. s2 = input.charAt(peg$currPos);
  28573. peg$currPos++;
  28574. } else {
  28575. s2 = peg$FAILED;
  28576. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28577. }
  28578. if (s2 !== peg$FAILED) {
  28579. while (s2 !== peg$FAILED) {
  28580. s1.push(s2);
  28581. if (peg$c73.test(input.charAt(peg$currPos))) {
  28582. s2 = input.charAt(peg$currPos);
  28583. peg$currPos++;
  28584. } else {
  28585. s2 = peg$FAILED;
  28586. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28587. }
  28588. }
  28589. } else {
  28590. s1 = peg$FAILED;
  28591. }
  28592. if (s1 !== peg$FAILED) {
  28593. s0 = input.substring(s0, peg$currPos);
  28594. } else {
  28595. s0 = s1;
  28596. }
  28597. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28598. return s0;
  28599. }
  28600. function peg$parsewsKeywordPattern() {
  28601. var s0, s1, s2, s3, s4, s5, s6;
  28602. var key = peg$currPos * 63 + 32,
  28603. cached = peg$resultsCache[key];
  28604. if (cached) {
  28605. peg$currPos = cached.nextPos;
  28606. return cached.result;
  28607. }
  28608. s0 = peg$currPos;
  28609. s1 = [];
  28610. s2 = peg$currPos;
  28611. s3 = peg$parsews();
  28612. if (s3 !== peg$FAILED) {
  28613. s4 = peg$parsekeyword();
  28614. if (s4 !== peg$FAILED) {
  28615. s5 = peg$parsews();
  28616. if (s5 !== peg$FAILED) {
  28617. s6 = peg$parseidentifier();
  28618. if (s6 !== peg$FAILED) {
  28619. peg$savedPos = s2;
  28620. s3 = peg$c75(s4, s6);
  28621. s2 = s3;
  28622. } else {
  28623. peg$currPos = s2;
  28624. s2 = peg$FAILED;
  28625. }
  28626. } else {
  28627. peg$currPos = s2;
  28628. s2 = peg$FAILED;
  28629. }
  28630. } else {
  28631. peg$currPos = s2;
  28632. s2 = peg$FAILED;
  28633. }
  28634. } else {
  28635. peg$currPos = s2;
  28636. s2 = peg$FAILED;
  28637. }
  28638. if (s2 !== peg$FAILED) {
  28639. while (s2 !== peg$FAILED) {
  28640. s1.push(s2);
  28641. s2 = peg$currPos;
  28642. s3 = peg$parsews();
  28643. if (s3 !== peg$FAILED) {
  28644. s4 = peg$parsekeyword();
  28645. if (s4 !== peg$FAILED) {
  28646. s5 = peg$parsews();
  28647. if (s5 !== peg$FAILED) {
  28648. s6 = peg$parseidentifier();
  28649. if (s6 !== peg$FAILED) {
  28650. peg$savedPos = s2;
  28651. s3 = peg$c75(s4, s6);
  28652. s2 = s3;
  28653. } else {
  28654. peg$currPos = s2;
  28655. s2 = peg$FAILED;
  28656. }
  28657. } else {
  28658. peg$currPos = s2;
  28659. s2 = peg$FAILED;
  28660. }
  28661. } else {
  28662. peg$currPos = s2;
  28663. s2 = peg$FAILED;
  28664. }
  28665. } else {
  28666. peg$currPos = s2;
  28667. s2 = peg$FAILED;
  28668. }
  28669. }
  28670. } else {
  28671. s1 = peg$FAILED;
  28672. }
  28673. if (s1 !== peg$FAILED) {
  28674. peg$savedPos = s0;
  28675. s1 = peg$c76(s1);
  28676. }
  28677. s0 = s1;
  28678. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28679. return s0;
  28680. }
  28681. function peg$parsewsBinaryPattern() {
  28682. var s0, s1, s2, s3, s4;
  28683. var key = peg$currPos * 63 + 33,
  28684. cached = peg$resultsCache[key];
  28685. if (cached) {
  28686. peg$currPos = cached.nextPos;
  28687. return cached.result;
  28688. }
  28689. s0 = peg$currPos;
  28690. s1 = peg$parsews();
  28691. if (s1 !== peg$FAILED) {
  28692. s2 = peg$parsebinarySelector();
  28693. if (s2 !== peg$FAILED) {
  28694. s3 = peg$parsews();
  28695. if (s3 !== peg$FAILED) {
  28696. s4 = peg$parseidentifier();
  28697. if (s4 !== peg$FAILED) {
  28698. peg$savedPos = s0;
  28699. s1 = peg$c77(s2, s4);
  28700. s0 = s1;
  28701. } else {
  28702. peg$currPos = s0;
  28703. s0 = peg$FAILED;
  28704. }
  28705. } else {
  28706. peg$currPos = s0;
  28707. s0 = peg$FAILED;
  28708. }
  28709. } else {
  28710. peg$currPos = s0;
  28711. s0 = peg$FAILED;
  28712. }
  28713. } else {
  28714. peg$currPos = s0;
  28715. s0 = peg$FAILED;
  28716. }
  28717. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28718. return s0;
  28719. }
  28720. function peg$parsewsUnaryPattern() {
  28721. var s0, s1, s2;
  28722. var key = peg$currPos * 63 + 34,
  28723. cached = peg$resultsCache[key];
  28724. if (cached) {
  28725. peg$currPos = cached.nextPos;
  28726. return cached.result;
  28727. }
  28728. s0 = peg$currPos;
  28729. s1 = peg$parsews();
  28730. if (s1 !== peg$FAILED) {
  28731. s2 = peg$parseidentifier();
  28732. if (s2 !== peg$FAILED) {
  28733. peg$savedPos = s0;
  28734. s1 = peg$c78(s2);
  28735. s0 = s1;
  28736. } else {
  28737. peg$currPos = s0;
  28738. s0 = peg$FAILED;
  28739. }
  28740. } else {
  28741. peg$currPos = s0;
  28742. s0 = peg$FAILED;
  28743. }
  28744. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28745. return s0;
  28746. }
  28747. function peg$parseexpression() {
  28748. var s0;
  28749. var key = peg$currPos * 63 + 35,
  28750. cached = peg$resultsCache[key];
  28751. if (cached) {
  28752. peg$currPos = cached.nextPos;
  28753. return cached.result;
  28754. }
  28755. s0 = peg$parseassignment();
  28756. if (s0 === peg$FAILED) {
  28757. s0 = peg$parsecascade();
  28758. if (s0 === peg$FAILED) {
  28759. s0 = peg$parsekeywordSend();
  28760. }
  28761. }
  28762. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28763. return s0;
  28764. }
  28765. function peg$parsewsExpressionsRest() {
  28766. var s0, s1, s2;
  28767. var key = peg$currPos * 63 + 36,
  28768. cached = peg$resultsCache[key];
  28769. if (cached) {
  28770. peg$currPos = cached.nextPos;
  28771. return cached.result;
  28772. }
  28773. s0 = peg$currPos;
  28774. s1 = peg$parsesomeDotsWs();
  28775. if (s1 !== peg$FAILED) {
  28776. s2 = peg$parseexpression();
  28777. if (s2 !== peg$FAILED) {
  28778. peg$savedPos = s0;
  28779. s1 = peg$c79(s2);
  28780. s0 = s1;
  28781. } else {
  28782. peg$currPos = s0;
  28783. s0 = peg$FAILED;
  28784. }
  28785. } else {
  28786. peg$currPos = s0;
  28787. s0 = peg$FAILED;
  28788. }
  28789. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28790. return s0;
  28791. }
  28792. function peg$parsewsExpressions() {
  28793. var s0, s1, s2, s3, s4;
  28794. var key = peg$currPos * 63 + 37,
  28795. cached = peg$resultsCache[key];
  28796. if (cached) {
  28797. peg$currPos = cached.nextPos;
  28798. return cached.result;
  28799. }
  28800. s0 = peg$currPos;
  28801. s1 = peg$parsemaybeDotsWs();
  28802. if (s1 !== peg$FAILED) {
  28803. s2 = peg$parseexpression();
  28804. if (s2 !== peg$FAILED) {
  28805. s3 = [];
  28806. s4 = peg$parsewsExpressionsRest();
  28807. while (s4 !== peg$FAILED) {
  28808. s3.push(s4);
  28809. s4 = peg$parsewsExpressionsRest();
  28810. }
  28811. if (s3 !== peg$FAILED) {
  28812. peg$savedPos = s0;
  28813. s1 = peg$c80(s2, s3);
  28814. s0 = s1;
  28815. } else {
  28816. peg$currPos = s0;
  28817. s0 = peg$FAILED;
  28818. }
  28819. } else {
  28820. peg$currPos = s0;
  28821. s0 = peg$FAILED;
  28822. }
  28823. } else {
  28824. peg$currPos = s0;
  28825. s0 = peg$FAILED;
  28826. }
  28827. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28828. return s0;
  28829. }
  28830. function peg$parseassignment() {
  28831. var s0, s1, s2, s3, s4, s5;
  28832. var key = peg$currPos * 63 + 38,
  28833. cached = peg$resultsCache[key];
  28834. if (cached) {
  28835. peg$currPos = cached.nextPos;
  28836. return cached.result;
  28837. }
  28838. s0 = peg$currPos;
  28839. s1 = peg$parsevariable();
  28840. if (s1 !== peg$FAILED) {
  28841. s2 = peg$parsews();
  28842. if (s2 !== peg$FAILED) {
  28843. if (input.substr(peg$currPos, 2) === peg$c81) {
  28844. s3 = peg$c81;
  28845. peg$currPos += 2;
  28846. } else {
  28847. s3 = peg$FAILED;
  28848. if (peg$silentFails === 0) { peg$fail(peg$c82); }
  28849. }
  28850. if (s3 !== peg$FAILED) {
  28851. s4 = peg$parsews();
  28852. if (s4 !== peg$FAILED) {
  28853. s5 = peg$parseexpression();
  28854. if (s5 !== peg$FAILED) {
  28855. peg$savedPos = s0;
  28856. s1 = peg$c83(s1, s5);
  28857. s0 = s1;
  28858. } else {
  28859. peg$currPos = s0;
  28860. s0 = peg$FAILED;
  28861. }
  28862. } else {
  28863. peg$currPos = s0;
  28864. s0 = peg$FAILED;
  28865. }
  28866. } else {
  28867. peg$currPos = s0;
  28868. s0 = peg$FAILED;
  28869. }
  28870. } else {
  28871. peg$currPos = s0;
  28872. s0 = peg$FAILED;
  28873. }
  28874. } else {
  28875. peg$currPos = s0;
  28876. s0 = peg$FAILED;
  28877. }
  28878. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28879. return s0;
  28880. }
  28881. function peg$parseret() {
  28882. var s0, s1, s2, s3;
  28883. var key = peg$currPos * 63 + 39,
  28884. cached = peg$resultsCache[key];
  28885. if (cached) {
  28886. peg$currPos = cached.nextPos;
  28887. return cached.result;
  28888. }
  28889. s0 = peg$currPos;
  28890. if (input.charCodeAt(peg$currPos) === 94) {
  28891. s1 = peg$c84;
  28892. peg$currPos++;
  28893. } else {
  28894. s1 = peg$FAILED;
  28895. if (peg$silentFails === 0) { peg$fail(peg$c85); }
  28896. }
  28897. if (s1 !== peg$FAILED) {
  28898. s2 = peg$parsews();
  28899. if (s2 !== peg$FAILED) {
  28900. s3 = peg$parseexpression();
  28901. if (s3 !== peg$FAILED) {
  28902. peg$savedPos = s0;
  28903. s1 = peg$c86(s3);
  28904. s0 = s1;
  28905. } else {
  28906. peg$currPos = s0;
  28907. s0 = peg$FAILED;
  28908. }
  28909. } else {
  28910. peg$currPos = s0;
  28911. s0 = peg$FAILED;
  28912. }
  28913. } else {
  28914. peg$currPos = s0;
  28915. s0 = peg$FAILED;
  28916. }
  28917. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28918. return s0;
  28919. }
  28920. function peg$parsetemps() {
  28921. var s0, s1, s2, s3, s4, s5;
  28922. var key = peg$currPos * 63 + 40,
  28923. cached = peg$resultsCache[key];
  28924. if (cached) {
  28925. peg$currPos = cached.nextPos;
  28926. return cached.result;
  28927. }
  28928. s0 = peg$currPos;
  28929. if (input.charCodeAt(peg$currPos) === 124) {
  28930. s1 = peg$c87;
  28931. peg$currPos++;
  28932. } else {
  28933. s1 = peg$FAILED;
  28934. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  28935. }
  28936. if (s1 !== peg$FAILED) {
  28937. s2 = [];
  28938. s3 = peg$currPos;
  28939. s4 = peg$parsews();
  28940. if (s4 !== peg$FAILED) {
  28941. s5 = peg$parseidentifier();
  28942. if (s5 !== peg$FAILED) {
  28943. peg$savedPos = s3;
  28944. s4 = peg$c89(s5);
  28945. s3 = s4;
  28946. } else {
  28947. peg$currPos = s3;
  28948. s3 = peg$FAILED;
  28949. }
  28950. } else {
  28951. peg$currPos = s3;
  28952. s3 = peg$FAILED;
  28953. }
  28954. while (s3 !== peg$FAILED) {
  28955. s2.push(s3);
  28956. s3 = peg$currPos;
  28957. s4 = peg$parsews();
  28958. if (s4 !== peg$FAILED) {
  28959. s5 = peg$parseidentifier();
  28960. if (s5 !== peg$FAILED) {
  28961. peg$savedPos = s3;
  28962. s4 = peg$c89(s5);
  28963. s3 = s4;
  28964. } else {
  28965. peg$currPos = s3;
  28966. s3 = peg$FAILED;
  28967. }
  28968. } else {
  28969. peg$currPos = s3;
  28970. s3 = peg$FAILED;
  28971. }
  28972. }
  28973. if (s2 !== peg$FAILED) {
  28974. s3 = peg$parsews();
  28975. if (s3 !== peg$FAILED) {
  28976. if (input.charCodeAt(peg$currPos) === 124) {
  28977. s4 = peg$c87;
  28978. peg$currPos++;
  28979. } else {
  28980. s4 = peg$FAILED;
  28981. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  28982. }
  28983. if (s4 !== peg$FAILED) {
  28984. peg$savedPos = s0;
  28985. s1 = peg$c90(s2);
  28986. s0 = s1;
  28987. } else {
  28988. peg$currPos = s0;
  28989. s0 = peg$FAILED;
  28990. }
  28991. } else {
  28992. peg$currPos = s0;
  28993. s0 = peg$FAILED;
  28994. }
  28995. } else {
  28996. peg$currPos = s0;
  28997. s0 = peg$FAILED;
  28998. }
  28999. } else {
  29000. peg$currPos = s0;
  29001. s0 = peg$FAILED;
  29002. }
  29003. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29004. return s0;
  29005. }
  29006. function peg$parsewsBlockParamList() {
  29007. var s0, s1, s2, s3, s4, s5, s6;
  29008. var key = peg$currPos * 63 + 41,
  29009. cached = peg$resultsCache[key];
  29010. if (cached) {
  29011. peg$currPos = cached.nextPos;
  29012. return cached.result;
  29013. }
  29014. s0 = peg$currPos;
  29015. s1 = [];
  29016. s2 = peg$currPos;
  29017. s3 = peg$parsews();
  29018. if (s3 !== peg$FAILED) {
  29019. if (input.charCodeAt(peg$currPos) === 58) {
  29020. s4 = peg$c12;
  29021. peg$currPos++;
  29022. } else {
  29023. s4 = peg$FAILED;
  29024. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29025. }
  29026. if (s4 !== peg$FAILED) {
  29027. s5 = peg$parsews();
  29028. if (s5 !== peg$FAILED) {
  29029. s6 = peg$parseidentifier();
  29030. if (s6 !== peg$FAILED) {
  29031. peg$savedPos = s2;
  29032. s3 = peg$c91(s6);
  29033. s2 = s3;
  29034. } else {
  29035. peg$currPos = s2;
  29036. s2 = peg$FAILED;
  29037. }
  29038. } else {
  29039. peg$currPos = s2;
  29040. s2 = peg$FAILED;
  29041. }
  29042. } else {
  29043. peg$currPos = s2;
  29044. s2 = peg$FAILED;
  29045. }
  29046. } else {
  29047. peg$currPos = s2;
  29048. s2 = peg$FAILED;
  29049. }
  29050. if (s2 !== peg$FAILED) {
  29051. while (s2 !== peg$FAILED) {
  29052. s1.push(s2);
  29053. s2 = peg$currPos;
  29054. s3 = peg$parsews();
  29055. if (s3 !== peg$FAILED) {
  29056. if (input.charCodeAt(peg$currPos) === 58) {
  29057. s4 = peg$c12;
  29058. peg$currPos++;
  29059. } else {
  29060. s4 = peg$FAILED;
  29061. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29062. }
  29063. if (s4 !== peg$FAILED) {
  29064. s5 = peg$parsews();
  29065. if (s5 !== peg$FAILED) {
  29066. s6 = peg$parseidentifier();
  29067. if (s6 !== peg$FAILED) {
  29068. peg$savedPos = s2;
  29069. s3 = peg$c91(s6);
  29070. s2 = s3;
  29071. } else {
  29072. peg$currPos = s2;
  29073. s2 = peg$FAILED;
  29074. }
  29075. } else {
  29076. peg$currPos = s2;
  29077. s2 = peg$FAILED;
  29078. }
  29079. } else {
  29080. peg$currPos = s2;
  29081. s2 = peg$FAILED;
  29082. }
  29083. } else {
  29084. peg$currPos = s2;
  29085. s2 = peg$FAILED;
  29086. }
  29087. }
  29088. } else {
  29089. s1 = peg$FAILED;
  29090. }
  29091. if (s1 !== peg$FAILED) {
  29092. s2 = peg$parsews();
  29093. if (s2 !== peg$FAILED) {
  29094. if (input.charCodeAt(peg$currPos) === 124) {
  29095. s3 = peg$c87;
  29096. peg$currPos++;
  29097. } else {
  29098. s3 = peg$FAILED;
  29099. if (peg$silentFails === 0) { peg$fail(peg$c88); }
  29100. }
  29101. if (s3 !== peg$FAILED) {
  29102. peg$savedPos = s0;
  29103. s1 = peg$c92(s1);
  29104. s0 = s1;
  29105. } else {
  29106. peg$currPos = s0;
  29107. s0 = peg$FAILED;
  29108. }
  29109. } else {
  29110. peg$currPos = s0;
  29111. s0 = peg$FAILED;
  29112. }
  29113. } else {
  29114. peg$currPos = s0;
  29115. s0 = peg$FAILED;
  29116. }
  29117. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29118. return s0;
  29119. }
  29120. function peg$parsesubexpression() {
  29121. var s0, s1, s2, s3, s4, s5;
  29122. var key = peg$currPos * 63 + 42,
  29123. cached = peg$resultsCache[key];
  29124. if (cached) {
  29125. peg$currPos = cached.nextPos;
  29126. return cached.result;
  29127. }
  29128. s0 = peg$currPos;
  29129. if (input.charCodeAt(peg$currPos) === 40) {
  29130. s1 = peg$c51;
  29131. peg$currPos++;
  29132. } else {
  29133. s1 = peg$FAILED;
  29134. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29135. }
  29136. if (s1 !== peg$FAILED) {
  29137. s2 = peg$parsews();
  29138. if (s2 !== peg$FAILED) {
  29139. s3 = peg$parseexpression();
  29140. if (s3 !== peg$FAILED) {
  29141. s4 = peg$parsews();
  29142. if (s4 !== peg$FAILED) {
  29143. if (input.charCodeAt(peg$currPos) === 41) {
  29144. s5 = peg$c48;
  29145. peg$currPos++;
  29146. } else {
  29147. s5 = peg$FAILED;
  29148. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29149. }
  29150. if (s5 !== peg$FAILED) {
  29151. peg$savedPos = s0;
  29152. s1 = peg$c79(s3);
  29153. s0 = s1;
  29154. } else {
  29155. peg$currPos = s0;
  29156. s0 = peg$FAILED;
  29157. }
  29158. } else {
  29159. peg$currPos = s0;
  29160. s0 = peg$FAILED;
  29161. }
  29162. } else {
  29163. peg$currPos = s0;
  29164. s0 = peg$FAILED;
  29165. }
  29166. } else {
  29167. peg$currPos = s0;
  29168. s0 = peg$FAILED;
  29169. }
  29170. } else {
  29171. peg$currPos = s0;
  29172. s0 = peg$FAILED;
  29173. }
  29174. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29175. return s0;
  29176. }
  29177. function peg$parsewsStatements() {
  29178. var s0, s1, s2, s3;
  29179. var key = peg$currPos * 63 + 43,
  29180. cached = peg$resultsCache[key];
  29181. if (cached) {
  29182. peg$currPos = cached.nextPos;
  29183. return cached.result;
  29184. }
  29185. s0 = peg$currPos;
  29186. s1 = peg$parsemaybeDotsWs();
  29187. if (s1 !== peg$FAILED) {
  29188. s2 = peg$parseret();
  29189. if (s2 !== peg$FAILED) {
  29190. peg$savedPos = s0;
  29191. s1 = peg$c93(s2);
  29192. s0 = s1;
  29193. } else {
  29194. peg$currPos = s0;
  29195. s0 = peg$FAILED;
  29196. }
  29197. } else {
  29198. peg$currPos = s0;
  29199. s0 = peg$FAILED;
  29200. }
  29201. if (s0 === peg$FAILED) {
  29202. s0 = peg$currPos;
  29203. s1 = peg$parsewsExpressions();
  29204. if (s1 !== peg$FAILED) {
  29205. s2 = peg$parsesomeDotsWs();
  29206. if (s2 !== peg$FAILED) {
  29207. s3 = peg$parseret();
  29208. if (s3 !== peg$FAILED) {
  29209. peg$savedPos = s0;
  29210. s1 = peg$c94(s1, s3);
  29211. s0 = s1;
  29212. } else {
  29213. peg$currPos = s0;
  29214. s0 = peg$FAILED;
  29215. }
  29216. } else {
  29217. peg$currPos = s0;
  29218. s0 = peg$FAILED;
  29219. }
  29220. } else {
  29221. peg$currPos = s0;
  29222. s0 = peg$FAILED;
  29223. }
  29224. if (s0 === peg$FAILED) {
  29225. s0 = peg$currPos;
  29226. s1 = peg$parsewsExpressions();
  29227. if (s1 === peg$FAILED) {
  29228. s1 = null;
  29229. }
  29230. if (s1 !== peg$FAILED) {
  29231. peg$savedPos = s0;
  29232. s1 = peg$c95(s1);
  29233. }
  29234. s0 = s1;
  29235. }
  29236. }
  29237. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29238. return s0;
  29239. }
  29240. function peg$parsewsSequenceWs() {
  29241. var s0, s1, s2, s3;
  29242. var key = peg$currPos * 63 + 44,
  29243. cached = peg$resultsCache[key];
  29244. if (cached) {
  29245. peg$currPos = cached.nextPos;
  29246. return cached.result;
  29247. }
  29248. s0 = peg$currPos;
  29249. s1 = peg$parsews();
  29250. if (s1 !== peg$FAILED) {
  29251. s2 = peg$parsejsStatement();
  29252. if (s2 !== peg$FAILED) {
  29253. s3 = peg$parsews();
  29254. if (s3 !== peg$FAILED) {
  29255. peg$savedPos = s0;
  29256. s1 = peg$c96(s2);
  29257. s0 = s1;
  29258. } else {
  29259. peg$currPos = s0;
  29260. s0 = peg$FAILED;
  29261. }
  29262. } else {
  29263. peg$currPos = s0;
  29264. s0 = peg$FAILED;
  29265. }
  29266. } else {
  29267. peg$currPos = s0;
  29268. s0 = peg$FAILED;
  29269. }
  29270. if (s0 === peg$FAILED) {
  29271. s0 = peg$parsewsStSequenceWs();
  29272. }
  29273. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29274. return s0;
  29275. }
  29276. function peg$parsewsStSequenceWs() {
  29277. var s0, s1, s2, s3, s4;
  29278. var key = peg$currPos * 63 + 45,
  29279. cached = peg$resultsCache[key];
  29280. if (cached) {
  29281. peg$currPos = cached.nextPos;
  29282. return cached.result;
  29283. }
  29284. s0 = peg$currPos;
  29285. s1 = peg$parsews();
  29286. if (s1 !== peg$FAILED) {
  29287. s2 = peg$parsetemps();
  29288. if (s2 === peg$FAILED) {
  29289. s2 = null;
  29290. }
  29291. if (s2 !== peg$FAILED) {
  29292. s3 = peg$parsewsStatements();
  29293. if (s3 === peg$FAILED) {
  29294. s3 = null;
  29295. }
  29296. if (s3 !== peg$FAILED) {
  29297. s4 = peg$parsemaybeDotsWs();
  29298. if (s4 !== peg$FAILED) {
  29299. peg$savedPos = s0;
  29300. s1 = peg$c97(s2, s3);
  29301. s0 = s1;
  29302. } else {
  29303. peg$currPos = s0;
  29304. s0 = peg$FAILED;
  29305. }
  29306. } else {
  29307. peg$currPos = s0;
  29308. s0 = peg$FAILED;
  29309. }
  29310. } else {
  29311. peg$currPos = s0;
  29312. s0 = peg$FAILED;
  29313. }
  29314. } else {
  29315. peg$currPos = s0;
  29316. s0 = peg$FAILED;
  29317. }
  29318. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29319. return s0;
  29320. }
  29321. function peg$parseblock() {
  29322. var s0, s1, s2, s3, s4;
  29323. var key = peg$currPos * 63 + 46,
  29324. cached = peg$resultsCache[key];
  29325. if (cached) {
  29326. peg$currPos = cached.nextPos;
  29327. return cached.result;
  29328. }
  29329. s0 = peg$currPos;
  29330. if (input.charCodeAt(peg$currPos) === 91) {
  29331. s1 = peg$c98;
  29332. peg$currPos++;
  29333. } else {
  29334. s1 = peg$FAILED;
  29335. if (peg$silentFails === 0) { peg$fail(peg$c99); }
  29336. }
  29337. if (s1 !== peg$FAILED) {
  29338. s2 = peg$parsewsBlockParamList();
  29339. if (s2 === peg$FAILED) {
  29340. s2 = null;
  29341. }
  29342. if (s2 !== peg$FAILED) {
  29343. s3 = peg$parsewsSequenceWs();
  29344. if (s3 !== peg$FAILED) {
  29345. if (input.charCodeAt(peg$currPos) === 93) {
  29346. s4 = peg$c100;
  29347. peg$currPos++;
  29348. } else {
  29349. s4 = peg$FAILED;
  29350. if (peg$silentFails === 0) { peg$fail(peg$c101); }
  29351. }
  29352. if (s4 !== peg$FAILED) {
  29353. peg$savedPos = s0;
  29354. s1 = peg$c102(s2, s3);
  29355. s0 = s1;
  29356. } else {
  29357. peg$currPos = s0;
  29358. s0 = peg$FAILED;
  29359. }
  29360. } else {
  29361. peg$currPos = s0;
  29362. s0 = peg$FAILED;
  29363. }
  29364. } else {
  29365. peg$currPos = s0;
  29366. s0 = peg$FAILED;
  29367. }
  29368. } else {
  29369. peg$currPos = s0;
  29370. s0 = peg$FAILED;
  29371. }
  29372. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29373. return s0;
  29374. }
  29375. function peg$parseoperand() {
  29376. var s0;
  29377. var key = peg$currPos * 63 + 47,
  29378. cached = peg$resultsCache[key];
  29379. if (cached) {
  29380. peg$currPos = cached.nextPos;
  29381. return cached.result;
  29382. }
  29383. s0 = peg$parseliteral();
  29384. if (s0 === peg$FAILED) {
  29385. s0 = peg$parsevariable();
  29386. if (s0 === peg$FAILED) {
  29387. s0 = peg$parsesubexpression();
  29388. }
  29389. }
  29390. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29391. return s0;
  29392. }
  29393. function peg$parsewsUnaryMessage() {
  29394. var s0, s1, s2, s3, s4;
  29395. var key = peg$currPos * 63 + 48,
  29396. cached = peg$resultsCache[key];
  29397. if (cached) {
  29398. peg$currPos = cached.nextPos;
  29399. return cached.result;
  29400. }
  29401. s0 = peg$currPos;
  29402. s1 = peg$parsews();
  29403. if (s1 !== peg$FAILED) {
  29404. s2 = peg$parseidentifier();
  29405. if (s2 !== peg$FAILED) {
  29406. s3 = peg$currPos;
  29407. peg$silentFails++;
  29408. if (input.charCodeAt(peg$currPos) === 58) {
  29409. s4 = peg$c12;
  29410. peg$currPos++;
  29411. } else {
  29412. s4 = peg$FAILED;
  29413. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29414. }
  29415. peg$silentFails--;
  29416. if (s4 === peg$FAILED) {
  29417. s3 = void 0;
  29418. } else {
  29419. peg$currPos = s3;
  29420. s3 = peg$FAILED;
  29421. }
  29422. if (s3 !== peg$FAILED) {
  29423. peg$savedPos = s0;
  29424. s1 = peg$c103(s2);
  29425. s0 = s1;
  29426. } else {
  29427. peg$currPos = s0;
  29428. s0 = peg$FAILED;
  29429. }
  29430. } else {
  29431. peg$currPos = s0;
  29432. s0 = peg$FAILED;
  29433. }
  29434. } else {
  29435. peg$currPos = s0;
  29436. s0 = peg$FAILED;
  29437. }
  29438. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29439. return s0;
  29440. }
  29441. function peg$parseunarySend() {
  29442. var s0, s1, s2, s3;
  29443. var key = peg$currPos * 63 + 49,
  29444. cached = peg$resultsCache[key];
  29445. if (cached) {
  29446. peg$currPos = cached.nextPos;
  29447. return cached.result;
  29448. }
  29449. s0 = peg$currPos;
  29450. s1 = peg$parseoperand();
  29451. if (s1 !== peg$FAILED) {
  29452. s2 = [];
  29453. s3 = peg$parsewsUnaryMessage();
  29454. while (s3 !== peg$FAILED) {
  29455. s2.push(s3);
  29456. s3 = peg$parsewsUnaryMessage();
  29457. }
  29458. if (s2 !== peg$FAILED) {
  29459. peg$savedPos = s0;
  29460. s1 = peg$c104(s1, s2);
  29461. s0 = s1;
  29462. } else {
  29463. peg$currPos = s0;
  29464. s0 = peg$FAILED;
  29465. }
  29466. } else {
  29467. peg$currPos = s0;
  29468. s0 = peg$FAILED;
  29469. }
  29470. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29471. return s0;
  29472. }
  29473. function peg$parsewsBinaryMessage() {
  29474. var s0, s1, s2, s3, s4;
  29475. var key = peg$currPos * 63 + 50,
  29476. cached = peg$resultsCache[key];
  29477. if (cached) {
  29478. peg$currPos = cached.nextPos;
  29479. return cached.result;
  29480. }
  29481. s0 = peg$currPos;
  29482. s1 = peg$parsews();
  29483. if (s1 !== peg$FAILED) {
  29484. s2 = peg$parsebinarySelector();
  29485. if (s2 !== peg$FAILED) {
  29486. s3 = peg$parsews();
  29487. if (s3 !== peg$FAILED) {
  29488. s4 = peg$parseunarySend();
  29489. if (s4 !== peg$FAILED) {
  29490. peg$savedPos = s0;
  29491. s1 = peg$c105(s2, s4);
  29492. s0 = s1;
  29493. } else {
  29494. peg$currPos = s0;
  29495. s0 = peg$FAILED;
  29496. }
  29497. } else {
  29498. peg$currPos = s0;
  29499. s0 = peg$FAILED;
  29500. }
  29501. } else {
  29502. peg$currPos = s0;
  29503. s0 = peg$FAILED;
  29504. }
  29505. } else {
  29506. peg$currPos = s0;
  29507. s0 = peg$FAILED;
  29508. }
  29509. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29510. return s0;
  29511. }
  29512. function peg$parsebinarySend() {
  29513. var s0, s1, s2, s3;
  29514. var key = peg$currPos * 63 + 51,
  29515. cached = peg$resultsCache[key];
  29516. if (cached) {
  29517. peg$currPos = cached.nextPos;
  29518. return cached.result;
  29519. }
  29520. s0 = peg$currPos;
  29521. s1 = peg$parseunarySend();
  29522. if (s1 !== peg$FAILED) {
  29523. s2 = [];
  29524. s3 = peg$parsewsBinaryMessage();
  29525. while (s3 !== peg$FAILED) {
  29526. s2.push(s3);
  29527. s3 = peg$parsewsBinaryMessage();
  29528. }
  29529. if (s2 !== peg$FAILED) {
  29530. peg$savedPos = s0;
  29531. s1 = peg$c104(s1, s2);
  29532. s0 = s1;
  29533. } else {
  29534. peg$currPos = s0;
  29535. s0 = peg$FAILED;
  29536. }
  29537. } else {
  29538. peg$currPos = s0;
  29539. s0 = peg$FAILED;
  29540. }
  29541. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29542. return s0;
  29543. }
  29544. function peg$parsewsKeywordMessage() {
  29545. var s0, s1, s2, s3, s4, s5, s6;
  29546. var key = peg$currPos * 63 + 52,
  29547. cached = peg$resultsCache[key];
  29548. if (cached) {
  29549. peg$currPos = cached.nextPos;
  29550. return cached.result;
  29551. }
  29552. s0 = peg$currPos;
  29553. s1 = [];
  29554. s2 = peg$currPos;
  29555. s3 = peg$parsews();
  29556. if (s3 !== peg$FAILED) {
  29557. s4 = peg$parsekeyword();
  29558. if (s4 !== peg$FAILED) {
  29559. s5 = peg$parsews();
  29560. if (s5 !== peg$FAILED) {
  29561. s6 = peg$parsebinarySend();
  29562. if (s6 !== peg$FAILED) {
  29563. peg$savedPos = s2;
  29564. s3 = peg$c75(s4, s6);
  29565. s2 = s3;
  29566. } else {
  29567. peg$currPos = s2;
  29568. s2 = peg$FAILED;
  29569. }
  29570. } else {
  29571. peg$currPos = s2;
  29572. s2 = peg$FAILED;
  29573. }
  29574. } else {
  29575. peg$currPos = s2;
  29576. s2 = peg$FAILED;
  29577. }
  29578. } else {
  29579. peg$currPos = s2;
  29580. s2 = peg$FAILED;
  29581. }
  29582. if (s2 !== peg$FAILED) {
  29583. while (s2 !== peg$FAILED) {
  29584. s1.push(s2);
  29585. s2 = peg$currPos;
  29586. s3 = peg$parsews();
  29587. if (s3 !== peg$FAILED) {
  29588. s4 = peg$parsekeyword();
  29589. if (s4 !== peg$FAILED) {
  29590. s5 = peg$parsews();
  29591. if (s5 !== peg$FAILED) {
  29592. s6 = peg$parsebinarySend();
  29593. if (s6 !== peg$FAILED) {
  29594. peg$savedPos = s2;
  29595. s3 = peg$c75(s4, s6);
  29596. s2 = s3;
  29597. } else {
  29598. peg$currPos = s2;
  29599. s2 = peg$FAILED;
  29600. }
  29601. } else {
  29602. peg$currPos = s2;
  29603. s2 = peg$FAILED;
  29604. }
  29605. } else {
  29606. peg$currPos = s2;
  29607. s2 = peg$FAILED;
  29608. }
  29609. } else {
  29610. peg$currPos = s2;
  29611. s2 = peg$FAILED;
  29612. }
  29613. }
  29614. } else {
  29615. s1 = peg$FAILED;
  29616. }
  29617. if (s1 !== peg$FAILED) {
  29618. peg$savedPos = s0;
  29619. s1 = peg$c106(s1);
  29620. }
  29621. s0 = s1;
  29622. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29623. return s0;
  29624. }
  29625. function peg$parsekeywordSend() {
  29626. var s0, s1, s2;
  29627. var key = peg$currPos * 63 + 53,
  29628. cached = peg$resultsCache[key];
  29629. if (cached) {
  29630. peg$currPos = cached.nextPos;
  29631. return cached.result;
  29632. }
  29633. s0 = peg$currPos;
  29634. s1 = peg$parsebinarySend();
  29635. if (s1 !== peg$FAILED) {
  29636. s2 = peg$parsewsKeywordMessage();
  29637. if (s2 === peg$FAILED) {
  29638. s2 = null;
  29639. }
  29640. if (s2 !== peg$FAILED) {
  29641. peg$savedPos = s0;
  29642. s1 = peg$c107(s1, s2);
  29643. s0 = s1;
  29644. } else {
  29645. peg$currPos = s0;
  29646. s0 = peg$FAILED;
  29647. }
  29648. } else {
  29649. peg$currPos = s0;
  29650. s0 = peg$FAILED;
  29651. }
  29652. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29653. return s0;
  29654. }
  29655. function peg$parsewsMessage() {
  29656. var s0;
  29657. var key = peg$currPos * 63 + 54,
  29658. cached = peg$resultsCache[key];
  29659. if (cached) {
  29660. peg$currPos = cached.nextPos;
  29661. return cached.result;
  29662. }
  29663. s0 = peg$parsewsBinaryMessage();
  29664. if (s0 === peg$FAILED) {
  29665. s0 = peg$parsewsUnaryMessage();
  29666. if (s0 === peg$FAILED) {
  29667. s0 = peg$parsewsKeywordMessage();
  29668. }
  29669. }
  29670. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29671. return s0;
  29672. }
  29673. function peg$parsecascade() {
  29674. var s0, s1, s2, s3, s4, s5, s6, s7;
  29675. var key = peg$currPos * 63 + 55,
  29676. cached = peg$resultsCache[key];
  29677. if (cached) {
  29678. peg$currPos = cached.nextPos;
  29679. return cached.result;
  29680. }
  29681. s0 = peg$currPos;
  29682. s1 = peg$parsekeywordSend();
  29683. if (s1 !== peg$FAILED) {
  29684. peg$savedPos = peg$currPos;
  29685. s2 = peg$c108(s1);
  29686. if (s2) {
  29687. s2 = void 0;
  29688. } else {
  29689. s2 = peg$FAILED;
  29690. }
  29691. if (s2 !== peg$FAILED) {
  29692. s3 = [];
  29693. s4 = peg$currPos;
  29694. s5 = peg$parsews();
  29695. if (s5 !== peg$FAILED) {
  29696. if (input.charCodeAt(peg$currPos) === 59) {
  29697. s6 = peg$c109;
  29698. peg$currPos++;
  29699. } else {
  29700. s6 = peg$FAILED;
  29701. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  29702. }
  29703. if (s6 !== peg$FAILED) {
  29704. s7 = peg$parsewsMessage();
  29705. if (s7 !== peg$FAILED) {
  29706. peg$savedPos = s4;
  29707. s5 = peg$c111(s1, s7);
  29708. s4 = s5;
  29709. } else {
  29710. peg$currPos = s4;
  29711. s4 = peg$FAILED;
  29712. }
  29713. } else {
  29714. peg$currPos = s4;
  29715. s4 = peg$FAILED;
  29716. }
  29717. } else {
  29718. peg$currPos = s4;
  29719. s4 = peg$FAILED;
  29720. }
  29721. if (s4 !== peg$FAILED) {
  29722. while (s4 !== peg$FAILED) {
  29723. s3.push(s4);
  29724. s4 = peg$currPos;
  29725. s5 = peg$parsews();
  29726. if (s5 !== peg$FAILED) {
  29727. if (input.charCodeAt(peg$currPos) === 59) {
  29728. s6 = peg$c109;
  29729. peg$currPos++;
  29730. } else {
  29731. s6 = peg$FAILED;
  29732. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  29733. }
  29734. if (s6 !== peg$FAILED) {
  29735. s7 = peg$parsewsMessage();
  29736. if (s7 !== peg$FAILED) {
  29737. peg$savedPos = s4;
  29738. s5 = peg$c111(s1, s7);
  29739. s4 = s5;
  29740. } else {
  29741. peg$currPos = s4;
  29742. s4 = peg$FAILED;
  29743. }
  29744. } else {
  29745. peg$currPos = s4;
  29746. s4 = peg$FAILED;
  29747. }
  29748. } else {
  29749. peg$currPos = s4;
  29750. s4 = peg$FAILED;
  29751. }
  29752. }
  29753. } else {
  29754. s3 = peg$FAILED;
  29755. }
  29756. if (s3 !== peg$FAILED) {
  29757. peg$savedPos = s0;
  29758. s1 = peg$c112(s1, s3);
  29759. s0 = s1;
  29760. } else {
  29761. peg$currPos = s0;
  29762. s0 = peg$FAILED;
  29763. }
  29764. } else {
  29765. peg$currPos = s0;
  29766. s0 = peg$FAILED;
  29767. }
  29768. } else {
  29769. peg$currPos = s0;
  29770. s0 = peg$FAILED;
  29771. }
  29772. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29773. return s0;
  29774. }
  29775. function peg$parsejsStatement() {
  29776. var s0;
  29777. var key = peg$currPos * 63 + 56,
  29778. cached = peg$resultsCache[key];
  29779. if (cached) {
  29780. peg$currPos = cached.nextPos;
  29781. return cached.result;
  29782. }
  29783. s0 = peg$parsepragmaJsStatement();
  29784. if (s0 === peg$FAILED) {
  29785. s0 = peg$parselegacyJsStatement();
  29786. }
  29787. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29788. return s0;
  29789. }
  29790. function peg$parselegacyJsStatement() {
  29791. var s0, s1, s2, s3, s4;
  29792. var key = peg$currPos * 63 + 57,
  29793. cached = peg$resultsCache[key];
  29794. if (cached) {
  29795. peg$currPos = cached.nextPos;
  29796. return cached.result;
  29797. }
  29798. s0 = peg$currPos;
  29799. if (input.charCodeAt(peg$currPos) === 60) {
  29800. s1 = peg$c113;
  29801. peg$currPos++;
  29802. } else {
  29803. s1 = peg$FAILED;
  29804. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  29805. }
  29806. if (s1 !== peg$FAILED) {
  29807. s2 = [];
  29808. s3 = peg$currPos;
  29809. if (input.substr(peg$currPos, 2) === peg$c115) {
  29810. s4 = peg$c115;
  29811. peg$currPos += 2;
  29812. } else {
  29813. s4 = peg$FAILED;
  29814. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29815. }
  29816. if (s4 !== peg$FAILED) {
  29817. peg$savedPos = s3;
  29818. s4 = peg$c117();
  29819. }
  29820. s3 = s4;
  29821. if (s3 === peg$FAILED) {
  29822. if (peg$c118.test(input.charAt(peg$currPos))) {
  29823. s3 = input.charAt(peg$currPos);
  29824. peg$currPos++;
  29825. } else {
  29826. s3 = peg$FAILED;
  29827. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  29828. }
  29829. }
  29830. while (s3 !== peg$FAILED) {
  29831. s2.push(s3);
  29832. s3 = peg$currPos;
  29833. if (input.substr(peg$currPos, 2) === peg$c115) {
  29834. s4 = peg$c115;
  29835. peg$currPos += 2;
  29836. } else {
  29837. s4 = peg$FAILED;
  29838. if (peg$silentFails === 0) { peg$fail(peg$c116); }
  29839. }
  29840. if (s4 !== peg$FAILED) {
  29841. peg$savedPos = s3;
  29842. s4 = peg$c117();
  29843. }
  29844. s3 = s4;
  29845. if (s3 === peg$FAILED) {
  29846. if (peg$c118.test(input.charAt(peg$currPos))) {
  29847. s3 = input.charAt(peg$currPos);
  29848. peg$currPos++;
  29849. } else {
  29850. s3 = peg$FAILED;
  29851. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  29852. }
  29853. }
  29854. }
  29855. if (s2 !== peg$FAILED) {
  29856. if (input.charCodeAt(peg$currPos) === 62) {
  29857. s3 = peg$c120;
  29858. peg$currPos++;
  29859. } else {
  29860. s3 = peg$FAILED;
  29861. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  29862. }
  29863. if (s3 !== peg$FAILED) {
  29864. peg$savedPos = peg$currPos;
  29865. s4 = peg$c122(s2);
  29866. if (s4) {
  29867. s4 = void 0;
  29868. } else {
  29869. s4 = peg$FAILED;
  29870. }
  29871. if (s4 !== peg$FAILED) {
  29872. peg$savedPos = s0;
  29873. s1 = peg$c123(s2);
  29874. s0 = s1;
  29875. } else {
  29876. peg$currPos = s0;
  29877. s0 = peg$FAILED;
  29878. }
  29879. } else {
  29880. peg$currPos = s0;
  29881. s0 = peg$FAILED;
  29882. }
  29883. } else {
  29884. peg$currPos = s0;
  29885. s0 = peg$FAILED;
  29886. }
  29887. } else {
  29888. peg$currPos = s0;
  29889. s0 = peg$FAILED;
  29890. }
  29891. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29892. return s0;
  29893. }
  29894. function peg$parsepragmaJsStatement() {
  29895. var s0, s1, s2, s3, s4, s5, s6, s7;
  29896. var key = peg$currPos * 63 + 58,
  29897. cached = peg$resultsCache[key];
  29898. if (cached) {
  29899. peg$currPos = cached.nextPos;
  29900. return cached.result;
  29901. }
  29902. s0 = peg$currPos;
  29903. if (input.charCodeAt(peg$currPos) === 60) {
  29904. s1 = peg$c113;
  29905. peg$currPos++;
  29906. } else {
  29907. s1 = peg$FAILED;
  29908. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  29909. }
  29910. if (s1 !== peg$FAILED) {
  29911. s2 = peg$parsews();
  29912. if (s2 !== peg$FAILED) {
  29913. if (input.substr(peg$currPos, 9) === peg$c124) {
  29914. s3 = peg$c124;
  29915. peg$currPos += 9;
  29916. } else {
  29917. s3 = peg$FAILED;
  29918. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  29919. }
  29920. if (s3 !== peg$FAILED) {
  29921. s4 = peg$parsews();
  29922. if (s4 !== peg$FAILED) {
  29923. s5 = peg$parserawString();
  29924. if (s5 !== peg$FAILED) {
  29925. s6 = peg$parsews();
  29926. if (s6 !== peg$FAILED) {
  29927. if (input.charCodeAt(peg$currPos) === 62) {
  29928. s7 = peg$c120;
  29929. peg$currPos++;
  29930. } else {
  29931. s7 = peg$FAILED;
  29932. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  29933. }
  29934. if (s7 !== peg$FAILED) {
  29935. peg$savedPos = s0;
  29936. s1 = peg$c126(s5);
  29937. s0 = s1;
  29938. } else {
  29939. peg$currPos = s0;
  29940. s0 = peg$FAILED;
  29941. }
  29942. } else {
  29943. peg$currPos = s0;
  29944. s0 = peg$FAILED;
  29945. }
  29946. } else {
  29947. peg$currPos = s0;
  29948. s0 = peg$FAILED;
  29949. }
  29950. } else {
  29951. peg$currPos = s0;
  29952. s0 = peg$FAILED;
  29953. }
  29954. } else {
  29955. peg$currPos = s0;
  29956. s0 = peg$FAILED;
  29957. }
  29958. } else {
  29959. peg$currPos = s0;
  29960. s0 = peg$FAILED;
  29961. }
  29962. } else {
  29963. peg$currPos = s0;
  29964. s0 = peg$FAILED;
  29965. }
  29966. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29967. return s0;
  29968. }
  29969. function peg$parsemethod() {
  29970. var s0, s1, s2;
  29971. var key = peg$currPos * 63 + 59,
  29972. cached = peg$resultsCache[key];
  29973. if (cached) {
  29974. peg$currPos = cached.nextPos;
  29975. return cached.result;
  29976. }
  29977. s0 = peg$currPos;
  29978. s1 = peg$parsewsKeywordPattern();
  29979. if (s1 === peg$FAILED) {
  29980. s1 = peg$parsewsBinaryPattern();
  29981. if (s1 === peg$FAILED) {
  29982. s1 = peg$parsewsUnaryPattern();
  29983. }
  29984. }
  29985. if (s1 !== peg$FAILED) {
  29986. s2 = peg$parsewsSequenceWs();
  29987. if (s2 !== peg$FAILED) {
  29988. peg$savedPos = s0;
  29989. s1 = peg$c127(s1, s2);
  29990. s0 = s1;
  29991. } else {
  29992. peg$currPos = s0;
  29993. s0 = peg$FAILED;
  29994. }
  29995. } else {
  29996. peg$currPos = s0;
  29997. s0 = peg$FAILED;
  29998. }
  29999. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30000. return s0;
  30001. }
  30002. function peg$parseassociationSend() {
  30003. var s0, s1, s2;
  30004. var key = peg$currPos * 63 + 60,
  30005. cached = peg$resultsCache[key];
  30006. if (cached) {
  30007. peg$currPos = cached.nextPos;
  30008. return cached.result;
  30009. }
  30010. s0 = peg$currPos;
  30011. s1 = peg$parsebinarySend();
  30012. if (s1 !== peg$FAILED) {
  30013. peg$savedPos = peg$currPos;
  30014. s2 = peg$c128(s1);
  30015. if (s2) {
  30016. s2 = void 0;
  30017. } else {
  30018. s2 = peg$FAILED;
  30019. }
  30020. if (s2 !== peg$FAILED) {
  30021. peg$savedPos = s0;
  30022. s1 = peg$c129(s1);
  30023. s0 = s1;
  30024. } else {
  30025. peg$currPos = s0;
  30026. s0 = peg$FAILED;
  30027. }
  30028. } else {
  30029. peg$currPos = s0;
  30030. s0 = peg$FAILED;
  30031. }
  30032. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30033. return s0;
  30034. }
  30035. function peg$parsewsAssociationsRest() {
  30036. var s0, s1, s2;
  30037. var key = peg$currPos * 63 + 61,
  30038. cached = peg$resultsCache[key];
  30039. if (cached) {
  30040. peg$currPos = cached.nextPos;
  30041. return cached.result;
  30042. }
  30043. s0 = peg$currPos;
  30044. s1 = peg$parsesomeDotsWs();
  30045. if (s1 !== peg$FAILED) {
  30046. s2 = peg$parseassociationSend();
  30047. if (s2 !== peg$FAILED) {
  30048. peg$savedPos = s0;
  30049. s1 = peg$c79(s2);
  30050. s0 = s1;
  30051. } else {
  30052. peg$currPos = s0;
  30053. s0 = peg$FAILED;
  30054. }
  30055. } else {
  30056. peg$currPos = s0;
  30057. s0 = peg$FAILED;
  30058. }
  30059. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30060. return s0;
  30061. }
  30062. function peg$parsewsAssociations() {
  30063. var s0, s1, s2, s3, s4;
  30064. var key = peg$currPos * 63 + 62,
  30065. cached = peg$resultsCache[key];
  30066. if (cached) {
  30067. peg$currPos = cached.nextPos;
  30068. return cached.result;
  30069. }
  30070. s0 = peg$currPos;
  30071. s1 = peg$parsemaybeDotsWs();
  30072. if (s1 !== peg$FAILED) {
  30073. s2 = peg$parseassociationSend();
  30074. if (s2 !== peg$FAILED) {
  30075. s3 = [];
  30076. s4 = peg$parsewsAssociationsRest();
  30077. while (s4 !== peg$FAILED) {
  30078. s3.push(s4);
  30079. s4 = peg$parsewsAssociationsRest();
  30080. }
  30081. if (s3 !== peg$FAILED) {
  30082. peg$savedPos = s0;
  30083. s1 = peg$c130(s2, s3);
  30084. s0 = s1;
  30085. } else {
  30086. peg$currPos = s0;
  30087. s0 = peg$FAILED;
  30088. }
  30089. } else {
  30090. peg$currPos = s0;
  30091. s0 = peg$FAILED;
  30092. }
  30093. } else {
  30094. peg$currPos = s0;
  30095. s0 = peg$FAILED;
  30096. }
  30097. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30098. return s0;
  30099. }
  30100. peg$result = peg$startRuleFunction();
  30101. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30102. return peg$result;
  30103. } else {
  30104. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30105. peg$fail({ type: "end", description: "end of input" });
  30106. }
  30107. throw peg$buildException(
  30108. null,
  30109. peg$maxFailExpected,
  30110. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30111. peg$maxFailPos < input.length
  30112. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30113. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30114. );
  30115. }
  30116. }
  30117. return {
  30118. SyntaxError: peg$SyntaxError,
  30119. parse: peg$parse
  30120. };
  30121. })();
  30122. });
  30123. 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";
  30124. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30125. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30126. $core.addPackage("Platform-ImportExport");
  30127. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  30128. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30129. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30130. $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.";
  30131. $core.addMethod(
  30132. $core.method({
  30133. selector: "exportPackage:on:",
  30134. protocol: "output",
  30135. fn: function (aPackage,aStream){
  30136. var self=this,$self=this;
  30137. return $core.withContext(function($ctx1) {
  30138. $self._subclassResponsibility();
  30139. return self;
  30140. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30141. },
  30142. args: ["aPackage", "aStream"],
  30143. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30144. referencedClasses: [],
  30145. messageSends: ["subclassResponsibility"]
  30146. }),
  30147. $globals.AbstractExporter);
  30148. $core.addMethod(
  30149. $core.method({
  30150. selector: "extensionMethodsOfPackage:",
  30151. protocol: "accessing",
  30152. fn: function (aPackage){
  30153. var self=this,$self=this;
  30154. var result;
  30155. return $core.withContext(function($ctx1) {
  30156. result=$recv($globals.OrderedCollection)._new();
  30157. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30158. return $core.withContext(function($ctx2) {
  30159. return $recv(result)._addAll_($recv(each)._ownMethods());
  30160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30161. }));
  30162. return result;
  30163. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30164. },
  30165. args: ["aPackage"],
  30166. 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",
  30167. referencedClasses: ["OrderedCollection"],
  30168. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30169. }),
  30170. $globals.AbstractExporter);
  30171. $core.addMethod(
  30172. $core.method({
  30173. selector: "extensionProtocolsOfPackage:",
  30174. protocol: "accessing",
  30175. fn: function (aPackage){
  30176. var self=this,$self=this;
  30177. var extensionName,result;
  30178. return $core.withContext(function($ctx1) {
  30179. var $1,$2,$3;
  30180. $1=$recv(aPackage)._name();
  30181. $ctx1.sendIdx["name"]=1;
  30182. extensionName="*".__comma($1);
  30183. result=$recv($globals.OrderedCollection)._new();
  30184. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30185. return $core.withContext(function($ctx2) {
  30186. $2=$recv(a)._name();
  30187. $ctx2.sendIdx["name"]=2;
  30188. return $recv($2).__lt($recv(b)._name());
  30189. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30190. })))._do_((function(each){
  30191. return $core.withContext(function($ctx2) {
  30192. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30193. return $core.withContext(function($ctx3) {
  30194. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30195. if($core.assert($3)){
  30196. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30197. }
  30198. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30199. }));
  30200. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30201. }));
  30202. $ctx1.sendIdx["do:"]=1;
  30203. return result;
  30204. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30205. },
  30206. args: ["aPackage"],
  30207. 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",
  30208. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30209. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30210. }),
  30211. $globals.AbstractExporter);
  30212. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30213. $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.";
  30214. $core.addMethod(
  30215. $core.method({
  30216. selector: "chunkEscape:",
  30217. protocol: "convenience",
  30218. fn: function (aString){
  30219. var self=this,$self=this;
  30220. return $core.withContext(function($ctx1) {
  30221. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30222. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30223. },
  30224. args: ["aString"],
  30225. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30226. referencedClasses: [],
  30227. messageSends: ["trimBoth", "replace:with:"]
  30228. }),
  30229. $globals.ChunkExporter);
  30230. $core.addMethod(
  30231. $core.method({
  30232. selector: "exportBehavior:on:",
  30233. protocol: "output",
  30234. fn: function (aBehavior,aStream){
  30235. var self=this,$self=this;
  30236. return $core.withContext(function($ctx1) {
  30237. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30238. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30239. return self;
  30240. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30241. },
  30242. args: ["aBehavior", "aStream"],
  30243. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30244. referencedClasses: [],
  30245. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30246. }),
  30247. $globals.ChunkExporter);
  30248. $core.addMethod(
  30249. $core.method({
  30250. selector: "exportCategoryEpilogueOf:on:",
  30251. protocol: "output",
  30252. fn: function (aCategory,aStream){
  30253. var self=this,$self=this;
  30254. return $core.withContext(function($ctx1) {
  30255. $recv(aStream)._write_(" !");
  30256. $recv(aStream)._lf();
  30257. $ctx1.sendIdx["lf"]=1;
  30258. $recv(aStream)._lf();
  30259. return self;
  30260. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30261. },
  30262. args: ["aCategory", "aStream"],
  30263. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30264. referencedClasses: [],
  30265. messageSends: ["write:", "lf"]
  30266. }),
  30267. $globals.ChunkExporter);
  30268. $core.addMethod(
  30269. $core.method({
  30270. selector: "exportCategoryPrologueOf:on:",
  30271. protocol: "output",
  30272. fn: function (aCategory,aStream){
  30273. var self=this,$self=this;
  30274. return $core.withContext(function($ctx1) {
  30275. $recv(aStream)._write_("!");
  30276. $ctx1.sendIdx["write:"]=1;
  30277. $recv(aStream)._print_($recv(aCategory)._theClass());
  30278. $ctx1.sendIdx["print:"]=1;
  30279. $recv(aStream)._write_(" methodsFor: ");
  30280. $ctx1.sendIdx["write:"]=2;
  30281. $recv(aStream)._print_(aCategory);
  30282. $recv(aStream)._write_("!");
  30283. return self;
  30284. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30285. },
  30286. args: ["aCategory", "aStream"],
  30287. 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: '!'",
  30288. referencedClasses: [],
  30289. messageSends: ["write:", "print:", "theClass"]
  30290. }),
  30291. $globals.ChunkExporter);
  30292. $core.addMethod(
  30293. $core.method({
  30294. selector: "exportDefinitionOf:on:",
  30295. protocol: "output",
  30296. fn: function (aClass,aStream){
  30297. var self=this,$self=this;
  30298. return $core.withContext(function($ctx1) {
  30299. var $1,$2,$3,$4;
  30300. $recv(aStream)._print_($recv(aClass)._superclass());
  30301. $ctx1.sendIdx["print:"]=1;
  30302. $recv(aStream)._write_(" subclass: ");
  30303. $ctx1.sendIdx["write:"]=1;
  30304. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30305. $1=$recv(aStream)._lf();
  30306. $ctx1.sendIdx["lf"]=1;
  30307. $recv(aStream)._tab();
  30308. $ctx1.sendIdx["tab"]=1;
  30309. $recv(aStream)._write_("instanceVariableNames: ");
  30310. $ctx1.sendIdx["write:"]=2;
  30311. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30312. $ctx1.sendIdx["print:"]=2;
  30313. $recv(aStream)._lf();
  30314. $ctx1.sendIdx["lf"]=2;
  30315. $recv(aStream)._tab();
  30316. $recv(aStream)._write_("package: ");
  30317. $ctx1.sendIdx["write:"]=3;
  30318. $recv(aStream)._print_($recv(aClass)._category());
  30319. $ctx1.sendIdx["print:"]=3;
  30320. $recv(aStream)._write_("!");
  30321. $ctx1.sendIdx["write:"]=4;
  30322. $2=$recv(aStream)._lf();
  30323. $ctx1.sendIdx["lf"]=3;
  30324. $3=$recv(aClass)._comment();
  30325. $ctx1.sendIdx["comment"]=1;
  30326. $recv($3)._ifNotEmpty_((function(){
  30327. return $core.withContext(function($ctx2) {
  30328. $recv(aStream)._write_("!");
  30329. $ctx2.sendIdx["write:"]=5;
  30330. $recv(aStream)._print_(aClass);
  30331. $recv(aStream)._write_(" commentStamp!");
  30332. $ctx2.sendIdx["write:"]=6;
  30333. $recv(aStream)._lf();
  30334. $ctx2.sendIdx["lf"]=4;
  30335. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30336. $4=$recv(aStream)._lf();
  30337. $ctx2.sendIdx["lf"]=5;
  30338. return $4;
  30339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30340. }));
  30341. $recv(aStream)._lf();
  30342. return self;
  30343. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30344. },
  30345. args: ["aClass", "aStream"],
  30346. 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",
  30347. referencedClasses: [],
  30348. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30349. }),
  30350. $globals.ChunkExporter);
  30351. $core.addMethod(
  30352. $core.method({
  30353. selector: "exportMetaDefinitionOf:on:",
  30354. protocol: "output",
  30355. fn: function (aClass,aStream){
  30356. var self=this,$self=this;
  30357. var classIvars,classTraitComposition;
  30358. return $core.withContext(function($ctx1) {
  30359. var $1,$2;
  30360. $1=$recv(aClass)._class();
  30361. $ctx1.sendIdx["class"]=1;
  30362. classIvars=$recv($1)._instanceVariableNames();
  30363. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30364. $2=$recv(classIvars)._notEmpty();
  30365. if($core.assert($2)){
  30366. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30367. $ctx1.sendIdx["print:"]=1;
  30368. $recv(aStream)._space();
  30369. $recv(aStream)._write_("instanceVariableNames: ");
  30370. $ctx1.sendIdx["write:"]=1;
  30371. $recv(aStream)._print_(" "._join_(classIvars));
  30372. $recv(aStream)._write_("!");
  30373. $recv(aStream)._lf();
  30374. $ctx1.sendIdx["lf"]=1;
  30375. $recv(aStream)._lf();
  30376. }
  30377. return self;
  30378. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30379. },
  30380. args: ["aClass", "aStream"],
  30381. 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 ]",
  30382. referencedClasses: [],
  30383. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30384. }),
  30385. $globals.ChunkExporter);
  30386. $core.addMethod(
  30387. $core.method({
  30388. selector: "exportMethod:on:",
  30389. protocol: "output",
  30390. fn: function (aMethod,aStream){
  30391. var self=this,$self=this;
  30392. return $core.withContext(function($ctx1) {
  30393. $recv(aStream)._lf();
  30394. $ctx1.sendIdx["lf"]=1;
  30395. $recv(aStream)._lf();
  30396. $ctx1.sendIdx["lf"]=2;
  30397. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30398. $ctx1.sendIdx["write:"]=1;
  30399. $recv(aStream)._lf();
  30400. $recv(aStream)._write_("!");
  30401. return self;
  30402. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30403. },
  30404. args: ["aMethod", "aStream"],
  30405. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30406. referencedClasses: [],
  30407. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30408. }),
  30409. $globals.ChunkExporter);
  30410. $core.addMethod(
  30411. $core.method({
  30412. selector: "exportPackage:on:",
  30413. protocol: "output",
  30414. fn: function (aPackage,aStream){
  30415. var self=this,$self=this;
  30416. return $core.withContext(function($ctx1) {
  30417. var $1,$receiver;
  30418. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30419. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30420. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30421. return $core.withContext(function($ctx2) {
  30422. $self._exportBehavior_on_(each,aStream);
  30423. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30424. $1=$recv(each)._theMetaClass();
  30425. if(($receiver = $1) == null || $receiver.a$nil){
  30426. return $1;
  30427. } else {
  30428. var meta;
  30429. meta=$receiver;
  30430. return $self._exportBehavior_on_(meta,aStream);
  30431. }
  30432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30433. }));
  30434. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30435. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30436. return self;
  30437. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30438. },
  30439. args: ["aPackage", "aStream"],
  30440. 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",
  30441. referencedClasses: [],
  30442. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30443. }),
  30444. $globals.ChunkExporter);
  30445. $core.addMethod(
  30446. $core.method({
  30447. selector: "exportPackageDefinitionOf:on:",
  30448. protocol: "output",
  30449. fn: function (aPackage,aStream){
  30450. var self=this,$self=this;
  30451. return $core.withContext(function($ctx1) {
  30452. $recv(aStream)._write_("Smalltalk createPackage: ");
  30453. $ctx1.sendIdx["write:"]=1;
  30454. $recv(aStream)._print_($recv(aPackage)._name());
  30455. $recv(aStream)._write_("!");
  30456. $recv(aStream)._lf();
  30457. return self;
  30458. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30459. },
  30460. args: ["aPackage", "aStream"],
  30461. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30462. referencedClasses: [],
  30463. messageSends: ["write:", "print:", "name", "lf"]
  30464. }),
  30465. $globals.ChunkExporter);
  30466. $core.addMethod(
  30467. $core.method({
  30468. selector: "exportPackageImportsOf:on:",
  30469. protocol: "output",
  30470. fn: function (aPackage,aStream){
  30471. var self=this,$self=this;
  30472. return $core.withContext(function($ctx1) {
  30473. var $1;
  30474. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30475. return $core.withContext(function($ctx2) {
  30476. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30477. $ctx2.sendIdx["write:"]=1;
  30478. $1=$recv(aPackage)._name();
  30479. $ctx2.sendIdx["name"]=1;
  30480. $recv(aStream)._print_($1);
  30481. $ctx2.sendIdx["print:"]=1;
  30482. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30483. $ctx2.sendIdx["write:"]=2;
  30484. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30485. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30486. return $recv(aStream)._lf();
  30487. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30488. }));
  30489. return self;
  30490. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30491. },
  30492. args: ["aPackage", "aStream"],
  30493. 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 ]",
  30494. referencedClasses: [],
  30495. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30496. }),
  30497. $globals.ChunkExporter);
  30498. $core.addMethod(
  30499. $core.method({
  30500. selector: "exportPackageTraitCompositionsOf:on:",
  30501. protocol: "output",
  30502. fn: function (aPackage,aStream){
  30503. var self=this,$self=this;
  30504. return $core.withContext(function($ctx1) {
  30505. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30506. return $core.withContext(function($ctx2) {
  30507. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30508. return $core.withContext(function($ctx3) {
  30509. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30510. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30511. }));
  30512. $recv(aStream)._write_("! !");
  30513. $recv(aStream)._lf();
  30514. $ctx2.sendIdx["lf"]=1;
  30515. return $recv(aStream)._lf();
  30516. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30517. }));
  30518. return self;
  30519. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30520. },
  30521. args: ["aPackage", "aStream"],
  30522. 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 ]",
  30523. referencedClasses: [],
  30524. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30525. }),
  30526. $globals.ChunkExporter);
  30527. $core.addMethod(
  30528. $core.method({
  30529. selector: "exportProtocol:on:",
  30530. protocol: "output",
  30531. fn: function (aProtocol,aStream){
  30532. var self=this,$self=this;
  30533. return $core.withContext(function($ctx1) {
  30534. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30535. return $core.withContext(function($ctx2) {
  30536. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30537. $recv(methods)._do_((function(method){
  30538. return $core.withContext(function($ctx3) {
  30539. return $self._exportMethod_on_(method,aStream);
  30540. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30541. }));
  30542. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30543. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30544. }));
  30545. return self;
  30546. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30547. },
  30548. args: ["aProtocol", "aStream"],
  30549. 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 ]",
  30550. referencedClasses: [],
  30551. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30552. }),
  30553. $globals.ChunkExporter);
  30554. $core.addMethod(
  30555. $core.method({
  30556. selector: "exportProtocolEpilogueOf:on:",
  30557. protocol: "output",
  30558. fn: function (aProtocol,aStream){
  30559. var self=this,$self=this;
  30560. return $core.withContext(function($ctx1) {
  30561. $recv(aStream)._write_(" !");
  30562. $recv(aStream)._lf();
  30563. $ctx1.sendIdx["lf"]=1;
  30564. $recv(aStream)._lf();
  30565. return self;
  30566. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30567. },
  30568. args: ["aProtocol", "aStream"],
  30569. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30570. referencedClasses: [],
  30571. messageSends: ["write:", "lf"]
  30572. }),
  30573. $globals.ChunkExporter);
  30574. $core.addMethod(
  30575. $core.method({
  30576. selector: "exportProtocolPrologueOf:on:",
  30577. protocol: "output",
  30578. fn: function (aProtocol,aStream){
  30579. var self=this,$self=this;
  30580. return $core.withContext(function($ctx1) {
  30581. $recv(aStream)._write_("!");
  30582. $ctx1.sendIdx["write:"]=1;
  30583. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30584. $ctx1.sendIdx["print:"]=1;
  30585. $recv(aStream)._write_(" methodsFor: ");
  30586. $ctx1.sendIdx["write:"]=2;
  30587. $recv(aStream)._print_($recv(aProtocol)._name());
  30588. $recv(aStream)._write_("!");
  30589. return self;
  30590. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30591. },
  30592. args: ["aProtocol", "aStream"],
  30593. 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: '!'",
  30594. referencedClasses: [],
  30595. messageSends: ["write:", "print:", "theClass", "name"]
  30596. }),
  30597. $globals.ChunkExporter);
  30598. $core.addMethod(
  30599. $core.method({
  30600. selector: "exportProtocols:on:",
  30601. protocol: "output",
  30602. fn: function (aCollection,aStream){
  30603. var self=this,$self=this;
  30604. return $core.withContext(function($ctx1) {
  30605. $recv(aCollection)._do_((function(each){
  30606. return $core.withContext(function($ctx2) {
  30607. return $self._exportProtocol_on_(each,aStream);
  30608. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30609. }));
  30610. return self;
  30611. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30612. },
  30613. args: ["aCollection", "aStream"],
  30614. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30615. referencedClasses: [],
  30616. messageSends: ["do:", "exportProtocol:on:"]
  30617. }),
  30618. $globals.ChunkExporter);
  30619. $core.addMethod(
  30620. $core.method({
  30621. selector: "exportTraitComposition:of:on:",
  30622. protocol: "output",
  30623. fn: function (aTraitComposition,aBehavior,aStream){
  30624. var self=this,$self=this;
  30625. return $core.withContext(function($ctx1) {
  30626. $recv(aStream)._print_(aBehavior);
  30627. $recv(aStream)._write_(" setTraitComposition: ");
  30628. $ctx1.sendIdx["write:"]=1;
  30629. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30630. $ctx1.sendIdx["write:"]=2;
  30631. $recv(aStream)._write_(" asTraitComposition!");
  30632. $recv(aStream)._lf();
  30633. return self;
  30634. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30635. },
  30636. args: ["aTraitComposition", "aBehavior", "aStream"],
  30637. 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",
  30638. referencedClasses: [],
  30639. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30640. }),
  30641. $globals.ChunkExporter);
  30642. $core.addMethod(
  30643. $core.method({
  30644. selector: "exportTraitDefinitionOf:on:",
  30645. protocol: "output",
  30646. fn: function (aClass,aStream){
  30647. var self=this,$self=this;
  30648. return $core.withContext(function($ctx1) {
  30649. var $1,$2,$3,$4;
  30650. $recv(aStream)._write_("Trait named: ");
  30651. $ctx1.sendIdx["write:"]=1;
  30652. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30653. $1=$recv(aStream)._lf();
  30654. $ctx1.sendIdx["lf"]=1;
  30655. $recv(aStream)._tab();
  30656. $recv(aStream)._write_("package: ");
  30657. $ctx1.sendIdx["write:"]=2;
  30658. $recv(aStream)._print_($recv(aClass)._category());
  30659. $ctx1.sendIdx["print:"]=1;
  30660. $recv(aStream)._write_("!");
  30661. $ctx1.sendIdx["write:"]=3;
  30662. $2=$recv(aStream)._lf();
  30663. $ctx1.sendIdx["lf"]=2;
  30664. $3=$recv(aClass)._comment();
  30665. $ctx1.sendIdx["comment"]=1;
  30666. $recv($3)._ifNotEmpty_((function(){
  30667. return $core.withContext(function($ctx2) {
  30668. $recv(aStream)._write_("!");
  30669. $ctx2.sendIdx["write:"]=4;
  30670. $recv(aStream)._print_(aClass);
  30671. $recv(aStream)._write_(" commentStamp!");
  30672. $ctx2.sendIdx["write:"]=5;
  30673. $recv(aStream)._lf();
  30674. $ctx2.sendIdx["lf"]=3;
  30675. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30676. $4=$recv(aStream)._lf();
  30677. $ctx2.sendIdx["lf"]=4;
  30678. return $4;
  30679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30680. }));
  30681. $recv(aStream)._lf();
  30682. return self;
  30683. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30684. },
  30685. args: ["aClass", "aStream"],
  30686. 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",
  30687. referencedClasses: [],
  30688. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30689. }),
  30690. $globals.ChunkExporter);
  30691. $core.addMethod(
  30692. $core.method({
  30693. selector: "extensionCategoriesOfPackage:",
  30694. protocol: "accessing",
  30695. fn: function (aPackage){
  30696. var self=this,$self=this;
  30697. var name,map,result;
  30698. return $core.withContext(function($ctx1) {
  30699. var $1;
  30700. name=$recv(aPackage)._name();
  30701. result=$recv($globals.OrderedCollection)._new();
  30702. $ctx1.sendIdx["new"]=1;
  30703. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30704. return $core.withContext(function($ctx2) {
  30705. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30706. return $core.withContext(function($ctx3) {
  30707. map=$recv($globals.Dictionary)._new();
  30708. map;
  30709. $recv(aClass)._protocolsDo_((function(category,methods){
  30710. return $core.withContext(function($ctx4) {
  30711. $1=$recv(category).__eq("*".__comma(name));
  30712. if($core.assert($1)){
  30713. return $recv(map)._at_put_(category,methods);
  30714. }
  30715. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30716. }));
  30717. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30718. return $core.withContext(function($ctx4) {
  30719. return $recv(a).__lt_eq(b);
  30720. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30721. })))._collect_((function(category){
  30722. return $core.withContext(function($ctx4) {
  30723. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30724. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30725. })));
  30726. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30727. }));
  30728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30729. }));
  30730. $ctx1.sendIdx["do:"]=1;
  30731. return result;
  30732. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30733. },
  30734. args: ["aPackage"],
  30735. 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",
  30736. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30737. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30738. }),
  30739. $globals.ChunkExporter);
  30740. $core.addMethod(
  30741. $core.method({
  30742. selector: "ownCategoriesOfClass:",
  30743. protocol: "accessing",
  30744. fn: function (aClass){
  30745. var self=this,$self=this;
  30746. var map;
  30747. return $core.withContext(function($ctx1) {
  30748. var $1;
  30749. map=$recv($globals.Dictionary)._new();
  30750. $recv(aClass)._protocolsDo_((function(each,methods){
  30751. return $core.withContext(function($ctx2) {
  30752. $1=$recv(each)._match_("^\x5c*");
  30753. if(!$core.assert($1)){
  30754. return $recv(map)._at_put_(each,methods);
  30755. }
  30756. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30757. }));
  30758. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30759. return $core.withContext(function($ctx2) {
  30760. return $recv(a).__lt_eq(b);
  30761. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30762. })))._collect_((function(each){
  30763. return $core.withContext(function($ctx2) {
  30764. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30766. }));
  30767. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30768. },
  30769. args: ["aClass"],
  30770. 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) ]",
  30771. referencedClasses: ["Dictionary", "MethodCategory"],
  30772. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30773. }),
  30774. $globals.ChunkExporter);
  30775. $core.addMethod(
  30776. $core.method({
  30777. selector: "ownCategoriesOfMetaClass:",
  30778. protocol: "accessing",
  30779. fn: function (aClass){
  30780. var self=this,$self=this;
  30781. return $core.withContext(function($ctx1) {
  30782. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30783. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30784. },
  30785. args: ["aClass"],
  30786. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30787. referencedClasses: [],
  30788. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30789. }),
  30790. $globals.ChunkExporter);
  30791. $core.addMethod(
  30792. $core.method({
  30793. selector: "ownMethodProtocolsOfClass:",
  30794. protocol: "accessing",
  30795. fn: function (aClass){
  30796. var self=this,$self=this;
  30797. return $core.withContext(function($ctx1) {
  30798. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30799. return $core.withContext(function($ctx2) {
  30800. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30801. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30802. }));
  30803. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30804. },
  30805. args: ["aClass"],
  30806. 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 ]",
  30807. referencedClasses: ["ExportMethodProtocol"],
  30808. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30809. }),
  30810. $globals.ChunkExporter);
  30811. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30812. $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.).";
  30813. $core.addMethod(
  30814. $core.method({
  30815. selector: "exportBehavior:on:",
  30816. protocol: "output",
  30817. fn: function (aBehavior,aStream){
  30818. var self=this,$self=this;
  30819. return $core.withContext(function($ctx1) {
  30820. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30821. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30822. return $core.withContext(function($ctx2) {
  30823. return $self._exportMethod_on_(method,aStream);
  30824. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30825. }));
  30826. return self;
  30827. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30828. },
  30829. args: ["aBehavior", "aStream"],
  30830. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30831. referencedClasses: [],
  30832. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30833. }),
  30834. $globals.Exporter);
  30835. $core.addMethod(
  30836. $core.method({
  30837. selector: "exportDefinitionOf:on:",
  30838. protocol: "output",
  30839. fn: function (aClass,aStream){
  30840. var self=this,$self=this;
  30841. return $core.withContext(function($ctx1) {
  30842. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  30843. $recv(aStream)._lf();
  30844. $ctx1.sendIdx["lf"]=1;
  30845. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  30846. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30847. $5=$recv(aClass)._superclass();
  30848. if(($receiver = $5) == null || $receiver.a$nil){
  30849. $4="null";
  30850. } else {
  30851. var superclass;
  30852. superclass=$receiver;
  30853. $4=$recv(superclass)._asJavaScriptSource();
  30854. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30855. }
  30856. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  30857. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30858. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  30859. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30860. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  30861. $1=$recv(aStream)._write_($2);
  30862. $ctx1.sendIdx["write:"]=1;
  30863. $8=$recv(aClass)._comment();
  30864. $ctx1.sendIdx["comment"]=1;
  30865. $recv($8)._ifNotEmpty_((function(){
  30866. return $core.withContext(function($ctx2) {
  30867. $recv(aStream)._lf();
  30868. $ctx2.sendIdx["lf"]=2;
  30869. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30870. $ctx2.sendIdx["write:"]=2;
  30871. $recv(aStream)._lf();
  30872. $ctx2.sendIdx["lf"]=3;
  30873. $10=$recv(aClass)._asJavaScriptSource();
  30874. $ctx2.sendIdx["asJavaScriptSource"]=5;
  30875. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  30876. $recv(aStream)._write_($9);
  30877. $ctx2.sendIdx["write:"]=3;
  30878. $recv(aStream)._lf();
  30879. $ctx2.sendIdx["lf"]=4;
  30880. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30882. }));
  30883. $recv(aStream)._lf();
  30884. return self;
  30885. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30886. },
  30887. args: ["aClass", "aStream"],
  30888. 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",
  30889. referencedClasses: [],
  30890. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  30891. }),
  30892. $globals.Exporter);
  30893. $core.addMethod(
  30894. $core.method({
  30895. selector: "exportMetaDefinitionOf:on:",
  30896. protocol: "output",
  30897. fn: function (aClass,aStream){
  30898. var self=this,$self=this;
  30899. return $core.withContext(function($ctx1) {
  30900. var $2,$1,$4,$3;
  30901. $recv(aStream)._lf();
  30902. $ctx1.sendIdx["lf"]=1;
  30903. $2=$recv(aClass)._theMetaClass();
  30904. $ctx1.sendIdx["theMetaClass"]=1;
  30905. $1=$recv($2)._instanceVariableNames();
  30906. $recv($1)._ifNotEmpty_((function(classIvars){
  30907. return $core.withContext(function($ctx2) {
  30908. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  30909. $ctx2.sendIdx["asJavaScriptSource"]=1;
  30910. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  30911. $recv(aStream)._write_($3);
  30912. return $recv(aStream)._lf();
  30913. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  30914. }));
  30915. return self;
  30916. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  30917. },
  30918. args: ["aClass", "aStream"],
  30919. 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 ]",
  30920. referencedClasses: [],
  30921. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  30922. }),
  30923. $globals.Exporter);
  30924. $core.addMethod(
  30925. $core.method({
  30926. selector: "exportMethod:on:",
  30927. protocol: "output",
  30928. fn: function (aMethod,aStream){
  30929. var self=this,$self=this;
  30930. return $core.withContext(function($ctx1) {
  30931. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  30932. $recv(aStream)._write_("$core.addMethod(");
  30933. $ctx1.sendIdx["write:"]=1;
  30934. $recv(aStream)._lf();
  30935. $ctx1.sendIdx["lf"]=1;
  30936. $recv(aStream)._write_("$core.method({");
  30937. $ctx1.sendIdx["write:"]=2;
  30938. $recv(aStream)._lf();
  30939. $ctx1.sendIdx["lf"]=2;
  30940. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  30941. $ctx1.sendIdx["asJavaScriptSource"]=1;
  30942. $1=["selector: ",$2,","];
  30943. $recv(aStream)._write_($1);
  30944. $ctx1.sendIdx["write:"]=3;
  30945. $recv(aStream)._lf();
  30946. $ctx1.sendIdx["lf"]=3;
  30947. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  30948. $ctx1.sendIdx["asJavaScriptSource"]=2;
  30949. $3=["protocol: ",$4,","];
  30950. $recv(aStream)._write_($3);
  30951. $ctx1.sendIdx["write:"]=4;
  30952. $recv(aStream)._lf();
  30953. $ctx1.sendIdx["lf"]=4;
  30954. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  30955. $ctx1.sendIdx["write:"]=5;
  30956. $recv(aStream)._lf();
  30957. $ctx1.sendIdx["lf"]=5;
  30958. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  30959. $ctx1.sendIdx["write:"]=6;
  30960. $recv(aStream)._lf();
  30961. $ctx1.sendIdx["lf"]=6;
  30962. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  30963. $ctx1.sendIdx["asJavaScriptSource"]=3;
  30964. $5=["args: ",$6,","];
  30965. $recv(aStream)._write_($5);
  30966. $ctx1.sendIdx["write:"]=7;
  30967. $recv(aStream)._lf();
  30968. $ctx1.sendIdx["lf"]=7;
  30969. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  30970. $ctx1.sendIdx["asJavaScriptSource"]=4;
  30971. $7=["source: ",$8,","];
  30972. $recv(aStream)._write_($7);
  30973. $ctx1.sendIdx["write:"]=8;
  30974. $recv(aStream)._lf();
  30975. $ctx1.sendIdx["lf"]=8;
  30976. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  30977. $ctx1.sendIdx["asJavaScriptSource"]=5;
  30978. $9=["referencedClasses: ",$10,","];
  30979. $recv(aStream)._write_($9);
  30980. $ctx1.sendIdx["write:"]=9;
  30981. $recv(aStream)._lf();
  30982. $ctx1.sendIdx["lf"]=9;
  30983. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  30984. $ctx1.sendIdx["write:"]=10;
  30985. $recv(aStream)._lf();
  30986. $ctx1.sendIdx["lf"]=10;
  30987. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  30988. $ctx1.sendIdx["asJavaScriptSource"]=6;
  30989. $11=["messageSends: ",$12];
  30990. $recv(aStream)._write_($11);
  30991. $ctx1.sendIdx["write:"]=11;
  30992. $recv(aStream)._lf();
  30993. $ctx1.sendIdx["lf"]=11;
  30994. $recv(aStream)._write_("}),");
  30995. $ctx1.sendIdx["write:"]=12;
  30996. $recv(aStream)._lf();
  30997. $ctx1.sendIdx["lf"]=12;
  30998. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  30999. $recv(aStream)._lf();
  31000. $ctx1.sendIdx["lf"]=13;
  31001. $recv(aStream)._lf();
  31002. return self;
  31003. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31004. },
  31005. args: ["aMethod", "aStream"],
  31006. 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",
  31007. referencedClasses: [],
  31008. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31009. }),
  31010. $globals.Exporter);
  31011. $core.addMethod(
  31012. $core.method({
  31013. selector: "exportPackage:on:",
  31014. protocol: "output",
  31015. fn: function (aPackage,aStream){
  31016. var self=this,$self=this;
  31017. return $core.withContext(function($ctx1) {
  31018. var $1,$receiver;
  31019. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31020. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31021. $self._exportPackageContextOf_on_(aPackage,aStream);
  31022. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31023. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31024. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31025. return $core.withContext(function($ctx2) {
  31026. $self._exportBehavior_on_(each,aStream);
  31027. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31028. $1=$recv(each)._theMetaClass();
  31029. if(($receiver = $1) == null || $receiver.a$nil){
  31030. return $1;
  31031. } else {
  31032. var meta;
  31033. meta=$receiver;
  31034. return $self._exportBehavior_on_(meta,aStream);
  31035. }
  31036. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31037. }));
  31038. $ctx1.sendIdx["do:"]=1;
  31039. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31040. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31041. return $core.withContext(function($ctx2) {
  31042. return $self._exportMethod_on_(each,aStream);
  31043. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31044. }));
  31045. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31046. return self;
  31047. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31048. },
  31049. args: ["aPackage", "aStream"],
  31050. 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",
  31051. referencedClasses: [],
  31052. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31053. }),
  31054. $globals.Exporter);
  31055. $core.addMethod(
  31056. $core.method({
  31057. selector: "exportPackageBodyBlockPrologueOf:on:",
  31058. protocol: "output",
  31059. fn: function (aPackage,aStream){
  31060. var self=this,$self=this;
  31061. return $core.withContext(function($ctx1) {
  31062. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31063. $ctx1.sendIdx["write:"]=1;
  31064. $recv(aStream)._lf();
  31065. $ctx1.sendIdx["lf"]=1;
  31066. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31067. $recv(aStream)._lf();
  31068. return self;
  31069. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31070. },
  31071. args: ["aPackage", "aStream"],
  31072. 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",
  31073. referencedClasses: [],
  31074. messageSends: ["write:", "lf"]
  31075. }),
  31076. $globals.Exporter);
  31077. $core.addMethod(
  31078. $core.method({
  31079. selector: "exportPackageContextOf:on:",
  31080. protocol: "output",
  31081. fn: function (aPackage,aStream){
  31082. var self=this,$self=this;
  31083. return $core.withContext(function($ctx1) {
  31084. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  31085. $recv(aStream)._lf();
  31086. return self;
  31087. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31088. },
  31089. args: ["aPackage", "aStream"],
  31090. 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",
  31091. referencedClasses: [],
  31092. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31093. }),
  31094. $globals.Exporter);
  31095. $core.addMethod(
  31096. $core.method({
  31097. selector: "exportPackageDefinitionOf:on:",
  31098. protocol: "output",
  31099. fn: function (aPackage,aStream){
  31100. var self=this,$self=this;
  31101. return $core.withContext(function($ctx1) {
  31102. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31103. $recv(aStream)._lf();
  31104. return self;
  31105. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31106. },
  31107. args: ["aPackage", "aStream"],
  31108. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31109. referencedClasses: [],
  31110. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31111. }),
  31112. $globals.Exporter);
  31113. $core.addMethod(
  31114. $core.method({
  31115. selector: "exportPackageEpilogueOf:on:",
  31116. protocol: "output",
  31117. fn: function (aPackage,aStream){
  31118. var self=this,$self=this;
  31119. return $core.withContext(function($ctx1) {
  31120. $self._subclassResponsibility();
  31121. return self;
  31122. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31123. },
  31124. args: ["aPackage", "aStream"],
  31125. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31126. referencedClasses: [],
  31127. messageSends: ["subclassResponsibility"]
  31128. }),
  31129. $globals.Exporter);
  31130. $core.addMethod(
  31131. $core.method({
  31132. selector: "exportPackageImportsOf:on:",
  31133. protocol: "output",
  31134. fn: function (aPackage,aStream){
  31135. var self=this,$self=this;
  31136. return $core.withContext(function($ctx1) {
  31137. var $2,$1;
  31138. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31139. return $core.withContext(function($ctx2) {
  31140. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  31141. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31142. $1=["($core.packageDescriptors||$core.packages)[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  31143. $recv(aStream)._write_($1);
  31144. return $recv(aStream)._lf();
  31145. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31146. }));
  31147. return self;
  31148. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31149. },
  31150. args: ["aPackage", "aStream"],
  31151. 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 ]",
  31152. referencedClasses: [],
  31153. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  31154. }),
  31155. $globals.Exporter);
  31156. $core.addMethod(
  31157. $core.method({
  31158. selector: "exportPackagePrologueOf: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,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31166. },
  31167. args: ["aPackage", "aStream"],
  31168. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31169. referencedClasses: [],
  31170. messageSends: ["subclassResponsibility"]
  31171. }),
  31172. $globals.Exporter);
  31173. $core.addMethod(
  31174. $core.method({
  31175. selector: "exportPackageTraitCompositionsOf:on:",
  31176. protocol: "output",
  31177. fn: function (aPackage,aStream){
  31178. var self=this,$self=this;
  31179. return $core.withContext(function($ctx1) {
  31180. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31181. return $core.withContext(function($ctx2) {
  31182. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31183. return $core.withContext(function($ctx3) {
  31184. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31185. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31186. }));
  31187. return $recv(aStream)._lf();
  31188. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31189. }));
  31190. return self;
  31191. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31192. },
  31193. args: ["aPackage", "aStream"],
  31194. 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 ]",
  31195. referencedClasses: [],
  31196. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31197. }),
  31198. $globals.Exporter);
  31199. $core.addMethod(
  31200. $core.method({
  31201. selector: "exportPackageTransportOf:on:",
  31202. protocol: "output",
  31203. fn: function (aPackage,aStream){
  31204. var self=this,$self=this;
  31205. return $core.withContext(function($ctx1) {
  31206. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31207. $recv(aStream)._lf();
  31208. return self;
  31209. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31210. },
  31211. args: ["aPackage", "aStream"],
  31212. 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",
  31213. referencedClasses: [],
  31214. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  31215. }),
  31216. $globals.Exporter);
  31217. $core.addMethod(
  31218. $core.method({
  31219. selector: "exportTraitComposition:of:on:",
  31220. protocol: "output",
  31221. fn: function (aTraitComposition,aBehavior,aStream){
  31222. var self=this,$self=this;
  31223. return $core.withContext(function($ctx1) {
  31224. var $2,$1;
  31225. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31226. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31227. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31228. $recv(aStream)._write_($1);
  31229. $recv(aStream)._lf();
  31230. return self;
  31231. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31232. },
  31233. args: ["aTraitComposition", "aBehavior", "aStream"],
  31234. 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",
  31235. referencedClasses: [],
  31236. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31237. }),
  31238. $globals.Exporter);
  31239. $core.addMethod(
  31240. $core.method({
  31241. selector: "exportTraitDefinitionOf:on:",
  31242. protocol: "output",
  31243. fn: function (aClass,aStream){
  31244. var self=this,$self=this;
  31245. return $core.withContext(function($ctx1) {
  31246. var $3,$4,$2,$1,$5,$7,$6;
  31247. $recv(aStream)._lf();
  31248. $ctx1.sendIdx["lf"]=1;
  31249. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31250. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31251. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31252. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31253. $2=["$core.addTrait(",$3,", ",$4,");"];
  31254. $1=$recv(aStream)._write_($2);
  31255. $ctx1.sendIdx["write:"]=1;
  31256. $5=$recv(aClass)._comment();
  31257. $ctx1.sendIdx["comment"]=1;
  31258. $recv($5)._ifNotEmpty_((function(){
  31259. return $core.withContext(function($ctx2) {
  31260. $recv(aStream)._lf();
  31261. $ctx2.sendIdx["lf"]=2;
  31262. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31263. $ctx2.sendIdx["write:"]=2;
  31264. $recv(aStream)._lf();
  31265. $ctx2.sendIdx["lf"]=3;
  31266. $7=$recv(aClass)._asJavaScriptSource();
  31267. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31268. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31269. $recv(aStream)._write_($6);
  31270. $ctx2.sendIdx["write:"]=3;
  31271. $recv(aStream)._lf();
  31272. $ctx2.sendIdx["lf"]=4;
  31273. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31275. }));
  31276. $recv(aStream)._lf();
  31277. return self;
  31278. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31279. },
  31280. args: ["aClass", "aStream"],
  31281. 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",
  31282. referencedClasses: [],
  31283. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31284. }),
  31285. $globals.Exporter);
  31286. $core.addMethod(
  31287. $core.method({
  31288. selector: "ownMethodsOfClass:",
  31289. protocol: "accessing",
  31290. fn: function (aClass){
  31291. var self=this,$self=this;
  31292. return $core.withContext(function($ctx1) {
  31293. var $1;
  31294. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31295. return $core.withContext(function($ctx2) {
  31296. $1=$recv(a)._selector();
  31297. $ctx2.sendIdx["selector"]=1;
  31298. return $recv($1).__lt_eq($recv(b)._selector());
  31299. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31300. })))._reject_((function(each){
  31301. return $core.withContext(function($ctx2) {
  31302. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31304. }));
  31305. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31306. },
  31307. args: ["aClass"],
  31308. 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*') ]",
  31309. referencedClasses: [],
  31310. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31311. }),
  31312. $globals.Exporter);
  31313. $core.addMethod(
  31314. $core.method({
  31315. selector: "ownMethodsOfMetaClass:",
  31316. protocol: "accessing",
  31317. fn: function (aClass){
  31318. var self=this,$self=this;
  31319. return $core.withContext(function($ctx1) {
  31320. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31321. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31322. },
  31323. args: ["aClass"],
  31324. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31325. referencedClasses: [],
  31326. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31327. }),
  31328. $globals.Exporter);
  31329. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31330. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31331. $core.addMethod(
  31332. $core.method({
  31333. selector: "amdNamesOfPackages:",
  31334. protocol: "private",
  31335. fn: function (anArray){
  31336. var self=this,$self=this;
  31337. return $core.withContext(function($ctx1) {
  31338. var $1;
  31339. return $recv($recv(anArray)._select_((function(each){
  31340. return $core.withContext(function($ctx2) {
  31341. $1=$self._amdNamespaceOfPackage_(each);
  31342. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31343. return $recv($1)._notNil();
  31344. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31345. })))._collect_((function(each){
  31346. return $core.withContext(function($ctx2) {
  31347. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31348. $ctx2.sendIdx[","]=1;
  31349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31350. }));
  31351. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31352. },
  31353. args: ["anArray"],
  31354. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31355. referencedClasses: [],
  31356. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31357. }),
  31358. $globals.AmdExporter);
  31359. $core.addMethod(
  31360. $core.method({
  31361. selector: "amdNamespaceOfPackage:",
  31362. protocol: "private",
  31363. fn: function (aPackage){
  31364. var self=this,$self=this;
  31365. return $core.withContext(function($ctx1) {
  31366. var $3,$2,$1;
  31367. $3=$recv(aPackage)._transport();
  31368. $ctx1.sendIdx["transport"]=1;
  31369. $2=$recv($3)._type();
  31370. $1=$recv($2).__eq("amd");
  31371. if($core.assert($1)){
  31372. return $recv($recv(aPackage)._transport())._namespace();
  31373. } else {
  31374. return nil;
  31375. }
  31376. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31377. },
  31378. args: ["aPackage"],
  31379. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31380. referencedClasses: [],
  31381. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31382. }),
  31383. $globals.AmdExporter);
  31384. $core.addMethod(
  31385. $core.method({
  31386. selector: "exportPackageEpilogueOf:on:",
  31387. protocol: "output",
  31388. fn: function (aPackage,aStream){
  31389. var self=this,$self=this;
  31390. return $core.withContext(function($ctx1) {
  31391. $recv(aStream)._write_("});");
  31392. $recv(aStream)._lf();
  31393. return self;
  31394. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31395. },
  31396. args: ["aPackage", "aStream"],
  31397. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31398. referencedClasses: [],
  31399. messageSends: ["write:", "lf"]
  31400. }),
  31401. $globals.AmdExporter);
  31402. $core.addMethod(
  31403. $core.method({
  31404. selector: "exportPackagePrologueOf:on:",
  31405. protocol: "output",
  31406. fn: function (aPackage,aStream){
  31407. var self=this,$self=this;
  31408. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31409. return $core.withContext(function($ctx1) {
  31410. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31411. pragmaStart="";
  31412. pragmaEnd="";
  31413. importsForOutput=$self._importsForOutput_(aPackage);
  31414. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31415. $1=$recv(importsForOutput)._value();
  31416. $ctx1.sendIdx["value"]=1;
  31417. $recv($1)._ifNotEmpty_((function(){
  31418. return $core.withContext(function($ctx2) {
  31419. $3=$recv($globals.String)._lf();
  31420. $ctx2.sendIdx["lf"]=1;
  31421. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31422. $ctx2.sendIdx[","]=2;
  31423. $4=$recv($globals.String)._lf();
  31424. $ctx2.sendIdx["lf"]=2;
  31425. pragmaStart=$recv($2).__comma($4);
  31426. $ctx2.sendIdx[","]=1;
  31427. pragmaStart;
  31428. $6=$recv($globals.String)._lf();
  31429. $ctx2.sendIdx["lf"]=3;
  31430. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31431. $ctx2.sendIdx[","]=4;
  31432. $7=$recv($globals.String)._lf();
  31433. $ctx2.sendIdx["lf"]=4;
  31434. pragmaEnd=$recv($5).__comma($7);
  31435. $ctx2.sendIdx[","]=3;
  31436. return pragmaEnd;
  31437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31438. }));
  31439. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31440. $ctx1.sendIdx[","]=7;
  31441. $13=$recv($14).__comma([":2:"]);
  31442. $ctx1.sendIdx[","]=6;
  31443. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31444. $ctx1.sendIdx[","]=5;
  31445. $11=$recv($12)._asJavaScriptSource();
  31446. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31447. $ctx1.sendIdx["replace:with:"]=2;
  31448. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31449. $ctx1.sendIdx["replace:with:"]=1;
  31450. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31451. $ctx1.sendIdx[","]=8;
  31452. $17=$recv($18)._join_(",");
  31453. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31454. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31455. $ctx1.sendIdx["replace:with:"]=3;
  31456. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31457. $recv(aStream)._write_($8);
  31458. $recv(aStream)._lf();
  31459. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31460. return self;
  31461. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31462. },
  31463. args: ["aPackage", "aStream"],
  31464. 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",
  31465. referencedClasses: ["String"],
  31466. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31467. }),
  31468. $globals.AmdExporter);
  31469. $core.addMethod(
  31470. $core.method({
  31471. selector: "importsForOutput:",
  31472. protocol: "private",
  31473. fn: function (aPackage){
  31474. var self=this,$self=this;
  31475. var namedImports,anonImports,importVarNames;
  31476. return $core.withContext(function($ctx1) {
  31477. var $1;
  31478. namedImports=[];
  31479. anonImports=[];
  31480. importVarNames=[];
  31481. $recv($recv(aPackage)._imports())._do_((function(each){
  31482. return $core.withContext(function($ctx2) {
  31483. $1=$recv(each)._isString();
  31484. if($core.assert($1)){
  31485. return $recv(anonImports)._add_(each);
  31486. $ctx2.sendIdx["add:"]=1;
  31487. } else {
  31488. $recv(namedImports)._add_($recv(each)._value());
  31489. $ctx2.sendIdx["add:"]=2;
  31490. return $recv(importVarNames)._add_($recv(each)._key());
  31491. }
  31492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31493. }));
  31494. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31495. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31496. },
  31497. args: ["aPackage"],
  31498. 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)",
  31499. referencedClasses: [],
  31500. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31501. }),
  31502. $globals.AmdExporter);
  31503. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31504. $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";
  31505. $core.addMethod(
  31506. $core.method({
  31507. selector: "last",
  31508. protocol: "accessing",
  31509. fn: function (){
  31510. var self=this,$self=this;
  31511. return $self["@last"];
  31512. },
  31513. args: [],
  31514. source: "last\x0a\x09^ last",
  31515. referencedClasses: [],
  31516. messageSends: []
  31517. }),
  31518. $globals.ChunkParser);
  31519. $core.addMethod(
  31520. $core.method({
  31521. selector: "nextChunk",
  31522. protocol: "reading",
  31523. fn: function (){
  31524. var self=this,$self=this;
  31525. var char,result,chunk;
  31526. return $core.withContext(function($ctx1) {
  31527. var $1,$2,$3,$4;
  31528. var $early={};
  31529. try {
  31530. result=""._writeStream();
  31531. $recv((function(){
  31532. return $core.withContext(function($ctx2) {
  31533. char=$recv($self["@stream"])._next();
  31534. $ctx2.sendIdx["next"]=1;
  31535. char;
  31536. return $recv(char)._notNil();
  31537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31538. }))._whileTrue_((function(){
  31539. return $core.withContext(function($ctx2) {
  31540. $1=$recv(char).__eq("!");
  31541. $ctx2.sendIdx["="]=1;
  31542. if($core.assert($1)){
  31543. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31544. if($core.assert($2)){
  31545. $recv($self["@stream"])._next();
  31546. } else {
  31547. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31548. $3=$self["@last"];
  31549. throw $early=[$3];
  31550. }
  31551. }
  31552. return $recv(result)._nextPut_(char);
  31553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31554. }));
  31555. $self["@last"]=nil;
  31556. $4=$self["@last"];
  31557. return $4;
  31558. }
  31559. catch(e) {if(e===$early)return e[0]; throw e}
  31560. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31561. },
  31562. args: [],
  31563. 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",
  31564. referencedClasses: [],
  31565. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31566. }),
  31567. $globals.ChunkParser);
  31568. $core.addMethod(
  31569. $core.method({
  31570. selector: "stream:",
  31571. protocol: "accessing",
  31572. fn: function (aStream){
  31573. var self=this,$self=this;
  31574. $self["@stream"]=aStream;
  31575. return self;
  31576. },
  31577. args: ["aStream"],
  31578. source: "stream: aStream\x0a\x09stream := aStream",
  31579. referencedClasses: [],
  31580. messageSends: []
  31581. }),
  31582. $globals.ChunkParser);
  31583. $core.addMethod(
  31584. $core.method({
  31585. selector: "on:",
  31586. protocol: "instance creation",
  31587. fn: function (aStream){
  31588. var self=this,$self=this;
  31589. return $core.withContext(function($ctx1) {
  31590. return $recv($self._new())._stream_(aStream);
  31591. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31592. },
  31593. args: ["aStream"],
  31594. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31595. referencedClasses: [],
  31596. messageSends: ["stream:", "new"]
  31597. }),
  31598. $globals.ChunkParser.a$cls);
  31599. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31600. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31601. $core.addMethod(
  31602. $core.method({
  31603. selector: "class:",
  31604. protocol: "accessing",
  31605. fn: function (aClass){
  31606. var self=this,$self=this;
  31607. $self["@class"]=aClass;
  31608. return self;
  31609. },
  31610. args: ["aClass"],
  31611. source: "class: aClass\x0a\x09class := aClass",
  31612. referencedClasses: [],
  31613. messageSends: []
  31614. }),
  31615. $globals.ClassCommentReader);
  31616. $core.addMethod(
  31617. $core.method({
  31618. selector: "initialize",
  31619. protocol: "initialization",
  31620. fn: function (){
  31621. var self=this,$self=this;
  31622. return $core.withContext(function($ctx1) {
  31623. (
  31624. $ctx1.supercall = true,
  31625. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31626. $ctx1.supercall = false;
  31627. return self;
  31628. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31629. },
  31630. args: [],
  31631. source: "initialize\x0a\x09super initialize.",
  31632. referencedClasses: [],
  31633. messageSends: ["initialize"]
  31634. }),
  31635. $globals.ClassCommentReader);
  31636. $core.addMethod(
  31637. $core.method({
  31638. selector: "scanFrom:",
  31639. protocol: "fileIn",
  31640. fn: function (aChunkParser){
  31641. var self=this,$self=this;
  31642. var chunk;
  31643. return $core.withContext(function($ctx1) {
  31644. chunk=$recv(aChunkParser)._nextChunk();
  31645. $recv(chunk)._ifNotEmpty_((function(){
  31646. return $core.withContext(function($ctx2) {
  31647. return $self._setComment_(chunk);
  31648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31649. }));
  31650. return self;
  31651. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31652. },
  31653. args: ["aChunkParser"],
  31654. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31655. referencedClasses: [],
  31656. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31657. }),
  31658. $globals.ClassCommentReader);
  31659. $core.addMethod(
  31660. $core.method({
  31661. selector: "setComment:",
  31662. protocol: "private",
  31663. fn: function (aString){
  31664. var self=this,$self=this;
  31665. return $core.withContext(function($ctx1) {
  31666. $recv($self["@class"])._comment_(aString);
  31667. return self;
  31668. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31669. },
  31670. args: ["aString"],
  31671. source: "setComment: aString\x0a\x09class comment: aString",
  31672. referencedClasses: [],
  31673. messageSends: ["comment:"]
  31674. }),
  31675. $globals.ClassCommentReader);
  31676. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31677. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31678. $core.addMethod(
  31679. $core.method({
  31680. selector: "class:category:",
  31681. protocol: "accessing",
  31682. fn: function (aClass,aString){
  31683. var self=this,$self=this;
  31684. $self["@class"]=aClass;
  31685. $self["@category"]=aString;
  31686. return self;
  31687. },
  31688. args: ["aClass", "aString"],
  31689. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31690. referencedClasses: [],
  31691. messageSends: []
  31692. }),
  31693. $globals.ClassProtocolReader);
  31694. $core.addMethod(
  31695. $core.method({
  31696. selector: "compileMethod:",
  31697. protocol: "private",
  31698. fn: function (aString){
  31699. var self=this,$self=this;
  31700. return $core.withContext(function($ctx1) {
  31701. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31702. return self;
  31703. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31704. },
  31705. args: ["aString"],
  31706. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31707. referencedClasses: ["Compiler"],
  31708. messageSends: ["install:forClass:protocol:", "new"]
  31709. }),
  31710. $globals.ClassProtocolReader);
  31711. $core.addMethod(
  31712. $core.method({
  31713. selector: "initialize",
  31714. protocol: "initialization",
  31715. fn: function (){
  31716. var self=this,$self=this;
  31717. return $core.withContext(function($ctx1) {
  31718. (
  31719. $ctx1.supercall = true,
  31720. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31721. $ctx1.supercall = false;
  31722. return self;
  31723. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31724. },
  31725. args: [],
  31726. source: "initialize\x0a\x09super initialize.",
  31727. referencedClasses: [],
  31728. messageSends: ["initialize"]
  31729. }),
  31730. $globals.ClassProtocolReader);
  31731. $core.addMethod(
  31732. $core.method({
  31733. selector: "scanFrom:",
  31734. protocol: "fileIn",
  31735. fn: function (aChunkParser){
  31736. var self=this,$self=this;
  31737. var chunk;
  31738. return $core.withContext(function($ctx1) {
  31739. $recv((function(){
  31740. return $core.withContext(function($ctx2) {
  31741. chunk=$recv(aChunkParser)._nextChunk();
  31742. chunk;
  31743. return $recv(chunk)._isEmpty();
  31744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31745. }))._whileFalse_((function(){
  31746. return $core.withContext(function($ctx2) {
  31747. return $self._compileMethod_(chunk);
  31748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31749. }));
  31750. return self;
  31751. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31752. },
  31753. args: ["aChunkParser"],
  31754. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31755. referencedClasses: [],
  31756. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31757. }),
  31758. $globals.ClassProtocolReader);
  31759. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31760. $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.";
  31761. $core.addMethod(
  31762. $core.method({
  31763. selector: "methods",
  31764. protocol: "accessing",
  31765. fn: function (){
  31766. var self=this,$self=this;
  31767. return $core.withContext(function($ctx1) {
  31768. var $1;
  31769. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31770. return $core.withContext(function($ctx2) {
  31771. $1=$recv(a)._selector();
  31772. $ctx2.sendIdx["selector"]=1;
  31773. return $recv($1).__lt_eq($recv(b)._selector());
  31774. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31775. }));
  31776. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31777. },
  31778. args: [],
  31779. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31780. referencedClasses: [],
  31781. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31782. }),
  31783. $globals.ExportMethodProtocol);
  31784. $core.addMethod(
  31785. $core.method({
  31786. selector: "name",
  31787. protocol: "accessing",
  31788. fn: function (){
  31789. var self=this,$self=this;
  31790. return $self["@name"];
  31791. },
  31792. args: [],
  31793. source: "name\x0a\x09^ name",
  31794. referencedClasses: [],
  31795. messageSends: []
  31796. }),
  31797. $globals.ExportMethodProtocol);
  31798. $core.addMethod(
  31799. $core.method({
  31800. selector: "name:",
  31801. protocol: "accessing",
  31802. fn: function (aString){
  31803. var self=this,$self=this;
  31804. $self["@name"]=aString;
  31805. return self;
  31806. },
  31807. args: ["aString"],
  31808. source: "name: aString\x0a\x09name := aString",
  31809. referencedClasses: [],
  31810. messageSends: []
  31811. }),
  31812. $globals.ExportMethodProtocol);
  31813. $core.addMethod(
  31814. $core.method({
  31815. selector: "ownMethods",
  31816. protocol: "accessing",
  31817. fn: function (){
  31818. var self=this,$self=this;
  31819. return $core.withContext(function($ctx1) {
  31820. var $1;
  31821. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31822. return $core.withContext(function($ctx2) {
  31823. $1=$recv(a)._selector();
  31824. $ctx2.sendIdx["selector"]=1;
  31825. return $recv($1).__lt_eq($recv(b)._selector());
  31826. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31827. }));
  31828. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31829. },
  31830. args: [],
  31831. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31832. referencedClasses: [],
  31833. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31834. }),
  31835. $globals.ExportMethodProtocol);
  31836. $core.addMethod(
  31837. $core.method({
  31838. selector: "theClass",
  31839. protocol: "accessing",
  31840. fn: function (){
  31841. var self=this,$self=this;
  31842. return $self["@theClass"];
  31843. },
  31844. args: [],
  31845. source: "theClass\x0a\x09^ theClass",
  31846. referencedClasses: [],
  31847. messageSends: []
  31848. }),
  31849. $globals.ExportMethodProtocol);
  31850. $core.addMethod(
  31851. $core.method({
  31852. selector: "theClass:",
  31853. protocol: "accessing",
  31854. fn: function (aClass){
  31855. var self=this,$self=this;
  31856. $self["@theClass"]=aClass;
  31857. return self;
  31858. },
  31859. args: ["aClass"],
  31860. source: "theClass: aClass\x0a\x09theClass := aClass",
  31861. referencedClasses: [],
  31862. messageSends: []
  31863. }),
  31864. $globals.ExportMethodProtocol);
  31865. $core.addMethod(
  31866. $core.method({
  31867. selector: "name:theClass:",
  31868. protocol: "instance creation",
  31869. fn: function (aString,aClass){
  31870. var self=this,$self=this;
  31871. return $core.withContext(function($ctx1) {
  31872. var $1;
  31873. $1=$self._new();
  31874. $recv($1)._name_(aString);
  31875. $recv($1)._theClass_(aClass);
  31876. return $recv($1)._yourself();
  31877. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  31878. },
  31879. args: ["aString", "aClass"],
  31880. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  31881. referencedClasses: [],
  31882. messageSends: ["name:", "new", "theClass:", "yourself"]
  31883. }),
  31884. $globals.ExportMethodProtocol.a$cls);
  31885. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  31886. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  31887. $core.addMethod(
  31888. $core.method({
  31889. selector: "import:",
  31890. protocol: "fileIn",
  31891. fn: function (aStream){
  31892. var self=this,$self=this;
  31893. var chunk,result,parser,lastEmpty;
  31894. return $core.withContext(function($ctx1) {
  31895. var $1;
  31896. parser=$recv($globals.ChunkParser)._on_(aStream);
  31897. lastEmpty=false;
  31898. $self["@lastSection"]="n/a, not started";
  31899. $self["@lastChunk"]=nil;
  31900. $recv((function(){
  31901. return $core.withContext(function($ctx2) {
  31902. $recv((function(){
  31903. return $core.withContext(function($ctx3) {
  31904. chunk=$recv(parser)._nextChunk();
  31905. chunk;
  31906. return $recv(chunk)._isNil();
  31907. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  31908. }))._whileFalse_((function(){
  31909. return $core.withContext(function($ctx3) {
  31910. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  31911. lastEmpty=true;
  31912. return lastEmpty;
  31913. }),(function(){
  31914. return $core.withContext(function($ctx4) {
  31915. $self["@lastSection"]=chunk;
  31916. $self["@lastSection"];
  31917. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  31918. result;
  31919. $1=lastEmpty;
  31920. if($core.assert($1)){
  31921. lastEmpty=false;
  31922. lastEmpty;
  31923. return $recv(result)._scanFrom_(parser);
  31924. }
  31925. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  31926. }));
  31927. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  31928. }));
  31929. $self["@lastSection"]="n/a, finished";
  31930. return $self["@lastSection"];
  31931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31932. }))._on_do_($globals.Error,(function(e){
  31933. return $core.withContext(function($ctx2) {
  31934. $self["@lastChunk"]=$recv(parser)._last();
  31935. $self["@lastChunk"];
  31936. return $recv(e)._resignal();
  31937. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  31938. }));
  31939. return self;
  31940. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  31941. },
  31942. args: ["aStream"],
  31943. 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 ].",
  31944. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  31945. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  31946. }),
  31947. $globals.Importer);
  31948. $core.addMethod(
  31949. $core.method({
  31950. selector: "lastChunk",
  31951. protocol: "accessing",
  31952. fn: function (){
  31953. var self=this,$self=this;
  31954. return $self["@lastChunk"];
  31955. },
  31956. args: [],
  31957. source: "lastChunk\x0a\x09^ lastChunk",
  31958. referencedClasses: [],
  31959. messageSends: []
  31960. }),
  31961. $globals.Importer);
  31962. $core.addMethod(
  31963. $core.method({
  31964. selector: "lastSection",
  31965. protocol: "accessing",
  31966. fn: function (){
  31967. var self=this,$self=this;
  31968. return $self["@lastSection"];
  31969. },
  31970. args: [],
  31971. source: "lastSection\x0a\x09^ lastSection",
  31972. referencedClasses: [],
  31973. messageSends: []
  31974. }),
  31975. $globals.Importer);
  31976. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  31977. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  31978. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  31979. $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.";
  31980. $core.addMethod(
  31981. $core.method({
  31982. selector: "ajaxPutAt:data:onSuccess:onError:",
  31983. protocol: "private",
  31984. fn: function (aURL,aString,aBlock,anotherBlock){
  31985. var self=this,$self=this;
  31986. var xhr;
  31987. return $core.withContext(function($ctx1) {
  31988. var $1,$4,$3,$2;
  31989. xhr=$recv($globals.Platform)._newXhr();
  31990. $recv(xhr)._open_url_async_("PUT",aURL,true);
  31991. $recv(xhr)._onreadystatechange_((function(){
  31992. return $core.withContext(function($ctx2) {
  31993. $1=$recv($recv(xhr)._readyState()).__eq((4));
  31994. if($core.assert($1)){
  31995. $4=$recv(xhr)._status();
  31996. $ctx2.sendIdx["status"]=1;
  31997. $3=$recv($4).__gt_eq((200));
  31998. $2=$recv($3)._and_((function(){
  31999. return $core.withContext(function($ctx3) {
  32000. return $recv($recv(xhr)._status()).__lt((300));
  32001. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32002. }));
  32003. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32004. }
  32005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32006. }));
  32007. $recv(xhr)._send_(aString);
  32008. return self;
  32009. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32010. },
  32011. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32012. 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",
  32013. referencedClasses: ["Platform"],
  32014. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32015. }),
  32016. $globals.PackageHandler);
  32017. $core.addMethod(
  32018. $core.method({
  32019. selector: "chunkContentsFor:",
  32020. protocol: "accessing",
  32021. fn: function (aPackage){
  32022. var self=this,$self=this;
  32023. return $core.withContext(function($ctx1) {
  32024. return $recv($globals.String)._streamContents_((function(str){
  32025. return $core.withContext(function($ctx2) {
  32026. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32027. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32028. }));
  32029. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32030. },
  32031. args: ["aPackage"],
  32032. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32033. referencedClasses: ["String"],
  32034. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32035. }),
  32036. $globals.PackageHandler);
  32037. $core.addMethod(
  32038. $core.method({
  32039. selector: "chunkExporter",
  32040. protocol: "factory",
  32041. fn: function (){
  32042. var self=this,$self=this;
  32043. return $core.withContext(function($ctx1) {
  32044. return $recv($self._chunkExporterClass())._new();
  32045. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32046. },
  32047. args: [],
  32048. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32049. referencedClasses: [],
  32050. messageSends: ["new", "chunkExporterClass"]
  32051. }),
  32052. $globals.PackageHandler);
  32053. $core.addMethod(
  32054. $core.method({
  32055. selector: "chunkExporterClass",
  32056. protocol: "accessing",
  32057. fn: function (){
  32058. var self=this,$self=this;
  32059. return $globals.ChunkExporter;
  32060. },
  32061. args: [],
  32062. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32063. referencedClasses: ["ChunkExporter"],
  32064. messageSends: []
  32065. }),
  32066. $globals.PackageHandler);
  32067. $core.addMethod(
  32068. $core.method({
  32069. selector: "commit:",
  32070. protocol: "committing",
  32071. fn: function (aPackage){
  32072. var self=this,$self=this;
  32073. return $core.withContext(function($ctx1) {
  32074. var $1,$2;
  32075. $self._commit_onSuccess_onError_(aPackage,(function(){
  32076. }),(function(error){
  32077. return $core.withContext(function($ctx2) {
  32078. $1=$recv($globals.PackageCommitError)._new();
  32079. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32080. $ctx2.sendIdx[","]=1;
  32081. $recv($1)._messageText_($2);
  32082. return $recv($1)._signal();
  32083. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32084. }));
  32085. return self;
  32086. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32087. },
  32088. args: ["aPackage"],
  32089. 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 ]",
  32090. referencedClasses: ["PackageCommitError"],
  32091. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32092. }),
  32093. $globals.PackageHandler);
  32094. $core.addMethod(
  32095. $core.method({
  32096. selector: "commit:onSuccess:onError:",
  32097. protocol: "committing",
  32098. fn: function (aPackage,aBlock,anotherBlock){
  32099. var self=this,$self=this;
  32100. return $core.withContext(function($ctx1) {
  32101. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32102. return $core.withContext(function($ctx2) {
  32103. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32104. return $core.withContext(function($ctx3) {
  32105. $recv(aPackage)._beClean();
  32106. return $recv(aBlock)._value();
  32107. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32108. }),anotherBlock);
  32109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32110. }),anotherBlock);
  32111. return self;
  32112. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32113. },
  32114. args: ["aPackage", "aBlock", "anotherBlock"],
  32115. 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",
  32116. referencedClasses: [],
  32117. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32118. }),
  32119. $globals.PackageHandler);
  32120. $core.addMethod(
  32121. $core.method({
  32122. selector: "commitJsFileFor:onSuccess:onError:",
  32123. protocol: "committing",
  32124. fn: function (aPackage,aBlock,anotherBlock){
  32125. var self=this,$self=this;
  32126. return $core.withContext(function($ctx1) {
  32127. var $2,$1;
  32128. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32129. $ctx1.sendIdx[","]=2;
  32130. $1=$recv($2).__comma(".js");
  32131. $ctx1.sendIdx[","]=1;
  32132. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32133. return self;
  32134. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32135. },
  32136. args: ["aPackage", "aBlock", "anotherBlock"],
  32137. 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",
  32138. referencedClasses: [],
  32139. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32140. }),
  32141. $globals.PackageHandler);
  32142. $core.addMethod(
  32143. $core.method({
  32144. selector: "commitPathJsFor:",
  32145. protocol: "accessing",
  32146. fn: function (aPackage){
  32147. var self=this,$self=this;
  32148. return $core.withContext(function($ctx1) {
  32149. $self._subclassResponsibility();
  32150. return self;
  32151. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32152. },
  32153. args: ["aPackage"],
  32154. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32155. referencedClasses: [],
  32156. messageSends: ["subclassResponsibility"]
  32157. }),
  32158. $globals.PackageHandler);
  32159. $core.addMethod(
  32160. $core.method({
  32161. selector: "commitPathStFor:",
  32162. protocol: "accessing",
  32163. fn: function (aPackage){
  32164. var self=this,$self=this;
  32165. return $core.withContext(function($ctx1) {
  32166. $self._subclassResponsibility();
  32167. return self;
  32168. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32169. },
  32170. args: ["aPackage"],
  32171. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32172. referencedClasses: [],
  32173. messageSends: ["subclassResponsibility"]
  32174. }),
  32175. $globals.PackageHandler);
  32176. $core.addMethod(
  32177. $core.method({
  32178. selector: "commitStFileFor:onSuccess:onError:",
  32179. protocol: "committing",
  32180. fn: function (aPackage,aBlock,anotherBlock){
  32181. var self=this,$self=this;
  32182. return $core.withContext(function($ctx1) {
  32183. var $2,$1;
  32184. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32185. $ctx1.sendIdx[","]=2;
  32186. $1=$recv($2).__comma(".st");
  32187. $ctx1.sendIdx[","]=1;
  32188. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32189. return self;
  32190. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32191. },
  32192. args: ["aPackage", "aBlock", "anotherBlock"],
  32193. 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",
  32194. referencedClasses: [],
  32195. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32196. }),
  32197. $globals.PackageHandler);
  32198. $core.addMethod(
  32199. $core.method({
  32200. selector: "contentsFor:",
  32201. protocol: "accessing",
  32202. fn: function (aPackage){
  32203. var self=this,$self=this;
  32204. return $core.withContext(function($ctx1) {
  32205. return $recv($globals.String)._streamContents_((function(str){
  32206. return $core.withContext(function($ctx2) {
  32207. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32208. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32209. }));
  32210. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32211. },
  32212. args: ["aPackage"],
  32213. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32214. referencedClasses: ["String"],
  32215. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32216. }),
  32217. $globals.PackageHandler);
  32218. $core.addMethod(
  32219. $core.method({
  32220. selector: "exporter",
  32221. protocol: "factory",
  32222. fn: function (){
  32223. var self=this,$self=this;
  32224. return $core.withContext(function($ctx1) {
  32225. return $recv($self._exporterClass())._new();
  32226. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32227. },
  32228. args: [],
  32229. source: "exporter\x0a\x09^ self exporterClass new",
  32230. referencedClasses: [],
  32231. messageSends: ["new", "exporterClass"]
  32232. }),
  32233. $globals.PackageHandler);
  32234. $core.addMethod(
  32235. $core.method({
  32236. selector: "exporterClass",
  32237. protocol: "accessing",
  32238. fn: function (){
  32239. var self=this,$self=this;
  32240. return $core.withContext(function($ctx1) {
  32241. $self._subclassResponsibility();
  32242. return self;
  32243. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32244. },
  32245. args: [],
  32246. source: "exporterClass\x0a\x09self subclassResponsibility",
  32247. referencedClasses: [],
  32248. messageSends: ["subclassResponsibility"]
  32249. }),
  32250. $globals.PackageHandler);
  32251. $core.addMethod(
  32252. $core.method({
  32253. selector: "load:",
  32254. protocol: "loading",
  32255. fn: function (aPackage){
  32256. var self=this,$self=this;
  32257. return $core.withContext(function($ctx1) {
  32258. $self._subclassResponsibility();
  32259. return self;
  32260. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32261. },
  32262. args: ["aPackage"],
  32263. source: "load: aPackage\x0a\x09self subclassResponsibility",
  32264. referencedClasses: [],
  32265. messageSends: ["subclassResponsibility"]
  32266. }),
  32267. $globals.PackageHandler);
  32268. $core.addMethod(
  32269. $core.method({
  32270. selector: "onCommitError:",
  32271. protocol: "error handling",
  32272. fn: function (anError){
  32273. var self=this,$self=this;
  32274. return $core.withContext(function($ctx1) {
  32275. var $1,$2;
  32276. $1=$recv($globals.PackageCommitError)._new();
  32277. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32278. $ctx1.sendIdx[","]=1;
  32279. $recv($1)._messageText_($2);
  32280. $recv($1)._signal();
  32281. return self;
  32282. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32283. },
  32284. args: ["anError"],
  32285. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32286. referencedClasses: ["PackageCommitError"],
  32287. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32288. }),
  32289. $globals.PackageHandler);
  32290. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32291. $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.";
  32292. $core.addMethod(
  32293. $core.method({
  32294. selector: "commitPathJsFor:",
  32295. protocol: "accessing",
  32296. fn: function (aPackage){
  32297. var self=this,$self=this;
  32298. return $core.withContext(function($ctx1) {
  32299. return $self._toUrl_($self._namespaceFor_(aPackage));
  32300. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32301. },
  32302. args: ["aPackage"],
  32303. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32304. referencedClasses: [],
  32305. messageSends: ["toUrl:", "namespaceFor:"]
  32306. }),
  32307. $globals.AmdPackageHandler);
  32308. $core.addMethod(
  32309. $core.method({
  32310. selector: "commitPathStFor:",
  32311. protocol: "accessing",
  32312. fn: function (aPackage){
  32313. var self=this,$self=this;
  32314. var path,pathWithout;
  32315. return $core.withContext(function($ctx1) {
  32316. var $1,$2;
  32317. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32318. $ctx1.sendIdx[","]=1;
  32319. path=$self._toUrl_($1);
  32320. pathWithout=$self._commitPathJsFor_(aPackage);
  32321. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32322. if($core.assert($2)){
  32323. return pathWithout;
  32324. } else {
  32325. return path;
  32326. }
  32327. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32328. },
  32329. args: ["aPackage"],
  32330. 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 ]",
  32331. referencedClasses: [],
  32332. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32333. }),
  32334. $globals.AmdPackageHandler);
  32335. $core.addMethod(
  32336. $core.method({
  32337. selector: "exporterClass",
  32338. protocol: "accessing",
  32339. fn: function (){
  32340. var self=this,$self=this;
  32341. return $globals.AmdExporter;
  32342. },
  32343. args: [],
  32344. source: "exporterClass\x0a\x09^ AmdExporter",
  32345. referencedClasses: ["AmdExporter"],
  32346. messageSends: []
  32347. }),
  32348. $globals.AmdPackageHandler);
  32349. $core.addMethod(
  32350. $core.method({
  32351. selector: "load:",
  32352. protocol: "loading",
  32353. fn: function (aPackage){
  32354. var self=this,$self=this;
  32355. return $core.withContext(function($ctx1) {
  32356. var $1,$3,$2,$receiver;
  32357. $1=$recv($globals.Smalltalk)._amdRequire();
  32358. if(($receiver = $1) == null || $receiver.a$nil){
  32359. $self._error_("AMD loader not present");
  32360. } else {
  32361. var require;
  32362. require=$receiver;
  32363. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32364. $ctx1.sendIdx[","]=1;
  32365. $2=$recv($globals.Array)._with_($3);
  32366. $recv(require)._value_($2);
  32367. }
  32368. return self;
  32369. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32370. },
  32371. args: ["aPackage"],
  32372. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  32373. referencedClasses: ["Smalltalk", "Array"],
  32374. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  32375. }),
  32376. $globals.AmdPackageHandler);
  32377. $core.addMethod(
  32378. $core.method({
  32379. selector: "namespaceFor:",
  32380. protocol: "committing",
  32381. fn: function (aPackage){
  32382. var self=this,$self=this;
  32383. return $core.withContext(function($ctx1) {
  32384. return $recv($recv(aPackage)._transport())._namespace();
  32385. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32386. },
  32387. args: ["aPackage"],
  32388. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32389. referencedClasses: [],
  32390. messageSends: ["namespace", "transport"]
  32391. }),
  32392. $globals.AmdPackageHandler);
  32393. $core.addMethod(
  32394. $core.method({
  32395. selector: "toUrl:",
  32396. protocol: "private",
  32397. fn: function (aString){
  32398. var self=this,$self=this;
  32399. return $core.withContext(function($ctx1) {
  32400. var $1,$receiver;
  32401. $1=$recv($globals.Smalltalk)._amdRequire();
  32402. if(($receiver = $1) == null || $receiver.a$nil){
  32403. return $self._error_("AMD loader not present");
  32404. } else {
  32405. var require;
  32406. require=$receiver;
  32407. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  32408. }
  32409. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32410. },
  32411. args: ["aString"],
  32412. 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 ]",
  32413. referencedClasses: ["Smalltalk"],
  32414. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  32415. }),
  32416. $globals.AmdPackageHandler);
  32417. $core.addMethod(
  32418. $core.method({
  32419. selector: "defaultNamespace",
  32420. protocol: "commit paths",
  32421. fn: function (){
  32422. var self=this,$self=this;
  32423. return $core.withContext(function($ctx1) {
  32424. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32425. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32426. },
  32427. args: [],
  32428. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32429. referencedClasses: ["Smalltalk"],
  32430. messageSends: ["defaultAmdNamespace"]
  32431. }),
  32432. $globals.AmdPackageHandler.a$cls);
  32433. $core.addMethod(
  32434. $core.method({
  32435. selector: "defaultNamespace:",
  32436. protocol: "commit paths",
  32437. fn: function (aString){
  32438. var self=this,$self=this;
  32439. return $core.withContext(function($ctx1) {
  32440. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32441. return self;
  32442. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32443. },
  32444. args: ["aString"],
  32445. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32446. referencedClasses: ["Smalltalk"],
  32447. messageSends: ["defaultAmdNamespace:"]
  32448. }),
  32449. $globals.AmdPackageHandler.a$cls);
  32450. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32451. $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.";
  32452. $core.addMethod(
  32453. $core.method({
  32454. selector: "asJavaScriptObject",
  32455. protocol: "converting",
  32456. fn: function (){
  32457. var self=this,$self=this;
  32458. return $core.withContext(function($ctx1) {
  32459. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32460. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32461. },
  32462. args: [],
  32463. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32464. referencedClasses: [],
  32465. messageSends: ["type"]
  32466. }),
  32467. $globals.PackageTransport);
  32468. $core.addMethod(
  32469. $core.method({
  32470. selector: "commit",
  32471. protocol: "committing",
  32472. fn: function (){
  32473. var self=this,$self=this;
  32474. return $core.withContext(function($ctx1) {
  32475. $recv($self._commitHandler())._commit_($self._package());
  32476. return self;
  32477. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32478. },
  32479. args: [],
  32480. source: "commit\x0a\x09self commitHandler commit: self package",
  32481. referencedClasses: [],
  32482. messageSends: ["commit:", "commitHandler", "package"]
  32483. }),
  32484. $globals.PackageTransport);
  32485. $core.addMethod(
  32486. $core.method({
  32487. selector: "commitHandler",
  32488. protocol: "factory",
  32489. fn: function (){
  32490. var self=this,$self=this;
  32491. return $core.withContext(function($ctx1) {
  32492. return $recv($self._commitHandlerClass())._new();
  32493. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32494. },
  32495. args: [],
  32496. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32497. referencedClasses: [],
  32498. messageSends: ["new", "commitHandlerClass"]
  32499. }),
  32500. $globals.PackageTransport);
  32501. $core.addMethod(
  32502. $core.method({
  32503. selector: "commitHandlerClass",
  32504. protocol: "accessing",
  32505. fn: function (){
  32506. var self=this,$self=this;
  32507. return $core.withContext(function($ctx1) {
  32508. $self._subclassResponsibility();
  32509. return self;
  32510. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32511. },
  32512. args: [],
  32513. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32514. referencedClasses: [],
  32515. messageSends: ["subclassResponsibility"]
  32516. }),
  32517. $globals.PackageTransport);
  32518. $core.addMethod(
  32519. $core.method({
  32520. selector: "commitOnSuccess:onError:",
  32521. protocol: "committing",
  32522. fn: function (aBlock,anotherBlock){
  32523. var self=this,$self=this;
  32524. return $core.withContext(function($ctx1) {
  32525. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32526. return self;
  32527. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32528. },
  32529. args: ["aBlock", "anotherBlock"],
  32530. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32531. referencedClasses: [],
  32532. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32533. }),
  32534. $globals.PackageTransport);
  32535. $core.addMethod(
  32536. $core.method({
  32537. selector: "definition",
  32538. protocol: "accessing",
  32539. fn: function (){
  32540. var self=this,$self=this;
  32541. return "";
  32542. },
  32543. args: [],
  32544. source: "definition\x0a\x09^ ''",
  32545. referencedClasses: [],
  32546. messageSends: []
  32547. }),
  32548. $globals.PackageTransport);
  32549. $core.addMethod(
  32550. $core.method({
  32551. selector: "load",
  32552. protocol: "loading",
  32553. fn: function (){
  32554. var self=this,$self=this;
  32555. return $core.withContext(function($ctx1) {
  32556. $recv($self._commitHandler())._load_($self._package());
  32557. return self;
  32558. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32559. },
  32560. args: [],
  32561. source: "load\x0a\x09self commitHandler load: self package",
  32562. referencedClasses: [],
  32563. messageSends: ["load:", "commitHandler", "package"]
  32564. }),
  32565. $globals.PackageTransport);
  32566. $core.addMethod(
  32567. $core.method({
  32568. selector: "package",
  32569. protocol: "accessing",
  32570. fn: function (){
  32571. var self=this,$self=this;
  32572. return $self["@package"];
  32573. },
  32574. args: [],
  32575. source: "package\x0a\x09^ package",
  32576. referencedClasses: [],
  32577. messageSends: []
  32578. }),
  32579. $globals.PackageTransport);
  32580. $core.addMethod(
  32581. $core.method({
  32582. selector: "package:",
  32583. protocol: "accessing",
  32584. fn: function (aPackage){
  32585. var self=this,$self=this;
  32586. $self["@package"]=aPackage;
  32587. return self;
  32588. },
  32589. args: ["aPackage"],
  32590. source: "package: aPackage\x0a\x09package := aPackage",
  32591. referencedClasses: [],
  32592. messageSends: []
  32593. }),
  32594. $globals.PackageTransport);
  32595. $core.addMethod(
  32596. $core.method({
  32597. selector: "setupFromJson:",
  32598. protocol: "initialization",
  32599. fn: function (anObject){
  32600. var self=this,$self=this;
  32601. return self;
  32602. },
  32603. args: ["anObject"],
  32604. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32605. referencedClasses: [],
  32606. messageSends: []
  32607. }),
  32608. $globals.PackageTransport);
  32609. $core.addMethod(
  32610. $core.method({
  32611. selector: "type",
  32612. protocol: "accessing",
  32613. fn: function (){
  32614. var self=this,$self=this;
  32615. return $core.withContext(function($ctx1) {
  32616. return $recv($self._class())._type();
  32617. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32618. },
  32619. args: [],
  32620. source: "type\x0a\x09^ self class type",
  32621. referencedClasses: [],
  32622. messageSends: ["type", "class"]
  32623. }),
  32624. $globals.PackageTransport);
  32625. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32626. $core.addMethod(
  32627. $core.method({
  32628. selector: "classRegisteredFor:",
  32629. protocol: "accessing",
  32630. fn: function (aString){
  32631. var self=this,$self=this;
  32632. return $core.withContext(function($ctx1) {
  32633. return $recv($self["@registry"])._at_(aString);
  32634. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32635. },
  32636. args: ["aString"],
  32637. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32638. referencedClasses: [],
  32639. messageSends: ["at:"]
  32640. }),
  32641. $globals.PackageTransport.a$cls);
  32642. $core.addMethod(
  32643. $core.method({
  32644. selector: "defaultType",
  32645. protocol: "accessing",
  32646. fn: function (){
  32647. var self=this,$self=this;
  32648. return $core.withContext(function($ctx1) {
  32649. return $recv($globals.AmdPackageTransport)._type();
  32650. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32651. },
  32652. args: [],
  32653. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32654. referencedClasses: ["AmdPackageTransport"],
  32655. messageSends: ["type"]
  32656. }),
  32657. $globals.PackageTransport.a$cls);
  32658. $core.addMethod(
  32659. $core.method({
  32660. selector: "for:",
  32661. protocol: "instance creation",
  32662. fn: function (aString){
  32663. var self=this,$self=this;
  32664. return $core.withContext(function($ctx1) {
  32665. return $recv($self._classRegisteredFor_(aString))._new();
  32666. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32667. },
  32668. args: ["aString"],
  32669. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32670. referencedClasses: [],
  32671. messageSends: ["new", "classRegisteredFor:"]
  32672. }),
  32673. $globals.PackageTransport.a$cls);
  32674. $core.addMethod(
  32675. $core.method({
  32676. selector: "fromJson:",
  32677. protocol: "instance creation",
  32678. fn: function (anObject){
  32679. var self=this,$self=this;
  32680. return $core.withContext(function($ctx1) {
  32681. var $1,$2,$receiver;
  32682. if(($receiver = anObject) == null || $receiver.a$nil){
  32683. $1=$self._for_($self._defaultType());
  32684. $ctx1.sendIdx["for:"]=1;
  32685. return $1;
  32686. } else {
  32687. anObject;
  32688. }
  32689. $2=$self._for_($recv(anObject)._type());
  32690. $recv($2)._setupFromJson_(anObject);
  32691. return $recv($2)._yourself();
  32692. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32693. },
  32694. args: ["anObject"],
  32695. 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",
  32696. referencedClasses: [],
  32697. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32698. }),
  32699. $globals.PackageTransport.a$cls);
  32700. $core.addMethod(
  32701. $core.method({
  32702. selector: "initialize",
  32703. protocol: "initialization",
  32704. fn: function (){
  32705. var self=this,$self=this;
  32706. return $core.withContext(function($ctx1) {
  32707. var $1;
  32708. (
  32709. $ctx1.supercall = true,
  32710. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32711. $ctx1.supercall = false;
  32712. $1=$self.__eq_eq($globals.PackageTransport);
  32713. if($core.assert($1)){
  32714. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32715. $self["@registry"];
  32716. } else {
  32717. $self._register();
  32718. }
  32719. return self;
  32720. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32721. },
  32722. args: [],
  32723. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32724. referencedClasses: ["PackageTransport"],
  32725. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32726. }),
  32727. $globals.PackageTransport.a$cls);
  32728. $core.addMethod(
  32729. $core.method({
  32730. selector: "register",
  32731. protocol: "registration",
  32732. fn: function (){
  32733. var self=this,$self=this;
  32734. return $core.withContext(function($ctx1) {
  32735. $recv($globals.PackageTransport)._register_(self);
  32736. return self;
  32737. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32738. },
  32739. args: [],
  32740. source: "register\x0a\x09PackageTransport register: self",
  32741. referencedClasses: ["PackageTransport"],
  32742. messageSends: ["register:"]
  32743. }),
  32744. $globals.PackageTransport.a$cls);
  32745. $core.addMethod(
  32746. $core.method({
  32747. selector: "register:",
  32748. protocol: "registration",
  32749. fn: function (aClass){
  32750. var self=this,$self=this;
  32751. return $core.withContext(function($ctx1) {
  32752. var $1,$receiver;
  32753. $1=$recv(aClass)._type();
  32754. $ctx1.sendIdx["type"]=1;
  32755. if(($receiver = $1) == null || $receiver.a$nil){
  32756. $1;
  32757. } else {
  32758. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32759. }
  32760. return self;
  32761. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32762. },
  32763. args: ["aClass"],
  32764. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32765. referencedClasses: [],
  32766. messageSends: ["ifNotNil:", "type", "at:put:"]
  32767. }),
  32768. $globals.PackageTransport.a$cls);
  32769. $core.addMethod(
  32770. $core.method({
  32771. selector: "type",
  32772. protocol: "accessing",
  32773. fn: function (){
  32774. var self=this,$self=this;
  32775. return nil;
  32776. },
  32777. args: [],
  32778. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32779. referencedClasses: [],
  32780. messageSends: []
  32781. }),
  32782. $globals.PackageTransport.a$cls);
  32783. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32784. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32785. $core.addMethod(
  32786. $core.method({
  32787. selector: "asJavaScriptObject",
  32788. protocol: "converting",
  32789. fn: function (){
  32790. var self=this,$self=this;
  32791. return $core.withContext(function($ctx1) {
  32792. var $1;
  32793. $1=(
  32794. $ctx1.supercall = true,
  32795. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32796. $ctx1.supercall = false;
  32797. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32798. return $recv($1)._yourself();
  32799. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32800. },
  32801. args: [],
  32802. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32803. referencedClasses: [],
  32804. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32805. }),
  32806. $globals.AmdPackageTransport);
  32807. $core.addMethod(
  32808. $core.method({
  32809. selector: "commitHandlerClass",
  32810. protocol: "accessing",
  32811. fn: function (){
  32812. var self=this,$self=this;
  32813. return $globals.AmdPackageHandler;
  32814. },
  32815. args: [],
  32816. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32817. referencedClasses: ["AmdPackageHandler"],
  32818. messageSends: []
  32819. }),
  32820. $globals.AmdPackageTransport);
  32821. $core.addMethod(
  32822. $core.method({
  32823. selector: "defaultNamespace",
  32824. protocol: "defaults",
  32825. fn: function (){
  32826. var self=this,$self=this;
  32827. return $core.withContext(function($ctx1) {
  32828. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32829. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32830. },
  32831. args: [],
  32832. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32833. referencedClasses: ["Smalltalk"],
  32834. messageSends: ["defaultAmdNamespace"]
  32835. }),
  32836. $globals.AmdPackageTransport);
  32837. $core.addMethod(
  32838. $core.method({
  32839. selector: "definition",
  32840. protocol: "accessing",
  32841. fn: function (){
  32842. var self=this,$self=this;
  32843. return $core.withContext(function($ctx1) {
  32844. return $recv($globals.String)._streamContents_((function(stream){
  32845. return $core.withContext(function($ctx2) {
  32846. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  32847. return $recv(stream)._print_($self._namespace());
  32848. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  32849. }));
  32850. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  32851. },
  32852. args: [],
  32853. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  32854. referencedClasses: ["String"],
  32855. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  32856. }),
  32857. $globals.AmdPackageTransport);
  32858. $core.addMethod(
  32859. $core.method({
  32860. selector: "namespace",
  32861. protocol: "accessing",
  32862. fn: function (){
  32863. var self=this,$self=this;
  32864. return $core.withContext(function($ctx1) {
  32865. var $1,$receiver;
  32866. $1=$self["@namespace"];
  32867. if(($receiver = $1) == null || $receiver.a$nil){
  32868. return $self._defaultNamespace();
  32869. } else {
  32870. return $1;
  32871. }
  32872. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  32873. },
  32874. args: [],
  32875. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  32876. referencedClasses: [],
  32877. messageSends: ["ifNil:", "defaultNamespace"]
  32878. }),
  32879. $globals.AmdPackageTransport);
  32880. $core.addMethod(
  32881. $core.method({
  32882. selector: "namespace:",
  32883. protocol: "accessing",
  32884. fn: function (aString){
  32885. var self=this,$self=this;
  32886. $self["@namespace"]=aString;
  32887. return self;
  32888. },
  32889. args: ["aString"],
  32890. source: "namespace: aString\x0a\x09namespace := aString",
  32891. referencedClasses: [],
  32892. messageSends: []
  32893. }),
  32894. $globals.AmdPackageTransport);
  32895. $core.addMethod(
  32896. $core.method({
  32897. selector: "printOn:",
  32898. protocol: "printing",
  32899. fn: function (aStream){
  32900. var self=this,$self=this;
  32901. return $core.withContext(function($ctx1) {
  32902. (
  32903. $ctx1.supercall = true,
  32904. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  32905. $ctx1.supercall = false;
  32906. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  32907. $ctx1.sendIdx["nextPutAll:"]=1;
  32908. $recv(aStream)._nextPutAll_($self._namespace());
  32909. $ctx1.sendIdx["nextPutAll:"]=2;
  32910. $recv(aStream)._nextPutAll_(")");
  32911. return self;
  32912. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  32913. },
  32914. args: ["aStream"],
  32915. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  32916. referencedClasses: [],
  32917. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  32918. }),
  32919. $globals.AmdPackageTransport);
  32920. $core.addMethod(
  32921. $core.method({
  32922. selector: "setPath:",
  32923. protocol: "actions",
  32924. fn: function (aString){
  32925. var self=this,$self=this;
  32926. return $core.withContext(function($ctx1) {
  32927. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  32928. return self;
  32929. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  32930. },
  32931. args: ["aString"],
  32932. 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}.",
  32933. referencedClasses: [],
  32934. messageSends: ["value:", "basicAt:", "namespace"]
  32935. }),
  32936. $globals.AmdPackageTransport);
  32937. $core.addMethod(
  32938. $core.method({
  32939. selector: "setupFromJson:",
  32940. protocol: "initialization",
  32941. fn: function (anObject){
  32942. var self=this,$self=this;
  32943. return $core.withContext(function($ctx1) {
  32944. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  32945. return self;
  32946. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  32947. },
  32948. args: ["anObject"],
  32949. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  32950. referencedClasses: [],
  32951. messageSends: ["namespace:", "at:"]
  32952. }),
  32953. $globals.AmdPackageTransport);
  32954. $core.addMethod(
  32955. $core.method({
  32956. selector: "namespace:",
  32957. protocol: "instance creation",
  32958. fn: function (aString){
  32959. var self=this,$self=this;
  32960. return $core.withContext(function($ctx1) {
  32961. var $1;
  32962. $1=$self._new();
  32963. $recv($1)._namespace_(aString);
  32964. return $recv($1)._yourself();
  32965. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  32966. },
  32967. args: ["aString"],
  32968. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  32969. referencedClasses: [],
  32970. messageSends: ["namespace:", "new", "yourself"]
  32971. }),
  32972. $globals.AmdPackageTransport.a$cls);
  32973. $core.addMethod(
  32974. $core.method({
  32975. selector: "type",
  32976. protocol: "accessing",
  32977. fn: function (){
  32978. var self=this,$self=this;
  32979. return "amd";
  32980. },
  32981. args: [],
  32982. source: "type\x0a\x09^ 'amd'",
  32983. referencedClasses: [],
  32984. messageSends: []
  32985. }),
  32986. $globals.AmdPackageTransport.a$cls);
  32987. $core.addMethod(
  32988. $core.method({
  32989. selector: "exportBehaviorDefinitionTo:using:",
  32990. protocol: "*Platform-ImportExport",
  32991. fn: function (aStream,anExporter){
  32992. var self=this,$self=this;
  32993. return $core.withContext(function($ctx1) {
  32994. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  32995. return self;
  32996. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  32997. },
  32998. args: ["aStream", "anExporter"],
  32999. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33000. referencedClasses: [],
  33001. messageSends: ["exportDefinitionOf:on:"]
  33002. }),
  33003. $globals.Class);
  33004. $core.addMethod(
  33005. $core.method({
  33006. selector: "exportBehaviorDefinitionTo:using:",
  33007. protocol: "*Platform-ImportExport",
  33008. fn: function (aStream,anExporter){
  33009. var self=this,$self=this;
  33010. return $core.withContext(function($ctx1) {
  33011. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33012. return self;
  33013. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33014. },
  33015. args: ["aStream", "anExporter"],
  33016. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33017. referencedClasses: [],
  33018. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33019. }),
  33020. $globals.Metaclass);
  33021. $core.addMethod(
  33022. $core.method({
  33023. selector: "commit",
  33024. protocol: "*Platform-ImportExport",
  33025. fn: function (){
  33026. var self=this,$self=this;
  33027. return $core.withContext(function($ctx1) {
  33028. return $recv($self._transport())._commit();
  33029. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33030. },
  33031. args: [],
  33032. source: "commit\x0a\x09^ self transport commit",
  33033. referencedClasses: [],
  33034. messageSends: ["commit", "transport"]
  33035. }),
  33036. $globals.Package);
  33037. $core.addMethod(
  33038. $core.method({
  33039. selector: "load",
  33040. protocol: "*Platform-ImportExport",
  33041. fn: function (){
  33042. var self=this,$self=this;
  33043. return $core.withContext(function($ctx1) {
  33044. return $recv($self._transport())._load();
  33045. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33046. },
  33047. args: [],
  33048. source: "load\x0a\x09^ self transport load",
  33049. referencedClasses: [],
  33050. messageSends: ["load", "transport"]
  33051. }),
  33052. $globals.Package);
  33053. $core.addMethod(
  33054. $core.method({
  33055. selector: "loadFromNamespace:",
  33056. protocol: "*Platform-ImportExport",
  33057. fn: function (aString){
  33058. var self=this,$self=this;
  33059. return $core.withContext(function($ctx1) {
  33060. var $1;
  33061. $1=$self._transport();
  33062. $recv($1)._namespace_(aString);
  33063. return $recv($1)._load();
  33064. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33065. },
  33066. args: ["aString"],
  33067. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33068. referencedClasses: [],
  33069. messageSends: ["namespace:", "transport", "load"]
  33070. }),
  33071. $globals.Package);
  33072. $core.addMethod(
  33073. $core.method({
  33074. selector: "load:",
  33075. protocol: "*Platform-ImportExport",
  33076. fn: function (aPackageName){
  33077. var self=this,$self=this;
  33078. return $core.withContext(function($ctx1) {
  33079. $recv($self._named_(aPackageName))._load();
  33080. return self;
  33081. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33082. },
  33083. args: ["aPackageName"],
  33084. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  33085. referencedClasses: [],
  33086. messageSends: ["load", "named:"]
  33087. }),
  33088. $globals.Package.a$cls);
  33089. $core.addMethod(
  33090. $core.method({
  33091. selector: "load:fromNamespace:",
  33092. protocol: "*Platform-ImportExport",
  33093. fn: function (aPackageName,aString){
  33094. var self=this,$self=this;
  33095. return $core.withContext(function($ctx1) {
  33096. $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33097. return self;
  33098. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33099. },
  33100. args: ["aPackageName", "aString"],
  33101. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  33102. referencedClasses: [],
  33103. messageSends: ["loadFromNamespace:", "named:"]
  33104. }),
  33105. $globals.Package.a$cls);
  33106. $core.addMethod(
  33107. $core.method({
  33108. selector: "methodsFor:",
  33109. protocol: "*Platform-ImportExport",
  33110. fn: function (aString){
  33111. var self=this,$self=this;
  33112. return $core.withContext(function($ctx1) {
  33113. var $1;
  33114. $1=$recv($globals.ClassProtocolReader)._new();
  33115. $recv($1)._class_category_(self,aString);
  33116. return $recv($1)._yourself();
  33117. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33118. },
  33119. args: ["aString"],
  33120. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33121. referencedClasses: ["ClassProtocolReader"],
  33122. messageSends: ["class:category:", "new", "yourself"]
  33123. }),
  33124. $globals.TBehaviorProvider);
  33125. $core.addMethod(
  33126. $core.method({
  33127. selector: "methodsFor:stamp:",
  33128. protocol: "*Platform-ImportExport",
  33129. fn: function (aString,aStamp){
  33130. var self=this,$self=this;
  33131. return $core.withContext(function($ctx1) {
  33132. return $self._methodsFor_(aString);
  33133. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33134. },
  33135. args: ["aString", "aStamp"],
  33136. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33137. referencedClasses: [],
  33138. messageSends: ["methodsFor:"]
  33139. }),
  33140. $globals.TBehaviorProvider);
  33141. $core.addMethod(
  33142. $core.method({
  33143. selector: "commentStamp",
  33144. protocol: "*Platform-ImportExport",
  33145. fn: function (){
  33146. var self=this,$self=this;
  33147. return $core.withContext(function($ctx1) {
  33148. var $1;
  33149. $1=$recv($globals.ClassCommentReader)._new();
  33150. $recv($1)._class_(self);
  33151. return $recv($1)._yourself();
  33152. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33153. },
  33154. args: [],
  33155. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33156. referencedClasses: ["ClassCommentReader"],
  33157. messageSends: ["class:", "new", "yourself"]
  33158. }),
  33159. $globals.TMasterBehavior);
  33160. $core.addMethod(
  33161. $core.method({
  33162. selector: "commentStamp:prior:",
  33163. protocol: "*Platform-ImportExport",
  33164. fn: function (aStamp,prior){
  33165. var self=this,$self=this;
  33166. return $core.withContext(function($ctx1) {
  33167. return $self._commentStamp();
  33168. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33169. },
  33170. args: ["aStamp", "prior"],
  33171. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33172. referencedClasses: [],
  33173. messageSends: ["commentStamp"]
  33174. }),
  33175. $globals.TMasterBehavior);
  33176. $core.addMethod(
  33177. $core.method({
  33178. selector: "exportBehaviorDefinitionTo:using:",
  33179. protocol: "*Platform-ImportExport",
  33180. fn: function (aStream,anExporter){
  33181. var self=this,$self=this;
  33182. return $core.withContext(function($ctx1) {
  33183. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33184. return self;
  33185. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33186. },
  33187. args: ["aStream", "anExporter"],
  33188. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33189. referencedClasses: [],
  33190. messageSends: ["exportTraitDefinitionOf:on:"]
  33191. }),
  33192. $globals.Trait);
  33193. });
  33194. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  33195. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33196. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33197. $core.addPackage("Compiler-Core");
  33198. ($core.packageDescriptors||$core.packages)["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  33199. ($core.packageDescriptors||$core.packages)["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33200. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  33201. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  33202. $core.addMethod(
  33203. $core.method({
  33204. selector: "compileNode:",
  33205. protocol: "compiling",
  33206. fn: function (aNode){
  33207. var self=this,$self=this;
  33208. return $core.withContext(function($ctx1) {
  33209. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  33210. return $core.withContext(function($ctx2) {
  33211. return $recv(transformer)._value_(input);
  33212. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  33213. }));
  33214. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  33215. },
  33216. args: ["aNode"],
  33217. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  33218. referencedClasses: [],
  33219. messageSends: ["inject:into:", "transformers", "value:"]
  33220. }),
  33221. $globals.AbstractCodeGenerator);
  33222. $core.addMethod(
  33223. $core.method({
  33224. selector: "currentClass",
  33225. protocol: "accessing",
  33226. fn: function (){
  33227. var self=this,$self=this;
  33228. return $self["@currentClass"];
  33229. },
  33230. args: [],
  33231. source: "currentClass\x0a\x09^ currentClass",
  33232. referencedClasses: [],
  33233. messageSends: []
  33234. }),
  33235. $globals.AbstractCodeGenerator);
  33236. $core.addMethod(
  33237. $core.method({
  33238. selector: "currentClass:",
  33239. protocol: "accessing",
  33240. fn: function (aClass){
  33241. var self=this,$self=this;
  33242. $self["@currentClass"]=aClass;
  33243. return self;
  33244. },
  33245. args: ["aClass"],
  33246. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  33247. referencedClasses: [],
  33248. messageSends: []
  33249. }),
  33250. $globals.AbstractCodeGenerator);
  33251. $core.addMethod(
  33252. $core.method({
  33253. selector: "currentPackage",
  33254. protocol: "accessing",
  33255. fn: function (){
  33256. var self=this,$self=this;
  33257. return $self["@currentPackage"];
  33258. },
  33259. args: [],
  33260. source: "currentPackage\x0a\x09^ currentPackage",
  33261. referencedClasses: [],
  33262. messageSends: []
  33263. }),
  33264. $globals.AbstractCodeGenerator);
  33265. $core.addMethod(
  33266. $core.method({
  33267. selector: "currentPackage:",
  33268. protocol: "accessing",
  33269. fn: function (anObject){
  33270. var self=this,$self=this;
  33271. $self["@currentPackage"]=anObject;
  33272. return self;
  33273. },
  33274. args: ["anObject"],
  33275. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  33276. referencedClasses: [],
  33277. messageSends: []
  33278. }),
  33279. $globals.AbstractCodeGenerator);
  33280. $core.addMethod(
  33281. $core.method({
  33282. selector: "pseudoVariables",
  33283. protocol: "accessing",
  33284. fn: function (){
  33285. var self=this,$self=this;
  33286. return $core.withContext(function($ctx1) {
  33287. return $recv($globals.Smalltalk)._pseudoVariableNames();
  33288. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  33289. },
  33290. args: [],
  33291. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  33292. referencedClasses: ["Smalltalk"],
  33293. messageSends: ["pseudoVariableNames"]
  33294. }),
  33295. $globals.AbstractCodeGenerator);
  33296. $core.addMethod(
  33297. $core.method({
  33298. selector: "source",
  33299. protocol: "accessing",
  33300. fn: function (){
  33301. var self=this,$self=this;
  33302. return $core.withContext(function($ctx1) {
  33303. var $1,$receiver;
  33304. $1=$self["@source"];
  33305. if(($receiver = $1) == null || $receiver.a$nil){
  33306. return "";
  33307. } else {
  33308. return $1;
  33309. }
  33310. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  33311. },
  33312. args: [],
  33313. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33314. referencedClasses: [],
  33315. messageSends: ["ifNil:"]
  33316. }),
  33317. $globals.AbstractCodeGenerator);
  33318. $core.addMethod(
  33319. $core.method({
  33320. selector: "source:",
  33321. protocol: "accessing",
  33322. fn: function (aString){
  33323. var self=this,$self=this;
  33324. $self["@source"]=aString;
  33325. return self;
  33326. },
  33327. args: ["aString"],
  33328. source: "source: aString\x0a\x09source := aString",
  33329. referencedClasses: [],
  33330. messageSends: []
  33331. }),
  33332. $globals.AbstractCodeGenerator);
  33333. $core.addMethod(
  33334. $core.method({
  33335. selector: "transformers",
  33336. protocol: "compiling",
  33337. fn: function (){
  33338. var self=this,$self=this;
  33339. var dict;
  33340. return $core.withContext(function($ctx1) {
  33341. dict=$self._transformersDictionary();
  33342. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  33343. return $core.withContext(function($ctx2) {
  33344. return $recv(dict)._at_(each);
  33345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33346. }));
  33347. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  33348. },
  33349. args: [],
  33350. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  33351. referencedClasses: [],
  33352. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  33353. }),
  33354. $globals.AbstractCodeGenerator);
  33355. $core.addMethod(
  33356. $core.method({
  33357. selector: "transformersDictionary",
  33358. protocol: "compiling",
  33359. fn: function (){
  33360. var self=this,$self=this;
  33361. return $core.withContext(function($ctx1) {
  33362. $self._subclassResponsibility();
  33363. return self;
  33364. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  33365. },
  33366. args: [],
  33367. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  33368. referencedClasses: [],
  33369. messageSends: ["subclassResponsibility"]
  33370. }),
  33371. $globals.AbstractCodeGenerator);
  33372. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  33373. $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.";
  33374. $core.addMethod(
  33375. $core.method({
  33376. selector: "irTranslator",
  33377. protocol: "compiling",
  33378. fn: function (){
  33379. var self=this,$self=this;
  33380. return $core.withContext(function($ctx1) {
  33381. var $1;
  33382. $1=$recv($self._irTranslatorClass())._new();
  33383. $recv($1)._currentClass_($self._currentClass());
  33384. return $recv($1)._yourself();
  33385. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  33386. },
  33387. args: [],
  33388. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  33389. referencedClasses: [],
  33390. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  33391. }),
  33392. $globals.CodeGenerator);
  33393. $core.addMethod(
  33394. $core.method({
  33395. selector: "irTranslatorClass",
  33396. protocol: "compiling",
  33397. fn: function (){
  33398. var self=this,$self=this;
  33399. return $globals.IRJSTranslator;
  33400. },
  33401. args: [],
  33402. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  33403. referencedClasses: ["IRJSTranslator"],
  33404. messageSends: []
  33405. }),
  33406. $globals.CodeGenerator);
  33407. $core.addMethod(
  33408. $core.method({
  33409. selector: "semanticAnalyzer",
  33410. protocol: "compiling",
  33411. fn: function (){
  33412. var self=this,$self=this;
  33413. return $core.withContext(function($ctx1) {
  33414. var $1;
  33415. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  33416. $recv($1)._thePackage_($self._currentPackage());
  33417. return $recv($1)._yourself();
  33418. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  33419. },
  33420. args: [],
  33421. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  33422. referencedClasses: ["SemanticAnalyzer"],
  33423. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  33424. }),
  33425. $globals.CodeGenerator);
  33426. $core.addMethod(
  33427. $core.method({
  33428. selector: "transformersDictionary",
  33429. protocol: "compiling",
  33430. fn: function (){
  33431. var self=this,$self=this;
  33432. return $core.withContext(function($ctx1) {
  33433. var $1,$2,$receiver;
  33434. $1=$self["@transformersDictionary"];
  33435. if(($receiver = $1) == null || $receiver.a$nil){
  33436. $2=$recv($globals.Dictionary)._new();
  33437. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  33438. $ctx1.sendIdx["at:put:"]=1;
  33439. $recv($2)._at_put_("5000-astToIr",$self._translator());
  33440. $ctx1.sendIdx["at:put:"]=2;
  33441. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  33442. $self["@transformersDictionary"]=$recv($2)._yourself();
  33443. return $self["@transformersDictionary"];
  33444. } else {
  33445. return $1;
  33446. }
  33447. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  33448. },
  33449. args: [],
  33450. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary 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 ]",
  33451. referencedClasses: ["Dictionary"],
  33452. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  33453. }),
  33454. $globals.CodeGenerator);
  33455. $core.addMethod(
  33456. $core.method({
  33457. selector: "translator",
  33458. protocol: "compiling",
  33459. fn: function (){
  33460. var self=this,$self=this;
  33461. return $core.withContext(function($ctx1) {
  33462. var $1;
  33463. $1=$recv($globals.IRASTTranslator)._new();
  33464. $recv($1)._source_($self._source());
  33465. $recv($1)._theClass_($self._currentClass());
  33466. return $recv($1)._yourself();
  33467. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  33468. },
  33469. args: [],
  33470. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  33471. referencedClasses: ["IRASTTranslator"],
  33472. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  33473. }),
  33474. $globals.CodeGenerator);
  33475. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass"], "Compiler-Core");
  33476. $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`";
  33477. $core.addMethod(
  33478. $core.method({
  33479. selector: "codeGeneratorClass",
  33480. protocol: "accessing",
  33481. fn: function (){
  33482. var self=this,$self=this;
  33483. return $core.withContext(function($ctx1) {
  33484. var $1,$receiver;
  33485. $1=$self["@codeGeneratorClass"];
  33486. if(($receiver = $1) == null || $receiver.a$nil){
  33487. return $globals.InliningCodeGenerator;
  33488. } else {
  33489. return $1;
  33490. }
  33491. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  33492. },
  33493. args: [],
  33494. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  33495. referencedClasses: ["InliningCodeGenerator"],
  33496. messageSends: ["ifNil:"]
  33497. }),
  33498. $globals.Compiler);
  33499. $core.addMethod(
  33500. $core.method({
  33501. selector: "codeGeneratorClass:",
  33502. protocol: "accessing",
  33503. fn: function (aClass){
  33504. var self=this,$self=this;
  33505. $self["@codeGeneratorClass"]=aClass;
  33506. return self;
  33507. },
  33508. args: ["aClass"],
  33509. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  33510. referencedClasses: [],
  33511. messageSends: []
  33512. }),
  33513. $globals.Compiler);
  33514. $core.addMethod(
  33515. $core.method({
  33516. selector: "compile:forClass:protocol:",
  33517. protocol: "compiling",
  33518. fn: function (aString,aClass,anotherString){
  33519. var self=this,$self=this;
  33520. return $core.withContext(function($ctx1) {
  33521. $self._source_(aString);
  33522. return $self._compileNode_forClass_package_($self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  33523. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  33524. },
  33525. args: ["aString", "aClass", "anotherString"],
  33526. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09compileNode: (self parse: aString)\x0a\x09\x09forClass: aClass\x0a\x09\x09package: (aClass packageOfProtocol: anotherString)",
  33527. referencedClasses: [],
  33528. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  33529. }),
  33530. $globals.Compiler);
  33531. $core.addMethod(
  33532. $core.method({
  33533. selector: "compileExpression:on:",
  33534. protocol: "compiling",
  33535. fn: function (aString,anObject){
  33536. var self=this,$self=this;
  33537. return $core.withContext(function($ctx1) {
  33538. var $1;
  33539. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  33540. $ctx1.sendIdx[","]=1;
  33541. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  33542. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  33543. },
  33544. args: ["aString", "anObject"],
  33545. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  33546. referencedClasses: [],
  33547. messageSends: ["compile:forClass:protocol:", ",", "class"]
  33548. }),
  33549. $globals.Compiler);
  33550. $core.addMethod(
  33551. $core.method({
  33552. selector: "compileNode:",
  33553. protocol: "compiling",
  33554. fn: function (aNode){
  33555. var self=this,$self=this;
  33556. var generator,result;
  33557. return $core.withContext(function($ctx1) {
  33558. var $1;
  33559. generator=$recv($self._codeGeneratorClass())._new();
  33560. $1=generator;
  33561. $recv($1)._source_($self._source());
  33562. $recv($1)._currentClass_($self._currentClass());
  33563. $recv($1)._currentPackage_($self._currentPackage());
  33564. result=$recv(generator)._compileNode_(aNode);
  33565. return result;
  33566. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  33567. },
  33568. args: ["aNode"],
  33569. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09currentPackage: self currentPackage.\x0a\x09result := generator compileNode: aNode.\x0a\x09^ result",
  33570. referencedClasses: [],
  33571. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:"]
  33572. }),
  33573. $globals.Compiler);
  33574. $core.addMethod(
  33575. $core.method({
  33576. selector: "compileNode:forClass:package:",
  33577. protocol: "compiling",
  33578. fn: function (aNode,aClass,aPackage){
  33579. var self=this,$self=this;
  33580. return $core.withContext(function($ctx1) {
  33581. $self._currentClass_(aClass);
  33582. $self._currentPackage_(aPackage);
  33583. return $self._compileNode_(aNode);
  33584. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  33585. },
  33586. args: ["aNode", "aClass", "aPackage"],
  33587. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  33588. referencedClasses: [],
  33589. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  33590. }),
  33591. $globals.Compiler);
  33592. $core.addMethod(
  33593. $core.method({
  33594. selector: "currentClass",
  33595. protocol: "accessing",
  33596. fn: function (){
  33597. var self=this,$self=this;
  33598. return $self["@currentClass"];
  33599. },
  33600. args: [],
  33601. source: "currentClass\x0a\x09^ currentClass",
  33602. referencedClasses: [],
  33603. messageSends: []
  33604. }),
  33605. $globals.Compiler);
  33606. $core.addMethod(
  33607. $core.method({
  33608. selector: "currentClass:",
  33609. protocol: "accessing",
  33610. fn: function (aClass){
  33611. var self=this,$self=this;
  33612. $self["@currentClass"]=aClass;
  33613. return self;
  33614. },
  33615. args: ["aClass"],
  33616. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  33617. referencedClasses: [],
  33618. messageSends: []
  33619. }),
  33620. $globals.Compiler);
  33621. $core.addMethod(
  33622. $core.method({
  33623. selector: "currentPackage",
  33624. protocol: "accessing",
  33625. fn: function (){
  33626. var self=this,$self=this;
  33627. return $self["@currentPackage"];
  33628. },
  33629. args: [],
  33630. source: "currentPackage\x0a\x09^ currentPackage",
  33631. referencedClasses: [],
  33632. messageSends: []
  33633. }),
  33634. $globals.Compiler);
  33635. $core.addMethod(
  33636. $core.method({
  33637. selector: "currentPackage:",
  33638. protocol: "accessing",
  33639. fn: function (anObject){
  33640. var self=this,$self=this;
  33641. $self["@currentPackage"]=anObject;
  33642. return self;
  33643. },
  33644. args: ["anObject"],
  33645. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  33646. referencedClasses: [],
  33647. messageSends: []
  33648. }),
  33649. $globals.Compiler);
  33650. $core.addMethod(
  33651. $core.method({
  33652. selector: "eval:",
  33653. protocol: "compiling",
  33654. fn: function (aString){
  33655. var self=this,$self=this;
  33656. return $core.withContext(function($ctx1) {
  33657. return eval(aString);
  33658. return self;
  33659. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  33660. },
  33661. args: ["aString"],
  33662. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  33663. referencedClasses: [],
  33664. messageSends: []
  33665. }),
  33666. $globals.Compiler);
  33667. $core.addMethod(
  33668. $core.method({
  33669. selector: "eval:forPackage:",
  33670. protocol: "compiling",
  33671. fn: function (aString,aPackage){
  33672. var self=this,$self=this;
  33673. return $core.withContext(function($ctx1) {
  33674. var $receiver;
  33675. if(($receiver = aPackage) == null || $receiver.a$nil){
  33676. return $self._eval_(aString);
  33677. $ctx1.sendIdx["eval:"]=1;
  33678. } else {
  33679. return $recv(aPackage)._eval_(aString);
  33680. }
  33681. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  33682. },
  33683. args: ["aString", "aPackage"],
  33684. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  33685. referencedClasses: [],
  33686. messageSends: ["ifNil:ifNotNil:", "eval:"]
  33687. }),
  33688. $globals.Compiler);
  33689. $core.addMethod(
  33690. $core.method({
  33691. selector: "evaluateExpression:",
  33692. protocol: "compiling",
  33693. fn: function (aString){
  33694. var self=this,$self=this;
  33695. return $core.withContext(function($ctx1) {
  33696. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  33697. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  33698. },
  33699. args: ["aString"],
  33700. 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",
  33701. referencedClasses: ["DoIt"],
  33702. messageSends: ["evaluateExpression:on:", "new"]
  33703. }),
  33704. $globals.Compiler);
  33705. $core.addMethod(
  33706. $core.method({
  33707. selector: "evaluateExpression:on:",
  33708. protocol: "compiling",
  33709. fn: function (aString,anObject){
  33710. var self=this,$self=this;
  33711. var result,method;
  33712. return $core.withContext(function($ctx1) {
  33713. var $1;
  33714. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  33715. $recv(method)._protocol_("**xxxDoIt");
  33716. $1=$recv(anObject)._class();
  33717. $ctx1.sendIdx["class"]=1;
  33718. $recv($1)._addCompiledMethod_(method);
  33719. result=$recv(anObject)._xxxDoIt();
  33720. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  33721. return result;
  33722. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  33723. },
  33724. args: ["aString", "anObject"],
  33725. 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",
  33726. referencedClasses: [],
  33727. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  33728. }),
  33729. $globals.Compiler);
  33730. $core.addMethod(
  33731. $core.method({
  33732. selector: "install:forClass:protocol:",
  33733. protocol: "compiling",
  33734. fn: function (aString,aBehavior,anotherString){
  33735. var self=this,$self=this;
  33736. var compiledMethod;
  33737. return $core.withContext(function($ctx1) {
  33738. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  33739. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  33740. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  33741. },
  33742. args: ["aString", "aBehavior", "anotherString"],
  33743. 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",
  33744. referencedClasses: ["ClassBuilder"],
  33745. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  33746. }),
  33747. $globals.Compiler);
  33748. $core.addMethod(
  33749. $core.method({
  33750. selector: "parse:",
  33751. protocol: "compiling",
  33752. fn: function (aString){
  33753. var self=this,$self=this;
  33754. return $core.withContext(function($ctx1) {
  33755. return $recv($globals.Smalltalk)._parse_(aString);
  33756. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  33757. },
  33758. args: ["aString"],
  33759. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  33760. referencedClasses: ["Smalltalk"],
  33761. messageSends: ["parse:"]
  33762. }),
  33763. $globals.Compiler);
  33764. $core.addMethod(
  33765. $core.method({
  33766. selector: "parseExpression:",
  33767. protocol: "compiling",
  33768. fn: function (aString){
  33769. var self=this,$self=this;
  33770. return $core.withContext(function($ctx1) {
  33771. var $1;
  33772. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  33773. $ctx1.sendIdx[","]=1;
  33774. return $self._parse_($1);
  33775. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  33776. },
  33777. args: ["aString"],
  33778. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  33779. referencedClasses: [],
  33780. messageSends: ["parse:", ","]
  33781. }),
  33782. $globals.Compiler);
  33783. $core.addMethod(
  33784. $core.method({
  33785. selector: "recompile:",
  33786. protocol: "compiling",
  33787. fn: function (aClass){
  33788. var self=this,$self=this;
  33789. return $core.withContext(function($ctx1) {
  33790. var $1,$2,$3,$receiver;
  33791. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  33792. return $core.withContext(function($ctx2) {
  33793. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  33794. $ctx2.sendIdx["="]=1;
  33795. if($core.assert($1)){
  33796. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  33797. }
  33798. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33799. }),"Recompiling ".__comma($recv(aClass)._name()));
  33800. $2=$recv(aClass)._theMetaClass();
  33801. if(($receiver = $2) == null || $receiver.a$nil){
  33802. $2;
  33803. } else {
  33804. var meta;
  33805. meta=$receiver;
  33806. $3=$recv(meta).__eq(aClass);
  33807. if(!$core.assert($3)){
  33808. $self._recompile_(meta);
  33809. }
  33810. }
  33811. return self;
  33812. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  33813. },
  33814. args: ["aClass"],
  33815. 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 ] ]",
  33816. referencedClasses: [],
  33817. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  33818. }),
  33819. $globals.Compiler);
  33820. $core.addMethod(
  33821. $core.method({
  33822. selector: "recompileAll",
  33823. protocol: "compiling",
  33824. fn: function (){
  33825. var self=this,$self=this;
  33826. return $core.withContext(function($ctx1) {
  33827. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  33828. return $core.withContext(function($ctx2) {
  33829. return $self._recompile_(each);
  33830. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33831. }),"Compiling all classes...");
  33832. return self;
  33833. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  33834. },
  33835. args: [],
  33836. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  33837. referencedClasses: ["Smalltalk"],
  33838. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  33839. }),
  33840. $globals.Compiler);
  33841. $core.addMethod(
  33842. $core.method({
  33843. selector: "source",
  33844. protocol: "accessing",
  33845. fn: function (){
  33846. var self=this,$self=this;
  33847. return $core.withContext(function($ctx1) {
  33848. var $1,$receiver;
  33849. $1=$self["@source"];
  33850. if(($receiver = $1) == null || $receiver.a$nil){
  33851. return "";
  33852. } else {
  33853. return $1;
  33854. }
  33855. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  33856. },
  33857. args: [],
  33858. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33859. referencedClasses: [],
  33860. messageSends: ["ifNil:"]
  33861. }),
  33862. $globals.Compiler);
  33863. $core.addMethod(
  33864. $core.method({
  33865. selector: "source:",
  33866. protocol: "accessing",
  33867. fn: function (aString){
  33868. var self=this,$self=this;
  33869. $self["@source"]=aString;
  33870. return self;
  33871. },
  33872. args: ["aString"],
  33873. source: "source: aString\x0a\x09source := aString",
  33874. referencedClasses: [],
  33875. messageSends: []
  33876. }),
  33877. $globals.Compiler);
  33878. $core.addMethod(
  33879. $core.method({
  33880. selector: "eval:",
  33881. protocol: "evaluating",
  33882. fn: function (aString){
  33883. var self=this,$self=this;
  33884. return $core.withContext(function($ctx1) {
  33885. return $recv($self._new())._eval_(aString);
  33886. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  33887. },
  33888. args: ["aString"],
  33889. source: "eval: aString\x0a\x09^ self new eval: aString",
  33890. referencedClasses: [],
  33891. messageSends: ["eval:", "new"]
  33892. }),
  33893. $globals.Compiler.a$cls);
  33894. $core.addMethod(
  33895. $core.method({
  33896. selector: "recompile:",
  33897. protocol: "compiling",
  33898. fn: function (aClass){
  33899. var self=this,$self=this;
  33900. return $core.withContext(function($ctx1) {
  33901. $recv($self._new())._recompile_(aClass);
  33902. return self;
  33903. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  33904. },
  33905. args: ["aClass"],
  33906. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  33907. referencedClasses: [],
  33908. messageSends: ["recompile:", "new"]
  33909. }),
  33910. $globals.Compiler.a$cls);
  33911. $core.addMethod(
  33912. $core.method({
  33913. selector: "recompileAll",
  33914. protocol: "compiling",
  33915. fn: function (){
  33916. var self=this,$self=this;
  33917. return $core.withContext(function($ctx1) {
  33918. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  33919. return $core.withContext(function($ctx2) {
  33920. return $self._recompile_(each);
  33921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33922. }));
  33923. return self;
  33924. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  33925. },
  33926. args: [],
  33927. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  33928. referencedClasses: ["Smalltalk"],
  33929. messageSends: ["do:", "classes", "recompile:"]
  33930. }),
  33931. $globals.Compiler.a$cls);
  33932. $core.addClass("CompilerError", $globals.Error, [], "Compiler-Core");
  33933. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  33934. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  33935. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  33936. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  33937. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  33938. $core.addMethod(
  33939. $core.method({
  33940. selector: "evaluate:context:",
  33941. protocol: "evaluating",
  33942. fn: function (aString,aContext){
  33943. var self=this,$self=this;
  33944. var compiler,ast;
  33945. return $core.withContext(function($ctx1) {
  33946. var $1;
  33947. var $early={};
  33948. try {
  33949. compiler=$recv($globals.Compiler)._new();
  33950. $recv((function(){
  33951. return $core.withContext(function($ctx2) {
  33952. ast=$recv(compiler)._parseExpression_(aString);
  33953. return ast;
  33954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33955. }))._on_do_($globals.Error,(function(ex){
  33956. return $core.withContext(function($ctx2) {
  33957. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  33958. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  33959. }));
  33960. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  33961. $recv($1)._context_(aContext);
  33962. $recv($1)._visit_(ast);
  33963. return $recv(aContext)._evaluateNode_(ast);
  33964. }
  33965. catch(e) {if(e===$early)return e[0]; throw e}
  33966. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  33967. },
  33968. args: ["aString", "aContext"],
  33969. 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",
  33970. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  33971. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  33972. }),
  33973. $globals.Evaluator);
  33974. $core.addMethod(
  33975. $core.method({
  33976. selector: "evaluate:for:",
  33977. protocol: "evaluating",
  33978. fn: function (aString,anObject){
  33979. var self=this,$self=this;
  33980. return $core.withContext(function($ctx1) {
  33981. return $recv(anObject)._evaluate_on_(aString,self);
  33982. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  33983. },
  33984. args: ["aString", "anObject"],
  33985. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  33986. referencedClasses: [],
  33987. messageSends: ["evaluate:on:"]
  33988. }),
  33989. $globals.Evaluator);
  33990. $core.addMethod(
  33991. $core.method({
  33992. selector: "evaluate:receiver:",
  33993. protocol: "evaluating",
  33994. fn: function (aString,anObject){
  33995. var self=this,$self=this;
  33996. var compiler;
  33997. return $core.withContext(function($ctx1) {
  33998. var $early={};
  33999. try {
  34000. compiler=$recv($globals.Compiler)._new();
  34001. $recv((function(){
  34002. return $core.withContext(function($ctx2) {
  34003. return $recv(compiler)._parseExpression_(aString);
  34004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34005. }))._on_do_($globals.Error,(function(ex){
  34006. return $core.withContext(function($ctx2) {
  34007. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  34008. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  34009. }));
  34010. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  34011. }
  34012. catch(e) {if(e===$early)return e[0]; throw e}
  34013. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  34014. },
  34015. args: ["aString", "anObject"],
  34016. 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",
  34017. referencedClasses: ["Compiler", "Error", "Terminal"],
  34018. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  34019. }),
  34020. $globals.Evaluator);
  34021. $core.addMethod(
  34022. $core.method({
  34023. selector: "evaluate:for:",
  34024. protocol: "instance creation",
  34025. fn: function (aString,anObject){
  34026. var self=this,$self=this;
  34027. return $core.withContext(function($ctx1) {
  34028. return $recv($self._new())._evaluate_for_(aString,anObject);
  34029. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  34030. },
  34031. args: ["aString", "anObject"],
  34032. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  34033. referencedClasses: [],
  34034. messageSends: ["evaluate:for:", "new"]
  34035. }),
  34036. $globals.Evaluator.a$cls);
  34037. $core.addMethod(
  34038. $core.method({
  34039. selector: "asVariableName",
  34040. protocol: "*Compiler-Core",
  34041. fn: function (){
  34042. var self=this,$self=this;
  34043. return $core.withContext(function($ctx1) {
  34044. var $1;
  34045. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  34046. if($core.assert($1)){
  34047. return $self.__comma("_");
  34048. } else {
  34049. return self;
  34050. }
  34051. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  34052. },
  34053. args: [],
  34054. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  34055. referencedClasses: ["Smalltalk"],
  34056. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  34057. }),
  34058. $globals.String);
  34059. });
  34060. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Methods"], function($boot){"use strict";
  34061. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  34062. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  34063. $core.addPackage("Compiler-AST");
  34064. ($core.packageDescriptors||$core.packages)["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  34065. ($core.packageDescriptors||$core.packages)["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  34066. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  34067. $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.";
  34068. $core.addMethod(
  34069. $core.method({
  34070. selector: "inPosition:",
  34071. protocol: "testing",
  34072. fn: function (aPoint){
  34073. var self=this,$self=this;
  34074. return $core.withContext(function($ctx1) {
  34075. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  34076. return $core.withContext(function($ctx2) {
  34077. return $recv($self._positionEnd()).__gt_eq(aPoint);
  34078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34079. }));
  34080. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  34081. },
  34082. args: ["aPoint"],
  34083. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  34084. referencedClasses: [],
  34085. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  34086. }),
  34087. $globals.ASTNode);
  34088. $core.addMethod(
  34089. $core.method({
  34090. selector: "isAssignmentNode",
  34091. protocol: "testing",
  34092. fn: function (){
  34093. var self=this,$self=this;
  34094. return false;
  34095. },
  34096. args: [],
  34097. source: "isAssignmentNode\x0a\x09^ false",
  34098. referencedClasses: [],
  34099. messageSends: []
  34100. }),
  34101. $globals.ASTNode);
  34102. $core.addMethod(
  34103. $core.method({
  34104. selector: "isBlockNode",
  34105. protocol: "testing",
  34106. fn: function (){
  34107. var self=this,$self=this;
  34108. return false;
  34109. },
  34110. args: [],
  34111. source: "isBlockNode\x0a\x09^ false",
  34112. referencedClasses: [],
  34113. messageSends: []
  34114. }),
  34115. $globals.ASTNode);
  34116. $core.addMethod(
  34117. $core.method({
  34118. selector: "isBlockSequenceNode",
  34119. protocol: "testing",
  34120. fn: function (){
  34121. var self=this,$self=this;
  34122. return false;
  34123. },
  34124. args: [],
  34125. source: "isBlockSequenceNode\x0a\x09^ false",
  34126. referencedClasses: [],
  34127. messageSends: []
  34128. }),
  34129. $globals.ASTNode);
  34130. $core.addMethod(
  34131. $core.method({
  34132. selector: "isCascadeNode",
  34133. protocol: "testing",
  34134. fn: function (){
  34135. var self=this,$self=this;
  34136. return false;
  34137. },
  34138. args: [],
  34139. source: "isCascadeNode\x0a\x09^ false",
  34140. referencedClasses: [],
  34141. messageSends: []
  34142. }),
  34143. $globals.ASTNode);
  34144. $core.addMethod(
  34145. $core.method({
  34146. selector: "isImmutable",
  34147. protocol: "testing",
  34148. fn: function (){
  34149. var self=this,$self=this;
  34150. return false;
  34151. },
  34152. args: [],
  34153. source: "isImmutable\x0a\x09^ false",
  34154. referencedClasses: [],
  34155. messageSends: []
  34156. }),
  34157. $globals.ASTNode);
  34158. $core.addMethod(
  34159. $core.method({
  34160. selector: "isJSStatementNode",
  34161. protocol: "testing",
  34162. fn: function (){
  34163. var self=this,$self=this;
  34164. return false;
  34165. },
  34166. args: [],
  34167. source: "isJSStatementNode\x0a\x09^ false",
  34168. referencedClasses: [],
  34169. messageSends: []
  34170. }),
  34171. $globals.ASTNode);
  34172. $core.addMethod(
  34173. $core.method({
  34174. selector: "isNavigationNode",
  34175. protocol: "testing",
  34176. fn: function (){
  34177. var self=this,$self=this;
  34178. return false;
  34179. },
  34180. args: [],
  34181. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  34182. referencedClasses: [],
  34183. messageSends: []
  34184. }),
  34185. $globals.ASTNode);
  34186. $core.addMethod(
  34187. $core.method({
  34188. selector: "isReturnNode",
  34189. protocol: "testing",
  34190. fn: function (){
  34191. var self=this,$self=this;
  34192. return false;
  34193. },
  34194. args: [],
  34195. source: "isReturnNode\x0a\x09^ false",
  34196. referencedClasses: [],
  34197. messageSends: []
  34198. }),
  34199. $globals.ASTNode);
  34200. $core.addMethod(
  34201. $core.method({
  34202. selector: "isSendNode",
  34203. protocol: "testing",
  34204. fn: function (){
  34205. var self=this,$self=this;
  34206. return false;
  34207. },
  34208. args: [],
  34209. source: "isSendNode\x0a\x09^ false",
  34210. referencedClasses: [],
  34211. messageSends: []
  34212. }),
  34213. $globals.ASTNode);
  34214. $core.addMethod(
  34215. $core.method({
  34216. selector: "isSequenceNode",
  34217. protocol: "testing",
  34218. fn: function (){
  34219. var self=this,$self=this;
  34220. return false;
  34221. },
  34222. args: [],
  34223. source: "isSequenceNode\x0a\x09^ false",
  34224. referencedClasses: [],
  34225. messageSends: []
  34226. }),
  34227. $globals.ASTNode);
  34228. $core.addMethod(
  34229. $core.method({
  34230. selector: "isSuperKeyword",
  34231. protocol: "testing",
  34232. fn: function (){
  34233. var self=this,$self=this;
  34234. return false;
  34235. },
  34236. args: [],
  34237. source: "isSuperKeyword\x0a\x09^ false",
  34238. referencedClasses: [],
  34239. messageSends: []
  34240. }),
  34241. $globals.ASTNode);
  34242. $core.addMethod(
  34243. $core.method({
  34244. selector: "isValueNode",
  34245. protocol: "testing",
  34246. fn: function (){
  34247. var self=this,$self=this;
  34248. return false;
  34249. },
  34250. args: [],
  34251. source: "isValueNode\x0a\x09^ false",
  34252. referencedClasses: [],
  34253. messageSends: []
  34254. }),
  34255. $globals.ASTNode);
  34256. $core.addMethod(
  34257. $core.method({
  34258. selector: "isVariableNode",
  34259. protocol: "testing",
  34260. fn: function (){
  34261. var self=this,$self=this;
  34262. return false;
  34263. },
  34264. args: [],
  34265. source: "isVariableNode\x0a\x09^ false",
  34266. referencedClasses: [],
  34267. messageSends: []
  34268. }),
  34269. $globals.ASTNode);
  34270. $core.addMethod(
  34271. $core.method({
  34272. selector: "location:",
  34273. protocol: "accessing",
  34274. fn: function (aLocation){
  34275. var self=this,$self=this;
  34276. return $core.withContext(function($ctx1) {
  34277. var $3,$2,$1;
  34278. $3=$recv(aLocation)._start();
  34279. $ctx1.sendIdx["start"]=1;
  34280. $2=$recv($3)._line();
  34281. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  34282. $self._position_($1);
  34283. return self;
  34284. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  34285. },
  34286. args: ["aLocation"],
  34287. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  34288. referencedClasses: [],
  34289. messageSends: ["position:", "@", "line", "start", "column"]
  34290. }),
  34291. $globals.ASTNode);
  34292. $core.addMethod(
  34293. $core.method({
  34294. selector: "method",
  34295. protocol: "accessing",
  34296. fn: function (){
  34297. var self=this,$self=this;
  34298. return $core.withContext(function($ctx1) {
  34299. var $1,$receiver;
  34300. $1=$self._parent();
  34301. if(($receiver = $1) == null || $receiver.a$nil){
  34302. return $1;
  34303. } else {
  34304. var node;
  34305. node=$receiver;
  34306. return $recv(node)._method();
  34307. }
  34308. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  34309. },
  34310. args: [],
  34311. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  34312. referencedClasses: [],
  34313. messageSends: ["ifNotNil:", "parent", "method"]
  34314. }),
  34315. $globals.ASTNode);
  34316. $core.addMethod(
  34317. $core.method({
  34318. selector: "navigationNodeAt:ifAbsent:",
  34319. protocol: "accessing",
  34320. fn: function (aPoint,aBlock){
  34321. var self=this,$self=this;
  34322. var children;
  34323. return $core.withContext(function($ctx1) {
  34324. var $2,$1;
  34325. var $early={};
  34326. try {
  34327. children=$recv($self._allDagChildren())._select_((function(each){
  34328. return $core.withContext(function($ctx2) {
  34329. return $recv($recv(each)._isNavigationNode())._and_((function(){
  34330. return $core.withContext(function($ctx3) {
  34331. return $recv(each)._inPosition_(aPoint);
  34332. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34333. }));
  34334. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34335. }));
  34336. $recv(children)._ifEmpty_((function(){
  34337. return $core.withContext(function($ctx2) {
  34338. throw $early=[$recv(aBlock)._value()];
  34339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  34340. }));
  34341. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  34342. return $core.withContext(function($ctx2) {
  34343. $2=$recv(a)._positionStart();
  34344. $ctx2.sendIdx["positionStart"]=1;
  34345. $1=$recv($2)._dist_(aPoint);
  34346. $ctx2.sendIdx["dist:"]=1;
  34347. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  34348. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  34349. })))._first();
  34350. }
  34351. catch(e) {if(e===$early)return e[0]; throw e}
  34352. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  34353. },
  34354. args: ["aPoint", "aBlock"],
  34355. 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",
  34356. referencedClasses: [],
  34357. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  34358. }),
  34359. $globals.ASTNode);
  34360. $core.addMethod(
  34361. $core.method({
  34362. selector: "parent",
  34363. protocol: "accessing",
  34364. fn: function (){
  34365. var self=this,$self=this;
  34366. return $self["@parent"];
  34367. },
  34368. args: [],
  34369. source: "parent\x0a\x09^ parent",
  34370. referencedClasses: [],
  34371. messageSends: []
  34372. }),
  34373. $globals.ASTNode);
  34374. $core.addMethod(
  34375. $core.method({
  34376. selector: "parent:",
  34377. protocol: "accessing",
  34378. fn: function (aNode){
  34379. var self=this,$self=this;
  34380. $self["@parent"]=aNode;
  34381. return self;
  34382. },
  34383. args: ["aNode"],
  34384. source: "parent: aNode\x0a\x09parent := aNode",
  34385. referencedClasses: [],
  34386. messageSends: []
  34387. }),
  34388. $globals.ASTNode);
  34389. $core.addMethod(
  34390. $core.method({
  34391. selector: "position",
  34392. protocol: "accessing",
  34393. fn: function (){
  34394. var self=this,$self=this;
  34395. return $core.withContext(function($ctx1) {
  34396. var $1,$2,$receiver;
  34397. $1=$self["@position"];
  34398. if(($receiver = $1) == null || $receiver.a$nil){
  34399. $2=$self._parent();
  34400. if(($receiver = $2) == null || $receiver.a$nil){
  34401. return $2;
  34402. } else {
  34403. var node;
  34404. node=$receiver;
  34405. return $recv(node)._position();
  34406. }
  34407. } else {
  34408. return $1;
  34409. }
  34410. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  34411. },
  34412. args: [],
  34413. 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 ] ]",
  34414. referencedClasses: [],
  34415. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  34416. }),
  34417. $globals.ASTNode);
  34418. $core.addMethod(
  34419. $core.method({
  34420. selector: "position:",
  34421. protocol: "accessing",
  34422. fn: function (aPosition){
  34423. var self=this,$self=this;
  34424. $self["@position"]=aPosition;
  34425. return self;
  34426. },
  34427. args: ["aPosition"],
  34428. source: "position: aPosition\x0a\x09position := aPosition",
  34429. referencedClasses: [],
  34430. messageSends: []
  34431. }),
  34432. $globals.ASTNode);
  34433. $core.addMethod(
  34434. $core.method({
  34435. selector: "positionEnd",
  34436. protocol: "accessing",
  34437. fn: function (){
  34438. var self=this,$self=this;
  34439. return $core.withContext(function($ctx1) {
  34440. var $1,$6,$5,$4,$3,$2;
  34441. $1=$self._positionStart();
  34442. $6=$self._source();
  34443. $ctx1.sendIdx["source"]=1;
  34444. $5=$recv($6)._lines();
  34445. $ctx1.sendIdx["lines"]=1;
  34446. $4=$recv($5)._size();
  34447. $ctx1.sendIdx["size"]=1;
  34448. $3=$recv($4).__minus((1));
  34449. $ctx1.sendIdx["-"]=1;
  34450. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  34451. return $recv($1).__plus($2);
  34452. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  34453. },
  34454. args: [],
  34455. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  34456. referencedClasses: [],
  34457. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  34458. }),
  34459. $globals.ASTNode);
  34460. $core.addMethod(
  34461. $core.method({
  34462. selector: "positionStart",
  34463. protocol: "accessing",
  34464. fn: function (){
  34465. var self=this,$self=this;
  34466. return $core.withContext(function($ctx1) {
  34467. return $self._position();
  34468. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  34469. },
  34470. args: [],
  34471. source: "positionStart\x0a\x09^ self position",
  34472. referencedClasses: [],
  34473. messageSends: ["position"]
  34474. }),
  34475. $globals.ASTNode);
  34476. $core.addMethod(
  34477. $core.method({
  34478. selector: "requiresSmalltalkContext",
  34479. protocol: "testing",
  34480. fn: function (){
  34481. var self=this,$self=this;
  34482. return $core.withContext(function($ctx1) {
  34483. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  34484. return $core.withContext(function($ctx2) {
  34485. return $recv(each)._requiresSmalltalkContext();
  34486. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34487. }),(function(){
  34488. return nil;
  34489. })))._notNil();
  34490. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  34491. },
  34492. args: [],
  34493. 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",
  34494. referencedClasses: [],
  34495. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  34496. }),
  34497. $globals.ASTNode);
  34498. $core.addMethod(
  34499. $core.method({
  34500. selector: "shouldBeAliased",
  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["@shouldBeAliased"];
  34507. if(($receiver = $1) == null || $receiver.a$nil){
  34508. return false;
  34509. } else {
  34510. return $1;
  34511. }
  34512. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  34513. },
  34514. args: [],
  34515. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  34516. referencedClasses: [],
  34517. messageSends: ["ifNil:"]
  34518. }),
  34519. $globals.ASTNode);
  34520. $core.addMethod(
  34521. $core.method({
  34522. selector: "shouldBeAliased:",
  34523. protocol: "accessing",
  34524. fn: function (aBoolean){
  34525. var self=this,$self=this;
  34526. $self["@shouldBeAliased"]=aBoolean;
  34527. return self;
  34528. },
  34529. args: ["aBoolean"],
  34530. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  34531. referencedClasses: [],
  34532. messageSends: []
  34533. }),
  34534. $globals.ASTNode);
  34535. $core.addMethod(
  34536. $core.method({
  34537. selector: "size",
  34538. protocol: "accessing",
  34539. fn: function (){
  34540. var self=this,$self=this;
  34541. return $core.withContext(function($ctx1) {
  34542. return $recv($self._source())._size();
  34543. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  34544. },
  34545. args: [],
  34546. source: "size\x0a\x09^ self source size",
  34547. referencedClasses: [],
  34548. messageSends: ["size", "source"]
  34549. }),
  34550. $globals.ASTNode);
  34551. $core.addMethod(
  34552. $core.method({
  34553. selector: "source",
  34554. protocol: "accessing",
  34555. fn: function (){
  34556. var self=this,$self=this;
  34557. return $core.withContext(function($ctx1) {
  34558. var $1,$receiver;
  34559. $1=$self["@source"];
  34560. if(($receiver = $1) == null || $receiver.a$nil){
  34561. return "";
  34562. } else {
  34563. return $1;
  34564. }
  34565. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  34566. },
  34567. args: [],
  34568. source: "source\x0a\x09^ source ifNil: [ '' ]",
  34569. referencedClasses: [],
  34570. messageSends: ["ifNil:"]
  34571. }),
  34572. $globals.ASTNode);
  34573. $core.addMethod(
  34574. $core.method({
  34575. selector: "source:",
  34576. protocol: "accessing",
  34577. fn: function (aString){
  34578. var self=this,$self=this;
  34579. $self["@source"]=aString;
  34580. return self;
  34581. },
  34582. args: ["aString"],
  34583. source: "source: aString\x0a\x09source := aString",
  34584. referencedClasses: [],
  34585. messageSends: []
  34586. }),
  34587. $globals.ASTNode);
  34588. $core.addMethod(
  34589. $core.method({
  34590. selector: "withTail:",
  34591. protocol: "building",
  34592. fn: function (aCollection){
  34593. var self=this,$self=this;
  34594. return $core.withContext(function($ctx1) {
  34595. var $1;
  34596. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  34597. return $core.withContext(function($ctx2) {
  34598. $1=$recv($globals.SendNode)._new();
  34599. $recv($1)._position_($recv(send)._position());
  34600. $recv($1)._source_($recv(send)._source());
  34601. $recv($1)._receiver_(receiver);
  34602. $recv($1)._selector_($recv(send)._selector());
  34603. $recv($1)._arguments_($recv(send)._arguments());
  34604. return $recv($1)._yourself();
  34605. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  34606. }));
  34607. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  34608. },
  34609. args: ["aCollection"],
  34610. 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 ]",
  34611. referencedClasses: ["SendNode"],
  34612. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  34613. }),
  34614. $globals.ASTNode);
  34615. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  34616. $globals.AssignmentNode.comment="I represent an assignment node.";
  34617. $core.addMethod(
  34618. $core.method({
  34619. selector: "acceptDagVisitor:",
  34620. protocol: "visiting",
  34621. fn: function (aVisitor){
  34622. var self=this,$self=this;
  34623. return $core.withContext(function($ctx1) {
  34624. return $recv(aVisitor)._visitAssignmentNode_(self);
  34625. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  34626. },
  34627. args: ["aVisitor"],
  34628. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  34629. referencedClasses: [],
  34630. messageSends: ["visitAssignmentNode:"]
  34631. }),
  34632. $globals.AssignmentNode);
  34633. $core.addMethod(
  34634. $core.method({
  34635. selector: "dagChildren",
  34636. protocol: "accessing",
  34637. fn: function (){
  34638. var self=this,$self=this;
  34639. return $core.withContext(function($ctx1) {
  34640. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  34641. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  34642. },
  34643. args: [],
  34644. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  34645. referencedClasses: ["Array"],
  34646. messageSends: ["with:with:", "left", "right"]
  34647. }),
  34648. $globals.AssignmentNode);
  34649. $core.addMethod(
  34650. $core.method({
  34651. selector: "isAssignmentNode",
  34652. protocol: "testing",
  34653. fn: function (){
  34654. var self=this,$self=this;
  34655. return true;
  34656. },
  34657. args: [],
  34658. source: "isAssignmentNode\x0a\x09^ true",
  34659. referencedClasses: [],
  34660. messageSends: []
  34661. }),
  34662. $globals.AssignmentNode);
  34663. $core.addMethod(
  34664. $core.method({
  34665. selector: "left",
  34666. protocol: "accessing",
  34667. fn: function (){
  34668. var self=this,$self=this;
  34669. return $self["@left"];
  34670. },
  34671. args: [],
  34672. source: "left\x0a\x09^ left",
  34673. referencedClasses: [],
  34674. messageSends: []
  34675. }),
  34676. $globals.AssignmentNode);
  34677. $core.addMethod(
  34678. $core.method({
  34679. selector: "left:",
  34680. protocol: "accessing",
  34681. fn: function (aNode){
  34682. var self=this,$self=this;
  34683. $self["@left"]=aNode;
  34684. return self;
  34685. },
  34686. args: ["aNode"],
  34687. source: "left: aNode\x0a\x09left := aNode",
  34688. referencedClasses: [],
  34689. messageSends: []
  34690. }),
  34691. $globals.AssignmentNode);
  34692. $core.addMethod(
  34693. $core.method({
  34694. selector: "right",
  34695. protocol: "accessing",
  34696. fn: function (){
  34697. var self=this,$self=this;
  34698. return $self["@right"];
  34699. },
  34700. args: [],
  34701. source: "right\x0a\x09^ right",
  34702. referencedClasses: [],
  34703. messageSends: []
  34704. }),
  34705. $globals.AssignmentNode);
  34706. $core.addMethod(
  34707. $core.method({
  34708. selector: "right:",
  34709. protocol: "accessing",
  34710. fn: function (aNode){
  34711. var self=this,$self=this;
  34712. $self["@right"]=aNode;
  34713. return self;
  34714. },
  34715. args: ["aNode"],
  34716. source: "right: aNode\x0a\x09right := aNode",
  34717. referencedClasses: [],
  34718. messageSends: []
  34719. }),
  34720. $globals.AssignmentNode);
  34721. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  34722. $globals.BlockNode.comment="I represent an block closure node.";
  34723. $core.addMethod(
  34724. $core.method({
  34725. selector: "acceptDagVisitor:",
  34726. protocol: "visiting",
  34727. fn: function (aVisitor){
  34728. var self=this,$self=this;
  34729. return $core.withContext(function($ctx1) {
  34730. return $recv(aVisitor)._visitBlockNode_(self);
  34731. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  34732. },
  34733. args: ["aVisitor"],
  34734. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  34735. referencedClasses: [],
  34736. messageSends: ["visitBlockNode:"]
  34737. }),
  34738. $globals.BlockNode);
  34739. $core.addMethod(
  34740. $core.method({
  34741. selector: "isBlockNode",
  34742. protocol: "testing",
  34743. fn: function (){
  34744. var self=this,$self=this;
  34745. return true;
  34746. },
  34747. args: [],
  34748. source: "isBlockNode\x0a\x09^ true",
  34749. referencedClasses: [],
  34750. messageSends: []
  34751. }),
  34752. $globals.BlockNode);
  34753. $core.addMethod(
  34754. $core.method({
  34755. selector: "parameters",
  34756. protocol: "accessing",
  34757. fn: function (){
  34758. var self=this,$self=this;
  34759. return $core.withContext(function($ctx1) {
  34760. var $1,$receiver;
  34761. $1=$self["@parameters"];
  34762. if(($receiver = $1) == null || $receiver.a$nil){
  34763. $self["@parameters"]=$recv($globals.Array)._new();
  34764. return $self["@parameters"];
  34765. } else {
  34766. return $1;
  34767. }
  34768. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34769. },
  34770. args: [],
  34771. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34772. referencedClasses: ["Array"],
  34773. messageSends: ["ifNil:", "new"]
  34774. }),
  34775. $globals.BlockNode);
  34776. $core.addMethod(
  34777. $core.method({
  34778. selector: "parameters:",
  34779. protocol: "accessing",
  34780. fn: function (aCollection){
  34781. var self=this,$self=this;
  34782. $self["@parameters"]=aCollection;
  34783. return self;
  34784. },
  34785. args: ["aCollection"],
  34786. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34787. referencedClasses: [],
  34788. messageSends: []
  34789. }),
  34790. $globals.BlockNode);
  34791. $core.addMethod(
  34792. $core.method({
  34793. selector: "scope",
  34794. protocol: "accessing",
  34795. fn: function (){
  34796. var self=this,$self=this;
  34797. return $self["@scope"];
  34798. },
  34799. args: [],
  34800. source: "scope\x0a\x09^ scope",
  34801. referencedClasses: [],
  34802. messageSends: []
  34803. }),
  34804. $globals.BlockNode);
  34805. $core.addMethod(
  34806. $core.method({
  34807. selector: "scope:",
  34808. protocol: "accessing",
  34809. fn: function (aLexicalScope){
  34810. var self=this,$self=this;
  34811. $self["@scope"]=aLexicalScope;
  34812. return self;
  34813. },
  34814. args: ["aLexicalScope"],
  34815. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34816. referencedClasses: [],
  34817. messageSends: []
  34818. }),
  34819. $globals.BlockNode);
  34820. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34821. $globals.CascadeNode.comment="I represent an cascade node.";
  34822. $core.addMethod(
  34823. $core.method({
  34824. selector: "acceptDagVisitor:",
  34825. protocol: "visiting",
  34826. fn: function (aVisitor){
  34827. var self=this,$self=this;
  34828. return $core.withContext(function($ctx1) {
  34829. return $recv(aVisitor)._visitCascadeNode_(self);
  34830. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34831. },
  34832. args: ["aVisitor"],
  34833. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34834. referencedClasses: [],
  34835. messageSends: ["visitCascadeNode:"]
  34836. }),
  34837. $globals.CascadeNode);
  34838. $core.addMethod(
  34839. $core.method({
  34840. selector: "isCascadeNode",
  34841. protocol: "testing",
  34842. fn: function (){
  34843. var self=this,$self=this;
  34844. return true;
  34845. },
  34846. args: [],
  34847. source: "isCascadeNode\x0a\x09^ true",
  34848. referencedClasses: [],
  34849. messageSends: []
  34850. }),
  34851. $globals.CascadeNode);
  34852. $core.addMethod(
  34853. $core.method({
  34854. selector: "receiver",
  34855. protocol: "accessing",
  34856. fn: function (){
  34857. var self=this,$self=this;
  34858. return $self["@receiver"];
  34859. },
  34860. args: [],
  34861. source: "receiver\x0a\x09^ receiver",
  34862. referencedClasses: [],
  34863. messageSends: []
  34864. }),
  34865. $globals.CascadeNode);
  34866. $core.addMethod(
  34867. $core.method({
  34868. selector: "receiver:",
  34869. protocol: "accessing",
  34870. fn: function (aNode){
  34871. var self=this,$self=this;
  34872. $self["@receiver"]=aNode;
  34873. return self;
  34874. },
  34875. args: ["aNode"],
  34876. source: "receiver: aNode\x0a\x09receiver := aNode",
  34877. referencedClasses: [],
  34878. messageSends: []
  34879. }),
  34880. $globals.CascadeNode);
  34881. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34882. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34883. $core.addMethod(
  34884. $core.method({
  34885. selector: "acceptDagVisitor:",
  34886. protocol: "visiting",
  34887. fn: function (aVisitor){
  34888. var self=this,$self=this;
  34889. return $core.withContext(function($ctx1) {
  34890. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34891. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34892. },
  34893. args: ["aVisitor"],
  34894. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34895. referencedClasses: [],
  34896. messageSends: ["visitDynamicArrayNode:"]
  34897. }),
  34898. $globals.DynamicArrayNode);
  34899. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34900. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34901. $core.addMethod(
  34902. $core.method({
  34903. selector: "acceptDagVisitor:",
  34904. protocol: "visiting",
  34905. fn: function (aVisitor){
  34906. var self=this,$self=this;
  34907. return $core.withContext(function($ctx1) {
  34908. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34909. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34910. },
  34911. args: ["aVisitor"],
  34912. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34913. referencedClasses: [],
  34914. messageSends: ["visitDynamicDictionaryNode:"]
  34915. }),
  34916. $globals.DynamicDictionaryNode);
  34917. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34918. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34919. $core.addMethod(
  34920. $core.method({
  34921. selector: "acceptDagVisitor:",
  34922. protocol: "visiting",
  34923. fn: function (aVisitor){
  34924. var self=this,$self=this;
  34925. return $core.withContext(function($ctx1) {
  34926. return $recv(aVisitor)._visitJSStatementNode_(self);
  34927. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34928. },
  34929. args: ["aVisitor"],
  34930. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34931. referencedClasses: [],
  34932. messageSends: ["visitJSStatementNode:"]
  34933. }),
  34934. $globals.JSStatementNode);
  34935. $core.addMethod(
  34936. $core.method({
  34937. selector: "isJSStatementNode",
  34938. protocol: "testing",
  34939. fn: function (){
  34940. var self=this,$self=this;
  34941. return true;
  34942. },
  34943. args: [],
  34944. source: "isJSStatementNode\x0a\x09^ true",
  34945. referencedClasses: [],
  34946. messageSends: []
  34947. }),
  34948. $globals.JSStatementNode);
  34949. $core.addMethod(
  34950. $core.method({
  34951. selector: "requiresSmalltalkContext",
  34952. protocol: "testing",
  34953. fn: function (){
  34954. var self=this,$self=this;
  34955. return true;
  34956. },
  34957. args: [],
  34958. source: "requiresSmalltalkContext\x0a\x09^ true",
  34959. referencedClasses: [],
  34960. messageSends: []
  34961. }),
  34962. $globals.JSStatementNode);
  34963. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34964. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34965. $core.addMethod(
  34966. $core.method({
  34967. selector: "acceptDagVisitor:",
  34968. protocol: "visiting",
  34969. fn: function (aVisitor){
  34970. var self=this,$self=this;
  34971. return $core.withContext(function($ctx1) {
  34972. return $recv(aVisitor)._visitMethodNode_(self);
  34973. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34974. },
  34975. args: ["aVisitor"],
  34976. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34977. referencedClasses: [],
  34978. messageSends: ["visitMethodNode:"]
  34979. }),
  34980. $globals.MethodNode);
  34981. $core.addMethod(
  34982. $core.method({
  34983. selector: "arguments",
  34984. protocol: "accessing",
  34985. fn: function (){
  34986. var self=this,$self=this;
  34987. return $core.withContext(function($ctx1) {
  34988. var $1,$receiver;
  34989. $1=$self["@arguments"];
  34990. if(($receiver = $1) == null || $receiver.a$nil){
  34991. return [];
  34992. } else {
  34993. return $1;
  34994. }
  34995. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34996. },
  34997. args: [],
  34998. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34999. referencedClasses: [],
  35000. messageSends: ["ifNil:"]
  35001. }),
  35002. $globals.MethodNode);
  35003. $core.addMethod(
  35004. $core.method({
  35005. selector: "arguments:",
  35006. protocol: "accessing",
  35007. fn: function (aCollection){
  35008. var self=this,$self=this;
  35009. $self["@arguments"]=aCollection;
  35010. return self;
  35011. },
  35012. args: ["aCollection"],
  35013. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  35014. referencedClasses: [],
  35015. messageSends: []
  35016. }),
  35017. $globals.MethodNode);
  35018. $core.addMethod(
  35019. $core.method({
  35020. selector: "classReferences",
  35021. protocol: "accessing",
  35022. fn: function (){
  35023. var self=this,$self=this;
  35024. return $self["@classReferences"];
  35025. },
  35026. args: [],
  35027. source: "classReferences\x0a\x09^ classReferences",
  35028. referencedClasses: [],
  35029. messageSends: []
  35030. }),
  35031. $globals.MethodNode);
  35032. $core.addMethod(
  35033. $core.method({
  35034. selector: "classReferences:",
  35035. protocol: "accessing",
  35036. fn: function (aCollection){
  35037. var self=this,$self=this;
  35038. $self["@classReferences"]=aCollection;
  35039. return self;
  35040. },
  35041. args: ["aCollection"],
  35042. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  35043. referencedClasses: [],
  35044. messageSends: []
  35045. }),
  35046. $globals.MethodNode);
  35047. $core.addMethod(
  35048. $core.method({
  35049. selector: "messageSends",
  35050. protocol: "accessing",
  35051. fn: function (){
  35052. var self=this,$self=this;
  35053. return $core.withContext(function($ctx1) {
  35054. return $recv($self._sendIndexes())._keys();
  35055. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  35056. },
  35057. args: [],
  35058. source: "messageSends\x0a\x09^ self sendIndexes keys",
  35059. referencedClasses: [],
  35060. messageSends: ["keys", "sendIndexes"]
  35061. }),
  35062. $globals.MethodNode);
  35063. $core.addMethod(
  35064. $core.method({
  35065. selector: "method",
  35066. protocol: "accessing",
  35067. fn: function (){
  35068. var self=this,$self=this;
  35069. return self;
  35070. },
  35071. args: [],
  35072. source: "method\x0a\x09^ self",
  35073. referencedClasses: [],
  35074. messageSends: []
  35075. }),
  35076. $globals.MethodNode);
  35077. $core.addMethod(
  35078. $core.method({
  35079. selector: "scope",
  35080. protocol: "accessing",
  35081. fn: function (){
  35082. var self=this,$self=this;
  35083. return $self["@scope"];
  35084. },
  35085. args: [],
  35086. source: "scope\x0a\x09^ scope",
  35087. referencedClasses: [],
  35088. messageSends: []
  35089. }),
  35090. $globals.MethodNode);
  35091. $core.addMethod(
  35092. $core.method({
  35093. selector: "scope:",
  35094. protocol: "accessing",
  35095. fn: function (aMethodScope){
  35096. var self=this,$self=this;
  35097. $self["@scope"]=aMethodScope;
  35098. return self;
  35099. },
  35100. args: ["aMethodScope"],
  35101. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  35102. referencedClasses: [],
  35103. messageSends: []
  35104. }),
  35105. $globals.MethodNode);
  35106. $core.addMethod(
  35107. $core.method({
  35108. selector: "selector",
  35109. protocol: "accessing",
  35110. fn: function (){
  35111. var self=this,$self=this;
  35112. return $self["@selector"];
  35113. },
  35114. args: [],
  35115. source: "selector\x0a\x09^ selector",
  35116. referencedClasses: [],
  35117. messageSends: []
  35118. }),
  35119. $globals.MethodNode);
  35120. $core.addMethod(
  35121. $core.method({
  35122. selector: "selector:",
  35123. protocol: "accessing",
  35124. fn: function (aString){
  35125. var self=this,$self=this;
  35126. $self["@selector"]=aString;
  35127. return self;
  35128. },
  35129. args: ["aString"],
  35130. source: "selector: aString\x0a\x09selector := aString",
  35131. referencedClasses: [],
  35132. messageSends: []
  35133. }),
  35134. $globals.MethodNode);
  35135. $core.addMethod(
  35136. $core.method({
  35137. selector: "sendIndexes",
  35138. protocol: "accessing",
  35139. fn: function (){
  35140. var self=this,$self=this;
  35141. return $self["@sendIndexes"];
  35142. },
  35143. args: [],
  35144. source: "sendIndexes\x0a\x09^ sendIndexes",
  35145. referencedClasses: [],
  35146. messageSends: []
  35147. }),
  35148. $globals.MethodNode);
  35149. $core.addMethod(
  35150. $core.method({
  35151. selector: "sendIndexes:",
  35152. protocol: "accessing",
  35153. fn: function (aDictionary){
  35154. var self=this,$self=this;
  35155. $self["@sendIndexes"]=aDictionary;
  35156. return self;
  35157. },
  35158. args: ["aDictionary"],
  35159. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  35160. referencedClasses: [],
  35161. messageSends: []
  35162. }),
  35163. $globals.MethodNode);
  35164. $core.addMethod(
  35165. $core.method({
  35166. selector: "sequenceNode",
  35167. protocol: "accessing",
  35168. fn: function (){
  35169. var self=this,$self=this;
  35170. return $core.withContext(function($ctx1) {
  35171. var $1;
  35172. var $early={};
  35173. try {
  35174. $recv($self._dagChildren())._do_((function(each){
  35175. return $core.withContext(function($ctx2) {
  35176. $1=$recv(each)._isSequenceNode();
  35177. if($core.assert($1)){
  35178. throw $early=[each];
  35179. }
  35180. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35181. }));
  35182. return nil;
  35183. }
  35184. catch(e) {if(e===$early)return e[0]; throw e}
  35185. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  35186. },
  35187. args: [],
  35188. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  35189. referencedClasses: [],
  35190. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  35191. }),
  35192. $globals.MethodNode);
  35193. $core.addMethod(
  35194. $core.method({
  35195. selector: "source",
  35196. protocol: "accessing",
  35197. fn: function (){
  35198. var self=this,$self=this;
  35199. return $self["@source"];
  35200. },
  35201. args: [],
  35202. source: "source\x0a\x09^ source",
  35203. referencedClasses: [],
  35204. messageSends: []
  35205. }),
  35206. $globals.MethodNode);
  35207. $core.addMethod(
  35208. $core.method({
  35209. selector: "source:",
  35210. protocol: "accessing",
  35211. fn: function (aString){
  35212. var self=this,$self=this;
  35213. $self["@source"]=aString;
  35214. return self;
  35215. },
  35216. args: ["aString"],
  35217. source: "source: aString\x0a\x09source := aString",
  35218. referencedClasses: [],
  35219. messageSends: []
  35220. }),
  35221. $globals.MethodNode);
  35222. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  35223. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  35224. $core.addMethod(
  35225. $core.method({
  35226. selector: "acceptDagVisitor:",
  35227. protocol: "visiting",
  35228. fn: function (aVisitor){
  35229. var self=this,$self=this;
  35230. return $core.withContext(function($ctx1) {
  35231. return $recv(aVisitor)._visitReturnNode_(self);
  35232. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  35233. },
  35234. args: ["aVisitor"],
  35235. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  35236. referencedClasses: [],
  35237. messageSends: ["visitReturnNode:"]
  35238. }),
  35239. $globals.ReturnNode);
  35240. $core.addMethod(
  35241. $core.method({
  35242. selector: "isReturnNode",
  35243. protocol: "testing",
  35244. fn: function (){
  35245. var self=this,$self=this;
  35246. return true;
  35247. },
  35248. args: [],
  35249. source: "isReturnNode\x0a\x09^ true",
  35250. referencedClasses: [],
  35251. messageSends: []
  35252. }),
  35253. $globals.ReturnNode);
  35254. $core.addMethod(
  35255. $core.method({
  35256. selector: "nonLocalReturn",
  35257. protocol: "testing",
  35258. fn: function (){
  35259. var self=this,$self=this;
  35260. return $core.withContext(function($ctx1) {
  35261. return $recv($recv($self._scope())._isMethodScope())._not();
  35262. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  35263. },
  35264. args: [],
  35265. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  35266. referencedClasses: [],
  35267. messageSends: ["not", "isMethodScope", "scope"]
  35268. }),
  35269. $globals.ReturnNode);
  35270. $core.addMethod(
  35271. $core.method({
  35272. selector: "scope",
  35273. protocol: "accessing",
  35274. fn: function (){
  35275. var self=this,$self=this;
  35276. return $self["@scope"];
  35277. },
  35278. args: [],
  35279. source: "scope\x0a\x09^ scope",
  35280. referencedClasses: [],
  35281. messageSends: []
  35282. }),
  35283. $globals.ReturnNode);
  35284. $core.addMethod(
  35285. $core.method({
  35286. selector: "scope:",
  35287. protocol: "accessing",
  35288. fn: function (aLexicalScope){
  35289. var self=this,$self=this;
  35290. $self["@scope"]=aLexicalScope;
  35291. return self;
  35292. },
  35293. args: ["aLexicalScope"],
  35294. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35295. referencedClasses: [],
  35296. messageSends: []
  35297. }),
  35298. $globals.ReturnNode);
  35299. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  35300. $globals.SendNode.comment="I represent an message send node.";
  35301. $core.addMethod(
  35302. $core.method({
  35303. selector: "acceptDagVisitor:",
  35304. protocol: "visiting",
  35305. fn: function (aVisitor){
  35306. var self=this,$self=this;
  35307. return $core.withContext(function($ctx1) {
  35308. return $recv(aVisitor)._visitSendNode_(self);
  35309. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  35310. },
  35311. args: ["aVisitor"],
  35312. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  35313. referencedClasses: [],
  35314. messageSends: ["visitSendNode:"]
  35315. }),
  35316. $globals.SendNode);
  35317. $core.addMethod(
  35318. $core.method({
  35319. selector: "arguments",
  35320. protocol: "accessing",
  35321. fn: function (){
  35322. var self=this,$self=this;
  35323. return $core.withContext(function($ctx1) {
  35324. var $1,$receiver;
  35325. $1=$self["@arguments"];
  35326. if(($receiver = $1) == null || $receiver.a$nil){
  35327. $self["@arguments"]=[];
  35328. return $self["@arguments"];
  35329. } else {
  35330. return $1;
  35331. }
  35332. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  35333. },
  35334. args: [],
  35335. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  35336. referencedClasses: [],
  35337. messageSends: ["ifNil:"]
  35338. }),
  35339. $globals.SendNode);
  35340. $core.addMethod(
  35341. $core.method({
  35342. selector: "arguments:",
  35343. protocol: "accessing",
  35344. fn: function (aCollection){
  35345. var self=this,$self=this;
  35346. $self["@arguments"]=aCollection;
  35347. return self;
  35348. },
  35349. args: ["aCollection"],
  35350. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  35351. referencedClasses: [],
  35352. messageSends: []
  35353. }),
  35354. $globals.SendNode);
  35355. $core.addMethod(
  35356. $core.method({
  35357. selector: "dagChildren",
  35358. protocol: "accessing",
  35359. fn: function (){
  35360. var self=this,$self=this;
  35361. return $core.withContext(function($ctx1) {
  35362. var $1,$2,$3,$receiver;
  35363. $1=$self._receiver();
  35364. $ctx1.sendIdx["receiver"]=1;
  35365. if(($receiver = $1) == null || $receiver.a$nil){
  35366. $2=$self._arguments();
  35367. $ctx1.sendIdx["arguments"]=1;
  35368. return $recv($2)._copy();
  35369. } else {
  35370. $1;
  35371. }
  35372. $3=$recv($globals.Array)._with_($self._receiver());
  35373. $recv($3)._addAll_($self._arguments());
  35374. return $recv($3)._yourself();
  35375. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  35376. },
  35377. args: [],
  35378. 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",
  35379. referencedClasses: ["Array"],
  35380. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  35381. }),
  35382. $globals.SendNode);
  35383. $core.addMethod(
  35384. $core.method({
  35385. selector: "index",
  35386. protocol: "accessing",
  35387. fn: function (){
  35388. var self=this,$self=this;
  35389. return $self["@index"];
  35390. },
  35391. args: [],
  35392. source: "index\x0a\x09^ index",
  35393. referencedClasses: [],
  35394. messageSends: []
  35395. }),
  35396. $globals.SendNode);
  35397. $core.addMethod(
  35398. $core.method({
  35399. selector: "index:",
  35400. protocol: "accessing",
  35401. fn: function (anInteger){
  35402. var self=this,$self=this;
  35403. $self["@index"]=anInteger;
  35404. return self;
  35405. },
  35406. args: ["anInteger"],
  35407. source: "index: anInteger\x0a\x09index := anInteger",
  35408. referencedClasses: [],
  35409. messageSends: []
  35410. }),
  35411. $globals.SendNode);
  35412. $core.addMethod(
  35413. $core.method({
  35414. selector: "isNavigationNode",
  35415. protocol: "testing",
  35416. fn: function (){
  35417. var self=this,$self=this;
  35418. return true;
  35419. },
  35420. args: [],
  35421. source: "isNavigationNode\x0a\x09^ true",
  35422. referencedClasses: [],
  35423. messageSends: []
  35424. }),
  35425. $globals.SendNode);
  35426. $core.addMethod(
  35427. $core.method({
  35428. selector: "isSendNode",
  35429. protocol: "testing",
  35430. fn: function (){
  35431. var self=this,$self=this;
  35432. return true;
  35433. },
  35434. args: [],
  35435. source: "isSendNode\x0a\x09^ true",
  35436. referencedClasses: [],
  35437. messageSends: []
  35438. }),
  35439. $globals.SendNode);
  35440. $core.addMethod(
  35441. $core.method({
  35442. selector: "navigationLink",
  35443. protocol: "accessing",
  35444. fn: function (){
  35445. var self=this,$self=this;
  35446. return $core.withContext(function($ctx1) {
  35447. return $self._selector();
  35448. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  35449. },
  35450. args: [],
  35451. source: "navigationLink\x0a\x09^ self selector",
  35452. referencedClasses: [],
  35453. messageSends: ["selector"]
  35454. }),
  35455. $globals.SendNode);
  35456. $core.addMethod(
  35457. $core.method({
  35458. selector: "receiver",
  35459. protocol: "accessing",
  35460. fn: function (){
  35461. var self=this,$self=this;
  35462. return $self["@receiver"];
  35463. },
  35464. args: [],
  35465. source: "receiver\x0a\x09^ receiver",
  35466. referencedClasses: [],
  35467. messageSends: []
  35468. }),
  35469. $globals.SendNode);
  35470. $core.addMethod(
  35471. $core.method({
  35472. selector: "receiver:",
  35473. protocol: "accessing",
  35474. fn: function (aNode){
  35475. var self=this,$self=this;
  35476. $self["@receiver"]=aNode;
  35477. return self;
  35478. },
  35479. args: ["aNode"],
  35480. source: "receiver: aNode\x0a\x09receiver := aNode",
  35481. referencedClasses: [],
  35482. messageSends: []
  35483. }),
  35484. $globals.SendNode);
  35485. $core.addMethod(
  35486. $core.method({
  35487. selector: "requiresSmalltalkContext",
  35488. protocol: "testing",
  35489. fn: function (){
  35490. var self=this,$self=this;
  35491. return true;
  35492. },
  35493. args: [],
  35494. source: "requiresSmalltalkContext\x0a\x09^ true",
  35495. referencedClasses: [],
  35496. messageSends: []
  35497. }),
  35498. $globals.SendNode);
  35499. $core.addMethod(
  35500. $core.method({
  35501. selector: "selector",
  35502. protocol: "accessing",
  35503. fn: function (){
  35504. var self=this,$self=this;
  35505. return $self["@selector"];
  35506. },
  35507. args: [],
  35508. source: "selector\x0a\x09^ selector",
  35509. referencedClasses: [],
  35510. messageSends: []
  35511. }),
  35512. $globals.SendNode);
  35513. $core.addMethod(
  35514. $core.method({
  35515. selector: "selector:",
  35516. protocol: "accessing",
  35517. fn: function (aString){
  35518. var self=this,$self=this;
  35519. $self["@selector"]=aString;
  35520. return self;
  35521. },
  35522. args: ["aString"],
  35523. source: "selector: aString\x0a\x09selector := aString",
  35524. referencedClasses: [],
  35525. messageSends: []
  35526. }),
  35527. $globals.SendNode);
  35528. $core.addMethod(
  35529. $core.method({
  35530. selector: "shouldBeInlined",
  35531. protocol: "accessing",
  35532. fn: function (){
  35533. var self=this,$self=this;
  35534. return $core.withContext(function($ctx1) {
  35535. var $1,$receiver;
  35536. $1=$self["@shouldBeInlined"];
  35537. if(($receiver = $1) == null || $receiver.a$nil){
  35538. return false;
  35539. } else {
  35540. return $1;
  35541. }
  35542. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  35543. },
  35544. args: [],
  35545. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  35546. referencedClasses: [],
  35547. messageSends: ["ifNil:"]
  35548. }),
  35549. $globals.SendNode);
  35550. $core.addMethod(
  35551. $core.method({
  35552. selector: "shouldBeInlined:",
  35553. protocol: "accessing",
  35554. fn: function (aBoolean){
  35555. var self=this,$self=this;
  35556. $self["@shouldBeInlined"]=aBoolean;
  35557. return self;
  35558. },
  35559. args: ["aBoolean"],
  35560. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  35561. referencedClasses: [],
  35562. messageSends: []
  35563. }),
  35564. $globals.SendNode);
  35565. $core.addMethod(
  35566. $core.method({
  35567. selector: "superSend",
  35568. protocol: "accessing",
  35569. fn: function (){
  35570. var self=this,$self=this;
  35571. return $core.withContext(function($ctx1) {
  35572. var $2,$1;
  35573. $2=$self._receiver();
  35574. $ctx1.sendIdx["receiver"]=1;
  35575. $1=$recv($2)._notNil();
  35576. return $recv($1)._and_((function(){
  35577. return $core.withContext(function($ctx2) {
  35578. return $recv($self._receiver())._isSuperKeyword();
  35579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35580. }));
  35581. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  35582. },
  35583. args: [],
  35584. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  35585. referencedClasses: [],
  35586. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  35587. }),
  35588. $globals.SendNode);
  35589. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "scope"], "Compiler-AST");
  35590. $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).";
  35591. $core.addMethod(
  35592. $core.method({
  35593. selector: "acceptDagVisitor:",
  35594. protocol: "visiting",
  35595. fn: function (aVisitor){
  35596. var self=this,$self=this;
  35597. return $core.withContext(function($ctx1) {
  35598. return $recv(aVisitor)._visitSequenceNode_(self);
  35599. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  35600. },
  35601. args: ["aVisitor"],
  35602. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  35603. referencedClasses: [],
  35604. messageSends: ["visitSequenceNode:"]
  35605. }),
  35606. $globals.SequenceNode);
  35607. $core.addMethod(
  35608. $core.method({
  35609. selector: "asBlockSequenceNode",
  35610. protocol: "building",
  35611. fn: function (){
  35612. var self=this,$self=this;
  35613. return $core.withContext(function($ctx1) {
  35614. var $1;
  35615. $1=$recv($globals.BlockSequenceNode)._new();
  35616. $recv($1)._position_($self._position());
  35617. $recv($1)._source_($self._source());
  35618. $recv($1)._dagChildren_($self._dagChildren());
  35619. $recv($1)._temps_($self._temps());
  35620. return $recv($1)._yourself();
  35621. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  35622. },
  35623. args: [],
  35624. 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\x09yourself",
  35625. referencedClasses: ["BlockSequenceNode"],
  35626. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "yourself"]
  35627. }),
  35628. $globals.SequenceNode);
  35629. $core.addMethod(
  35630. $core.method({
  35631. selector: "isSequenceNode",
  35632. protocol: "testing",
  35633. fn: function (){
  35634. var self=this,$self=this;
  35635. return true;
  35636. },
  35637. args: [],
  35638. source: "isSequenceNode\x0a\x09^ true",
  35639. referencedClasses: [],
  35640. messageSends: []
  35641. }),
  35642. $globals.SequenceNode);
  35643. $core.addMethod(
  35644. $core.method({
  35645. selector: "scope",
  35646. protocol: "accessing",
  35647. fn: function (){
  35648. var self=this,$self=this;
  35649. return $self["@scope"];
  35650. },
  35651. args: [],
  35652. source: "scope\x0a\x09^ scope",
  35653. referencedClasses: [],
  35654. messageSends: []
  35655. }),
  35656. $globals.SequenceNode);
  35657. $core.addMethod(
  35658. $core.method({
  35659. selector: "scope:",
  35660. protocol: "accessing",
  35661. fn: function (aLexicalScope){
  35662. var self=this,$self=this;
  35663. $self["@scope"]=aLexicalScope;
  35664. return self;
  35665. },
  35666. args: ["aLexicalScope"],
  35667. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35668. referencedClasses: [],
  35669. messageSends: []
  35670. }),
  35671. $globals.SequenceNode);
  35672. $core.addMethod(
  35673. $core.method({
  35674. selector: "temps",
  35675. protocol: "accessing",
  35676. fn: function (){
  35677. var self=this,$self=this;
  35678. return $core.withContext(function($ctx1) {
  35679. var $1,$receiver;
  35680. $1=$self["@temps"];
  35681. if(($receiver = $1) == null || $receiver.a$nil){
  35682. return [];
  35683. } else {
  35684. return $1;
  35685. }
  35686. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  35687. },
  35688. args: [],
  35689. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  35690. referencedClasses: [],
  35691. messageSends: ["ifNil:"]
  35692. }),
  35693. $globals.SequenceNode);
  35694. $core.addMethod(
  35695. $core.method({
  35696. selector: "temps:",
  35697. protocol: "accessing",
  35698. fn: function (aCollection){
  35699. var self=this,$self=this;
  35700. $self["@temps"]=aCollection;
  35701. return self;
  35702. },
  35703. args: ["aCollection"],
  35704. source: "temps: aCollection\x0a\x09temps := aCollection",
  35705. referencedClasses: [],
  35706. messageSends: []
  35707. }),
  35708. $globals.SequenceNode);
  35709. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  35710. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  35711. $core.addMethod(
  35712. $core.method({
  35713. selector: "acceptDagVisitor:",
  35714. protocol: "visiting",
  35715. fn: function (aVisitor){
  35716. var self=this,$self=this;
  35717. return $core.withContext(function($ctx1) {
  35718. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  35719. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  35720. },
  35721. args: ["aVisitor"],
  35722. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35723. referencedClasses: [],
  35724. messageSends: ["visitBlockSequenceNode:"]
  35725. }),
  35726. $globals.BlockSequenceNode);
  35727. $core.addMethod(
  35728. $core.method({
  35729. selector: "isBlockSequenceNode",
  35730. protocol: "testing",
  35731. fn: function (){
  35732. var self=this,$self=this;
  35733. return true;
  35734. },
  35735. args: [],
  35736. source: "isBlockSequenceNode\x0a\x09^ true",
  35737. referencedClasses: [],
  35738. messageSends: []
  35739. }),
  35740. $globals.BlockSequenceNode);
  35741. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35742. $globals.ValueNode.comment="I represent a value node.";
  35743. $core.addMethod(
  35744. $core.method({
  35745. selector: "acceptDagVisitor:",
  35746. protocol: "visiting",
  35747. fn: function (aVisitor){
  35748. var self=this,$self=this;
  35749. return $core.withContext(function($ctx1) {
  35750. return $recv(aVisitor)._visitValueNode_(self);
  35751. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35752. },
  35753. args: ["aVisitor"],
  35754. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35755. referencedClasses: [],
  35756. messageSends: ["visitValueNode:"]
  35757. }),
  35758. $globals.ValueNode);
  35759. $core.addMethod(
  35760. $core.method({
  35761. selector: "isImmutable",
  35762. protocol: "testing",
  35763. fn: function (){
  35764. var self=this,$self=this;
  35765. return $core.withContext(function($ctx1) {
  35766. return $recv($self._value())._isImmutable();
  35767. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35768. },
  35769. args: [],
  35770. source: "isImmutable\x0a\x09^ self value isImmutable",
  35771. referencedClasses: [],
  35772. messageSends: ["isImmutable", "value"]
  35773. }),
  35774. $globals.ValueNode);
  35775. $core.addMethod(
  35776. $core.method({
  35777. selector: "isValueNode",
  35778. protocol: "testing",
  35779. fn: function (){
  35780. var self=this,$self=this;
  35781. return true;
  35782. },
  35783. args: [],
  35784. source: "isValueNode\x0a\x09^ true",
  35785. referencedClasses: [],
  35786. messageSends: []
  35787. }),
  35788. $globals.ValueNode);
  35789. $core.addMethod(
  35790. $core.method({
  35791. selector: "value",
  35792. protocol: "accessing",
  35793. fn: function (){
  35794. var self=this,$self=this;
  35795. return $self["@value"];
  35796. },
  35797. args: [],
  35798. source: "value\x0a\x09^ value",
  35799. referencedClasses: [],
  35800. messageSends: []
  35801. }),
  35802. $globals.ValueNode);
  35803. $core.addMethod(
  35804. $core.method({
  35805. selector: "value:",
  35806. protocol: "accessing",
  35807. fn: function (anObject){
  35808. var self=this,$self=this;
  35809. $self["@value"]=anObject;
  35810. return self;
  35811. },
  35812. args: ["anObject"],
  35813. source: "value: anObject\x0a\x09value := anObject",
  35814. referencedClasses: [],
  35815. messageSends: []
  35816. }),
  35817. $globals.ValueNode);
  35818. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35819. $globals.VariableNode.comment="I represent an variable node.";
  35820. $core.addMethod(
  35821. $core.method({
  35822. selector: "acceptDagVisitor:",
  35823. protocol: "visiting",
  35824. fn: function (aVisitor){
  35825. var self=this,$self=this;
  35826. return $core.withContext(function($ctx1) {
  35827. return $recv(aVisitor)._visitVariableNode_(self);
  35828. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35829. },
  35830. args: ["aVisitor"],
  35831. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35832. referencedClasses: [],
  35833. messageSends: ["visitVariableNode:"]
  35834. }),
  35835. $globals.VariableNode);
  35836. $core.addMethod(
  35837. $core.method({
  35838. selector: "alias",
  35839. protocol: "accessing",
  35840. fn: function (){
  35841. var self=this,$self=this;
  35842. return $core.withContext(function($ctx1) {
  35843. return $recv($self._binding())._alias();
  35844. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35845. },
  35846. args: [],
  35847. source: "alias\x0a\x09^ self binding alias",
  35848. referencedClasses: [],
  35849. messageSends: ["alias", "binding"]
  35850. }),
  35851. $globals.VariableNode);
  35852. $core.addMethod(
  35853. $core.method({
  35854. selector: "assigned",
  35855. protocol: "accessing",
  35856. fn: function (){
  35857. var self=this,$self=this;
  35858. return $core.withContext(function($ctx1) {
  35859. var $1,$receiver;
  35860. $1=$self["@assigned"];
  35861. if(($receiver = $1) == null || $receiver.a$nil){
  35862. return false;
  35863. } else {
  35864. return $1;
  35865. }
  35866. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35867. },
  35868. args: [],
  35869. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35870. referencedClasses: [],
  35871. messageSends: ["ifNil:"]
  35872. }),
  35873. $globals.VariableNode);
  35874. $core.addMethod(
  35875. $core.method({
  35876. selector: "assigned:",
  35877. protocol: "accessing",
  35878. fn: function (aBoolean){
  35879. var self=this,$self=this;
  35880. $self["@assigned"]=aBoolean;
  35881. return self;
  35882. },
  35883. args: ["aBoolean"],
  35884. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35885. referencedClasses: [],
  35886. messageSends: []
  35887. }),
  35888. $globals.VariableNode);
  35889. $core.addMethod(
  35890. $core.method({
  35891. selector: "beAssigned",
  35892. protocol: "accessing",
  35893. fn: function (){
  35894. var self=this,$self=this;
  35895. return $core.withContext(function($ctx1) {
  35896. $recv($self._binding())._validateAssignment();
  35897. $self["@assigned"]=true;
  35898. return self;
  35899. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35900. },
  35901. args: [],
  35902. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35903. referencedClasses: [],
  35904. messageSends: ["validateAssignment", "binding"]
  35905. }),
  35906. $globals.VariableNode);
  35907. $core.addMethod(
  35908. $core.method({
  35909. selector: "binding",
  35910. protocol: "accessing",
  35911. fn: function (){
  35912. var self=this,$self=this;
  35913. return $self["@binding"];
  35914. },
  35915. args: [],
  35916. source: "binding\x0a\x09^ binding",
  35917. referencedClasses: [],
  35918. messageSends: []
  35919. }),
  35920. $globals.VariableNode);
  35921. $core.addMethod(
  35922. $core.method({
  35923. selector: "binding:",
  35924. protocol: "accessing",
  35925. fn: function (aScopeVar){
  35926. var self=this,$self=this;
  35927. $self["@binding"]=aScopeVar;
  35928. return self;
  35929. },
  35930. args: ["aScopeVar"],
  35931. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35932. referencedClasses: [],
  35933. messageSends: []
  35934. }),
  35935. $globals.VariableNode);
  35936. $core.addMethod(
  35937. $core.method({
  35938. selector: "isArgument",
  35939. protocol: "testing",
  35940. fn: function (){
  35941. var self=this,$self=this;
  35942. return $core.withContext(function($ctx1) {
  35943. return $recv($self._binding())._isArgVar();
  35944. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35945. },
  35946. args: [],
  35947. source: "isArgument\x0a\x09^ self binding isArgVar",
  35948. referencedClasses: [],
  35949. messageSends: ["isArgVar", "binding"]
  35950. }),
  35951. $globals.VariableNode);
  35952. $core.addMethod(
  35953. $core.method({
  35954. selector: "isImmutable",
  35955. protocol: "testing",
  35956. fn: function (){
  35957. var self=this,$self=this;
  35958. return $core.withContext(function($ctx1) {
  35959. return $recv($self._binding())._isImmutable();
  35960. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35961. },
  35962. args: [],
  35963. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35964. referencedClasses: [],
  35965. messageSends: ["isImmutable", "binding"]
  35966. }),
  35967. $globals.VariableNode);
  35968. $core.addMethod(
  35969. $core.method({
  35970. selector: "isNavigationNode",
  35971. protocol: "testing",
  35972. fn: function (){
  35973. var self=this,$self=this;
  35974. return true;
  35975. },
  35976. args: [],
  35977. source: "isNavigationNode\x0a\x09^ true",
  35978. referencedClasses: [],
  35979. messageSends: []
  35980. }),
  35981. $globals.VariableNode);
  35982. $core.addMethod(
  35983. $core.method({
  35984. selector: "isSuperKeyword",
  35985. protocol: "testing",
  35986. fn: function (){
  35987. var self=this,$self=this;
  35988. return $core.withContext(function($ctx1) {
  35989. return $recv($self._value()).__eq("super");
  35990. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35991. },
  35992. args: [],
  35993. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35994. referencedClasses: [],
  35995. messageSends: ["=", "value"]
  35996. }),
  35997. $globals.VariableNode);
  35998. $core.addMethod(
  35999. $core.method({
  36000. selector: "isVariableNode",
  36001. protocol: "testing",
  36002. fn: function (){
  36003. var self=this,$self=this;
  36004. return true;
  36005. },
  36006. args: [],
  36007. source: "isVariableNode\x0a\x09^ true",
  36008. referencedClasses: [],
  36009. messageSends: []
  36010. }),
  36011. $globals.VariableNode);
  36012. $core.addMethod(
  36013. $core.method({
  36014. selector: "navigationLink",
  36015. protocol: "accessing",
  36016. fn: function (){
  36017. var self=this,$self=this;
  36018. return $core.withContext(function($ctx1) {
  36019. return $self._value();
  36020. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  36021. },
  36022. args: [],
  36023. source: "navigationLink\x0a\x09^ self value",
  36024. referencedClasses: [],
  36025. messageSends: ["value"]
  36026. }),
  36027. $globals.VariableNode);
  36028. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  36029. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  36030. $core.addMethod(
  36031. $core.method({
  36032. selector: "visit:",
  36033. protocol: "visiting",
  36034. fn: function (aNode){
  36035. var self=this,$self=this;
  36036. return $core.withContext(function($ctx1) {
  36037. var $1;
  36038. $recv($self._path())._ifNotEmpty_((function(p){
  36039. return $core.withContext(function($ctx2) {
  36040. return $recv(aNode)._parent_($recv(p)._last());
  36041. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  36042. }));
  36043. $1=(
  36044. $ctx1.supercall = true,
  36045. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  36046. $ctx1.supercall = false;
  36047. return $1;
  36048. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  36049. },
  36050. args: ["aNode"],
  36051. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  36052. referencedClasses: [],
  36053. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  36054. }),
  36055. $globals.ParentFakingPathDagVisitor);
  36056. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  36057. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  36058. $core.addMethod(
  36059. $core.method({
  36060. selector: "visitAssignmentNode:",
  36061. protocol: "visiting",
  36062. fn: function (aNode){
  36063. var self=this,$self=this;
  36064. return $core.withContext(function($ctx1) {
  36065. return $self._visitDagNode_(aNode);
  36066. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  36067. },
  36068. args: ["aNode"],
  36069. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36070. referencedClasses: [],
  36071. messageSends: ["visitDagNode:"]
  36072. }),
  36073. $globals.NodeVisitor);
  36074. $core.addMethod(
  36075. $core.method({
  36076. selector: "visitBlockNode:",
  36077. protocol: "visiting",
  36078. fn: function (aNode){
  36079. var self=this,$self=this;
  36080. return $core.withContext(function($ctx1) {
  36081. return $self._visitDagNode_(aNode);
  36082. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  36083. },
  36084. args: ["aNode"],
  36085. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36086. referencedClasses: [],
  36087. messageSends: ["visitDagNode:"]
  36088. }),
  36089. $globals.NodeVisitor);
  36090. $core.addMethod(
  36091. $core.method({
  36092. selector: "visitBlockSequenceNode:",
  36093. protocol: "visiting",
  36094. fn: function (aNode){
  36095. var self=this,$self=this;
  36096. return $core.withContext(function($ctx1) {
  36097. return $self._visitSequenceNode_(aNode);
  36098. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  36099. },
  36100. args: ["aNode"],
  36101. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  36102. referencedClasses: [],
  36103. messageSends: ["visitSequenceNode:"]
  36104. }),
  36105. $globals.NodeVisitor);
  36106. $core.addMethod(
  36107. $core.method({
  36108. selector: "visitCascadeNode:",
  36109. protocol: "visiting",
  36110. fn: function (aNode){
  36111. var self=this,$self=this;
  36112. return $core.withContext(function($ctx1) {
  36113. return $self._visitDagNode_(aNode);
  36114. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  36115. },
  36116. args: ["aNode"],
  36117. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36118. referencedClasses: [],
  36119. messageSends: ["visitDagNode:"]
  36120. }),
  36121. $globals.NodeVisitor);
  36122. $core.addMethod(
  36123. $core.method({
  36124. selector: "visitDagNode:",
  36125. protocol: "visiting",
  36126. fn: function (aNode){
  36127. var self=this,$self=this;
  36128. return $core.withContext(function($ctx1) {
  36129. return $self._visitDagNodeVariantSimple_(aNode);
  36130. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  36131. },
  36132. args: ["aNode"],
  36133. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  36134. referencedClasses: [],
  36135. messageSends: ["visitDagNodeVariantSimple:"]
  36136. }),
  36137. $globals.NodeVisitor);
  36138. $core.addMethod(
  36139. $core.method({
  36140. selector: "visitDynamicArrayNode:",
  36141. protocol: "visiting",
  36142. fn: function (aNode){
  36143. var self=this,$self=this;
  36144. return $core.withContext(function($ctx1) {
  36145. return $self._visitDagNode_(aNode);
  36146. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  36147. },
  36148. args: ["aNode"],
  36149. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36150. referencedClasses: [],
  36151. messageSends: ["visitDagNode:"]
  36152. }),
  36153. $globals.NodeVisitor);
  36154. $core.addMethod(
  36155. $core.method({
  36156. selector: "visitDynamicDictionaryNode:",
  36157. protocol: "visiting",
  36158. fn: function (aNode){
  36159. var self=this,$self=this;
  36160. return $core.withContext(function($ctx1) {
  36161. return $self._visitDagNode_(aNode);
  36162. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  36163. },
  36164. args: ["aNode"],
  36165. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36166. referencedClasses: [],
  36167. messageSends: ["visitDagNode:"]
  36168. }),
  36169. $globals.NodeVisitor);
  36170. $core.addMethod(
  36171. $core.method({
  36172. selector: "visitJSStatementNode:",
  36173. protocol: "visiting",
  36174. fn: function (aNode){
  36175. var self=this,$self=this;
  36176. return $core.withContext(function($ctx1) {
  36177. return $self._visitDagNode_(aNode);
  36178. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  36179. },
  36180. args: ["aNode"],
  36181. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36182. referencedClasses: [],
  36183. messageSends: ["visitDagNode:"]
  36184. }),
  36185. $globals.NodeVisitor);
  36186. $core.addMethod(
  36187. $core.method({
  36188. selector: "visitMethodNode:",
  36189. protocol: "visiting",
  36190. fn: function (aNode){
  36191. var self=this,$self=this;
  36192. return $core.withContext(function($ctx1) {
  36193. return $self._visitDagNode_(aNode);
  36194. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  36195. },
  36196. args: ["aNode"],
  36197. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36198. referencedClasses: [],
  36199. messageSends: ["visitDagNode:"]
  36200. }),
  36201. $globals.NodeVisitor);
  36202. $core.addMethod(
  36203. $core.method({
  36204. selector: "visitReturnNode:",
  36205. protocol: "visiting",
  36206. fn: function (aNode){
  36207. var self=this,$self=this;
  36208. return $core.withContext(function($ctx1) {
  36209. return $self._visitDagNode_(aNode);
  36210. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  36211. },
  36212. args: ["aNode"],
  36213. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36214. referencedClasses: [],
  36215. messageSends: ["visitDagNode:"]
  36216. }),
  36217. $globals.NodeVisitor);
  36218. $core.addMethod(
  36219. $core.method({
  36220. selector: "visitSendNode:",
  36221. protocol: "visiting",
  36222. fn: function (aNode){
  36223. var self=this,$self=this;
  36224. return $core.withContext(function($ctx1) {
  36225. return $self._visitDagNode_(aNode);
  36226. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  36227. },
  36228. args: ["aNode"],
  36229. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36230. referencedClasses: [],
  36231. messageSends: ["visitDagNode:"]
  36232. }),
  36233. $globals.NodeVisitor);
  36234. $core.addMethod(
  36235. $core.method({
  36236. selector: "visitSequenceNode:",
  36237. protocol: "visiting",
  36238. fn: function (aNode){
  36239. var self=this,$self=this;
  36240. return $core.withContext(function($ctx1) {
  36241. return $self._visitDagNode_(aNode);
  36242. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  36243. },
  36244. args: ["aNode"],
  36245. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36246. referencedClasses: [],
  36247. messageSends: ["visitDagNode:"]
  36248. }),
  36249. $globals.NodeVisitor);
  36250. $core.addMethod(
  36251. $core.method({
  36252. selector: "visitValueNode:",
  36253. protocol: "visiting",
  36254. fn: function (aNode){
  36255. var self=this,$self=this;
  36256. return $core.withContext(function($ctx1) {
  36257. return $self._visitDagNode_(aNode);
  36258. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  36259. },
  36260. args: ["aNode"],
  36261. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36262. referencedClasses: [],
  36263. messageSends: ["visitDagNode:"]
  36264. }),
  36265. $globals.NodeVisitor);
  36266. $core.addMethod(
  36267. $core.method({
  36268. selector: "visitVariableNode:",
  36269. protocol: "visiting",
  36270. fn: function (aNode){
  36271. var self=this,$self=this;
  36272. return $core.withContext(function($ctx1) {
  36273. return $self._visitDagNode_(aNode);
  36274. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  36275. },
  36276. args: ["aNode"],
  36277. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  36278. referencedClasses: [],
  36279. messageSends: ["visitDagNode:"]
  36280. }),
  36281. $globals.NodeVisitor);
  36282. $core.addMethod(
  36283. $core.method({
  36284. selector: "ast",
  36285. protocol: "*Compiler-AST",
  36286. fn: function (){
  36287. var self=this,$self=this;
  36288. return $core.withContext(function($ctx1) {
  36289. var $1;
  36290. $1=$self._source();
  36291. $ctx1.sendIdx["source"]=1;
  36292. $recv($1)._ifEmpty_((function(){
  36293. return $core.withContext(function($ctx2) {
  36294. return $self._error_("Method source is empty");
  36295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36296. }));
  36297. return $recv($globals.Smalltalk)._parse_($self._source());
  36298. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  36299. },
  36300. args: [],
  36301. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  36302. referencedClasses: ["Smalltalk"],
  36303. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  36304. }),
  36305. $globals.CompiledMethod);
  36306. });
  36307. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36308. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36309. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36310. $core.addPackage("Compiler-Semantic");
  36311. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  36312. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36313. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36314. $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.";
  36315. $core.addMethod(
  36316. $core.method({
  36317. selector: "addArg:",
  36318. protocol: "adding",
  36319. fn: function (aString){
  36320. var self=this,$self=this;
  36321. return $core.withContext(function($ctx1) {
  36322. var $1;
  36323. $1=$self._args();
  36324. $ctx1.sendIdx["args"]=1;
  36325. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36326. $recv($recv($self._args())._at_(aString))._scope_(self);
  36327. return self;
  36328. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36329. },
  36330. args: ["aString"],
  36331. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36332. referencedClasses: ["ArgVar"],
  36333. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36334. }),
  36335. $globals.LexicalScope);
  36336. $core.addMethod(
  36337. $core.method({
  36338. selector: "addTemp:",
  36339. protocol: "adding",
  36340. fn: function (aString){
  36341. var self=this,$self=this;
  36342. return $core.withContext(function($ctx1) {
  36343. var $1;
  36344. $1=$self._temps();
  36345. $ctx1.sendIdx["temps"]=1;
  36346. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36347. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36348. return self;
  36349. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36350. },
  36351. args: ["aString"],
  36352. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36353. referencedClasses: ["TempVar"],
  36354. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36355. }),
  36356. $globals.LexicalScope);
  36357. $core.addMethod(
  36358. $core.method({
  36359. selector: "alias",
  36360. protocol: "accessing",
  36361. fn: function (){
  36362. var self=this,$self=this;
  36363. return $core.withContext(function($ctx1) {
  36364. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36365. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36366. },
  36367. args: [],
  36368. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36369. referencedClasses: [],
  36370. messageSends: [",", "asString", "scopeLevel"]
  36371. }),
  36372. $globals.LexicalScope);
  36373. $core.addMethod(
  36374. $core.method({
  36375. selector: "allVariableNames",
  36376. protocol: "accessing",
  36377. fn: function (){
  36378. var self=this,$self=this;
  36379. return $core.withContext(function($ctx1) {
  36380. var $1;
  36381. $1=$recv($self._args())._keys();
  36382. $ctx1.sendIdx["keys"]=1;
  36383. return $recv($1).__comma($recv($self._temps())._keys());
  36384. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36385. },
  36386. args: [],
  36387. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36388. referencedClasses: [],
  36389. messageSends: [",", "keys", "args", "temps"]
  36390. }),
  36391. $globals.LexicalScope);
  36392. $core.addMethod(
  36393. $core.method({
  36394. selector: "args",
  36395. protocol: "accessing",
  36396. fn: function (){
  36397. var self=this,$self=this;
  36398. return $core.withContext(function($ctx1) {
  36399. var $1,$receiver;
  36400. $1=$self["@args"];
  36401. if(($receiver = $1) == null || $receiver.a$nil){
  36402. $self["@args"]=$recv($globals.Dictionary)._new();
  36403. return $self["@args"];
  36404. } else {
  36405. return $1;
  36406. }
  36407. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36408. },
  36409. args: [],
  36410. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36411. referencedClasses: ["Dictionary"],
  36412. messageSends: ["ifNil:", "new"]
  36413. }),
  36414. $globals.LexicalScope);
  36415. $core.addMethod(
  36416. $core.method({
  36417. selector: "bindingFor:",
  36418. protocol: "accessing",
  36419. fn: function (aStringOrNode){
  36420. var self=this,$self=this;
  36421. return $core.withContext(function($ctx1) {
  36422. var $2,$3,$4,$5,$1;
  36423. $2=$self._pseudoVars();
  36424. $3=$recv(aStringOrNode)._value();
  36425. $ctx1.sendIdx["value"]=1;
  36426. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36427. return $core.withContext(function($ctx2) {
  36428. $4=$self._args();
  36429. $5=$recv(aStringOrNode)._value();
  36430. $ctx2.sendIdx["value"]=2;
  36431. return $recv($4)._at_ifAbsent_($5,(function(){
  36432. return $core.withContext(function($ctx3) {
  36433. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36434. return nil;
  36435. }));
  36436. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36437. }));
  36438. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36440. }));
  36441. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36442. return $1;
  36443. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36444. },
  36445. args: ["aStringOrNode"],
  36446. 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 ]]]",
  36447. referencedClasses: [],
  36448. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36449. }),
  36450. $globals.LexicalScope);
  36451. $core.addMethod(
  36452. $core.method({
  36453. selector: "blockIndex",
  36454. protocol: "accessing",
  36455. fn: function (){
  36456. var self=this,$self=this;
  36457. return $core.withContext(function($ctx1) {
  36458. var $1,$receiver;
  36459. $1=$self["@blockIndex"];
  36460. if(($receiver = $1) == null || $receiver.a$nil){
  36461. return (0);
  36462. } else {
  36463. return $1;
  36464. }
  36465. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36466. },
  36467. args: [],
  36468. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36469. referencedClasses: [],
  36470. messageSends: ["ifNil:"]
  36471. }),
  36472. $globals.LexicalScope);
  36473. $core.addMethod(
  36474. $core.method({
  36475. selector: "blockIndex:",
  36476. protocol: "accessing",
  36477. fn: function (anInteger){
  36478. var self=this,$self=this;
  36479. $self["@blockIndex"]=anInteger;
  36480. return self;
  36481. },
  36482. args: ["anInteger"],
  36483. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36484. referencedClasses: [],
  36485. messageSends: []
  36486. }),
  36487. $globals.LexicalScope);
  36488. $core.addMethod(
  36489. $core.method({
  36490. selector: "canInlineNonLocalReturns",
  36491. protocol: "testing",
  36492. fn: function (){
  36493. var self=this,$self=this;
  36494. return $core.withContext(function($ctx1) {
  36495. return $recv($self._isInlined())._and_((function(){
  36496. return $core.withContext(function($ctx2) {
  36497. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36499. }));
  36500. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36501. },
  36502. args: [],
  36503. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36504. referencedClasses: [],
  36505. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36506. }),
  36507. $globals.LexicalScope);
  36508. $core.addMethod(
  36509. $core.method({
  36510. selector: "instruction",
  36511. protocol: "accessing",
  36512. fn: function (){
  36513. var self=this,$self=this;
  36514. return $self["@instruction"];
  36515. },
  36516. args: [],
  36517. source: "instruction\x0a\x09^ instruction",
  36518. referencedClasses: [],
  36519. messageSends: []
  36520. }),
  36521. $globals.LexicalScope);
  36522. $core.addMethod(
  36523. $core.method({
  36524. selector: "instruction:",
  36525. protocol: "accessing",
  36526. fn: function (anIRInstruction){
  36527. var self=this,$self=this;
  36528. $self["@instruction"]=anIRInstruction;
  36529. return self;
  36530. },
  36531. args: ["anIRInstruction"],
  36532. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36533. referencedClasses: [],
  36534. messageSends: []
  36535. }),
  36536. $globals.LexicalScope);
  36537. $core.addMethod(
  36538. $core.method({
  36539. selector: "isBlockScope",
  36540. protocol: "testing",
  36541. fn: function (){
  36542. var self=this,$self=this;
  36543. return $core.withContext(function($ctx1) {
  36544. return $recv($self._isMethodScope())._not();
  36545. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36546. },
  36547. args: [],
  36548. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36549. referencedClasses: [],
  36550. messageSends: ["not", "isMethodScope"]
  36551. }),
  36552. $globals.LexicalScope);
  36553. $core.addMethod(
  36554. $core.method({
  36555. selector: "isInlined",
  36556. protocol: "testing",
  36557. fn: function (){
  36558. var self=this,$self=this;
  36559. return $core.withContext(function($ctx1) {
  36560. var $2,$1;
  36561. $2=$self._instruction();
  36562. $ctx1.sendIdx["instruction"]=1;
  36563. $1=$recv($2)._notNil();
  36564. return $recv($1)._and_((function(){
  36565. return $core.withContext(function($ctx2) {
  36566. return $recv($self._instruction())._isInlined();
  36567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36568. }));
  36569. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  36570. },
  36571. args: [],
  36572. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  36573. referencedClasses: [],
  36574. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  36575. }),
  36576. $globals.LexicalScope);
  36577. $core.addMethod(
  36578. $core.method({
  36579. selector: "isMethodScope",
  36580. protocol: "testing",
  36581. fn: function (){
  36582. var self=this,$self=this;
  36583. return false;
  36584. },
  36585. args: [],
  36586. source: "isMethodScope\x0a\x09^ false",
  36587. referencedClasses: [],
  36588. messageSends: []
  36589. }),
  36590. $globals.LexicalScope);
  36591. $core.addMethod(
  36592. $core.method({
  36593. selector: "lookupVariable:",
  36594. protocol: "accessing",
  36595. fn: function (aNode){
  36596. var self=this,$self=this;
  36597. var lookup;
  36598. return $core.withContext(function($ctx1) {
  36599. var $1,$2,$receiver;
  36600. lookup=$self._bindingFor_(aNode);
  36601. $1=lookup;
  36602. if(($receiver = $1) == null || $receiver.a$nil){
  36603. $2=$self._outerScope();
  36604. $ctx1.sendIdx["outerScope"]=1;
  36605. if(($receiver = $2) == null || $receiver.a$nil){
  36606. lookup=$2;
  36607. } else {
  36608. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  36609. }
  36610. lookup;
  36611. } else {
  36612. $1;
  36613. }
  36614. return lookup;
  36615. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  36616. },
  36617. args: ["aNode"],
  36618. 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",
  36619. referencedClasses: [],
  36620. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  36621. }),
  36622. $globals.LexicalScope);
  36623. $core.addMethod(
  36624. $core.method({
  36625. selector: "methodScope",
  36626. protocol: "accessing",
  36627. fn: function (){
  36628. var self=this,$self=this;
  36629. return $core.withContext(function($ctx1) {
  36630. var $1,$receiver;
  36631. $1=$self._outerScope();
  36632. $ctx1.sendIdx["outerScope"]=1;
  36633. if(($receiver = $1) == null || $receiver.a$nil){
  36634. return $1;
  36635. } else {
  36636. return $recv($self._outerScope())._methodScope();
  36637. }
  36638. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  36639. },
  36640. args: [],
  36641. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  36642. referencedClasses: [],
  36643. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  36644. }),
  36645. $globals.LexicalScope);
  36646. $core.addMethod(
  36647. $core.method({
  36648. selector: "node",
  36649. protocol: "accessing",
  36650. fn: function (){
  36651. var self=this,$self=this;
  36652. return $self["@node"];
  36653. },
  36654. args: [],
  36655. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  36656. referencedClasses: [],
  36657. messageSends: []
  36658. }),
  36659. $globals.LexicalScope);
  36660. $core.addMethod(
  36661. $core.method({
  36662. selector: "node:",
  36663. protocol: "accessing",
  36664. fn: function (aNode){
  36665. var self=this,$self=this;
  36666. $self["@node"]=aNode;
  36667. return self;
  36668. },
  36669. args: ["aNode"],
  36670. source: "node: aNode\x0a\x09node := aNode",
  36671. referencedClasses: [],
  36672. messageSends: []
  36673. }),
  36674. $globals.LexicalScope);
  36675. $core.addMethod(
  36676. $core.method({
  36677. selector: "outerScope",
  36678. protocol: "accessing",
  36679. fn: function (){
  36680. var self=this,$self=this;
  36681. return $self["@outerScope"];
  36682. },
  36683. args: [],
  36684. source: "outerScope\x0a\x09^ outerScope",
  36685. referencedClasses: [],
  36686. messageSends: []
  36687. }),
  36688. $globals.LexicalScope);
  36689. $core.addMethod(
  36690. $core.method({
  36691. selector: "outerScope:",
  36692. protocol: "accessing",
  36693. fn: function (aLexicalScope){
  36694. var self=this,$self=this;
  36695. $self["@outerScope"]=aLexicalScope;
  36696. return self;
  36697. },
  36698. args: ["aLexicalScope"],
  36699. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  36700. referencedClasses: [],
  36701. messageSends: []
  36702. }),
  36703. $globals.LexicalScope);
  36704. $core.addMethod(
  36705. $core.method({
  36706. selector: "pseudoVars",
  36707. protocol: "accessing",
  36708. fn: function (){
  36709. var self=this,$self=this;
  36710. return $core.withContext(function($ctx1) {
  36711. return $recv($self._methodScope())._pseudoVars();
  36712. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  36713. },
  36714. args: [],
  36715. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  36716. referencedClasses: [],
  36717. messageSends: ["pseudoVars", "methodScope"]
  36718. }),
  36719. $globals.LexicalScope);
  36720. $core.addMethod(
  36721. $core.method({
  36722. selector: "scopeLevel",
  36723. protocol: "accessing",
  36724. fn: function (){
  36725. var self=this,$self=this;
  36726. return $core.withContext(function($ctx1) {
  36727. var $1,$2,$4,$3,$receiver;
  36728. $1=$self._outerScope();
  36729. $ctx1.sendIdx["outerScope"]=1;
  36730. if(($receiver = $1) == null || $receiver.a$nil){
  36731. return (1);
  36732. } else {
  36733. $1;
  36734. }
  36735. $2=$self._isInlined();
  36736. if($core.assert($2)){
  36737. $4=$self._outerScope();
  36738. $ctx1.sendIdx["outerScope"]=2;
  36739. $3=$recv($4)._scopeLevel();
  36740. $ctx1.sendIdx["scopeLevel"]=1;
  36741. return $3;
  36742. }
  36743. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  36744. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  36745. },
  36746. args: [],
  36747. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  36748. referencedClasses: [],
  36749. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  36750. }),
  36751. $globals.LexicalScope);
  36752. $core.addMethod(
  36753. $core.method({
  36754. selector: "temps",
  36755. protocol: "accessing",
  36756. fn: function (){
  36757. var self=this,$self=this;
  36758. return $core.withContext(function($ctx1) {
  36759. var $1,$receiver;
  36760. $1=$self["@temps"];
  36761. if(($receiver = $1) == null || $receiver.a$nil){
  36762. $self["@temps"]=$recv($globals.Dictionary)._new();
  36763. return $self["@temps"];
  36764. } else {
  36765. return $1;
  36766. }
  36767. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  36768. },
  36769. args: [],
  36770. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  36771. referencedClasses: ["Dictionary"],
  36772. messageSends: ["ifNil:", "new"]
  36773. }),
  36774. $globals.LexicalScope);
  36775. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  36776. $globals.MethodLexicalScope.comment="I represent a method scope.";
  36777. $core.addMethod(
  36778. $core.method({
  36779. selector: "addIVar:",
  36780. protocol: "adding",
  36781. fn: function (aString){
  36782. var self=this,$self=this;
  36783. return $core.withContext(function($ctx1) {
  36784. var $1;
  36785. $1=$self._iVars();
  36786. $ctx1.sendIdx["iVars"]=1;
  36787. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  36788. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  36789. return self;
  36790. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  36791. },
  36792. args: ["aString"],
  36793. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  36794. referencedClasses: ["InstanceVar"],
  36795. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  36796. }),
  36797. $globals.MethodLexicalScope);
  36798. $core.addMethod(
  36799. $core.method({
  36800. selector: "addNonLocalReturn:",
  36801. protocol: "adding",
  36802. fn: function (aScope){
  36803. var self=this,$self=this;
  36804. return $core.withContext(function($ctx1) {
  36805. $recv($self._nonLocalReturns())._add_(aScope);
  36806. return self;
  36807. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  36808. },
  36809. args: ["aScope"],
  36810. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  36811. referencedClasses: [],
  36812. messageSends: ["add:", "nonLocalReturns"]
  36813. }),
  36814. $globals.MethodLexicalScope);
  36815. $core.addMethod(
  36816. $core.method({
  36817. selector: "allVariableNames",
  36818. protocol: "accessing",
  36819. fn: function (){
  36820. var self=this,$self=this;
  36821. return $core.withContext(function($ctx1) {
  36822. var $1;
  36823. $1=(
  36824. $ctx1.supercall = true,
  36825. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  36826. $ctx1.supercall = false;
  36827. return $recv($1).__comma($recv($self._iVars())._keys());
  36828. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  36829. },
  36830. args: [],
  36831. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  36832. referencedClasses: [],
  36833. messageSends: [",", "allVariableNames", "keys", "iVars"]
  36834. }),
  36835. $globals.MethodLexicalScope);
  36836. $core.addMethod(
  36837. $core.method({
  36838. selector: "bindingFor:",
  36839. protocol: "accessing",
  36840. fn: function (aNode){
  36841. var self=this,$self=this;
  36842. return $core.withContext(function($ctx1) {
  36843. var $1,$receiver;
  36844. $1=(
  36845. $ctx1.supercall = true,
  36846. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  36847. $ctx1.supercall = false;
  36848. if(($receiver = $1) == null || $receiver.a$nil){
  36849. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  36850. return nil;
  36851. }));
  36852. } else {
  36853. return $1;
  36854. }
  36855. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  36856. },
  36857. args: ["aNode"],
  36858. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  36859. referencedClasses: [],
  36860. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  36861. }),
  36862. $globals.MethodLexicalScope);
  36863. $core.addMethod(
  36864. $core.method({
  36865. selector: "canInlineNonLocalReturns",
  36866. protocol: "testing",
  36867. fn: function (){
  36868. var self=this,$self=this;
  36869. return true;
  36870. },
  36871. args: [],
  36872. source: "canInlineNonLocalReturns\x0a\x09^ true",
  36873. referencedClasses: [],
  36874. messageSends: []
  36875. }),
  36876. $globals.MethodLexicalScope);
  36877. $core.addMethod(
  36878. $core.method({
  36879. selector: "hasLocalReturn",
  36880. protocol: "testing",
  36881. fn: function (){
  36882. var self=this,$self=this;
  36883. return $core.withContext(function($ctx1) {
  36884. return $self._localReturn();
  36885. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  36886. },
  36887. args: [],
  36888. source: "hasLocalReturn\x0a\x09^ self localReturn",
  36889. referencedClasses: [],
  36890. messageSends: ["localReturn"]
  36891. }),
  36892. $globals.MethodLexicalScope);
  36893. $core.addMethod(
  36894. $core.method({
  36895. selector: "hasNonLocalReturn",
  36896. protocol: "testing",
  36897. fn: function (){
  36898. var self=this,$self=this;
  36899. return $core.withContext(function($ctx1) {
  36900. return $recv($self._nonLocalReturns())._notEmpty();
  36901. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  36902. },
  36903. args: [],
  36904. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  36905. referencedClasses: [],
  36906. messageSends: ["notEmpty", "nonLocalReturns"]
  36907. }),
  36908. $globals.MethodLexicalScope);
  36909. $core.addMethod(
  36910. $core.method({
  36911. selector: "iVars",
  36912. protocol: "accessing",
  36913. fn: function (){
  36914. var self=this,$self=this;
  36915. return $core.withContext(function($ctx1) {
  36916. var $1,$receiver;
  36917. $1=$self["@iVars"];
  36918. if(($receiver = $1) == null || $receiver.a$nil){
  36919. $self["@iVars"]=$recv($globals.Dictionary)._new();
  36920. return $self["@iVars"];
  36921. } else {
  36922. return $1;
  36923. }
  36924. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  36925. },
  36926. args: [],
  36927. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  36928. referencedClasses: ["Dictionary"],
  36929. messageSends: ["ifNil:", "new"]
  36930. }),
  36931. $globals.MethodLexicalScope);
  36932. $core.addMethod(
  36933. $core.method({
  36934. selector: "isMethodScope",
  36935. protocol: "testing",
  36936. fn: function (){
  36937. var self=this,$self=this;
  36938. return true;
  36939. },
  36940. args: [],
  36941. source: "isMethodScope\x0a\x09^ true",
  36942. referencedClasses: [],
  36943. messageSends: []
  36944. }),
  36945. $globals.MethodLexicalScope);
  36946. $core.addMethod(
  36947. $core.method({
  36948. selector: "localReturn",
  36949. protocol: "accessing",
  36950. fn: function (){
  36951. var self=this,$self=this;
  36952. return $core.withContext(function($ctx1) {
  36953. var $1,$receiver;
  36954. $1=$self["@localReturn"];
  36955. if(($receiver = $1) == null || $receiver.a$nil){
  36956. return false;
  36957. } else {
  36958. return $1;
  36959. }
  36960. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  36961. },
  36962. args: [],
  36963. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  36964. referencedClasses: [],
  36965. messageSends: ["ifNil:"]
  36966. }),
  36967. $globals.MethodLexicalScope);
  36968. $core.addMethod(
  36969. $core.method({
  36970. selector: "localReturn:",
  36971. protocol: "accessing",
  36972. fn: function (aBoolean){
  36973. var self=this,$self=this;
  36974. $self["@localReturn"]=aBoolean;
  36975. return self;
  36976. },
  36977. args: ["aBoolean"],
  36978. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  36979. referencedClasses: [],
  36980. messageSends: []
  36981. }),
  36982. $globals.MethodLexicalScope);
  36983. $core.addMethod(
  36984. $core.method({
  36985. selector: "methodScope",
  36986. protocol: "accessing",
  36987. fn: function (){
  36988. var self=this,$self=this;
  36989. return self;
  36990. },
  36991. args: [],
  36992. source: "methodScope\x0a\x09^ self",
  36993. referencedClasses: [],
  36994. messageSends: []
  36995. }),
  36996. $globals.MethodLexicalScope);
  36997. $core.addMethod(
  36998. $core.method({
  36999. selector: "nonLocalReturns",
  37000. protocol: "accessing",
  37001. fn: function (){
  37002. var self=this,$self=this;
  37003. return $core.withContext(function($ctx1) {
  37004. var $1,$receiver;
  37005. $1=$self["@nonLocalReturns"];
  37006. if(($receiver = $1) == null || $receiver.a$nil){
  37007. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37008. return $self["@nonLocalReturns"];
  37009. } else {
  37010. return $1;
  37011. }
  37012. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37013. },
  37014. args: [],
  37015. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37016. referencedClasses: ["OrderedCollection"],
  37017. messageSends: ["ifNil:", "new"]
  37018. }),
  37019. $globals.MethodLexicalScope);
  37020. $core.addMethod(
  37021. $core.method({
  37022. selector: "pseudoVars",
  37023. protocol: "accessing",
  37024. fn: function (){
  37025. var self=this,$self=this;
  37026. return $core.withContext(function($ctx1) {
  37027. var $1,$2,$4,$3,$receiver;
  37028. $1=$self["@pseudoVars"];
  37029. if(($receiver = $1) == null || $receiver.a$nil){
  37030. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37031. $self["@pseudoVars"];
  37032. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37033. return $core.withContext(function($ctx2) {
  37034. $2=$self["@pseudoVars"];
  37035. $4=$recv($globals.PseudoVar)._on_(each);
  37036. $recv($4)._scope_($self._methodScope());
  37037. $3=$recv($4)._yourself();
  37038. return $recv($2)._at_put_(each,$3);
  37039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37040. }));
  37041. } else {
  37042. $1;
  37043. }
  37044. return $self["@pseudoVars"];
  37045. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37046. },
  37047. args: [],
  37048. 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",
  37049. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37050. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37051. }),
  37052. $globals.MethodLexicalScope);
  37053. $core.addMethod(
  37054. $core.method({
  37055. selector: "removeNonLocalReturn:",
  37056. protocol: "adding",
  37057. fn: function (aScope){
  37058. var self=this,$self=this;
  37059. return $core.withContext(function($ctx1) {
  37060. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37061. }));
  37062. return self;
  37063. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37064. },
  37065. args: ["aScope"],
  37066. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37067. referencedClasses: [],
  37068. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37069. }),
  37070. $globals.MethodLexicalScope);
  37071. $core.addMethod(
  37072. $core.method({
  37073. selector: "unknownVariables",
  37074. protocol: "accessing",
  37075. fn: function (){
  37076. var self=this,$self=this;
  37077. return $core.withContext(function($ctx1) {
  37078. var $1,$receiver;
  37079. $1=$self["@unknownVariables"];
  37080. if(($receiver = $1) == null || $receiver.a$nil){
  37081. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37082. return $self["@unknownVariables"];
  37083. } else {
  37084. return $1;
  37085. }
  37086. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37087. },
  37088. args: [],
  37089. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37090. referencedClasses: ["OrderedCollection"],
  37091. messageSends: ["ifNil:", "new"]
  37092. }),
  37093. $globals.MethodLexicalScope);
  37094. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37095. $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.";
  37096. $core.addMethod(
  37097. $core.method({
  37098. selector: "alias",
  37099. protocol: "accessing",
  37100. fn: function (){
  37101. var self=this,$self=this;
  37102. return $core.withContext(function($ctx1) {
  37103. return $recv($self._name())._asVariableName();
  37104. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37105. },
  37106. args: [],
  37107. source: "alias\x0a\x09^ self name asVariableName",
  37108. referencedClasses: [],
  37109. messageSends: ["asVariableName", "name"]
  37110. }),
  37111. $globals.ScopeVar);
  37112. $core.addMethod(
  37113. $core.method({
  37114. selector: "isArgVar",
  37115. protocol: "testing",
  37116. fn: function (){
  37117. var self=this,$self=this;
  37118. return false;
  37119. },
  37120. args: [],
  37121. source: "isArgVar\x0a\x09^ false",
  37122. referencedClasses: [],
  37123. messageSends: []
  37124. }),
  37125. $globals.ScopeVar);
  37126. $core.addMethod(
  37127. $core.method({
  37128. selector: "isClassRefVar",
  37129. protocol: "testing",
  37130. fn: function (){
  37131. var self=this,$self=this;
  37132. return false;
  37133. },
  37134. args: [],
  37135. source: "isClassRefVar\x0a\x09^ false",
  37136. referencedClasses: [],
  37137. messageSends: []
  37138. }),
  37139. $globals.ScopeVar);
  37140. $core.addMethod(
  37141. $core.method({
  37142. selector: "isImmutable",
  37143. protocol: "testing",
  37144. fn: function (){
  37145. var self=this,$self=this;
  37146. return false;
  37147. },
  37148. args: [],
  37149. source: "isImmutable\x0a\x09^ false",
  37150. referencedClasses: [],
  37151. messageSends: []
  37152. }),
  37153. $globals.ScopeVar);
  37154. $core.addMethod(
  37155. $core.method({
  37156. selector: "isInstanceVar",
  37157. protocol: "testing",
  37158. fn: function (){
  37159. var self=this,$self=this;
  37160. return false;
  37161. },
  37162. args: [],
  37163. source: "isInstanceVar\x0a\x09^ false",
  37164. referencedClasses: [],
  37165. messageSends: []
  37166. }),
  37167. $globals.ScopeVar);
  37168. $core.addMethod(
  37169. $core.method({
  37170. selector: "isPseudoVar",
  37171. protocol: "testing",
  37172. fn: function (){
  37173. var self=this,$self=this;
  37174. return false;
  37175. },
  37176. args: [],
  37177. source: "isPseudoVar\x0a\x09^ false",
  37178. referencedClasses: [],
  37179. messageSends: []
  37180. }),
  37181. $globals.ScopeVar);
  37182. $core.addMethod(
  37183. $core.method({
  37184. selector: "isSelf",
  37185. protocol: "testing",
  37186. fn: function (){
  37187. var self=this,$self=this;
  37188. return false;
  37189. },
  37190. args: [],
  37191. source: "isSelf\x0a\x09^ false",
  37192. referencedClasses: [],
  37193. messageSends: []
  37194. }),
  37195. $globals.ScopeVar);
  37196. $core.addMethod(
  37197. $core.method({
  37198. selector: "isSuper",
  37199. protocol: "testing",
  37200. fn: function (){
  37201. var self=this,$self=this;
  37202. return false;
  37203. },
  37204. args: [],
  37205. source: "isSuper\x0a\x09^ false",
  37206. referencedClasses: [],
  37207. messageSends: []
  37208. }),
  37209. $globals.ScopeVar);
  37210. $core.addMethod(
  37211. $core.method({
  37212. selector: "isTempVar",
  37213. protocol: "testing",
  37214. fn: function (){
  37215. var self=this,$self=this;
  37216. return false;
  37217. },
  37218. args: [],
  37219. source: "isTempVar\x0a\x09^ false",
  37220. referencedClasses: [],
  37221. messageSends: []
  37222. }),
  37223. $globals.ScopeVar);
  37224. $core.addMethod(
  37225. $core.method({
  37226. selector: "isUnknownVar",
  37227. protocol: "testing",
  37228. fn: function (){
  37229. var self=this,$self=this;
  37230. return false;
  37231. },
  37232. args: [],
  37233. source: "isUnknownVar\x0a\x09^ false",
  37234. referencedClasses: [],
  37235. messageSends: []
  37236. }),
  37237. $globals.ScopeVar);
  37238. $core.addMethod(
  37239. $core.method({
  37240. selector: "name",
  37241. protocol: "accessing",
  37242. fn: function (){
  37243. var self=this,$self=this;
  37244. return $self["@name"];
  37245. },
  37246. args: [],
  37247. source: "name\x0a\x09^ name",
  37248. referencedClasses: [],
  37249. messageSends: []
  37250. }),
  37251. $globals.ScopeVar);
  37252. $core.addMethod(
  37253. $core.method({
  37254. selector: "name:",
  37255. protocol: "accessing",
  37256. fn: function (aString){
  37257. var self=this,$self=this;
  37258. $self["@name"]=aString;
  37259. return self;
  37260. },
  37261. args: ["aString"],
  37262. source: "name: aString\x0a\x09name := aString",
  37263. referencedClasses: [],
  37264. messageSends: []
  37265. }),
  37266. $globals.ScopeVar);
  37267. $core.addMethod(
  37268. $core.method({
  37269. selector: "scope",
  37270. protocol: "accessing",
  37271. fn: function (){
  37272. var self=this,$self=this;
  37273. return $self["@scope"];
  37274. },
  37275. args: [],
  37276. source: "scope\x0a\x09^ scope",
  37277. referencedClasses: [],
  37278. messageSends: []
  37279. }),
  37280. $globals.ScopeVar);
  37281. $core.addMethod(
  37282. $core.method({
  37283. selector: "scope:",
  37284. protocol: "accessing",
  37285. fn: function (aScope){
  37286. var self=this,$self=this;
  37287. $self["@scope"]=aScope;
  37288. return self;
  37289. },
  37290. args: ["aScope"],
  37291. source: "scope: aScope\x0a\x09scope := aScope",
  37292. referencedClasses: [],
  37293. messageSends: []
  37294. }),
  37295. $globals.ScopeVar);
  37296. $core.addMethod(
  37297. $core.method({
  37298. selector: "validateAssignment",
  37299. protocol: "testing",
  37300. fn: function (){
  37301. var self=this,$self=this;
  37302. return $core.withContext(function($ctx1) {
  37303. var $1,$2;
  37304. $1=$recv($self._isArgVar())._or_((function(){
  37305. return $core.withContext(function($ctx2) {
  37306. return $self._isPseudoVar();
  37307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37308. }));
  37309. if($core.assert($1)){
  37310. $2=$recv($globals.InvalidAssignmentError)._new();
  37311. $recv($2)._variableName_($self._name());
  37312. $recv($2)._signal();
  37313. }
  37314. return self;
  37315. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37316. },
  37317. args: [],
  37318. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37319. referencedClasses: ["InvalidAssignmentError"],
  37320. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37321. }),
  37322. $globals.ScopeVar);
  37323. $core.addMethod(
  37324. $core.method({
  37325. selector: "on:",
  37326. protocol: "instance creation",
  37327. fn: function (aString){
  37328. var self=this,$self=this;
  37329. return $core.withContext(function($ctx1) {
  37330. var $1;
  37331. $1=$self._new();
  37332. $recv($1)._name_(aString);
  37333. return $recv($1)._yourself();
  37334. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37335. },
  37336. args: ["aString"],
  37337. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37338. referencedClasses: [],
  37339. messageSends: ["name:", "new", "yourself"]
  37340. }),
  37341. $globals.ScopeVar.a$cls);
  37342. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37343. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37344. $core.addMethod(
  37345. $core.method({
  37346. selector: "isImmutable",
  37347. protocol: "testing",
  37348. fn: function (){
  37349. var self=this,$self=this;
  37350. return true;
  37351. },
  37352. args: [],
  37353. source: "isImmutable\x0a\x09^ true",
  37354. referencedClasses: [],
  37355. messageSends: []
  37356. }),
  37357. $globals.AliasVar);
  37358. $core.addMethod(
  37359. $core.method({
  37360. selector: "node",
  37361. protocol: "accessing",
  37362. fn: function (){
  37363. var self=this,$self=this;
  37364. return $self["@node"];
  37365. },
  37366. args: [],
  37367. source: "node\x0a\x09^ node",
  37368. referencedClasses: [],
  37369. messageSends: []
  37370. }),
  37371. $globals.AliasVar);
  37372. $core.addMethod(
  37373. $core.method({
  37374. selector: "node:",
  37375. protocol: "accessing",
  37376. fn: function (aNode){
  37377. var self=this,$self=this;
  37378. $self["@node"]=aNode;
  37379. return self;
  37380. },
  37381. args: ["aNode"],
  37382. source: "node: aNode\x0a\x09node := aNode",
  37383. referencedClasses: [],
  37384. messageSends: []
  37385. }),
  37386. $globals.AliasVar);
  37387. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37388. $globals.ArgVar.comment="I am an argument of a method or block.";
  37389. $core.addMethod(
  37390. $core.method({
  37391. selector: "isArgVar",
  37392. protocol: "testing",
  37393. fn: function (){
  37394. var self=this,$self=this;
  37395. return true;
  37396. },
  37397. args: [],
  37398. source: "isArgVar\x0a\x09^ true",
  37399. referencedClasses: [],
  37400. messageSends: []
  37401. }),
  37402. $globals.ArgVar);
  37403. $core.addMethod(
  37404. $core.method({
  37405. selector: "isImmutable",
  37406. protocol: "testing",
  37407. fn: function (){
  37408. var self=this,$self=this;
  37409. return true;
  37410. },
  37411. args: [],
  37412. source: "isImmutable\x0a\x09^ true",
  37413. referencedClasses: [],
  37414. messageSends: []
  37415. }),
  37416. $globals.ArgVar);
  37417. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37418. $globals.ClassRefVar.comment="I am an class reference variable";
  37419. $core.addMethod(
  37420. $core.method({
  37421. selector: "alias",
  37422. protocol: "accessing",
  37423. fn: function (){
  37424. var self=this,$self=this;
  37425. return $core.withContext(function($ctx1) {
  37426. return "$globals.".__comma($self._name());
  37427. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37428. },
  37429. args: [],
  37430. 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",
  37431. referencedClasses: [],
  37432. messageSends: [",", "name"]
  37433. }),
  37434. $globals.ClassRefVar);
  37435. $core.addMethod(
  37436. $core.method({
  37437. selector: "isClassRefVar",
  37438. protocol: "testing",
  37439. fn: function (){
  37440. var self=this,$self=this;
  37441. return true;
  37442. },
  37443. args: [],
  37444. source: "isClassRefVar\x0a\x09^ true",
  37445. referencedClasses: [],
  37446. messageSends: []
  37447. }),
  37448. $globals.ClassRefVar);
  37449. $core.addMethod(
  37450. $core.method({
  37451. selector: "isImmutable",
  37452. protocol: "testing",
  37453. fn: function (){
  37454. var self=this,$self=this;
  37455. return true;
  37456. },
  37457. args: [],
  37458. source: "isImmutable\x0a\x09^ true",
  37459. referencedClasses: [],
  37460. messageSends: []
  37461. }),
  37462. $globals.ClassRefVar);
  37463. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37464. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37465. $core.addMethod(
  37466. $core.method({
  37467. selector: "alias",
  37468. protocol: "testing",
  37469. fn: function (){
  37470. var self=this,$self=this;
  37471. return $core.withContext(function($ctx1) {
  37472. var $1;
  37473. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37474. $ctx1.sendIdx[","]=1;
  37475. return $1;
  37476. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37477. },
  37478. args: [],
  37479. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37480. referencedClasses: [],
  37481. messageSends: [",", "name"]
  37482. }),
  37483. $globals.InstanceVar);
  37484. $core.addMethod(
  37485. $core.method({
  37486. selector: "isInstanceVar",
  37487. protocol: "testing",
  37488. fn: function (){
  37489. var self=this,$self=this;
  37490. return true;
  37491. },
  37492. args: [],
  37493. source: "isInstanceVar\x0a\x09^ true",
  37494. referencedClasses: [],
  37495. messageSends: []
  37496. }),
  37497. $globals.InstanceVar);
  37498. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37499. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37500. $core.addMethod(
  37501. $core.method({
  37502. selector: "alias",
  37503. protocol: "accessing",
  37504. fn: function (){
  37505. var self=this,$self=this;
  37506. return $core.withContext(function($ctx1) {
  37507. return $self._name();
  37508. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37509. },
  37510. args: [],
  37511. source: "alias\x0a\x09^ self name",
  37512. referencedClasses: [],
  37513. messageSends: ["name"]
  37514. }),
  37515. $globals.PseudoVar);
  37516. $core.addMethod(
  37517. $core.method({
  37518. selector: "isImmutable",
  37519. protocol: "testing",
  37520. fn: function (){
  37521. var self=this,$self=this;
  37522. return true;
  37523. },
  37524. args: [],
  37525. source: "isImmutable\x0a\x09^ true",
  37526. referencedClasses: [],
  37527. messageSends: []
  37528. }),
  37529. $globals.PseudoVar);
  37530. $core.addMethod(
  37531. $core.method({
  37532. selector: "isPseudoVar",
  37533. protocol: "testing",
  37534. fn: function (){
  37535. var self=this,$self=this;
  37536. return true;
  37537. },
  37538. args: [],
  37539. source: "isPseudoVar\x0a\x09^ true",
  37540. referencedClasses: [],
  37541. messageSends: []
  37542. }),
  37543. $globals.PseudoVar);
  37544. $core.addMethod(
  37545. $core.method({
  37546. selector: "isSelf",
  37547. protocol: "testing",
  37548. fn: function (){
  37549. var self=this,$self=this;
  37550. return $core.withContext(function($ctx1) {
  37551. return $recv($self["@name"]).__eq("self");
  37552. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37553. },
  37554. args: [],
  37555. source: "isSelf\x0a\x09^ name = 'self'",
  37556. referencedClasses: [],
  37557. messageSends: ["="]
  37558. }),
  37559. $globals.PseudoVar);
  37560. $core.addMethod(
  37561. $core.method({
  37562. selector: "isSuper",
  37563. protocol: "testing",
  37564. fn: function (){
  37565. var self=this,$self=this;
  37566. return $core.withContext(function($ctx1) {
  37567. return $recv($self["@name"]).__eq("super");
  37568. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  37569. },
  37570. args: [],
  37571. source: "isSuper\x0a\x09^ name = 'super'",
  37572. referencedClasses: [],
  37573. messageSends: ["="]
  37574. }),
  37575. $globals.PseudoVar);
  37576. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37577. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  37578. $core.addMethod(
  37579. $core.method({
  37580. selector: "isTempVar",
  37581. protocol: "testing",
  37582. fn: function (){
  37583. var self=this,$self=this;
  37584. return true;
  37585. },
  37586. args: [],
  37587. source: "isTempVar\x0a\x09^ true",
  37588. referencedClasses: [],
  37589. messageSends: []
  37590. }),
  37591. $globals.TempVar);
  37592. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37593. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  37594. $core.addMethod(
  37595. $core.method({
  37596. selector: "isUnknownVar",
  37597. protocol: "testing",
  37598. fn: function (){
  37599. var self=this,$self=this;
  37600. return true;
  37601. },
  37602. args: [],
  37603. source: "isUnknownVar\x0a\x09^ true",
  37604. referencedClasses: [],
  37605. messageSends: []
  37606. }),
  37607. $globals.UnknownVar);
  37608. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  37609. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  37610. $core.addMethod(
  37611. $core.method({
  37612. selector: "classReferences",
  37613. protocol: "accessing",
  37614. fn: function (){
  37615. var self=this,$self=this;
  37616. return $core.withContext(function($ctx1) {
  37617. var $1,$receiver;
  37618. $1=$self["@classReferences"];
  37619. if(($receiver = $1) == null || $receiver.a$nil){
  37620. $self["@classReferences"]=$recv($globals.Set)._new();
  37621. return $self["@classReferences"];
  37622. } else {
  37623. return $1;
  37624. }
  37625. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  37626. },
  37627. args: [],
  37628. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  37629. referencedClasses: ["Set"],
  37630. messageSends: ["ifNil:", "new"]
  37631. }),
  37632. $globals.SemanticAnalyzer);
  37633. $core.addMethod(
  37634. $core.method({
  37635. selector: "errorShadowingVariable:",
  37636. protocol: "error handling",
  37637. fn: function (aString){
  37638. var self=this,$self=this;
  37639. return $core.withContext(function($ctx1) {
  37640. var $1;
  37641. $1=$recv($globals.ShadowingVariableError)._new();
  37642. $recv($1)._variableName_(aString);
  37643. $recv($1)._signal();
  37644. return self;
  37645. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  37646. },
  37647. args: ["aString"],
  37648. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  37649. referencedClasses: ["ShadowingVariableError"],
  37650. messageSends: ["variableName:", "new", "signal"]
  37651. }),
  37652. $globals.SemanticAnalyzer);
  37653. $core.addMethod(
  37654. $core.method({
  37655. selector: "errorUnknownVariable:",
  37656. protocol: "error handling",
  37657. fn: function (aNode){
  37658. var self=this,$self=this;
  37659. var identifier;
  37660. return $core.withContext(function($ctx1) {
  37661. var $1,$2,$3;
  37662. identifier=$recv(aNode)._value();
  37663. $ctx1.sendIdx["value"]=1;
  37664. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  37665. return $core.withContext(function($ctx2) {
  37666. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  37667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37668. }));
  37669. if($core.assert($1)){
  37670. $2=$recv($globals.UnknownVariableError)._new();
  37671. $3=$recv(aNode)._value();
  37672. $ctx1.sendIdx["value"]=2;
  37673. $recv($2)._variableName_($3);
  37674. $recv($2)._signal();
  37675. } else {
  37676. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  37677. }
  37678. return self;
  37679. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  37680. },
  37681. args: ["aNode"],
  37682. 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 ]",
  37683. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  37684. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  37685. }),
  37686. $globals.SemanticAnalyzer);
  37687. $core.addMethod(
  37688. $core.method({
  37689. selector: "isVariableUndefined:inPackage:",
  37690. protocol: "testing",
  37691. fn: function (aString,aPackage){
  37692. var self=this,$self=this;
  37693. return $core.withContext(function($ctx1) {
  37694. var $1,$2,$receiver;
  37695. if(($receiver = aPackage) == null || $receiver.a$nil){
  37696. aPackage;
  37697. } else {
  37698. var packageKnownVars;
  37699. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  37700. packageKnownVars;
  37701. $1=$recv(packageKnownVars)._includes_(aString);
  37702. if($core.assert($1)){
  37703. return false;
  37704. }
  37705. }
  37706. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  37707. $ctx1.sendIdx[","]=1;
  37708. return $recv($globals.Compiler)._eval_($2);
  37709. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  37710. },
  37711. args: ["aString", "aPackage"],
  37712. 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'",
  37713. referencedClasses: ["Compiler"],
  37714. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  37715. }),
  37716. $globals.SemanticAnalyzer);
  37717. $core.addMethod(
  37718. $core.method({
  37719. selector: "messageSends",
  37720. protocol: "accessing",
  37721. fn: function (){
  37722. var self=this,$self=this;
  37723. return $core.withContext(function($ctx1) {
  37724. var $1,$receiver;
  37725. $1=$self["@messageSends"];
  37726. if(($receiver = $1) == null || $receiver.a$nil){
  37727. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  37728. return $self["@messageSends"];
  37729. } else {
  37730. return $1;
  37731. }
  37732. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  37733. },
  37734. args: [],
  37735. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  37736. referencedClasses: ["Dictionary"],
  37737. messageSends: ["ifNil:", "new"]
  37738. }),
  37739. $globals.SemanticAnalyzer);
  37740. $core.addMethod(
  37741. $core.method({
  37742. selector: "newBlockScope",
  37743. protocol: "factory",
  37744. fn: function (){
  37745. var self=this,$self=this;
  37746. return $core.withContext(function($ctx1) {
  37747. return $self._newScopeOfClass_($globals.LexicalScope);
  37748. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  37749. },
  37750. args: [],
  37751. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  37752. referencedClasses: ["LexicalScope"],
  37753. messageSends: ["newScopeOfClass:"]
  37754. }),
  37755. $globals.SemanticAnalyzer);
  37756. $core.addMethod(
  37757. $core.method({
  37758. selector: "newMethodScope",
  37759. protocol: "factory",
  37760. fn: function (){
  37761. var self=this,$self=this;
  37762. return $core.withContext(function($ctx1) {
  37763. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  37764. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  37765. },
  37766. args: [],
  37767. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  37768. referencedClasses: ["MethodLexicalScope"],
  37769. messageSends: ["newScopeOfClass:"]
  37770. }),
  37771. $globals.SemanticAnalyzer);
  37772. $core.addMethod(
  37773. $core.method({
  37774. selector: "newScopeOfClass:",
  37775. protocol: "factory",
  37776. fn: function (aLexicalScopeClass){
  37777. var self=this,$self=this;
  37778. return $core.withContext(function($ctx1) {
  37779. var $1;
  37780. $1=$recv(aLexicalScopeClass)._new();
  37781. $recv($1)._outerScope_($self["@currentScope"]);
  37782. return $recv($1)._yourself();
  37783. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  37784. },
  37785. args: ["aLexicalScopeClass"],
  37786. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  37787. referencedClasses: [],
  37788. messageSends: ["outerScope:", "new", "yourself"]
  37789. }),
  37790. $globals.SemanticAnalyzer);
  37791. $core.addMethod(
  37792. $core.method({
  37793. selector: "nextBlockIndex",
  37794. protocol: "private",
  37795. fn: function (){
  37796. var self=this,$self=this;
  37797. return $core.withContext(function($ctx1) {
  37798. var $1,$receiver;
  37799. $1=$self["@blockIndex"];
  37800. if(($receiver = $1) == null || $receiver.a$nil){
  37801. $self["@blockIndex"]=(0);
  37802. $self["@blockIndex"];
  37803. } else {
  37804. $1;
  37805. }
  37806. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  37807. return $self["@blockIndex"];
  37808. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  37809. },
  37810. args: [],
  37811. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  37812. referencedClasses: [],
  37813. messageSends: ["ifNil:", "+"]
  37814. }),
  37815. $globals.SemanticAnalyzer);
  37816. $core.addMethod(
  37817. $core.method({
  37818. selector: "popScope",
  37819. protocol: "scope",
  37820. fn: function (){
  37821. var self=this,$self=this;
  37822. return $core.withContext(function($ctx1) {
  37823. var $1,$receiver;
  37824. $1=$self["@currentScope"];
  37825. if(($receiver = $1) == null || $receiver.a$nil){
  37826. $1;
  37827. } else {
  37828. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  37829. $self["@currentScope"];
  37830. }
  37831. return self;
  37832. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  37833. },
  37834. args: [],
  37835. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  37836. referencedClasses: [],
  37837. messageSends: ["ifNotNil:", "outerScope"]
  37838. }),
  37839. $globals.SemanticAnalyzer);
  37840. $core.addMethod(
  37841. $core.method({
  37842. selector: "pushScope:",
  37843. protocol: "scope",
  37844. fn: function (aScope){
  37845. var self=this,$self=this;
  37846. return $core.withContext(function($ctx1) {
  37847. $recv(aScope)._outerScope_($self["@currentScope"]);
  37848. $self["@currentScope"]=aScope;
  37849. return self;
  37850. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  37851. },
  37852. args: ["aScope"],
  37853. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  37854. referencedClasses: [],
  37855. messageSends: ["outerScope:"]
  37856. }),
  37857. $globals.SemanticAnalyzer);
  37858. $core.addMethod(
  37859. $core.method({
  37860. selector: "theClass",
  37861. protocol: "accessing",
  37862. fn: function (){
  37863. var self=this,$self=this;
  37864. return $self["@theClass"];
  37865. },
  37866. args: [],
  37867. source: "theClass\x0a\x09^ theClass",
  37868. referencedClasses: [],
  37869. messageSends: []
  37870. }),
  37871. $globals.SemanticAnalyzer);
  37872. $core.addMethod(
  37873. $core.method({
  37874. selector: "theClass:",
  37875. protocol: "accessing",
  37876. fn: function (aClass){
  37877. var self=this,$self=this;
  37878. $self["@theClass"]=aClass;
  37879. return self;
  37880. },
  37881. args: ["aClass"],
  37882. source: "theClass: aClass\x0a\x09theClass := aClass",
  37883. referencedClasses: [],
  37884. messageSends: []
  37885. }),
  37886. $globals.SemanticAnalyzer);
  37887. $core.addMethod(
  37888. $core.method({
  37889. selector: "thePackage",
  37890. protocol: "accessing",
  37891. fn: function (){
  37892. var self=this,$self=this;
  37893. return $self["@thePackage"];
  37894. },
  37895. args: [],
  37896. source: "thePackage\x0a\x09^ thePackage",
  37897. referencedClasses: [],
  37898. messageSends: []
  37899. }),
  37900. $globals.SemanticAnalyzer);
  37901. $core.addMethod(
  37902. $core.method({
  37903. selector: "thePackage:",
  37904. protocol: "accessing",
  37905. fn: function (aPackage){
  37906. var self=this,$self=this;
  37907. $self["@thePackage"]=aPackage;
  37908. return self;
  37909. },
  37910. args: ["aPackage"],
  37911. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  37912. referencedClasses: [],
  37913. messageSends: []
  37914. }),
  37915. $globals.SemanticAnalyzer);
  37916. $core.addMethod(
  37917. $core.method({
  37918. selector: "validateVariableScope:",
  37919. protocol: "scope",
  37920. fn: function (aString){
  37921. var self=this,$self=this;
  37922. return $core.withContext(function($ctx1) {
  37923. var $1,$receiver;
  37924. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  37925. if(($receiver = $1) == null || $receiver.a$nil){
  37926. $1;
  37927. } else {
  37928. $self._errorShadowingVariable_(aString);
  37929. }
  37930. return self;
  37931. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  37932. },
  37933. args: ["aString"],
  37934. 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 ]",
  37935. referencedClasses: [],
  37936. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  37937. }),
  37938. $globals.SemanticAnalyzer);
  37939. $core.addMethod(
  37940. $core.method({
  37941. selector: "visitAssignmentNode:",
  37942. protocol: "visiting",
  37943. fn: function (aNode){
  37944. var self=this,$self=this;
  37945. return $core.withContext(function($ctx1) {
  37946. (
  37947. $ctx1.supercall = true,
  37948. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  37949. $ctx1.supercall = false;
  37950. $recv($recv(aNode)._left())._beAssigned();
  37951. return self;
  37952. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37953. },
  37954. args: ["aNode"],
  37955. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  37956. referencedClasses: [],
  37957. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  37958. }),
  37959. $globals.SemanticAnalyzer);
  37960. $core.addMethod(
  37961. $core.method({
  37962. selector: "visitBlockNode:",
  37963. protocol: "visiting",
  37964. fn: function (aNode){
  37965. var self=this,$self=this;
  37966. return $core.withContext(function($ctx1) {
  37967. $self._pushScope_($self._newBlockScope());
  37968. $recv(aNode)._scope_($self["@currentScope"]);
  37969. $recv($self["@currentScope"])._node_(aNode);
  37970. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  37971. $recv($recv(aNode)._parameters())._do_((function(each){
  37972. return $core.withContext(function($ctx2) {
  37973. $self._validateVariableScope_(each);
  37974. return $recv($self["@currentScope"])._addArg_(each);
  37975. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37976. }));
  37977. (
  37978. $ctx1.supercall = true,
  37979. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  37980. $ctx1.supercall = false;
  37981. $self._popScope();
  37982. return self;
  37983. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  37984. },
  37985. args: ["aNode"],
  37986. 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",
  37987. referencedClasses: [],
  37988. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  37989. }),
  37990. $globals.SemanticAnalyzer);
  37991. $core.addMethod(
  37992. $core.method({
  37993. selector: "visitCascadeNode:",
  37994. protocol: "visiting",
  37995. fn: function (aNode){
  37996. var self=this,$self=this;
  37997. return $core.withContext(function($ctx1) {
  37998. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  37999. (
  38000. $ctx1.supercall = true,
  38001. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38002. $ctx1.supercall = false;
  38003. return self;
  38004. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38005. },
  38006. args: ["aNode"],
  38007. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38008. referencedClasses: [],
  38009. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38010. }),
  38011. $globals.SemanticAnalyzer);
  38012. $core.addMethod(
  38013. $core.method({
  38014. selector: "visitMethodNode:",
  38015. protocol: "visiting",
  38016. fn: function (aNode){
  38017. var self=this,$self=this;
  38018. return $core.withContext(function($ctx1) {
  38019. $self._pushScope_($self._newMethodScope());
  38020. $recv(aNode)._scope_($self["@currentScope"]);
  38021. $recv($self["@currentScope"])._node_(aNode);
  38022. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38023. return $core.withContext(function($ctx2) {
  38024. return $recv($self["@currentScope"])._addIVar_(each);
  38025. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38026. }));
  38027. $ctx1.sendIdx["do:"]=1;
  38028. $recv($recv(aNode)._arguments())._do_((function(each){
  38029. return $core.withContext(function($ctx2) {
  38030. $self._validateVariableScope_(each);
  38031. return $recv($self["@currentScope"])._addArg_(each);
  38032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38033. }));
  38034. (
  38035. $ctx1.supercall = true,
  38036. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38037. $ctx1.supercall = false;
  38038. $recv(aNode)._classReferences_($self._classReferences());
  38039. $recv(aNode)._sendIndexes_($self._messageSends());
  38040. $self._popScope();
  38041. return aNode;
  38042. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38043. },
  38044. args: ["aNode"],
  38045. 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",
  38046. referencedClasses: [],
  38047. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38048. }),
  38049. $globals.SemanticAnalyzer);
  38050. $core.addMethod(
  38051. $core.method({
  38052. selector: "visitReturnNode:",
  38053. protocol: "visiting",
  38054. fn: function (aNode){
  38055. var self=this,$self=this;
  38056. return $core.withContext(function($ctx1) {
  38057. var $1;
  38058. $recv(aNode)._scope_($self["@currentScope"]);
  38059. $1=$recv($self["@currentScope"])._isMethodScope();
  38060. if($core.assert($1)){
  38061. $recv($self["@currentScope"])._localReturn_(true);
  38062. } else {
  38063. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38064. }
  38065. (
  38066. $ctx1.supercall = true,
  38067. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38068. $ctx1.supercall = false;
  38069. return self;
  38070. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38071. },
  38072. args: ["aNode"],
  38073. 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",
  38074. referencedClasses: [],
  38075. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38076. }),
  38077. $globals.SemanticAnalyzer);
  38078. $core.addMethod(
  38079. $core.method({
  38080. selector: "visitSendNode:",
  38081. protocol: "visiting",
  38082. fn: function (aNode){
  38083. var self=this,$self=this;
  38084. var sends;
  38085. return $core.withContext(function($ctx1) {
  38086. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38087. return $core.withContext(function($ctx2) {
  38088. return $recv($globals.OrderedCollection)._new();
  38089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38090. }));
  38091. $recv(sends)._add_(aNode);
  38092. $recv(aNode)._index_($recv(sends)._size());
  38093. (
  38094. $ctx1.supercall = true,
  38095. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38096. $ctx1.supercall = false;
  38097. return self;
  38098. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38099. },
  38100. args: ["aNode"],
  38101. 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",
  38102. referencedClasses: ["OrderedCollection"],
  38103. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38104. }),
  38105. $globals.SemanticAnalyzer);
  38106. $core.addMethod(
  38107. $core.method({
  38108. selector: "visitSequenceNode:",
  38109. protocol: "visiting",
  38110. fn: function (aNode){
  38111. var self=this,$self=this;
  38112. return $core.withContext(function($ctx1) {
  38113. $recv($recv(aNode)._temps())._do_((function(each){
  38114. return $core.withContext(function($ctx2) {
  38115. $self._validateVariableScope_(each);
  38116. return $recv($self["@currentScope"])._addTemp_(each);
  38117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38118. }));
  38119. (
  38120. $ctx1.supercall = true,
  38121. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38122. $ctx1.supercall = false;
  38123. return self;
  38124. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38125. },
  38126. args: ["aNode"],
  38127. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38128. referencedClasses: [],
  38129. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38130. }),
  38131. $globals.SemanticAnalyzer);
  38132. $core.addMethod(
  38133. $core.method({
  38134. selector: "visitVariableNode:",
  38135. protocol: "visiting",
  38136. fn: function (aNode){
  38137. var self=this,$self=this;
  38138. var binding;
  38139. return $core.withContext(function($ctx1) {
  38140. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38141. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38142. $1=binding;
  38143. if(($receiver = $1) == null || $receiver.a$nil){
  38144. $3=$recv(aNode)._value();
  38145. $ctx1.sendIdx["value"]=1;
  38146. $2=$recv($3)._isCapitalized();
  38147. if($core.assert($2)){
  38148. $4=$recv($globals.ClassRefVar)._new();
  38149. $ctx1.sendIdx["new"]=1;
  38150. $5=$recv(aNode)._value();
  38151. $ctx1.sendIdx["value"]=2;
  38152. $recv($4)._name_($5);
  38153. $ctx1.sendIdx["name:"]=1;
  38154. $6=$recv($4)._yourself();
  38155. $ctx1.sendIdx["yourself"]=1;
  38156. binding=$6;
  38157. binding;
  38158. $7=$self._classReferences();
  38159. $8=$recv(aNode)._value();
  38160. $ctx1.sendIdx["value"]=3;
  38161. $recv($7)._add_($8);
  38162. } else {
  38163. $self._errorUnknownVariable_(aNode);
  38164. $9=$recv($globals.UnknownVar)._new();
  38165. $recv($9)._name_($recv(aNode)._value());
  38166. binding=$recv($9)._yourself();
  38167. binding;
  38168. }
  38169. } else {
  38170. $1;
  38171. }
  38172. $recv(aNode)._binding_(binding);
  38173. return self;
  38174. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38175. },
  38176. args: ["aNode"],
  38177. 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.",
  38178. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38179. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38180. }),
  38181. $globals.SemanticAnalyzer);
  38182. $core.addMethod(
  38183. $core.method({
  38184. selector: "on:",
  38185. protocol: "instance creation",
  38186. fn: function (aClass){
  38187. var self=this,$self=this;
  38188. return $core.withContext(function($ctx1) {
  38189. var $1;
  38190. $1=$self._new();
  38191. $recv($1)._theClass_(aClass);
  38192. return $recv($1)._yourself();
  38193. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38194. },
  38195. args: ["aClass"],
  38196. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38197. referencedClasses: [],
  38198. messageSends: ["theClass:", "new", "yourself"]
  38199. }),
  38200. $globals.SemanticAnalyzer.a$cls);
  38201. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38202. $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";
  38203. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38204. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38205. $core.addMethod(
  38206. $core.method({
  38207. selector: "messageText",
  38208. protocol: "accessing",
  38209. fn: function (){
  38210. var self=this,$self=this;
  38211. return $core.withContext(function($ctx1) {
  38212. return " Invalid assignment to variable: ".__comma($self._variableName());
  38213. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38214. },
  38215. args: [],
  38216. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38217. referencedClasses: [],
  38218. messageSends: [",", "variableName"]
  38219. }),
  38220. $globals.InvalidAssignmentError);
  38221. $core.addMethod(
  38222. $core.method({
  38223. selector: "variableName",
  38224. protocol: "accessing",
  38225. fn: function (){
  38226. var self=this,$self=this;
  38227. return $self["@variableName"];
  38228. },
  38229. args: [],
  38230. source: "variableName\x0a\x09^ variableName",
  38231. referencedClasses: [],
  38232. messageSends: []
  38233. }),
  38234. $globals.InvalidAssignmentError);
  38235. $core.addMethod(
  38236. $core.method({
  38237. selector: "variableName:",
  38238. protocol: "accessing",
  38239. fn: function (aString){
  38240. var self=this,$self=this;
  38241. $self["@variableName"]=aString;
  38242. return self;
  38243. },
  38244. args: ["aString"],
  38245. source: "variableName: aString\x0a\x09variableName := aString",
  38246. referencedClasses: [],
  38247. messageSends: []
  38248. }),
  38249. $globals.InvalidAssignmentError);
  38250. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38251. $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.";
  38252. $core.addMethod(
  38253. $core.method({
  38254. selector: "messageText",
  38255. protocol: "accessing",
  38256. fn: function (){
  38257. var self=this,$self=this;
  38258. return $core.withContext(function($ctx1) {
  38259. var $1;
  38260. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38261. $ctx1.sendIdx[","]=1;
  38262. return $1;
  38263. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38264. },
  38265. args: [],
  38266. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38267. referencedClasses: [],
  38268. messageSends: [",", "variableName"]
  38269. }),
  38270. $globals.ShadowingVariableError);
  38271. $core.addMethod(
  38272. $core.method({
  38273. selector: "variableName",
  38274. protocol: "accessing",
  38275. fn: function (){
  38276. var self=this,$self=this;
  38277. return $self["@variableName"];
  38278. },
  38279. args: [],
  38280. source: "variableName\x0a\x09^ variableName",
  38281. referencedClasses: [],
  38282. messageSends: []
  38283. }),
  38284. $globals.ShadowingVariableError);
  38285. $core.addMethod(
  38286. $core.method({
  38287. selector: "variableName:",
  38288. protocol: "accessing",
  38289. fn: function (aString){
  38290. var self=this,$self=this;
  38291. $self["@variableName"]=aString;
  38292. return self;
  38293. },
  38294. args: ["aString"],
  38295. source: "variableName: aString\x0a\x09variableName := aString",
  38296. referencedClasses: [],
  38297. messageSends: []
  38298. }),
  38299. $globals.ShadowingVariableError);
  38300. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38301. $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.";
  38302. $core.addMethod(
  38303. $core.method({
  38304. selector: "messageText",
  38305. protocol: "accessing",
  38306. fn: function (){
  38307. var self=this,$self=this;
  38308. return $core.withContext(function($ctx1) {
  38309. var $1;
  38310. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38311. $ctx1.sendIdx[","]=1;
  38312. return $1;
  38313. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38314. },
  38315. args: [],
  38316. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38317. referencedClasses: [],
  38318. messageSends: [",", "variableName"]
  38319. }),
  38320. $globals.UnknownVariableError);
  38321. $core.addMethod(
  38322. $core.method({
  38323. selector: "variableName",
  38324. protocol: "accessing",
  38325. fn: function (){
  38326. var self=this,$self=this;
  38327. return $self["@variableName"];
  38328. },
  38329. args: [],
  38330. source: "variableName\x0a\x09^ variableName",
  38331. referencedClasses: [],
  38332. messageSends: []
  38333. }),
  38334. $globals.UnknownVariableError);
  38335. $core.addMethod(
  38336. $core.method({
  38337. selector: "variableName:",
  38338. protocol: "accessing",
  38339. fn: function (aString){
  38340. var self=this,$self=this;
  38341. $self["@variableName"]=aString;
  38342. return self;
  38343. },
  38344. args: ["aString"],
  38345. source: "variableName: aString\x0a\x09variableName := aString",
  38346. referencedClasses: [],
  38347. messageSends: []
  38348. }),
  38349. $globals.UnknownVariableError);
  38350. });
  38351. 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";
  38352. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38353. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38354. $core.addPackage("Compiler-IR");
  38355. ($core.packageDescriptors||$core.packages)["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  38356. ($core.packageDescriptors||$core.packages)["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38357. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38358. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38359. $core.addMethod(
  38360. $core.method({
  38361. selector: "alias:",
  38362. protocol: "visiting",
  38363. fn: function (aNode){
  38364. var self=this,$self=this;
  38365. var variable;
  38366. return $core.withContext(function($ctx1) {
  38367. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  38368. $1=$recv(aNode)._isImmutable();
  38369. if($core.assert($1)){
  38370. $2=$self._visit_(aNode);
  38371. $ctx1.sendIdx["visit:"]=1;
  38372. return $2;
  38373. }
  38374. $3=$recv($globals.IRVariable)._new();
  38375. $ctx1.sendIdx["new"]=1;
  38376. $5=$recv($globals.AliasVar)._new();
  38377. $ctx1.sendIdx["new"]=2;
  38378. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38379. $recv($3)._variable_($4);
  38380. $6=$recv($3)._yourself();
  38381. $ctx1.sendIdx["yourself"]=1;
  38382. variable=$6;
  38383. $7=$self._sequence();
  38384. $9=$recv($globals.IRAssignment)._new();
  38385. $recv($9)._add_(variable);
  38386. $ctx1.sendIdx["add:"]=2;
  38387. $recv($9)._add_($self._visit_(aNode));
  38388. $ctx1.sendIdx["add:"]=3;
  38389. $8=$recv($9)._yourself();
  38390. $recv($7)._add_($8);
  38391. $ctx1.sendIdx["add:"]=1;
  38392. $recv($recv($self._method())._internalVariables())._add_(variable);
  38393. return variable;
  38394. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38395. },
  38396. args: ["aNode"],
  38397. 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 sequence add: (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",
  38398. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38399. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  38400. }),
  38401. $globals.IRASTTranslator);
  38402. $core.addMethod(
  38403. $core.method({
  38404. selector: "aliasTemporally:",
  38405. protocol: "visiting",
  38406. fn: function (aCollection){
  38407. var self=this,$self=this;
  38408. var threshold,result;
  38409. return $core.withContext(function($ctx1) {
  38410. var $1,$2,$4,$3;
  38411. threshold=(0);
  38412. $recv(aCollection)._withIndexDo_((function(each,i){
  38413. return $core.withContext(function($ctx2) {
  38414. $1=$recv(each)._subtreeNeedsAliasing();
  38415. if($core.assert($1)){
  38416. threshold=i;
  38417. return threshold;
  38418. }
  38419. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38420. }));
  38421. $ctx1.sendIdx["withIndexDo:"]=1;
  38422. result=$recv($globals.OrderedCollection)._new();
  38423. $recv(aCollection)._withIndexDo_((function(each,i){
  38424. return $core.withContext(function($ctx2) {
  38425. $2=result;
  38426. $4=$recv(i).__lt_eq(threshold);
  38427. if($core.assert($4)){
  38428. $3=$self._alias_(each);
  38429. } else {
  38430. $3=$self._visit_(each);
  38431. }
  38432. return $recv($2)._add_($3);
  38433. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38434. }));
  38435. return result;
  38436. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38437. },
  38438. args: ["aCollection"],
  38439. 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",
  38440. referencedClasses: ["OrderedCollection"],
  38441. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38442. }),
  38443. $globals.IRASTTranslator);
  38444. $core.addMethod(
  38445. $core.method({
  38446. selector: "method",
  38447. protocol: "accessing",
  38448. fn: function (){
  38449. var self=this,$self=this;
  38450. return $self["@method"];
  38451. },
  38452. args: [],
  38453. source: "method\x0a\x09^ method",
  38454. referencedClasses: [],
  38455. messageSends: []
  38456. }),
  38457. $globals.IRASTTranslator);
  38458. $core.addMethod(
  38459. $core.method({
  38460. selector: "method:",
  38461. protocol: "accessing",
  38462. fn: function (anIRMethod){
  38463. var self=this,$self=this;
  38464. $self["@method"]=anIRMethod;
  38465. return self;
  38466. },
  38467. args: ["anIRMethod"],
  38468. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38469. referencedClasses: [],
  38470. messageSends: []
  38471. }),
  38472. $globals.IRASTTranslator);
  38473. $core.addMethod(
  38474. $core.method({
  38475. selector: "nextAlias",
  38476. protocol: "accessing",
  38477. fn: function (){
  38478. var self=this,$self=this;
  38479. return $core.withContext(function($ctx1) {
  38480. var $1,$receiver;
  38481. $1=$self["@nextAlias"];
  38482. if(($receiver = $1) == null || $receiver.a$nil){
  38483. $self["@nextAlias"]=(0);
  38484. $self["@nextAlias"];
  38485. } else {
  38486. $1;
  38487. }
  38488. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38489. return $recv($self["@nextAlias"])._asString();
  38490. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38491. },
  38492. args: [],
  38493. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38494. referencedClasses: [],
  38495. messageSends: ["ifNil:", "+", "asString"]
  38496. }),
  38497. $globals.IRASTTranslator);
  38498. $core.addMethod(
  38499. $core.method({
  38500. selector: "sequence",
  38501. protocol: "accessing",
  38502. fn: function (){
  38503. var self=this,$self=this;
  38504. return $self["@sequence"];
  38505. },
  38506. args: [],
  38507. source: "sequence\x0a\x09^ sequence",
  38508. referencedClasses: [],
  38509. messageSends: []
  38510. }),
  38511. $globals.IRASTTranslator);
  38512. $core.addMethod(
  38513. $core.method({
  38514. selector: "sequence:",
  38515. protocol: "accessing",
  38516. fn: function (anIRSequence){
  38517. var self=this,$self=this;
  38518. $self["@sequence"]=anIRSequence;
  38519. return self;
  38520. },
  38521. args: ["anIRSequence"],
  38522. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  38523. referencedClasses: [],
  38524. messageSends: []
  38525. }),
  38526. $globals.IRASTTranslator);
  38527. $core.addMethod(
  38528. $core.method({
  38529. selector: "source",
  38530. protocol: "accessing",
  38531. fn: function (){
  38532. var self=this,$self=this;
  38533. return $self["@source"];
  38534. },
  38535. args: [],
  38536. source: "source\x0a\x09^ source",
  38537. referencedClasses: [],
  38538. messageSends: []
  38539. }),
  38540. $globals.IRASTTranslator);
  38541. $core.addMethod(
  38542. $core.method({
  38543. selector: "source:",
  38544. protocol: "accessing",
  38545. fn: function (aString){
  38546. var self=this,$self=this;
  38547. $self["@source"]=aString;
  38548. return self;
  38549. },
  38550. args: ["aString"],
  38551. source: "source: aString\x0a\x09source := aString",
  38552. referencedClasses: [],
  38553. messageSends: []
  38554. }),
  38555. $globals.IRASTTranslator);
  38556. $core.addMethod(
  38557. $core.method({
  38558. selector: "theClass",
  38559. protocol: "accessing",
  38560. fn: function (){
  38561. var self=this,$self=this;
  38562. return $self["@theClass"];
  38563. },
  38564. args: [],
  38565. source: "theClass\x0a\x09^ theClass",
  38566. referencedClasses: [],
  38567. messageSends: []
  38568. }),
  38569. $globals.IRASTTranslator);
  38570. $core.addMethod(
  38571. $core.method({
  38572. selector: "theClass:",
  38573. protocol: "accessing",
  38574. fn: function (aClass){
  38575. var self=this,$self=this;
  38576. $self["@theClass"]=aClass;
  38577. return self;
  38578. },
  38579. args: ["aClass"],
  38580. source: "theClass: aClass\x0a\x09theClass := aClass",
  38581. referencedClasses: [],
  38582. messageSends: []
  38583. }),
  38584. $globals.IRASTTranslator);
  38585. $core.addMethod(
  38586. $core.method({
  38587. selector: "visitAssignmentNode:",
  38588. protocol: "visiting",
  38589. fn: function (aNode){
  38590. var self=this,$self=this;
  38591. var left,right,assignment;
  38592. return $core.withContext(function($ctx1) {
  38593. var $1,$3,$2;
  38594. right=$self._visit_($recv(aNode)._right());
  38595. $ctx1.sendIdx["visit:"]=1;
  38596. left=$self._visit_($recv(aNode)._left());
  38597. $1=$self._sequence();
  38598. $3=$recv($globals.IRAssignment)._new();
  38599. $recv($3)._add_(left);
  38600. $ctx1.sendIdx["add:"]=2;
  38601. $recv($3)._add_(right);
  38602. $2=$recv($3)._yourself();
  38603. $recv($1)._add_($2);
  38604. $ctx1.sendIdx["add:"]=1;
  38605. return left;
  38606. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  38607. },
  38608. args: ["aNode"],
  38609. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  38610. referencedClasses: ["IRAssignment"],
  38611. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  38612. }),
  38613. $globals.IRASTTranslator);
  38614. $core.addMethod(
  38615. $core.method({
  38616. selector: "visitBlockNode:",
  38617. protocol: "visiting",
  38618. fn: function (aNode){
  38619. var self=this,$self=this;
  38620. var closure;
  38621. return $core.withContext(function($ctx1) {
  38622. var $1,$2,$3,$5,$4,$6,$8,$7;
  38623. $1=$recv($globals.IRClosure)._new();
  38624. $ctx1.sendIdx["new"]=1;
  38625. $recv($1)._arguments_($recv(aNode)._parameters());
  38626. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  38627. $2=$recv(aNode)._scope();
  38628. $ctx1.sendIdx["scope"]=1;
  38629. $recv($1)._scope_($2);
  38630. $ctx1.sendIdx["scope:"]=1;
  38631. $3=$recv($1)._yourself();
  38632. $ctx1.sendIdx["yourself"]=1;
  38633. closure=$3;
  38634. $5=$recv(aNode)._scope();
  38635. $ctx1.sendIdx["scope"]=2;
  38636. $4=$recv($5)._temps();
  38637. $recv($4)._do_((function(each){
  38638. return $core.withContext(function($ctx2) {
  38639. $6=closure;
  38640. $8=$recv($globals.IRTempDeclaration)._new();
  38641. $recv($8)._name_($recv(each)._name());
  38642. $recv($8)._scope_($recv(aNode)._scope());
  38643. $7=$recv($8)._yourself();
  38644. return $recv($6)._add_($7);
  38645. $ctx2.sendIdx["add:"]=1;
  38646. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38647. }));
  38648. $ctx1.sendIdx["do:"]=1;
  38649. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38650. return $core.withContext(function($ctx2) {
  38651. return $recv(closure)._add_($self._visit_(each));
  38652. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38653. }));
  38654. return closure;
  38655. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  38656. },
  38657. args: ["aNode"],
  38658. 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",
  38659. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  38660. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  38661. }),
  38662. $globals.IRASTTranslator);
  38663. $core.addMethod(
  38664. $core.method({
  38665. selector: "visitBlockSequenceNode:",
  38666. protocol: "visiting",
  38667. fn: function (aNode){
  38668. var self=this,$self=this;
  38669. return $core.withContext(function($ctx1) {
  38670. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  38671. $1=$recv($globals.IRBlockSequence)._new();
  38672. $ctx1.sendIdx["new"]=1;
  38673. return $self._withSequence_do_($1,(function(){
  38674. return $core.withContext(function($ctx2) {
  38675. $2=$recv(aNode)._dagChildren();
  38676. $ctx2.sendIdx["dagChildren"]=1;
  38677. return $recv($2)._ifNotEmpty_((function(){
  38678. return $core.withContext(function($ctx3) {
  38679. $4=$recv(aNode)._dagChildren();
  38680. $ctx3.sendIdx["dagChildren"]=2;
  38681. $3=$recv($4)._allButLast();
  38682. $recv($3)._do_((function(each){
  38683. return $core.withContext(function($ctx4) {
  38684. $5=$self._sequence();
  38685. $ctx4.sendIdx["sequence"]=1;
  38686. $6=$self._visitOrAlias_(each);
  38687. $ctx4.sendIdx["visitOrAlias:"]=1;
  38688. return $recv($5)._add_($6);
  38689. $ctx4.sendIdx["add:"]=1;
  38690. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38691. }));
  38692. $9=$recv(aNode)._dagChildren();
  38693. $ctx3.sendIdx["dagChildren"]=3;
  38694. $8=$recv($9)._last();
  38695. $ctx3.sendIdx["last"]=1;
  38696. $7=$recv($8)._isReturnNode();
  38697. if($core.assert($7)){
  38698. return $recv($self._sequence())._add_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  38699. } else {
  38700. $10=$self._sequence();
  38701. $ctx3.sendIdx["sequence"]=2;
  38702. $12=$recv($globals.IRBlockReturn)._new();
  38703. $15=$recv(aNode)._dagChildren();
  38704. $ctx3.sendIdx["dagChildren"]=4;
  38705. $14=$recv($15)._last();
  38706. $ctx3.sendIdx["last"]=2;
  38707. $13=$self._visitOrAlias_($14);
  38708. $ctx3.sendIdx["visitOrAlias:"]=2;
  38709. $recv($12)._add_($13);
  38710. $ctx3.sendIdx["add:"]=3;
  38711. $11=$recv($12)._yourself();
  38712. return $recv($10)._add_($11);
  38713. $ctx3.sendIdx["add:"]=2;
  38714. }
  38715. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38716. }));
  38717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38718. }));
  38719. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38720. },
  38721. args: ["aNode"],
  38722. 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 sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode dagChildren last) ] ]]",
  38723. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  38724. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  38725. }),
  38726. $globals.IRASTTranslator);
  38727. $core.addMethod(
  38728. $core.method({
  38729. selector: "visitCascadeNode:",
  38730. protocol: "visiting",
  38731. fn: function (aNode){
  38732. var self=this,$self=this;
  38733. var receiver;
  38734. return $core.withContext(function($ctx1) {
  38735. var $1,$2,$4,$3;
  38736. receiver=$recv(aNode)._receiver();
  38737. $1=$recv(receiver)._isImmutable();
  38738. if(!$core.assert($1)){
  38739. var alias;
  38740. alias=$self._alias_(receiver);
  38741. alias;
  38742. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  38743. receiver;
  38744. }
  38745. $2=$recv(aNode)._dagChildren();
  38746. $ctx1.sendIdx["dagChildren"]=1;
  38747. $recv($2)._do_((function(each){
  38748. return $core.withContext(function($ctx2) {
  38749. return $recv(each)._receiver_(receiver);
  38750. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38751. }));
  38752. $ctx1.sendIdx["do:"]=1;
  38753. $4=$recv(aNode)._dagChildren();
  38754. $ctx1.sendIdx["dagChildren"]=2;
  38755. $3=$recv($4)._allButLast();
  38756. $recv($3)._do_((function(each){
  38757. return $core.withContext(function($ctx2) {
  38758. return $recv($self._sequence())._add_($self._visit_(each));
  38759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  38760. }));
  38761. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  38762. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  38763. },
  38764. args: ["aNode"],
  38765. 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 sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  38766. referencedClasses: ["VariableNode"],
  38767. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  38768. }),
  38769. $globals.IRASTTranslator);
  38770. $core.addMethod(
  38771. $core.method({
  38772. selector: "visitDynamicArrayNode:",
  38773. protocol: "visiting",
  38774. fn: function (aNode){
  38775. var self=this,$self=this;
  38776. var array;
  38777. return $core.withContext(function($ctx1) {
  38778. array=$recv($globals.IRDynamicArray)._new();
  38779. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38780. return $core.withContext(function($ctx2) {
  38781. return $recv(array)._add_(each);
  38782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38783. }));
  38784. return array;
  38785. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  38786. },
  38787. args: ["aNode"],
  38788. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  38789. referencedClasses: ["IRDynamicArray"],
  38790. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38791. }),
  38792. $globals.IRASTTranslator);
  38793. $core.addMethod(
  38794. $core.method({
  38795. selector: "visitDynamicDictionaryNode:",
  38796. protocol: "visiting",
  38797. fn: function (aNode){
  38798. var self=this,$self=this;
  38799. var dictionary;
  38800. return $core.withContext(function($ctx1) {
  38801. dictionary=$recv($globals.IRDynamicDictionary)._new();
  38802. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38803. return $core.withContext(function($ctx2) {
  38804. return $recv(dictionary)._add_(each);
  38805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38806. }));
  38807. return dictionary;
  38808. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  38809. },
  38810. args: ["aNode"],
  38811. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  38812. referencedClasses: ["IRDynamicDictionary"],
  38813. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  38814. }),
  38815. $globals.IRASTTranslator);
  38816. $core.addMethod(
  38817. $core.method({
  38818. selector: "visitJSStatementNode:",
  38819. protocol: "visiting",
  38820. fn: function (aNode){
  38821. var self=this,$self=this;
  38822. return $core.withContext(function($ctx1) {
  38823. var $1;
  38824. $1=$recv($globals.IRVerbatim)._new();
  38825. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  38826. return $recv($1)._yourself();
  38827. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38828. },
  38829. args: ["aNode"],
  38830. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  38831. referencedClasses: ["IRVerbatim"],
  38832. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  38833. }),
  38834. $globals.IRASTTranslator);
  38835. $core.addMethod(
  38836. $core.method({
  38837. selector: "visitMethodNode:",
  38838. protocol: "visiting",
  38839. fn: function (aNode){
  38840. var self=this,$self=this;
  38841. return $core.withContext(function($ctx1) {
  38842. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  38843. $2=$recv($globals.IRMethod)._new();
  38844. $ctx1.sendIdx["new"]=1;
  38845. $recv($2)._source_($recv($self._source())._crlfSanitized());
  38846. $ctx1.sendIdx["source:"]=1;
  38847. $recv($2)._theClass_($self._theClass());
  38848. $recv($2)._arguments_($recv(aNode)._arguments());
  38849. $recv($2)._selector_($recv(aNode)._selector());
  38850. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  38851. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  38852. $recv($2)._classReferences_($recv(aNode)._classReferences());
  38853. $3=$recv(aNode)._scope();
  38854. $ctx1.sendIdx["scope"]=1;
  38855. $recv($2)._scope_($3);
  38856. $ctx1.sendIdx["scope:"]=1;
  38857. $4=$recv($2)._yourself();
  38858. $ctx1.sendIdx["yourself"]=1;
  38859. $1=$4;
  38860. $self._method_($1);
  38861. $6=$recv(aNode)._scope();
  38862. $ctx1.sendIdx["scope"]=2;
  38863. $5=$recv($6)._temps();
  38864. $recv($5)._do_((function(each){
  38865. return $core.withContext(function($ctx2) {
  38866. $7=$self._method();
  38867. $ctx2.sendIdx["method"]=1;
  38868. $9=$recv($globals.IRTempDeclaration)._new();
  38869. $ctx2.sendIdx["new"]=2;
  38870. $recv($9)._name_($recv(each)._name());
  38871. $10=$recv(aNode)._scope();
  38872. $ctx2.sendIdx["scope"]=3;
  38873. $recv($9)._scope_($10);
  38874. $11=$recv($9)._yourself();
  38875. $ctx2.sendIdx["yourself"]=2;
  38876. $8=$11;
  38877. return $recv($7)._add_($8);
  38878. $ctx2.sendIdx["add:"]=1;
  38879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38880. }));
  38881. $ctx1.sendIdx["do:"]=1;
  38882. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38883. return $core.withContext(function($ctx2) {
  38884. $12=$self._method();
  38885. $ctx2.sendIdx["method"]=2;
  38886. return $recv($12)._add_($self._visit_(each));
  38887. $ctx2.sendIdx["add:"]=2;
  38888. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38889. }));
  38890. $14=$recv(aNode)._scope();
  38891. $ctx1.sendIdx["scope"]=4;
  38892. $13=$recv($14)._hasLocalReturn();
  38893. if(!$core.assert($13)){
  38894. $15=$self._method();
  38895. $ctx1.sendIdx["method"]=3;
  38896. $17=$recv($globals.IRReturn)._new();
  38897. $ctx1.sendIdx["new"]=3;
  38898. $19=$recv($globals.IRVariable)._new();
  38899. $ctx1.sendIdx["new"]=4;
  38900. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  38901. $20=$recv($19)._yourself();
  38902. $ctx1.sendIdx["yourself"]=3;
  38903. $18=$20;
  38904. $recv($17)._add_($18);
  38905. $ctx1.sendIdx["add:"]=4;
  38906. $21=$recv($17)._yourself();
  38907. $ctx1.sendIdx["yourself"]=4;
  38908. $16=$21;
  38909. $recv($15)._add_($16);
  38910. $ctx1.sendIdx["add:"]=3;
  38911. $23=$recv($globals.IRVerbatim)._new();
  38912. $recv($23)._source_("");
  38913. $22=$recv($23)._yourself();
  38914. $recv($15)._add_($22);
  38915. }
  38916. return $self._method();
  38917. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  38918. },
  38919. args: ["aNode"],
  38920. 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: ''; yourself) ].\x0a\x0a\x09^ self method",
  38921. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  38922. 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"]
  38923. }),
  38924. $globals.IRASTTranslator);
  38925. $core.addMethod(
  38926. $core.method({
  38927. selector: "visitOrAlias:",
  38928. protocol: "visiting",
  38929. fn: function (aNode){
  38930. var self=this,$self=this;
  38931. return $core.withContext(function($ctx1) {
  38932. var $1;
  38933. $1=$recv(aNode)._shouldBeAliased();
  38934. if($core.assert($1)){
  38935. return $self._alias_(aNode);
  38936. } else {
  38937. return $self._visit_(aNode);
  38938. }
  38939. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  38940. },
  38941. args: ["aNode"],
  38942. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  38943. referencedClasses: [],
  38944. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  38945. }),
  38946. $globals.IRASTTranslator);
  38947. $core.addMethod(
  38948. $core.method({
  38949. selector: "visitReturnNode:",
  38950. protocol: "visiting",
  38951. fn: function (aNode){
  38952. var self=this,$self=this;
  38953. var return_;
  38954. return $core.withContext(function($ctx1) {
  38955. var $1;
  38956. $1=$recv(aNode)._nonLocalReturn();
  38957. if($core.assert($1)){
  38958. return_=$recv($globals.IRNonLocalReturn)._new();
  38959. $ctx1.sendIdx["new"]=1;
  38960. } else {
  38961. return_=$recv($globals.IRReturn)._new();
  38962. }
  38963. $recv(return_)._scope_($recv(aNode)._scope());
  38964. $recv($recv(aNode)._dagChildren())._do_((function(each){
  38965. return $core.withContext(function($ctx2) {
  38966. return $recv(return_)._add_($self._visitOrAlias_(each));
  38967. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  38968. }));
  38969. return return_;
  38970. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  38971. },
  38972. args: ["aNode"],
  38973. 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",
  38974. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  38975. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  38976. }),
  38977. $globals.IRASTTranslator);
  38978. $core.addMethod(
  38979. $core.method({
  38980. selector: "visitSendNode:",
  38981. protocol: "visiting",
  38982. fn: function (aNode){
  38983. var self=this,$self=this;
  38984. var send;
  38985. return $core.withContext(function($ctx1) {
  38986. var $1;
  38987. send=$recv($globals.IRSend)._new();
  38988. $1=send;
  38989. $recv($1)._selector_($recv(aNode)._selector());
  38990. $recv($1)._index_($recv(aNode)._index());
  38991. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  38992. return $core.withContext(function($ctx2) {
  38993. return $recv(send)._add_(each);
  38994. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38995. }));
  38996. return send;
  38997. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  38998. },
  38999. args: ["aNode"],
  39000. 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",
  39001. referencedClasses: ["IRSend"],
  39002. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39003. }),
  39004. $globals.IRASTTranslator);
  39005. $core.addMethod(
  39006. $core.method({
  39007. selector: "visitSequenceNode:",
  39008. protocol: "visiting",
  39009. fn: function (aNode){
  39010. var self=this,$self=this;
  39011. return $core.withContext(function($ctx1) {
  39012. var $1;
  39013. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39014. return $core.withContext(function($ctx2) {
  39015. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39016. var instruction;
  39017. return $core.withContext(function($ctx3) {
  39018. instruction=$self._visitOrAlias_(each);
  39019. instruction;
  39020. $1=$recv(instruction)._isVariable();
  39021. if(!$core.assert($1)){
  39022. return $recv($self._sequence())._add_(instruction);
  39023. }
  39024. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  39025. }));
  39026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39027. }));
  39028. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39029. },
  39030. args: ["aNode"],
  39031. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode dagChildren do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  39032. referencedClasses: ["IRSequence"],
  39033. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  39034. }),
  39035. $globals.IRASTTranslator);
  39036. $core.addMethod(
  39037. $core.method({
  39038. selector: "visitValueNode:",
  39039. protocol: "visiting",
  39040. fn: function (aNode){
  39041. var self=this,$self=this;
  39042. return $core.withContext(function($ctx1) {
  39043. var $1;
  39044. $1=$recv($globals.IRValue)._new();
  39045. $recv($1)._value_($recv(aNode)._value());
  39046. return $recv($1)._yourself();
  39047. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39048. },
  39049. args: ["aNode"],
  39050. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39051. referencedClasses: ["IRValue"],
  39052. messageSends: ["value:", "new", "value", "yourself"]
  39053. }),
  39054. $globals.IRASTTranslator);
  39055. $core.addMethod(
  39056. $core.method({
  39057. selector: "visitVariableNode:",
  39058. protocol: "visiting",
  39059. fn: function (aNode){
  39060. var self=this,$self=this;
  39061. return $core.withContext(function($ctx1) {
  39062. var $1;
  39063. $1=$recv($globals.IRVariable)._new();
  39064. $recv($1)._variable_($recv(aNode)._binding());
  39065. return $recv($1)._yourself();
  39066. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39067. },
  39068. args: ["aNode"],
  39069. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39070. referencedClasses: ["IRVariable"],
  39071. messageSends: ["variable:", "new", "binding", "yourself"]
  39072. }),
  39073. $globals.IRASTTranslator);
  39074. $core.addMethod(
  39075. $core.method({
  39076. selector: "withSequence:do:",
  39077. protocol: "accessing",
  39078. fn: function (aSequence,aBlock){
  39079. var self=this,$self=this;
  39080. var outerSequence;
  39081. return $core.withContext(function($ctx1) {
  39082. outerSequence=$self._sequence();
  39083. $self._sequence_(aSequence);
  39084. $ctx1.sendIdx["sequence:"]=1;
  39085. $recv(aBlock)._value();
  39086. $self._sequence_(outerSequence);
  39087. return aSequence;
  39088. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39089. },
  39090. args: ["aSequence", "aBlock"],
  39091. 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",
  39092. referencedClasses: [],
  39093. messageSends: ["sequence", "sequence:", "value"]
  39094. }),
  39095. $globals.IRASTTranslator);
  39096. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39097. $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.";
  39098. $core.addMethod(
  39099. $core.method({
  39100. selector: "add:",
  39101. protocol: "building",
  39102. fn: function (anObject){
  39103. var self=this,$self=this;
  39104. return $core.withContext(function($ctx1) {
  39105. $recv(anObject)._parent_(self);
  39106. return $recv($self._dagChildren())._add_(anObject);
  39107. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39108. },
  39109. args: ["anObject"],
  39110. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39111. referencedClasses: [],
  39112. messageSends: ["parent:", "add:", "dagChildren"]
  39113. }),
  39114. $globals.IRInstruction);
  39115. $core.addMethod(
  39116. $core.method({
  39117. selector: "isClosure",
  39118. protocol: "testing",
  39119. fn: function (){
  39120. var self=this,$self=this;
  39121. return false;
  39122. },
  39123. args: [],
  39124. source: "isClosure\x0a\x09^ false",
  39125. referencedClasses: [],
  39126. messageSends: []
  39127. }),
  39128. $globals.IRInstruction);
  39129. $core.addMethod(
  39130. $core.method({
  39131. selector: "isInlined",
  39132. protocol: "testing",
  39133. fn: function (){
  39134. var self=this,$self=this;
  39135. return false;
  39136. },
  39137. args: [],
  39138. source: "isInlined\x0a\x09^ false",
  39139. referencedClasses: [],
  39140. messageSends: []
  39141. }),
  39142. $globals.IRInstruction);
  39143. $core.addMethod(
  39144. $core.method({
  39145. selector: "isMethod",
  39146. protocol: "testing",
  39147. fn: function (){
  39148. var self=this,$self=this;
  39149. return false;
  39150. },
  39151. args: [],
  39152. source: "isMethod\x0a\x09^ false",
  39153. referencedClasses: [],
  39154. messageSends: []
  39155. }),
  39156. $globals.IRInstruction);
  39157. $core.addMethod(
  39158. $core.method({
  39159. selector: "isSelf",
  39160. protocol: "testing",
  39161. fn: function (){
  39162. var self=this,$self=this;
  39163. return false;
  39164. },
  39165. args: [],
  39166. source: "isSelf\x0a\x09^ false",
  39167. referencedClasses: [],
  39168. messageSends: []
  39169. }),
  39170. $globals.IRInstruction);
  39171. $core.addMethod(
  39172. $core.method({
  39173. selector: "isSend",
  39174. protocol: "testing",
  39175. fn: function (){
  39176. var self=this,$self=this;
  39177. return false;
  39178. },
  39179. args: [],
  39180. source: "isSend\x0a\x09^ false",
  39181. referencedClasses: [],
  39182. messageSends: []
  39183. }),
  39184. $globals.IRInstruction);
  39185. $core.addMethod(
  39186. $core.method({
  39187. selector: "isSequence",
  39188. protocol: "testing",
  39189. fn: function (){
  39190. var self=this,$self=this;
  39191. return false;
  39192. },
  39193. args: [],
  39194. source: "isSequence\x0a\x09^ false",
  39195. referencedClasses: [],
  39196. messageSends: []
  39197. }),
  39198. $globals.IRInstruction);
  39199. $core.addMethod(
  39200. $core.method({
  39201. selector: "isSuper",
  39202. protocol: "testing",
  39203. fn: function (){
  39204. var self=this,$self=this;
  39205. return false;
  39206. },
  39207. args: [],
  39208. source: "isSuper\x0a\x09^ false",
  39209. referencedClasses: [],
  39210. messageSends: []
  39211. }),
  39212. $globals.IRInstruction);
  39213. $core.addMethod(
  39214. $core.method({
  39215. selector: "isTempDeclaration",
  39216. protocol: "testing",
  39217. fn: function (){
  39218. var self=this,$self=this;
  39219. return false;
  39220. },
  39221. args: [],
  39222. source: "isTempDeclaration\x0a\x09^ false",
  39223. referencedClasses: [],
  39224. messageSends: []
  39225. }),
  39226. $globals.IRInstruction);
  39227. $core.addMethod(
  39228. $core.method({
  39229. selector: "isVariable",
  39230. protocol: "testing",
  39231. fn: function (){
  39232. var self=this,$self=this;
  39233. return false;
  39234. },
  39235. args: [],
  39236. source: "isVariable\x0a\x09^ false",
  39237. referencedClasses: [],
  39238. messageSends: []
  39239. }),
  39240. $globals.IRInstruction);
  39241. $core.addMethod(
  39242. $core.method({
  39243. selector: "method",
  39244. protocol: "accessing",
  39245. fn: function (){
  39246. var self=this,$self=this;
  39247. return $core.withContext(function($ctx1) {
  39248. return $recv($self._parent())._method();
  39249. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39250. },
  39251. args: [],
  39252. source: "method\x0a\x09^ self parent method",
  39253. referencedClasses: [],
  39254. messageSends: ["method", "parent"]
  39255. }),
  39256. $globals.IRInstruction);
  39257. $core.addMethod(
  39258. $core.method({
  39259. selector: "needsBoxingAsReceiver",
  39260. protocol: "testing",
  39261. fn: function (){
  39262. var self=this,$self=this;
  39263. return true;
  39264. },
  39265. args: [],
  39266. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39267. referencedClasses: [],
  39268. messageSends: []
  39269. }),
  39270. $globals.IRInstruction);
  39271. $core.addMethod(
  39272. $core.method({
  39273. selector: "parent",
  39274. protocol: "accessing",
  39275. fn: function (){
  39276. var self=this,$self=this;
  39277. return $self["@parent"];
  39278. },
  39279. args: [],
  39280. source: "parent\x0a\x09^ parent",
  39281. referencedClasses: [],
  39282. messageSends: []
  39283. }),
  39284. $globals.IRInstruction);
  39285. $core.addMethod(
  39286. $core.method({
  39287. selector: "parent:",
  39288. protocol: "accessing",
  39289. fn: function (anIRInstruction){
  39290. var self=this,$self=this;
  39291. $self["@parent"]=anIRInstruction;
  39292. return self;
  39293. },
  39294. args: ["anIRInstruction"],
  39295. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39296. referencedClasses: [],
  39297. messageSends: []
  39298. }),
  39299. $globals.IRInstruction);
  39300. $core.addMethod(
  39301. $core.method({
  39302. selector: "remove:",
  39303. protocol: "building",
  39304. fn: function (anIRInstruction){
  39305. var self=this,$self=this;
  39306. return $core.withContext(function($ctx1) {
  39307. $recv($self._dagChildren())._remove_(anIRInstruction);
  39308. return self;
  39309. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39310. },
  39311. args: ["anIRInstruction"],
  39312. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39313. referencedClasses: [],
  39314. messageSends: ["remove:", "dagChildren"]
  39315. }),
  39316. $globals.IRInstruction);
  39317. $core.addMethod(
  39318. $core.method({
  39319. selector: "replace:with:",
  39320. protocol: "building",
  39321. fn: function (anIRInstruction,anotherIRInstruction){
  39322. var self=this,$self=this;
  39323. return $core.withContext(function($ctx1) {
  39324. var $1;
  39325. $recv(anotherIRInstruction)._parent_(self);
  39326. $1=$self._dagChildren();
  39327. $ctx1.sendIdx["dagChildren"]=1;
  39328. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39329. return self;
  39330. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39331. },
  39332. args: ["anIRInstruction", "anotherIRInstruction"],
  39333. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39334. referencedClasses: [],
  39335. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39336. }),
  39337. $globals.IRInstruction);
  39338. $core.addMethod(
  39339. $core.method({
  39340. selector: "replaceWith:",
  39341. protocol: "building",
  39342. fn: function (anIRInstruction){
  39343. var self=this,$self=this;
  39344. return $core.withContext(function($ctx1) {
  39345. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39346. return self;
  39347. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39348. },
  39349. args: ["anIRInstruction"],
  39350. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39351. referencedClasses: [],
  39352. messageSends: ["replace:with:", "parent"]
  39353. }),
  39354. $globals.IRInstruction);
  39355. $core.addMethod(
  39356. $core.method({
  39357. selector: "scope",
  39358. protocol: "accessing",
  39359. fn: function (){
  39360. var self=this,$self=this;
  39361. return $core.withContext(function($ctx1) {
  39362. var $1,$receiver;
  39363. $1=$self._parent();
  39364. if(($receiver = $1) == null || $receiver.a$nil){
  39365. return $1;
  39366. } else {
  39367. var node;
  39368. node=$receiver;
  39369. return $recv(node)._scope();
  39370. }
  39371. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39372. },
  39373. args: [],
  39374. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39375. referencedClasses: [],
  39376. messageSends: ["ifNotNil:", "parent", "scope"]
  39377. }),
  39378. $globals.IRInstruction);
  39379. $core.addMethod(
  39380. $core.method({
  39381. selector: "yieldsValue",
  39382. protocol: "testing",
  39383. fn: function (){
  39384. var self=this,$self=this;
  39385. return true;
  39386. },
  39387. args: [],
  39388. source: "yieldsValue\x0a\x09^ true",
  39389. referencedClasses: [],
  39390. messageSends: []
  39391. }),
  39392. $globals.IRInstruction);
  39393. $core.addMethod(
  39394. $core.method({
  39395. selector: "on:",
  39396. protocol: "instance creation",
  39397. fn: function (aBuilder){
  39398. var self=this,$self=this;
  39399. return $core.withContext(function($ctx1) {
  39400. var $1;
  39401. $1=$self._new();
  39402. $recv($1)._builder_(aBuilder);
  39403. return $recv($1)._yourself();
  39404. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39405. },
  39406. args: ["aBuilder"],
  39407. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39408. referencedClasses: [],
  39409. messageSends: ["builder:", "new", "yourself"]
  39410. }),
  39411. $globals.IRInstruction.a$cls);
  39412. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39413. $core.addMethod(
  39414. $core.method({
  39415. selector: "acceptDagVisitor:",
  39416. protocol: "visiting",
  39417. fn: function (aVisitor){
  39418. var self=this,$self=this;
  39419. return $core.withContext(function($ctx1) {
  39420. return $recv(aVisitor)._visitIRAssignment_(self);
  39421. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39422. },
  39423. args: ["aVisitor"],
  39424. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39425. referencedClasses: [],
  39426. messageSends: ["visitIRAssignment:"]
  39427. }),
  39428. $globals.IRAssignment);
  39429. $core.addMethod(
  39430. $core.method({
  39431. selector: "left",
  39432. protocol: "accessing",
  39433. fn: function (){
  39434. var self=this,$self=this;
  39435. return $core.withContext(function($ctx1) {
  39436. return $recv($self._dagChildren())._first();
  39437. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39438. },
  39439. args: [],
  39440. source: "left\x0a\x09^ self dagChildren first",
  39441. referencedClasses: [],
  39442. messageSends: ["first", "dagChildren"]
  39443. }),
  39444. $globals.IRAssignment);
  39445. $core.addMethod(
  39446. $core.method({
  39447. selector: "right",
  39448. protocol: "accessing",
  39449. fn: function (){
  39450. var self=this,$self=this;
  39451. return $core.withContext(function($ctx1) {
  39452. return $recv($self._dagChildren())._last();
  39453. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39454. },
  39455. args: [],
  39456. source: "right\x0a\x09^ self dagChildren last",
  39457. referencedClasses: [],
  39458. messageSends: ["last", "dagChildren"]
  39459. }),
  39460. $globals.IRAssignment);
  39461. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39462. $core.addMethod(
  39463. $core.method({
  39464. selector: "acceptDagVisitor:",
  39465. protocol: "visiting",
  39466. fn: function (aVisitor){
  39467. var self=this,$self=this;
  39468. return $core.withContext(function($ctx1) {
  39469. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39470. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39471. },
  39472. args: ["aVisitor"],
  39473. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39474. referencedClasses: [],
  39475. messageSends: ["visitIRDynamicArray:"]
  39476. }),
  39477. $globals.IRDynamicArray);
  39478. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39479. $core.addMethod(
  39480. $core.method({
  39481. selector: "acceptDagVisitor:",
  39482. protocol: "visiting",
  39483. fn: function (aVisitor){
  39484. var self=this,$self=this;
  39485. return $core.withContext(function($ctx1) {
  39486. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39487. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39488. },
  39489. args: ["aVisitor"],
  39490. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39491. referencedClasses: [],
  39492. messageSends: ["visitIRDynamicDictionary:"]
  39493. }),
  39494. $globals.IRDynamicDictionary);
  39495. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39496. $core.addMethod(
  39497. $core.method({
  39498. selector: "scope",
  39499. protocol: "accessing",
  39500. fn: function (){
  39501. var self=this,$self=this;
  39502. return $self["@scope"];
  39503. },
  39504. args: [],
  39505. source: "scope\x0a\x09^ scope",
  39506. referencedClasses: [],
  39507. messageSends: []
  39508. }),
  39509. $globals.IRScopedInstruction);
  39510. $core.addMethod(
  39511. $core.method({
  39512. selector: "scope:",
  39513. protocol: "accessing",
  39514. fn: function (aScope){
  39515. var self=this,$self=this;
  39516. $self["@scope"]=aScope;
  39517. return self;
  39518. },
  39519. args: ["aScope"],
  39520. source: "scope: aScope\x0a\x09scope := aScope",
  39521. referencedClasses: [],
  39522. messageSends: []
  39523. }),
  39524. $globals.IRScopedInstruction);
  39525. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  39526. $core.addMethod(
  39527. $core.method({
  39528. selector: "arguments",
  39529. protocol: "accessing",
  39530. fn: function (){
  39531. var self=this,$self=this;
  39532. return $core.withContext(function($ctx1) {
  39533. var $1,$receiver;
  39534. $1=$self["@arguments"];
  39535. if(($receiver = $1) == null || $receiver.a$nil){
  39536. return [];
  39537. } else {
  39538. return $1;
  39539. }
  39540. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  39541. },
  39542. args: [],
  39543. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  39544. referencedClasses: [],
  39545. messageSends: ["ifNil:"]
  39546. }),
  39547. $globals.IRClosureInstruction);
  39548. $core.addMethod(
  39549. $core.method({
  39550. selector: "arguments:",
  39551. protocol: "accessing",
  39552. fn: function (aCollection){
  39553. var self=this,$self=this;
  39554. $self["@arguments"]=aCollection;
  39555. return self;
  39556. },
  39557. args: ["aCollection"],
  39558. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  39559. referencedClasses: [],
  39560. messageSends: []
  39561. }),
  39562. $globals.IRClosureInstruction);
  39563. $core.addMethod(
  39564. $core.method({
  39565. selector: "locals",
  39566. protocol: "accessing",
  39567. fn: function (){
  39568. var self=this,$self=this;
  39569. return $core.withContext(function($ctx1) {
  39570. var $1;
  39571. $1=$recv($self._arguments())._copy();
  39572. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  39573. return $core.withContext(function($ctx2) {
  39574. return $recv(each)._name();
  39575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39576. })));
  39577. return $recv($1)._yourself();
  39578. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  39579. },
  39580. args: [],
  39581. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  39582. referencedClasses: [],
  39583. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  39584. }),
  39585. $globals.IRClosureInstruction);
  39586. $core.addMethod(
  39587. $core.method({
  39588. selector: "requiresSmalltalkContext",
  39589. protocol: "accessing",
  39590. fn: function (){
  39591. var self=this,$self=this;
  39592. return $core.withContext(function($ctx1) {
  39593. var $1,$receiver;
  39594. $1=$self["@requiresSmalltalkContext"];
  39595. if(($receiver = $1) == null || $receiver.a$nil){
  39596. return false;
  39597. } else {
  39598. return $1;
  39599. }
  39600. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  39601. },
  39602. args: [],
  39603. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  39604. referencedClasses: [],
  39605. messageSends: ["ifNil:"]
  39606. }),
  39607. $globals.IRClosureInstruction);
  39608. $core.addMethod(
  39609. $core.method({
  39610. selector: "requiresSmalltalkContext:",
  39611. protocol: "accessing",
  39612. fn: function (anObject){
  39613. var self=this,$self=this;
  39614. $self["@requiresSmalltalkContext"]=anObject;
  39615. return self;
  39616. },
  39617. args: ["anObject"],
  39618. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  39619. referencedClasses: [],
  39620. messageSends: []
  39621. }),
  39622. $globals.IRClosureInstruction);
  39623. $core.addMethod(
  39624. $core.method({
  39625. selector: "scope:",
  39626. protocol: "accessing",
  39627. fn: function (aScope){
  39628. var self=this,$self=this;
  39629. return $core.withContext(function($ctx1) {
  39630. (
  39631. $ctx1.supercall = true,
  39632. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  39633. $ctx1.supercall = false;
  39634. $recv(aScope)._instruction_(self);
  39635. return self;
  39636. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  39637. },
  39638. args: ["aScope"],
  39639. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  39640. referencedClasses: [],
  39641. messageSends: ["scope:", "instruction:"]
  39642. }),
  39643. $globals.IRClosureInstruction);
  39644. $core.addMethod(
  39645. $core.method({
  39646. selector: "tempDeclarations",
  39647. protocol: "accessing",
  39648. fn: function (){
  39649. var self=this,$self=this;
  39650. return $core.withContext(function($ctx1) {
  39651. return $recv($self._dagChildren())._select_((function(each){
  39652. return $core.withContext(function($ctx2) {
  39653. return $recv(each)._isTempDeclaration();
  39654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39655. }));
  39656. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  39657. },
  39658. args: [],
  39659. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  39660. referencedClasses: [],
  39661. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  39662. }),
  39663. $globals.IRClosureInstruction);
  39664. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  39665. $core.addMethod(
  39666. $core.method({
  39667. selector: "acceptDagVisitor:",
  39668. protocol: "visiting",
  39669. fn: function (aVisitor){
  39670. var self=this,$self=this;
  39671. return $core.withContext(function($ctx1) {
  39672. return $recv(aVisitor)._visitIRClosure_(self);
  39673. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  39674. },
  39675. args: ["aVisitor"],
  39676. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  39677. referencedClasses: [],
  39678. messageSends: ["visitIRClosure:"]
  39679. }),
  39680. $globals.IRClosure);
  39681. $core.addMethod(
  39682. $core.method({
  39683. selector: "isClosure",
  39684. protocol: "testing",
  39685. fn: function (){
  39686. var self=this,$self=this;
  39687. return true;
  39688. },
  39689. args: [],
  39690. source: "isClosure\x0a\x09^ true",
  39691. referencedClasses: [],
  39692. messageSends: []
  39693. }),
  39694. $globals.IRClosure);
  39695. $core.addMethod(
  39696. $core.method({
  39697. selector: "sequence",
  39698. protocol: "accessing",
  39699. fn: function (){
  39700. var self=this,$self=this;
  39701. return $core.withContext(function($ctx1) {
  39702. return $recv($self._dagChildren())._last();
  39703. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  39704. },
  39705. args: [],
  39706. source: "sequence\x0a\x09^ self dagChildren last",
  39707. referencedClasses: [],
  39708. messageSends: ["last", "dagChildren"]
  39709. }),
  39710. $globals.IRClosure);
  39711. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  39712. $globals.IRMethod.comment="I am a method instruction";
  39713. $core.addMethod(
  39714. $core.method({
  39715. selector: "acceptDagVisitor:",
  39716. protocol: "visiting",
  39717. fn: function (aVisitor){
  39718. var self=this,$self=this;
  39719. return $core.withContext(function($ctx1) {
  39720. return $recv(aVisitor)._visitIRMethod_(self);
  39721. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  39722. },
  39723. args: ["aVisitor"],
  39724. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  39725. referencedClasses: [],
  39726. messageSends: ["visitIRMethod:"]
  39727. }),
  39728. $globals.IRMethod);
  39729. $core.addMethod(
  39730. $core.method({
  39731. selector: "classReferences",
  39732. protocol: "accessing",
  39733. fn: function (){
  39734. var self=this,$self=this;
  39735. return $self["@classReferences"];
  39736. },
  39737. args: [],
  39738. source: "classReferences\x0a\x09^ classReferences",
  39739. referencedClasses: [],
  39740. messageSends: []
  39741. }),
  39742. $globals.IRMethod);
  39743. $core.addMethod(
  39744. $core.method({
  39745. selector: "classReferences:",
  39746. protocol: "accessing",
  39747. fn: function (aCollection){
  39748. var self=this,$self=this;
  39749. $self["@classReferences"]=aCollection;
  39750. return self;
  39751. },
  39752. args: ["aCollection"],
  39753. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  39754. referencedClasses: [],
  39755. messageSends: []
  39756. }),
  39757. $globals.IRMethod);
  39758. $core.addMethod(
  39759. $core.method({
  39760. selector: "internalVariables",
  39761. protocol: "accessing",
  39762. fn: function (){
  39763. var self=this,$self=this;
  39764. return $core.withContext(function($ctx1) {
  39765. var $1,$receiver;
  39766. $1=$self["@internalVariables"];
  39767. if(($receiver = $1) == null || $receiver.a$nil){
  39768. $self["@internalVariables"]=$recv($globals.Set)._new();
  39769. return $self["@internalVariables"];
  39770. } else {
  39771. return $1;
  39772. }
  39773. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  39774. },
  39775. args: [],
  39776. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  39777. referencedClasses: ["Set"],
  39778. messageSends: ["ifNil:", "new"]
  39779. }),
  39780. $globals.IRMethod);
  39781. $core.addMethod(
  39782. $core.method({
  39783. selector: "isMethod",
  39784. protocol: "testing",
  39785. fn: function (){
  39786. var self=this,$self=this;
  39787. return true;
  39788. },
  39789. args: [],
  39790. source: "isMethod\x0a\x09^ true",
  39791. referencedClasses: [],
  39792. messageSends: []
  39793. }),
  39794. $globals.IRMethod);
  39795. $core.addMethod(
  39796. $core.method({
  39797. selector: "messageSends",
  39798. protocol: "accessing",
  39799. fn: function (){
  39800. var self=this,$self=this;
  39801. return $core.withContext(function($ctx1) {
  39802. return $recv($self._sendIndexes())._keys();
  39803. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  39804. },
  39805. args: [],
  39806. source: "messageSends\x0a\x09^ self sendIndexes keys",
  39807. referencedClasses: [],
  39808. messageSends: ["keys", "sendIndexes"]
  39809. }),
  39810. $globals.IRMethod);
  39811. $core.addMethod(
  39812. $core.method({
  39813. selector: "method",
  39814. protocol: "accessing",
  39815. fn: function (){
  39816. var self=this,$self=this;
  39817. return self;
  39818. },
  39819. args: [],
  39820. source: "method\x0a\x09^ self",
  39821. referencedClasses: [],
  39822. messageSends: []
  39823. }),
  39824. $globals.IRMethod);
  39825. $core.addMethod(
  39826. $core.method({
  39827. selector: "selector",
  39828. protocol: "accessing",
  39829. fn: function (){
  39830. var self=this,$self=this;
  39831. return $self["@selector"];
  39832. },
  39833. args: [],
  39834. source: "selector\x0a\x09^ selector",
  39835. referencedClasses: [],
  39836. messageSends: []
  39837. }),
  39838. $globals.IRMethod);
  39839. $core.addMethod(
  39840. $core.method({
  39841. selector: "selector:",
  39842. protocol: "accessing",
  39843. fn: function (aString){
  39844. var self=this,$self=this;
  39845. $self["@selector"]=aString;
  39846. return self;
  39847. },
  39848. args: ["aString"],
  39849. source: "selector: aString\x0a\x09selector := aString",
  39850. referencedClasses: [],
  39851. messageSends: []
  39852. }),
  39853. $globals.IRMethod);
  39854. $core.addMethod(
  39855. $core.method({
  39856. selector: "sendIndexes",
  39857. protocol: "accessing",
  39858. fn: function (){
  39859. var self=this,$self=this;
  39860. return $self["@sendIndexes"];
  39861. },
  39862. args: [],
  39863. source: "sendIndexes\x0a\x09^ sendIndexes",
  39864. referencedClasses: [],
  39865. messageSends: []
  39866. }),
  39867. $globals.IRMethod);
  39868. $core.addMethod(
  39869. $core.method({
  39870. selector: "sendIndexes:",
  39871. protocol: "accessing",
  39872. fn: function (aDictionary){
  39873. var self=this,$self=this;
  39874. $self["@sendIndexes"]=aDictionary;
  39875. return self;
  39876. },
  39877. args: ["aDictionary"],
  39878. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  39879. referencedClasses: [],
  39880. messageSends: []
  39881. }),
  39882. $globals.IRMethod);
  39883. $core.addMethod(
  39884. $core.method({
  39885. selector: "source",
  39886. protocol: "accessing",
  39887. fn: function (){
  39888. var self=this,$self=this;
  39889. return $self["@source"];
  39890. },
  39891. args: [],
  39892. source: "source\x0a\x09^ source",
  39893. referencedClasses: [],
  39894. messageSends: []
  39895. }),
  39896. $globals.IRMethod);
  39897. $core.addMethod(
  39898. $core.method({
  39899. selector: "source:",
  39900. protocol: "accessing",
  39901. fn: function (aString){
  39902. var self=this,$self=this;
  39903. $self["@source"]=aString;
  39904. return self;
  39905. },
  39906. args: ["aString"],
  39907. source: "source: aString\x0a\x09source := aString",
  39908. referencedClasses: [],
  39909. messageSends: []
  39910. }),
  39911. $globals.IRMethod);
  39912. $core.addMethod(
  39913. $core.method({
  39914. selector: "theClass",
  39915. protocol: "accessing",
  39916. fn: function (){
  39917. var self=this,$self=this;
  39918. return $self["@theClass"];
  39919. },
  39920. args: [],
  39921. source: "theClass\x0a\x09^ theClass",
  39922. referencedClasses: [],
  39923. messageSends: []
  39924. }),
  39925. $globals.IRMethod);
  39926. $core.addMethod(
  39927. $core.method({
  39928. selector: "theClass:",
  39929. protocol: "accessing",
  39930. fn: function (aClass){
  39931. var self=this,$self=this;
  39932. $self["@theClass"]=aClass;
  39933. return self;
  39934. },
  39935. args: ["aClass"],
  39936. source: "theClass: aClass\x0a\x09theClass := aClass",
  39937. referencedClasses: [],
  39938. messageSends: []
  39939. }),
  39940. $globals.IRMethod);
  39941. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  39942. $globals.IRReturn.comment="I am a local return instruction.";
  39943. $core.addMethod(
  39944. $core.method({
  39945. selector: "acceptDagVisitor:",
  39946. protocol: "visiting",
  39947. fn: function (aVisitor){
  39948. var self=this,$self=this;
  39949. return $core.withContext(function($ctx1) {
  39950. return $recv(aVisitor)._visitIRReturn_(self);
  39951. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  39952. },
  39953. args: ["aVisitor"],
  39954. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  39955. referencedClasses: [],
  39956. messageSends: ["visitIRReturn:"]
  39957. }),
  39958. $globals.IRReturn);
  39959. $core.addMethod(
  39960. $core.method({
  39961. selector: "expression",
  39962. protocol: "accessing",
  39963. fn: function (){
  39964. var self=this,$self=this;
  39965. return $core.withContext(function($ctx1) {
  39966. return $recv($self._dagChildren())._single();
  39967. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  39968. },
  39969. args: [],
  39970. source: "expression\x0a\x09^ self dagChildren single",
  39971. referencedClasses: [],
  39972. messageSends: ["single", "dagChildren"]
  39973. }),
  39974. $globals.IRReturn);
  39975. $core.addMethod(
  39976. $core.method({
  39977. selector: "scope",
  39978. protocol: "accessing",
  39979. fn: function (){
  39980. var self=this,$self=this;
  39981. return $core.withContext(function($ctx1) {
  39982. var $1,$receiver;
  39983. $1=$self["@scope"];
  39984. if(($receiver = $1) == null || $receiver.a$nil){
  39985. return $recv($self._parent())._scope();
  39986. } else {
  39987. return $1;
  39988. }
  39989. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  39990. },
  39991. args: [],
  39992. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  39993. referencedClasses: [],
  39994. messageSends: ["ifNil:", "scope", "parent"]
  39995. }),
  39996. $globals.IRReturn);
  39997. $core.addMethod(
  39998. $core.method({
  39999. selector: "yieldsValue",
  40000. protocol: "testing",
  40001. fn: function (){
  40002. var self=this,$self=this;
  40003. return false;
  40004. },
  40005. args: [],
  40006. source: "yieldsValue\x0a\x09^ false",
  40007. referencedClasses: [],
  40008. messageSends: []
  40009. }),
  40010. $globals.IRReturn);
  40011. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40012. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40013. $core.addMethod(
  40014. $core.method({
  40015. selector: "acceptDagVisitor:",
  40016. protocol: "visiting",
  40017. fn: function (aVisitor){
  40018. var self=this,$self=this;
  40019. return $core.withContext(function($ctx1) {
  40020. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40021. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40022. },
  40023. args: ["aVisitor"],
  40024. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40025. referencedClasses: [],
  40026. messageSends: ["visitIRBlockReturn:"]
  40027. }),
  40028. $globals.IRBlockReturn);
  40029. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40030. $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.";
  40031. $core.addMethod(
  40032. $core.method({
  40033. selector: "acceptDagVisitor:",
  40034. protocol: "visiting",
  40035. fn: function (aVisitor){
  40036. var self=this,$self=this;
  40037. return $core.withContext(function($ctx1) {
  40038. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40039. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40040. },
  40041. args: ["aVisitor"],
  40042. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40043. referencedClasses: [],
  40044. messageSends: ["visitIRNonLocalReturn:"]
  40045. }),
  40046. $globals.IRNonLocalReturn);
  40047. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40048. $core.addMethod(
  40049. $core.method({
  40050. selector: "acceptDagVisitor:",
  40051. protocol: "visiting",
  40052. fn: function (aVisitor){
  40053. var self=this,$self=this;
  40054. return $core.withContext(function($ctx1) {
  40055. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40056. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40057. },
  40058. args: ["aVisitor"],
  40059. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40060. referencedClasses: [],
  40061. messageSends: ["visitIRTempDeclaration:"]
  40062. }),
  40063. $globals.IRTempDeclaration);
  40064. $core.addMethod(
  40065. $core.method({
  40066. selector: "isTempDeclaration",
  40067. protocol: "testing",
  40068. fn: function (){
  40069. var self=this,$self=this;
  40070. return true;
  40071. },
  40072. args: [],
  40073. source: "isTempDeclaration\x0a\x09^ true",
  40074. referencedClasses: [],
  40075. messageSends: []
  40076. }),
  40077. $globals.IRTempDeclaration);
  40078. $core.addMethod(
  40079. $core.method({
  40080. selector: "name",
  40081. protocol: "accessing",
  40082. fn: function (){
  40083. var self=this,$self=this;
  40084. return $self["@name"];
  40085. },
  40086. args: [],
  40087. source: "name\x0a\x09^ name",
  40088. referencedClasses: [],
  40089. messageSends: []
  40090. }),
  40091. $globals.IRTempDeclaration);
  40092. $core.addMethod(
  40093. $core.method({
  40094. selector: "name:",
  40095. protocol: "accessing",
  40096. fn: function (aString){
  40097. var self=this,$self=this;
  40098. $self["@name"]=aString;
  40099. return self;
  40100. },
  40101. args: ["aString"],
  40102. source: "name: aString\x0a\x09name := aString",
  40103. referencedClasses: [],
  40104. messageSends: []
  40105. }),
  40106. $globals.IRTempDeclaration);
  40107. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40108. $globals.IRSend.comment="I am a message send instruction.";
  40109. $core.addMethod(
  40110. $core.method({
  40111. selector: "acceptDagVisitor:",
  40112. protocol: "visiting",
  40113. fn: function (aVisitor){
  40114. var self=this,$self=this;
  40115. return $core.withContext(function($ctx1) {
  40116. return $recv(aVisitor)._visitIRSend_(self);
  40117. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40118. },
  40119. args: ["aVisitor"],
  40120. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40121. referencedClasses: [],
  40122. messageSends: ["visitIRSend:"]
  40123. }),
  40124. $globals.IRSend);
  40125. $core.addMethod(
  40126. $core.method({
  40127. selector: "arguments",
  40128. protocol: "accessing",
  40129. fn: function (){
  40130. var self=this,$self=this;
  40131. return $core.withContext(function($ctx1) {
  40132. return $recv($self._dagChildren())._allButFirst();
  40133. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40134. },
  40135. args: [],
  40136. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40137. referencedClasses: [],
  40138. messageSends: ["allButFirst", "dagChildren"]
  40139. }),
  40140. $globals.IRSend);
  40141. $core.addMethod(
  40142. $core.method({
  40143. selector: "index",
  40144. protocol: "accessing",
  40145. fn: function (){
  40146. var self=this,$self=this;
  40147. return $self["@index"];
  40148. },
  40149. args: [],
  40150. source: "index\x0a\x09^ index",
  40151. referencedClasses: [],
  40152. messageSends: []
  40153. }),
  40154. $globals.IRSend);
  40155. $core.addMethod(
  40156. $core.method({
  40157. selector: "index:",
  40158. protocol: "accessing",
  40159. fn: function (anInteger){
  40160. var self=this,$self=this;
  40161. $self["@index"]=anInteger;
  40162. return self;
  40163. },
  40164. args: ["anInteger"],
  40165. source: "index: anInteger\x0a\x09index := anInteger",
  40166. referencedClasses: [],
  40167. messageSends: []
  40168. }),
  40169. $globals.IRSend);
  40170. $core.addMethod(
  40171. $core.method({
  40172. selector: "isSend",
  40173. protocol: "testing",
  40174. fn: function (){
  40175. var self=this,$self=this;
  40176. return true;
  40177. },
  40178. args: [],
  40179. source: "isSend\x0a\x09^ true",
  40180. referencedClasses: [],
  40181. messageSends: []
  40182. }),
  40183. $globals.IRSend);
  40184. $core.addMethod(
  40185. $core.method({
  40186. selector: "receiver",
  40187. protocol: "accessing",
  40188. fn: function (){
  40189. var self=this,$self=this;
  40190. return $core.withContext(function($ctx1) {
  40191. return $recv($self._dagChildren())._first();
  40192. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40193. },
  40194. args: [],
  40195. source: "receiver\x0a\x09^ self dagChildren first",
  40196. referencedClasses: [],
  40197. messageSends: ["first", "dagChildren"]
  40198. }),
  40199. $globals.IRSend);
  40200. $core.addMethod(
  40201. $core.method({
  40202. selector: "selector",
  40203. protocol: "accessing",
  40204. fn: function (){
  40205. var self=this,$self=this;
  40206. return $self["@selector"];
  40207. },
  40208. args: [],
  40209. source: "selector\x0a\x09^ selector",
  40210. referencedClasses: [],
  40211. messageSends: []
  40212. }),
  40213. $globals.IRSend);
  40214. $core.addMethod(
  40215. $core.method({
  40216. selector: "selector:",
  40217. protocol: "accessing",
  40218. fn: function (aString){
  40219. var self=this,$self=this;
  40220. $self["@selector"]=aString;
  40221. return self;
  40222. },
  40223. args: ["aString"],
  40224. source: "selector: aString\x0a\x09selector := aString",
  40225. referencedClasses: [],
  40226. messageSends: []
  40227. }),
  40228. $globals.IRSend);
  40229. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40230. $core.addMethod(
  40231. $core.method({
  40232. selector: "acceptDagVisitor:",
  40233. protocol: "visiting",
  40234. fn: function (aVisitor){
  40235. var self=this,$self=this;
  40236. return $core.withContext(function($ctx1) {
  40237. return $recv(aVisitor)._visitIRSequence_(self);
  40238. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40239. },
  40240. args: ["aVisitor"],
  40241. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40242. referencedClasses: [],
  40243. messageSends: ["visitIRSequence:"]
  40244. }),
  40245. $globals.IRSequence);
  40246. $core.addMethod(
  40247. $core.method({
  40248. selector: "isSequence",
  40249. protocol: "testing",
  40250. fn: function (){
  40251. var self=this,$self=this;
  40252. return true;
  40253. },
  40254. args: [],
  40255. source: "isSequence\x0a\x09^ true",
  40256. referencedClasses: [],
  40257. messageSends: []
  40258. }),
  40259. $globals.IRSequence);
  40260. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40261. $core.addMethod(
  40262. $core.method({
  40263. selector: "acceptDagVisitor:",
  40264. protocol: "visiting",
  40265. fn: function (aVisitor){
  40266. var self=this,$self=this;
  40267. return $core.withContext(function($ctx1) {
  40268. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40269. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40270. },
  40271. args: ["aVisitor"],
  40272. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40273. referencedClasses: [],
  40274. messageSends: ["visitIRBlockSequence:"]
  40275. }),
  40276. $globals.IRBlockSequence);
  40277. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40278. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40279. $core.addMethod(
  40280. $core.method({
  40281. selector: "acceptDagVisitor:",
  40282. protocol: "visiting",
  40283. fn: function (aVisitor){
  40284. var self=this,$self=this;
  40285. return $core.withContext(function($ctx1) {
  40286. return $recv(aVisitor)._visitIRValue_(self);
  40287. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40288. },
  40289. args: ["aVisitor"],
  40290. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40291. referencedClasses: [],
  40292. messageSends: ["visitIRValue:"]
  40293. }),
  40294. $globals.IRValue);
  40295. $core.addMethod(
  40296. $core.method({
  40297. selector: "needsBoxingAsReceiver",
  40298. protocol: "testing",
  40299. fn: function (){
  40300. var self=this,$self=this;
  40301. return false;
  40302. },
  40303. args: [],
  40304. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40305. referencedClasses: [],
  40306. messageSends: []
  40307. }),
  40308. $globals.IRValue);
  40309. $core.addMethod(
  40310. $core.method({
  40311. selector: "value",
  40312. protocol: "accessing",
  40313. fn: function (){
  40314. var self=this,$self=this;
  40315. return $self["@value"];
  40316. },
  40317. args: [],
  40318. source: "value\x0a\x09^ value",
  40319. referencedClasses: [],
  40320. messageSends: []
  40321. }),
  40322. $globals.IRValue);
  40323. $core.addMethod(
  40324. $core.method({
  40325. selector: "value:",
  40326. protocol: "accessing",
  40327. fn: function (aString){
  40328. var self=this,$self=this;
  40329. $self["@value"]=aString;
  40330. return self;
  40331. },
  40332. args: ["aString"],
  40333. source: "value: aString\x0a\x09value := aString",
  40334. referencedClasses: [],
  40335. messageSends: []
  40336. }),
  40337. $globals.IRValue);
  40338. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40339. $globals.IRVariable.comment="I am a variable instruction.";
  40340. $core.addMethod(
  40341. $core.method({
  40342. selector: "acceptDagVisitor:",
  40343. protocol: "visiting",
  40344. fn: function (aVisitor){
  40345. var self=this,$self=this;
  40346. return $core.withContext(function($ctx1) {
  40347. return $recv(aVisitor)._visitIRVariable_(self);
  40348. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40349. },
  40350. args: ["aVisitor"],
  40351. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40352. referencedClasses: [],
  40353. messageSends: ["visitIRVariable:"]
  40354. }),
  40355. $globals.IRVariable);
  40356. $core.addMethod(
  40357. $core.method({
  40358. selector: "isSelf",
  40359. protocol: "testing",
  40360. fn: function (){
  40361. var self=this,$self=this;
  40362. return $core.withContext(function($ctx1) {
  40363. return $recv($self._variable())._isSelf();
  40364. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40365. },
  40366. args: [],
  40367. source: "isSelf\x0a\x09^ self variable isSelf",
  40368. referencedClasses: [],
  40369. messageSends: ["isSelf", "variable"]
  40370. }),
  40371. $globals.IRVariable);
  40372. $core.addMethod(
  40373. $core.method({
  40374. selector: "isSuper",
  40375. protocol: "testing",
  40376. fn: function (){
  40377. var self=this,$self=this;
  40378. return $core.withContext(function($ctx1) {
  40379. return $recv($self._variable())._isSuper();
  40380. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40381. },
  40382. args: [],
  40383. source: "isSuper\x0a\x09^ self variable isSuper",
  40384. referencedClasses: [],
  40385. messageSends: ["isSuper", "variable"]
  40386. }),
  40387. $globals.IRVariable);
  40388. $core.addMethod(
  40389. $core.method({
  40390. selector: "isVariable",
  40391. protocol: "testing",
  40392. fn: function (){
  40393. var self=this,$self=this;
  40394. return true;
  40395. },
  40396. args: [],
  40397. source: "isVariable\x0a\x09^ true",
  40398. referencedClasses: [],
  40399. messageSends: []
  40400. }),
  40401. $globals.IRVariable);
  40402. $core.addMethod(
  40403. $core.method({
  40404. selector: "needsBoxingAsReceiver",
  40405. protocol: "testing",
  40406. fn: function (){
  40407. var self=this,$self=this;
  40408. return $core.withContext(function($ctx1) {
  40409. return $recv($recv($self._variable())._isPseudoVar())._not();
  40410. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40411. },
  40412. args: [],
  40413. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40414. referencedClasses: [],
  40415. messageSends: ["not", "isPseudoVar", "variable"]
  40416. }),
  40417. $globals.IRVariable);
  40418. $core.addMethod(
  40419. $core.method({
  40420. selector: "variable",
  40421. protocol: "accessing",
  40422. fn: function (){
  40423. var self=this,$self=this;
  40424. return $self["@variable"];
  40425. },
  40426. args: [],
  40427. source: "variable\x0a\x09^ variable",
  40428. referencedClasses: [],
  40429. messageSends: []
  40430. }),
  40431. $globals.IRVariable);
  40432. $core.addMethod(
  40433. $core.method({
  40434. selector: "variable:",
  40435. protocol: "accessing",
  40436. fn: function (aScopeVariable){
  40437. var self=this,$self=this;
  40438. $self["@variable"]=aScopeVariable;
  40439. return self;
  40440. },
  40441. args: ["aScopeVariable"],
  40442. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40443. referencedClasses: [],
  40444. messageSends: []
  40445. }),
  40446. $globals.IRVariable);
  40447. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40448. $core.addMethod(
  40449. $core.method({
  40450. selector: "acceptDagVisitor:",
  40451. protocol: "visiting",
  40452. fn: function (aVisitor){
  40453. var self=this,$self=this;
  40454. return $core.withContext(function($ctx1) {
  40455. return $recv(aVisitor)._visitIRVerbatim_(self);
  40456. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40457. },
  40458. args: ["aVisitor"],
  40459. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40460. referencedClasses: [],
  40461. messageSends: ["visitIRVerbatim:"]
  40462. }),
  40463. $globals.IRVerbatim);
  40464. $core.addMethod(
  40465. $core.method({
  40466. selector: "source",
  40467. protocol: "accessing",
  40468. fn: function (){
  40469. var self=this,$self=this;
  40470. return $self["@source"];
  40471. },
  40472. args: [],
  40473. source: "source\x0a\x09^ source",
  40474. referencedClasses: [],
  40475. messageSends: []
  40476. }),
  40477. $globals.IRVerbatim);
  40478. $core.addMethod(
  40479. $core.method({
  40480. selector: "source:",
  40481. protocol: "accessing",
  40482. fn: function (aString){
  40483. var self=this,$self=this;
  40484. $self["@source"]=aString;
  40485. return self;
  40486. },
  40487. args: ["aString"],
  40488. source: "source: aString\x0a\x09source := aString",
  40489. referencedClasses: [],
  40490. messageSends: []
  40491. }),
  40492. $globals.IRVerbatim);
  40493. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40494. $core.addMethod(
  40495. $core.method({
  40496. selector: "visitDagNode:",
  40497. protocol: "visiting",
  40498. fn: function (aNode){
  40499. var self=this,$self=this;
  40500. return $core.withContext(function($ctx1) {
  40501. return $self._visitDagNodeVariantSimple_(aNode);
  40502. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40503. },
  40504. args: ["aNode"],
  40505. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40506. referencedClasses: [],
  40507. messageSends: ["visitDagNodeVariantSimple:"]
  40508. }),
  40509. $globals.IRVisitor);
  40510. $core.addMethod(
  40511. $core.method({
  40512. selector: "visitIRAssignment:",
  40513. protocol: "visiting",
  40514. fn: function (anIRAssignment){
  40515. var self=this,$self=this;
  40516. return $core.withContext(function($ctx1) {
  40517. return $self._visitDagNode_(anIRAssignment);
  40518. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  40519. },
  40520. args: ["anIRAssignment"],
  40521. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  40522. referencedClasses: [],
  40523. messageSends: ["visitDagNode:"]
  40524. }),
  40525. $globals.IRVisitor);
  40526. $core.addMethod(
  40527. $core.method({
  40528. selector: "visitIRBlockReturn:",
  40529. protocol: "visiting",
  40530. fn: function (anIRBlockReturn){
  40531. var self=this,$self=this;
  40532. return $core.withContext(function($ctx1) {
  40533. return $self._visitIRReturn_(anIRBlockReturn);
  40534. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  40535. },
  40536. args: ["anIRBlockReturn"],
  40537. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  40538. referencedClasses: [],
  40539. messageSends: ["visitIRReturn:"]
  40540. }),
  40541. $globals.IRVisitor);
  40542. $core.addMethod(
  40543. $core.method({
  40544. selector: "visitIRBlockSequence:",
  40545. protocol: "visiting",
  40546. fn: function (anIRBlockSequence){
  40547. var self=this,$self=this;
  40548. return $core.withContext(function($ctx1) {
  40549. return $self._visitIRSequence_(anIRBlockSequence);
  40550. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  40551. },
  40552. args: ["anIRBlockSequence"],
  40553. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  40554. referencedClasses: [],
  40555. messageSends: ["visitIRSequence:"]
  40556. }),
  40557. $globals.IRVisitor);
  40558. $core.addMethod(
  40559. $core.method({
  40560. selector: "visitIRClosure:",
  40561. protocol: "visiting",
  40562. fn: function (anIRClosure){
  40563. var self=this,$self=this;
  40564. return $core.withContext(function($ctx1) {
  40565. return $self._visitDagNode_(anIRClosure);
  40566. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  40567. },
  40568. args: ["anIRClosure"],
  40569. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  40570. referencedClasses: [],
  40571. messageSends: ["visitDagNode:"]
  40572. }),
  40573. $globals.IRVisitor);
  40574. $core.addMethod(
  40575. $core.method({
  40576. selector: "visitIRDynamicArray:",
  40577. protocol: "visiting",
  40578. fn: function (anIRDynamicArray){
  40579. var self=this,$self=this;
  40580. return $core.withContext(function($ctx1) {
  40581. return $self._visitDagNode_(anIRDynamicArray);
  40582. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  40583. },
  40584. args: ["anIRDynamicArray"],
  40585. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  40586. referencedClasses: [],
  40587. messageSends: ["visitDagNode:"]
  40588. }),
  40589. $globals.IRVisitor);
  40590. $core.addMethod(
  40591. $core.method({
  40592. selector: "visitIRDynamicDictionary:",
  40593. protocol: "visiting",
  40594. fn: function (anIRDynamicDictionary){
  40595. var self=this,$self=this;
  40596. return $core.withContext(function($ctx1) {
  40597. return $self._visitDagNode_(anIRDynamicDictionary);
  40598. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  40599. },
  40600. args: ["anIRDynamicDictionary"],
  40601. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  40602. referencedClasses: [],
  40603. messageSends: ["visitDagNode:"]
  40604. }),
  40605. $globals.IRVisitor);
  40606. $core.addMethod(
  40607. $core.method({
  40608. selector: "visitIRInlinedClosure:",
  40609. protocol: "visiting",
  40610. fn: function (anIRInlinedClosure){
  40611. var self=this,$self=this;
  40612. return $core.withContext(function($ctx1) {
  40613. return $self._visitIRClosure_(anIRInlinedClosure);
  40614. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  40615. },
  40616. args: ["anIRInlinedClosure"],
  40617. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  40618. referencedClasses: [],
  40619. messageSends: ["visitIRClosure:"]
  40620. }),
  40621. $globals.IRVisitor);
  40622. $core.addMethod(
  40623. $core.method({
  40624. selector: "visitIRInlinedSequence:",
  40625. protocol: "visiting",
  40626. fn: function (anIRInlinedSequence){
  40627. var self=this,$self=this;
  40628. return $core.withContext(function($ctx1) {
  40629. return $self._visitIRSequence_(anIRInlinedSequence);
  40630. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  40631. },
  40632. args: ["anIRInlinedSequence"],
  40633. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  40634. referencedClasses: [],
  40635. messageSends: ["visitIRSequence:"]
  40636. }),
  40637. $globals.IRVisitor);
  40638. $core.addMethod(
  40639. $core.method({
  40640. selector: "visitIRMethod:",
  40641. protocol: "visiting",
  40642. fn: function (anIRMethod){
  40643. var self=this,$self=this;
  40644. return $core.withContext(function($ctx1) {
  40645. return $self._visitDagNode_(anIRMethod);
  40646. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  40647. },
  40648. args: ["anIRMethod"],
  40649. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  40650. referencedClasses: [],
  40651. messageSends: ["visitDagNode:"]
  40652. }),
  40653. $globals.IRVisitor);
  40654. $core.addMethod(
  40655. $core.method({
  40656. selector: "visitIRNonLocalReturn:",
  40657. protocol: "visiting",
  40658. fn: function (anIRNonLocalReturn){
  40659. var self=this,$self=this;
  40660. return $core.withContext(function($ctx1) {
  40661. return $self._visitDagNode_(anIRNonLocalReturn);
  40662. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  40663. },
  40664. args: ["anIRNonLocalReturn"],
  40665. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  40666. referencedClasses: [],
  40667. messageSends: ["visitDagNode:"]
  40668. }),
  40669. $globals.IRVisitor);
  40670. $core.addMethod(
  40671. $core.method({
  40672. selector: "visitIRNonLocalReturnHandling:",
  40673. protocol: "visiting",
  40674. fn: function (anIRNonLocalReturnHandling){
  40675. var self=this,$self=this;
  40676. return $core.withContext(function($ctx1) {
  40677. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  40678. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  40679. },
  40680. args: ["anIRNonLocalReturnHandling"],
  40681. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  40682. referencedClasses: [],
  40683. messageSends: ["visitDagNode:"]
  40684. }),
  40685. $globals.IRVisitor);
  40686. $core.addMethod(
  40687. $core.method({
  40688. selector: "visitIRReturn:",
  40689. protocol: "visiting",
  40690. fn: function (anIRReturn){
  40691. var self=this,$self=this;
  40692. return $core.withContext(function($ctx1) {
  40693. return $self._visitDagNode_(anIRReturn);
  40694. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  40695. },
  40696. args: ["anIRReturn"],
  40697. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  40698. referencedClasses: [],
  40699. messageSends: ["visitDagNode:"]
  40700. }),
  40701. $globals.IRVisitor);
  40702. $core.addMethod(
  40703. $core.method({
  40704. selector: "visitIRSend:",
  40705. protocol: "visiting",
  40706. fn: function (anIRSend){
  40707. var self=this,$self=this;
  40708. return $core.withContext(function($ctx1) {
  40709. return $self._visitDagNode_(anIRSend);
  40710. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  40711. },
  40712. args: ["anIRSend"],
  40713. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  40714. referencedClasses: [],
  40715. messageSends: ["visitDagNode:"]
  40716. }),
  40717. $globals.IRVisitor);
  40718. $core.addMethod(
  40719. $core.method({
  40720. selector: "visitIRSequence:",
  40721. protocol: "visiting",
  40722. fn: function (anIRSequence){
  40723. var self=this,$self=this;
  40724. return $core.withContext(function($ctx1) {
  40725. return $self._visitDagNode_(anIRSequence);
  40726. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  40727. },
  40728. args: ["anIRSequence"],
  40729. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  40730. referencedClasses: [],
  40731. messageSends: ["visitDagNode:"]
  40732. }),
  40733. $globals.IRVisitor);
  40734. $core.addMethod(
  40735. $core.method({
  40736. selector: "visitIRTempDeclaration:",
  40737. protocol: "visiting",
  40738. fn: function (anIRTempDeclaration){
  40739. var self=this,$self=this;
  40740. return $core.withContext(function($ctx1) {
  40741. return $self._visitDagNode_(anIRTempDeclaration);
  40742. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  40743. },
  40744. args: ["anIRTempDeclaration"],
  40745. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  40746. referencedClasses: [],
  40747. messageSends: ["visitDagNode:"]
  40748. }),
  40749. $globals.IRVisitor);
  40750. $core.addMethod(
  40751. $core.method({
  40752. selector: "visitIRValue:",
  40753. protocol: "visiting",
  40754. fn: function (anIRValue){
  40755. var self=this,$self=this;
  40756. return $core.withContext(function($ctx1) {
  40757. return $self._visitDagNode_(anIRValue);
  40758. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  40759. },
  40760. args: ["anIRValue"],
  40761. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  40762. referencedClasses: [],
  40763. messageSends: ["visitDagNode:"]
  40764. }),
  40765. $globals.IRVisitor);
  40766. $core.addMethod(
  40767. $core.method({
  40768. selector: "visitIRVariable:",
  40769. protocol: "visiting",
  40770. fn: function (anIRVariable){
  40771. var self=this,$self=this;
  40772. return $core.withContext(function($ctx1) {
  40773. return $self._visitDagNode_(anIRVariable);
  40774. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  40775. },
  40776. args: ["anIRVariable"],
  40777. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  40778. referencedClasses: [],
  40779. messageSends: ["visitDagNode:"]
  40780. }),
  40781. $globals.IRVisitor);
  40782. $core.addMethod(
  40783. $core.method({
  40784. selector: "visitIRVerbatim:",
  40785. protocol: "visiting",
  40786. fn: function (anIRVerbatim){
  40787. var self=this,$self=this;
  40788. return $core.withContext(function($ctx1) {
  40789. return $self._visitDagNode_(anIRVerbatim);
  40790. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  40791. },
  40792. args: ["anIRVerbatim"],
  40793. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  40794. referencedClasses: [],
  40795. messageSends: ["visitDagNode:"]
  40796. }),
  40797. $globals.IRVisitor);
  40798. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  40799. $core.addMethod(
  40800. $core.method({
  40801. selector: "contents",
  40802. protocol: "accessing",
  40803. fn: function (){
  40804. var self=this,$self=this;
  40805. return $core.withContext(function($ctx1) {
  40806. return $recv($self._stream())._contents();
  40807. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  40808. },
  40809. args: [],
  40810. source: "contents\x0a\x09^ self stream contents",
  40811. referencedClasses: [],
  40812. messageSends: ["contents", "stream"]
  40813. }),
  40814. $globals.IRJSTranslator);
  40815. $core.addMethod(
  40816. $core.method({
  40817. selector: "currentClass",
  40818. protocol: "accessing",
  40819. fn: function (){
  40820. var self=this,$self=this;
  40821. return $self["@currentClass"];
  40822. },
  40823. args: [],
  40824. source: "currentClass\x0a\x09^ currentClass",
  40825. referencedClasses: [],
  40826. messageSends: []
  40827. }),
  40828. $globals.IRJSTranslator);
  40829. $core.addMethod(
  40830. $core.method({
  40831. selector: "currentClass:",
  40832. protocol: "accessing",
  40833. fn: function (aClass){
  40834. var self=this,$self=this;
  40835. $self["@currentClass"]=aClass;
  40836. return self;
  40837. },
  40838. args: ["aClass"],
  40839. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  40840. referencedClasses: [],
  40841. messageSends: []
  40842. }),
  40843. $globals.IRJSTranslator);
  40844. $core.addMethod(
  40845. $core.method({
  40846. selector: "initialize",
  40847. protocol: "initialization",
  40848. fn: function (){
  40849. var self=this,$self=this;
  40850. return $core.withContext(function($ctx1) {
  40851. (
  40852. $ctx1.supercall = true,
  40853. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  40854. $ctx1.supercall = false;
  40855. $self["@stream"]=$recv($globals.JSStream)._new();
  40856. return self;
  40857. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  40858. },
  40859. args: [],
  40860. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  40861. referencedClasses: ["JSStream"],
  40862. messageSends: ["initialize", "new"]
  40863. }),
  40864. $globals.IRJSTranslator);
  40865. $core.addMethod(
  40866. $core.method({
  40867. selector: "stream",
  40868. protocol: "accessing",
  40869. fn: function (){
  40870. var self=this,$self=this;
  40871. return $self["@stream"];
  40872. },
  40873. args: [],
  40874. source: "stream\x0a\x09^ stream",
  40875. referencedClasses: [],
  40876. messageSends: []
  40877. }),
  40878. $globals.IRJSTranslator);
  40879. $core.addMethod(
  40880. $core.method({
  40881. selector: "stream:",
  40882. protocol: "accessing",
  40883. fn: function (aStream){
  40884. var self=this,$self=this;
  40885. $self["@stream"]=aStream;
  40886. return self;
  40887. },
  40888. args: ["aStream"],
  40889. source: "stream: aStream\x0a\x09stream := aStream",
  40890. referencedClasses: [],
  40891. messageSends: []
  40892. }),
  40893. $globals.IRJSTranslator);
  40894. $core.addMethod(
  40895. $core.method({
  40896. selector: "visitIRAssignment:",
  40897. protocol: "visiting",
  40898. fn: function (anIRAssignment){
  40899. var self=this,$self=this;
  40900. return $core.withContext(function($ctx1) {
  40901. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  40902. return $core.withContext(function($ctx2) {
  40903. return $self._visit_($recv(anIRAssignment)._left());
  40904. $ctx2.sendIdx["visit:"]=1;
  40905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40906. }),(function(){
  40907. return $core.withContext(function($ctx2) {
  40908. return $self._visit_($recv(anIRAssignment)._right());
  40909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40910. }));
  40911. return self;
  40912. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  40913. },
  40914. args: ["anIRAssignment"],
  40915. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  40916. referencedClasses: [],
  40917. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  40918. }),
  40919. $globals.IRJSTranslator);
  40920. $core.addMethod(
  40921. $core.method({
  40922. selector: "visitIRClosure:",
  40923. protocol: "visiting",
  40924. fn: function (anIRClosure){
  40925. var self=this,$self=this;
  40926. return $core.withContext(function($ctx1) {
  40927. var $1,$2;
  40928. $1=$self._stream();
  40929. $ctx1.sendIdx["stream"]=1;
  40930. $recv($1)._nextPutClosureWith_arguments_((function(){
  40931. return $core.withContext(function($ctx2) {
  40932. $2=$self._stream();
  40933. $ctx2.sendIdx["stream"]=2;
  40934. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  40935. return $core.withContext(function($ctx3) {
  40936. return $recv($recv(each)._name())._asVariableName();
  40937. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  40938. })));
  40939. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  40940. return $core.withContext(function($ctx3) {
  40941. return (
  40942. $ctx3.supercall = true,
  40943. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  40944. $ctx3.supercall = false;
  40945. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  40946. }));
  40947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40948. }),$recv(anIRClosure)._arguments());
  40949. return self;
  40950. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  40951. },
  40952. args: ["anIRClosure"],
  40953. 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",
  40954. referencedClasses: [],
  40955. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  40956. }),
  40957. $globals.IRJSTranslator);
  40958. $core.addMethod(
  40959. $core.method({
  40960. selector: "visitIRDynamicArray:",
  40961. protocol: "visiting",
  40962. fn: function (anIRDynamicArray){
  40963. var self=this,$self=this;
  40964. return $core.withContext(function($ctx1) {
  40965. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  40966. return self;
  40967. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  40968. },
  40969. args: ["anIRDynamicArray"],
  40970. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  40971. referencedClasses: [],
  40972. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  40973. }),
  40974. $globals.IRJSTranslator);
  40975. $core.addMethod(
  40976. $core.method({
  40977. selector: "visitIRDynamicDictionary:",
  40978. protocol: "visiting",
  40979. fn: function (anIRDynamicDictionary){
  40980. var self=this,$self=this;
  40981. return $core.withContext(function($ctx1) {
  40982. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  40983. return self;
  40984. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  40985. },
  40986. args: ["anIRDynamicDictionary"],
  40987. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  40988. referencedClasses: [],
  40989. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  40990. }),
  40991. $globals.IRJSTranslator);
  40992. $core.addMethod(
  40993. $core.method({
  40994. selector: "visitIRMethod:",
  40995. protocol: "visiting",
  40996. fn: function (anIRMethod){
  40997. var self=this,$self=this;
  40998. return $core.withContext(function($ctx1) {
  40999. var $1,$2,$3,$4,$5,$6,$7;
  41000. $1=$self._stream();
  41001. $ctx1.sendIdx["stream"]=1;
  41002. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41003. return $core.withContext(function($ctx2) {
  41004. $2=$self._stream();
  41005. $ctx2.sendIdx["stream"]=2;
  41006. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41007. return $core.withContext(function($ctx3) {
  41008. $3=$self._stream();
  41009. $ctx3.sendIdx["stream"]=3;
  41010. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41011. return $core.withContext(function($ctx4) {
  41012. return $recv($recv(each)._name())._asVariableName();
  41013. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41014. }));
  41015. $ctx3.sendIdx["collect:"]=1;
  41016. $recv($3)._nextPutVars_($4);
  41017. $ctx3.sendIdx["nextPutVars:"]=1;
  41018. $5=$self._stream();
  41019. $ctx3.sendIdx["stream"]=4;
  41020. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41021. return $core.withContext(function($ctx4) {
  41022. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41023. return $core.withContext(function($ctx5) {
  41024. $6=$self._stream();
  41025. $ctx5.sendIdx["stream"]=5;
  41026. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41027. return $core.withContext(function($ctx6) {
  41028. return $recv($recv(each)._variable())._alias();
  41029. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41030. })));
  41031. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41032. }));
  41033. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41034. if($core.assert($7)){
  41035. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41036. return $core.withContext(function($ctx5) {
  41037. return (
  41038. $ctx5.supercall = true,
  41039. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41040. $ctx5.supercall = false;
  41041. $ctx5.sendIdx["visitIRMethod:"]=1;
  41042. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41043. }));
  41044. } else {
  41045. return (
  41046. $ctx4.supercall = true,
  41047. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41048. $ctx4.supercall = false;
  41049. }
  41050. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41051. }));
  41052. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41053. }),$recv(anIRMethod)._arguments());
  41054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41055. }));
  41056. return $self._contents();
  41057. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41058. },
  41059. args: ["anIRMethod"],
  41060. 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",
  41061. referencedClasses: [],
  41062. 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"]
  41063. }),
  41064. $globals.IRJSTranslator);
  41065. $core.addMethod(
  41066. $core.method({
  41067. selector: "visitIRNonLocalReturn:",
  41068. protocol: "visiting",
  41069. fn: function (anIRNonLocalReturn){
  41070. var self=this,$self=this;
  41071. return $core.withContext(function($ctx1) {
  41072. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41073. return $core.withContext(function($ctx2) {
  41074. return (
  41075. $ctx2.supercall = true,
  41076. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41077. $ctx2.supercall = false;
  41078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41079. }));
  41080. return self;
  41081. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41082. },
  41083. args: ["anIRNonLocalReturn"],
  41084. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41085. referencedClasses: [],
  41086. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41087. }),
  41088. $globals.IRJSTranslator);
  41089. $core.addMethod(
  41090. $core.method({
  41091. selector: "visitIRReturn:",
  41092. protocol: "visiting",
  41093. fn: function (anIRReturn){
  41094. var self=this,$self=this;
  41095. return $core.withContext(function($ctx1) {
  41096. $recv($self._stream())._nextPutReturnWith_((function(){
  41097. return $core.withContext(function($ctx2) {
  41098. return (
  41099. $ctx2.supercall = true,
  41100. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41101. $ctx2.supercall = false;
  41102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41103. }));
  41104. return self;
  41105. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41106. },
  41107. args: ["anIRReturn"],
  41108. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41109. referencedClasses: [],
  41110. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41111. }),
  41112. $globals.IRJSTranslator);
  41113. $core.addMethod(
  41114. $core.method({
  41115. selector: "visitIRSend:",
  41116. protocol: "visiting",
  41117. fn: function (anIRSend){
  41118. var self=this,$self=this;
  41119. var sends,superclass;
  41120. return $core.withContext(function($ctx1) {
  41121. var $1,$2;
  41122. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41123. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41124. if($core.assert($1)){
  41125. $self._visitSuperSend_(anIRSend);
  41126. } else {
  41127. $self._visitSend_(anIRSend);
  41128. }
  41129. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41130. if($core.assert($2)){
  41131. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41132. }
  41133. return self;
  41134. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41135. },
  41136. args: ["anIRSend"],
  41137. 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 ]",
  41138. referencedClasses: [],
  41139. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41140. }),
  41141. $globals.IRJSTranslator);
  41142. $core.addMethod(
  41143. $core.method({
  41144. selector: "visitIRSequence:",
  41145. protocol: "visiting",
  41146. fn: function (anIRSequence){
  41147. var self=this,$self=this;
  41148. return $core.withContext(function($ctx1) {
  41149. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41150. return $core.withContext(function($ctx2) {
  41151. return $recv($self._stream())._nextPutStatementWith_((function(){
  41152. return $core.withContext(function($ctx3) {
  41153. return $self._visit_(each);
  41154. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41155. }));
  41156. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41157. }));
  41158. return self;
  41159. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41160. },
  41161. args: ["anIRSequence"],
  41162. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41163. referencedClasses: [],
  41164. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41165. }),
  41166. $globals.IRJSTranslator);
  41167. $core.addMethod(
  41168. $core.method({
  41169. selector: "visitIRTempDeclaration:",
  41170. protocol: "visiting",
  41171. fn: function (anIRTempDeclaration){
  41172. var self=this,$self=this;
  41173. return self;
  41174. },
  41175. args: ["anIRTempDeclaration"],
  41176. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41177. referencedClasses: [],
  41178. messageSends: []
  41179. }),
  41180. $globals.IRJSTranslator);
  41181. $core.addMethod(
  41182. $core.method({
  41183. selector: "visitIRValue:",
  41184. protocol: "visiting",
  41185. fn: function (anIRValue){
  41186. var self=this,$self=this;
  41187. return $core.withContext(function($ctx1) {
  41188. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41189. return self;
  41190. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41191. },
  41192. args: ["anIRValue"],
  41193. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41194. referencedClasses: [],
  41195. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41196. }),
  41197. $globals.IRJSTranslator);
  41198. $core.addMethod(
  41199. $core.method({
  41200. selector: "visitIRVariable:",
  41201. protocol: "visiting",
  41202. fn: function (anIRVariable){
  41203. var self=this,$self=this;
  41204. return $core.withContext(function($ctx1) {
  41205. var $3,$2,$1,$4;
  41206. $3=$recv(anIRVariable)._variable();
  41207. $ctx1.sendIdx["variable"]=1;
  41208. $2=$recv($3)._name();
  41209. $1=$recv($2).__eq("thisContext");
  41210. if($core.assert($1)){
  41211. $4=$self._stream();
  41212. $ctx1.sendIdx["stream"]=1;
  41213. $recv($4)._nextPutAll_("$core.getThisContext()");
  41214. $ctx1.sendIdx["nextPutAll:"]=1;
  41215. } else {
  41216. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41217. }
  41218. return self;
  41219. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41220. },
  41221. args: ["anIRVariable"],
  41222. 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 ]",
  41223. referencedClasses: [],
  41224. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41225. }),
  41226. $globals.IRJSTranslator);
  41227. $core.addMethod(
  41228. $core.method({
  41229. selector: "visitIRVerbatim:",
  41230. protocol: "visiting",
  41231. fn: function (anIRVerbatim){
  41232. var self=this,$self=this;
  41233. return $core.withContext(function($ctx1) {
  41234. var $1;
  41235. $1=$self._stream();
  41236. $ctx1.sendIdx["stream"]=1;
  41237. $recv($1)._nextPutStatementWith_((function(){
  41238. return $core.withContext(function($ctx2) {
  41239. return $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41241. }));
  41242. return self;
  41243. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41244. },
  41245. args: ["anIRVerbatim"],
  41246. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  41247. referencedClasses: [],
  41248. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  41249. }),
  41250. $globals.IRJSTranslator);
  41251. $core.addMethod(
  41252. $core.method({
  41253. selector: "visitInstructionList:enclosedBetween:and:",
  41254. protocol: "visiting",
  41255. fn: function (anArray,aString,anotherString){
  41256. var self=this,$self=this;
  41257. return $core.withContext(function($ctx1) {
  41258. var $1;
  41259. $1=$self._stream();
  41260. $ctx1.sendIdx["stream"]=1;
  41261. $recv($1)._nextPutAll_(aString);
  41262. $ctx1.sendIdx["nextPutAll:"]=1;
  41263. $recv(anArray)._do_separatedBy_((function(each){
  41264. return $core.withContext(function($ctx2) {
  41265. return $self._visit_(each);
  41266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41267. }),(function(){
  41268. return $core.withContext(function($ctx2) {
  41269. return $recv($self._stream())._nextPutAll_(",");
  41270. $ctx2.sendIdx["nextPutAll:"]=2;
  41271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41272. }));
  41273. $recv($self["@stream"])._nextPutAll_(anotherString);
  41274. return self;
  41275. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41276. },
  41277. args: ["anArray", "aString", "anotherString"],
  41278. 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",
  41279. referencedClasses: [],
  41280. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41281. }),
  41282. $globals.IRJSTranslator);
  41283. $core.addMethod(
  41284. $core.method({
  41285. selector: "visitReceiver:",
  41286. protocol: "visiting",
  41287. fn: function (anIRInstruction){
  41288. var self=this,$self=this;
  41289. var instr;
  41290. return $core.withContext(function($ctx1) {
  41291. var $1,$2,$4,$5,$3,$6,$7,$8;
  41292. $1=$recv(anIRInstruction)._isSelf();
  41293. if($core.assert($1)){
  41294. $2=$recv(anIRInstruction)._copy();
  41295. $ctx1.sendIdx["copy"]=1;
  41296. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41297. $recv($4)._name_("$self");
  41298. $5=$recv($4)._yourself();
  41299. $ctx1.sendIdx["yourself"]=1;
  41300. $3=$5;
  41301. $recv($2)._variable_($3);
  41302. instr=$recv($2)._yourself();
  41303. instr;
  41304. } else {
  41305. instr=anIRInstruction;
  41306. instr;
  41307. }
  41308. $6=$recv(instr)._needsBoxingAsReceiver();
  41309. if(!$core.assert($6)){
  41310. $7=$self._visit_(instr);
  41311. $ctx1.sendIdx["visit:"]=1;
  41312. return $7;
  41313. }
  41314. $8=$self._stream();
  41315. $ctx1.sendIdx["stream"]=1;
  41316. $recv($8)._nextPutAll_("$recv(");
  41317. $ctx1.sendIdx["nextPutAll:"]=1;
  41318. $self._visit_(instr);
  41319. $recv($self._stream())._nextPutAll_(")");
  41320. return self;
  41321. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41322. },
  41323. args: ["anIRInstruction"],
  41324. 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: ')'",
  41325. referencedClasses: [],
  41326. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41327. }),
  41328. $globals.IRJSTranslator);
  41329. $core.addMethod(
  41330. $core.method({
  41331. selector: "visitSend:",
  41332. protocol: "visiting",
  41333. fn: function (anIRSend){
  41334. var self=this,$self=this;
  41335. return $core.withContext(function($ctx1) {
  41336. $self._visitReceiver_($recv(anIRSend)._receiver());
  41337. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41338. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41339. return self;
  41340. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41341. },
  41342. args: ["anIRSend"],
  41343. 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: ')'",
  41344. referencedClasses: [],
  41345. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41346. }),
  41347. $globals.IRJSTranslator);
  41348. $core.addMethod(
  41349. $core.method({
  41350. selector: "visitSuperSend:",
  41351. protocol: "visiting",
  41352. fn: function (anIRSend){
  41353. var self=this,$self=this;
  41354. return $core.withContext(function($ctx1) {
  41355. var $1,$4,$3,$2,$5,$6,$7,$8;
  41356. $1=$self._stream();
  41357. $ctx1.sendIdx["stream"]=1;
  41358. $recv($1)._nextPutAll_("(");
  41359. $ctx1.sendIdx["nextPutAll:"]=1;
  41360. $recv($1)._lf();
  41361. $ctx1.sendIdx["lf"]=1;
  41362. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41363. $ctx1.sendIdx["nextPutAll:"]=2;
  41364. $recv($1)._lf();
  41365. $ctx1.sendIdx["lf"]=2;
  41366. $4=$recv(anIRSend)._scope();
  41367. $ctx1.sendIdx["scope"]=1;
  41368. $3=$recv($4)._alias();
  41369. $ctx1.sendIdx["alias"]=1;
  41370. $2=$recv($3).__comma(".supercall = true,");
  41371. $ctx1.sendIdx[","]=1;
  41372. $recv($1)._nextPutAll_($2);
  41373. $ctx1.sendIdx["nextPutAll:"]=3;
  41374. $recv($1)._lf();
  41375. $ctx1.sendIdx["lf"]=3;
  41376. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41377. $ctx1.sendIdx["nextPutAll:"]=4;
  41378. $recv($1)._lf();
  41379. $ctx1.sendIdx["lf"]=4;
  41380. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41381. $ctx1.sendIdx[","]=2;
  41382. $recv($1)._nextPutAll_($5);
  41383. $ctx1.sendIdx["nextPutAll:"]=5;
  41384. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41385. $ctx1.sendIdx["nextPutAll:"]=6;
  41386. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41387. $ctx1.sendIdx[","]=3;
  41388. $recv($1)._nextPutAll_($6);
  41389. $ctx1.sendIdx["nextPutAll:"]=7;
  41390. $7=$recv($1)._nextPutAll_("$self, ");
  41391. $ctx1.sendIdx["nextPutAll:"]=8;
  41392. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41393. $8=$self._stream();
  41394. $recv($8)._nextPutAll_("));");
  41395. $ctx1.sendIdx["nextPutAll:"]=9;
  41396. $recv($8)._lf();
  41397. $ctx1.sendIdx["lf"]=5;
  41398. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41399. $ctx1.sendIdx["nextPutAll:"]=10;
  41400. $recv($8)._lf();
  41401. $ctx1.sendIdx["lf"]=6;
  41402. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41403. $ctx1.sendIdx["nextPutAll:"]=11;
  41404. $recv($8)._lf();
  41405. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41406. return self;
  41407. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41408. },
  41409. args: ["anIRSend"],
  41410. 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);'",
  41411. referencedClasses: [],
  41412. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41413. }),
  41414. $globals.IRJSTranslator);
  41415. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41416. $core.addMethod(
  41417. $core.method({
  41418. selector: "contents",
  41419. protocol: "accessing",
  41420. fn: function (){
  41421. var self=this,$self=this;
  41422. return $core.withContext(function($ctx1) {
  41423. return $recv($self["@stream"])._contents();
  41424. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41425. },
  41426. args: [],
  41427. source: "contents\x0a\x09^ stream contents",
  41428. referencedClasses: [],
  41429. messageSends: ["contents"]
  41430. }),
  41431. $globals.JSStream);
  41432. $core.addMethod(
  41433. $core.method({
  41434. selector: "initialize",
  41435. protocol: "initialization",
  41436. fn: function (){
  41437. var self=this,$self=this;
  41438. return $core.withContext(function($ctx1) {
  41439. (
  41440. $ctx1.supercall = true,
  41441. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41442. $ctx1.supercall = false;
  41443. $self["@stream"]=""._writeStream();
  41444. return self;
  41445. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41446. },
  41447. args: [],
  41448. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41449. referencedClasses: [],
  41450. messageSends: ["initialize", "writeStream"]
  41451. }),
  41452. $globals.JSStream);
  41453. $core.addMethod(
  41454. $core.method({
  41455. selector: "lf",
  41456. protocol: "streaming",
  41457. fn: function (){
  41458. var self=this,$self=this;
  41459. return $core.withContext(function($ctx1) {
  41460. $recv($self["@stream"])._lf();
  41461. return self;
  41462. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41463. },
  41464. args: [],
  41465. source: "lf\x0a\x09stream lf",
  41466. referencedClasses: [],
  41467. messageSends: ["lf"]
  41468. }),
  41469. $globals.JSStream);
  41470. $core.addMethod(
  41471. $core.method({
  41472. selector: "nextPut:",
  41473. protocol: "streaming",
  41474. fn: function (aString){
  41475. var self=this,$self=this;
  41476. return $core.withContext(function($ctx1) {
  41477. $recv($self["@stream"])._nextPut_(aString);
  41478. return self;
  41479. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41480. },
  41481. args: ["aString"],
  41482. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41483. referencedClasses: [],
  41484. messageSends: ["nextPut:"]
  41485. }),
  41486. $globals.JSStream);
  41487. $core.addMethod(
  41488. $core.method({
  41489. selector: "nextPutAll:",
  41490. protocol: "streaming",
  41491. fn: function (aString){
  41492. var self=this,$self=this;
  41493. return $core.withContext(function($ctx1) {
  41494. $recv($self["@stream"])._nextPutAll_(aString);
  41495. return self;
  41496. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41497. },
  41498. args: ["aString"],
  41499. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41500. referencedClasses: [],
  41501. messageSends: ["nextPutAll:"]
  41502. }),
  41503. $globals.JSStream);
  41504. $core.addMethod(
  41505. $core.method({
  41506. selector: "nextPutAssignLhs:rhs:",
  41507. protocol: "streaming",
  41508. fn: function (aBlock,anotherBlock){
  41509. var self=this,$self=this;
  41510. return $core.withContext(function($ctx1) {
  41511. $recv(aBlock)._value();
  41512. $ctx1.sendIdx["value"]=1;
  41513. $recv($self["@stream"])._nextPutAll_("=");
  41514. $recv(anotherBlock)._value();
  41515. return self;
  41516. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41517. },
  41518. args: ["aBlock", "anotherBlock"],
  41519. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41520. referencedClasses: [],
  41521. messageSends: ["value", "nextPutAll:"]
  41522. }),
  41523. $globals.JSStream);
  41524. $core.addMethod(
  41525. $core.method({
  41526. selector: "nextPutBlockContextFor:during:",
  41527. protocol: "streaming",
  41528. fn: function (anIRClosure,aBlock){
  41529. var self=this,$self=this;
  41530. return $core.withContext(function($ctx1) {
  41531. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  41532. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  41533. if(!$core.assert($1)){
  41534. $2=$recv(aBlock)._value();
  41535. $ctx1.sendIdx["value"]=1;
  41536. return $2;
  41537. }
  41538. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41539. $ctx1.sendIdx["nextPutAll:"]=1;
  41540. $self._lf();
  41541. $ctx1.sendIdx["lf"]=1;
  41542. $6=$recv(anIRClosure)._scope();
  41543. $ctx1.sendIdx["scope"]=1;
  41544. $5=$recv($6)._alias();
  41545. $ctx1.sendIdx["alias"]=1;
  41546. $4="return $core.withContext(function(".__comma($5);
  41547. $ctx1.sendIdx[","]=2;
  41548. $3=$recv($4).__comma(") {");
  41549. $ctx1.sendIdx[","]=1;
  41550. $self._nextPutAll_($3);
  41551. $ctx1.sendIdx["nextPutAll:"]=2;
  41552. $self._lf();
  41553. $ctx1.sendIdx["lf"]=2;
  41554. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41555. $ctx1.sendIdx["nextPutAll:"]=3;
  41556. $7=$self._lf();
  41557. $ctx1.sendIdx["lf"]=3;
  41558. $recv(aBlock)._value();
  41559. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41560. $ctx1.sendIdx["nextPutAll:"]=4;
  41561. $self._lf();
  41562. $ctx1.sendIdx["lf"]=4;
  41563. $11=$recv(anIRClosure)._scope();
  41564. $ctx1.sendIdx["scope"]=2;
  41565. $10=$recv($11)._alias();
  41566. $ctx1.sendIdx["alias"]=2;
  41567. $9="}, function(".__comma($10);
  41568. $ctx1.sendIdx[","]=4;
  41569. $8=$recv($9).__comma(") {");
  41570. $ctx1.sendIdx[","]=3;
  41571. $self._nextPutAll_($8);
  41572. $ctx1.sendIdx["nextPutAll:"]=5;
  41573. $15=$recv(anIRClosure)._scope();
  41574. $ctx1.sendIdx["scope"]=3;
  41575. $14=$recv($15)._alias();
  41576. $ctx1.sendIdx["alias"]=3;
  41577. $13=$recv($14).__comma(".fillBlock({");
  41578. $ctx1.sendIdx[","]=5;
  41579. $12=$self._nextPutAll_($13);
  41580. $ctx1.sendIdx["nextPutAll:"]=6;
  41581. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  41582. return $core.withContext(function($ctx2) {
  41583. $16=$recv(each)._asVariableName();
  41584. $ctx2.sendIdx["asVariableName"]=1;
  41585. $self._nextPutAll_($16);
  41586. $ctx2.sendIdx["nextPutAll:"]=7;
  41587. $self._nextPutAll_(":");
  41588. $ctx2.sendIdx["nextPutAll:"]=8;
  41589. $17=$self._nextPutAll_($recv(each)._asVariableName());
  41590. $ctx2.sendIdx["nextPutAll:"]=9;
  41591. return $17;
  41592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41593. }),(function(){
  41594. return $core.withContext(function($ctx2) {
  41595. return $self._nextPutAll_(",");
  41596. $ctx2.sendIdx["nextPutAll:"]=10;
  41597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41598. }));
  41599. $self._nextPutAll_("},");
  41600. $ctx1.sendIdx["nextPutAll:"]=11;
  41601. $23=$recv(anIRClosure)._scope();
  41602. $ctx1.sendIdx["scope"]=4;
  41603. $22=$recv($23)._outerScope();
  41604. $21=$recv($22)._alias();
  41605. $20=$recv($21).__comma(",");
  41606. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  41607. $ctx1.sendIdx[","]=7;
  41608. $18=$recv($19).__comma(")});");
  41609. $ctx1.sendIdx[","]=6;
  41610. $self._nextPutAll_($18);
  41611. $ctx1.sendIdx["nextPutAll:"]=12;
  41612. $self._lf();
  41613. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41614. return self;
  41615. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  41616. },
  41617. args: ["anIRClosure", "aBlock"],
  41618. 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);'",
  41619. referencedClasses: [],
  41620. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  41621. }),
  41622. $globals.JSStream);
  41623. $core.addMethod(
  41624. $core.method({
  41625. selector: "nextPutClosureWith:arguments:",
  41626. protocol: "streaming",
  41627. fn: function (aBlock,anArray){
  41628. var self=this,$self=this;
  41629. return $core.withContext(function($ctx1) {
  41630. var $1,$2,$3;
  41631. $recv($self["@stream"])._nextPutAll_("(function(");
  41632. $ctx1.sendIdx["nextPutAll:"]=1;
  41633. $recv(anArray)._do_separatedBy_((function(each){
  41634. return $core.withContext(function($ctx2) {
  41635. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41636. $ctx2.sendIdx["nextPutAll:"]=2;
  41637. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41638. }),(function(){
  41639. return $core.withContext(function($ctx2) {
  41640. return $recv($self["@stream"])._nextPut_(",");
  41641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41642. }));
  41643. $1=$self["@stream"];
  41644. $recv($1)._nextPutAll_("){");
  41645. $ctx1.sendIdx["nextPutAll:"]=3;
  41646. $2=$recv($1)._lf();
  41647. $ctx1.sendIdx["lf"]=1;
  41648. $recv(aBlock)._value();
  41649. $3=$self["@stream"];
  41650. $recv($3)._lf();
  41651. $recv($3)._nextPutAll_("})");
  41652. return self;
  41653. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  41654. },
  41655. args: ["aBlock", "anArray"],
  41656. 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: '})'",
  41657. referencedClasses: [],
  41658. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  41659. }),
  41660. $globals.JSStream);
  41661. $core.addMethod(
  41662. $core.method({
  41663. selector: "nextPutContextFor:during:",
  41664. protocol: "streaming",
  41665. fn: function (aMethod,aBlock){
  41666. var self=this,$self=this;
  41667. return $core.withContext(function($ctx1) {
  41668. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  41669. $1=$recv(aMethod)._requiresSmalltalkContext();
  41670. if(!$core.assert($1)){
  41671. $2=$recv(aBlock)._value();
  41672. $ctx1.sendIdx["value"]=1;
  41673. return $2;
  41674. }
  41675. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41676. $ctx1.sendIdx["nextPutAll:"]=1;
  41677. $self._lf();
  41678. $ctx1.sendIdx["lf"]=1;
  41679. $6=$recv(aMethod)._scope();
  41680. $ctx1.sendIdx["scope"]=1;
  41681. $5=$recv($6)._alias();
  41682. $ctx1.sendIdx["alias"]=1;
  41683. $4="return $core.withContext(function(".__comma($5);
  41684. $ctx1.sendIdx[","]=2;
  41685. $3=$recv($4).__comma(") {");
  41686. $ctx1.sendIdx[","]=1;
  41687. $self._nextPutAll_($3);
  41688. $ctx1.sendIdx["nextPutAll:"]=2;
  41689. $self._lf();
  41690. $ctx1.sendIdx["lf"]=2;
  41691. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41692. $ctx1.sendIdx["nextPutAll:"]=3;
  41693. $7=$self._lf();
  41694. $ctx1.sendIdx["lf"]=3;
  41695. $recv(aBlock)._value();
  41696. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41697. $ctx1.sendIdx["nextPutAll:"]=4;
  41698. $self._lf();
  41699. $ctx1.sendIdx["lf"]=4;
  41700. $12=$recv(aMethod)._scope();
  41701. $ctx1.sendIdx["scope"]=2;
  41702. $11=$recv($12)._alias();
  41703. $ctx1.sendIdx["alias"]=2;
  41704. $10="}, function(".__comma($11);
  41705. $ctx1.sendIdx[","]=5;
  41706. $9=$recv($10).__comma(") {");
  41707. $ctx1.sendIdx[","]=4;
  41708. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  41709. $ctx1.sendIdx[","]=3;
  41710. $self._nextPutAll_($8);
  41711. $ctx1.sendIdx["nextPutAll:"]=5;
  41712. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  41713. $ctx1.sendIdx["asJavaScriptSource"]=1;
  41714. $15=".fill(self,".__comma($16);
  41715. $14=$recv($15).__comma(",{");
  41716. $ctx1.sendIdx[","]=6;
  41717. $13=$self._nextPutAll_($14);
  41718. $ctx1.sendIdx["nextPutAll:"]=6;
  41719. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  41720. return $core.withContext(function($ctx2) {
  41721. $17=$recv(each)._asVariableName();
  41722. $ctx2.sendIdx["asVariableName"]=1;
  41723. $self._nextPutAll_($17);
  41724. $ctx2.sendIdx["nextPutAll:"]=7;
  41725. $self._nextPutAll_(":");
  41726. $ctx2.sendIdx["nextPutAll:"]=8;
  41727. $18=$self._nextPutAll_($recv(each)._asVariableName());
  41728. $ctx2.sendIdx["nextPutAll:"]=9;
  41729. return $18;
  41730. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41731. }),(function(){
  41732. return $core.withContext(function($ctx2) {
  41733. return $self._nextPutAll_(",");
  41734. $ctx2.sendIdx["nextPutAll:"]=10;
  41735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41736. }));
  41737. $self._nextPutAll_("},");
  41738. $ctx1.sendIdx["nextPutAll:"]=11;
  41739. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  41740. $ctx1.sendIdx["nextPutAll:"]=12;
  41741. $self._nextPutAll_(")});");
  41742. $ctx1.sendIdx["nextPutAll:"]=13;
  41743. $self._lf();
  41744. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41745. return self;
  41746. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  41747. },
  41748. args: ["aMethod", "aBlock"],
  41749. 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);'",
  41750. referencedClasses: [],
  41751. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  41752. }),
  41753. $globals.JSStream);
  41754. $core.addMethod(
  41755. $core.method({
  41756. selector: "nextPutFunctionWith:arguments:",
  41757. protocol: "streaming",
  41758. fn: function (aBlock,anArray){
  41759. var self=this,$self=this;
  41760. return $core.withContext(function($ctx1) {
  41761. var $1,$2,$3,$4,$5;
  41762. $recv($self["@stream"])._nextPutAll_("fn: function(");
  41763. $ctx1.sendIdx["nextPutAll:"]=1;
  41764. $recv(anArray)._do_separatedBy_((function(each){
  41765. return $core.withContext(function($ctx2) {
  41766. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  41767. $ctx2.sendIdx["nextPutAll:"]=2;
  41768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41769. }),(function(){
  41770. return $core.withContext(function($ctx2) {
  41771. return $recv($self["@stream"])._nextPut_(",");
  41772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41773. }));
  41774. $1=$self["@stream"];
  41775. $recv($1)._nextPutAll_("){");
  41776. $ctx1.sendIdx["nextPutAll:"]=3;
  41777. $2=$recv($1)._lf();
  41778. $ctx1.sendIdx["lf"]=1;
  41779. $3=$self["@stream"];
  41780. $recv($3)._nextPutAll_("var self=this,$self=this;");
  41781. $ctx1.sendIdx["nextPutAll:"]=4;
  41782. $4=$recv($3)._lf();
  41783. $ctx1.sendIdx["lf"]=2;
  41784. $recv(aBlock)._value();
  41785. $5=$self["@stream"];
  41786. $recv($5)._lf();
  41787. $recv($5)._nextPutAll_("}");
  41788. return self;
  41789. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  41790. },
  41791. args: ["aBlock", "anArray"],
  41792. 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: '}'",
  41793. referencedClasses: [],
  41794. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  41795. }),
  41796. $globals.JSStream);
  41797. $core.addMethod(
  41798. $core.method({
  41799. selector: "nextPutIf:then:",
  41800. protocol: "streaming",
  41801. fn: function (aBlock,anotherBlock){
  41802. var self=this,$self=this;
  41803. return $core.withContext(function($ctx1) {
  41804. var $1;
  41805. $recv($self["@stream"])._nextPutAll_("if(");
  41806. $ctx1.sendIdx["nextPutAll:"]=1;
  41807. $recv(aBlock)._value();
  41808. $ctx1.sendIdx["value"]=1;
  41809. $1=$self["@stream"];
  41810. $recv($1)._nextPutAll_("){");
  41811. $ctx1.sendIdx["nextPutAll:"]=2;
  41812. $recv($1)._lf();
  41813. $recv(anotherBlock)._value();
  41814. $recv($self["@stream"])._nextPutAll_("}");
  41815. $self._omitSemicolon_(true);
  41816. return self;
  41817. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41818. },
  41819. args: ["aBlock", "anotherBlock"],
  41820. 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",
  41821. referencedClasses: [],
  41822. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  41823. }),
  41824. $globals.JSStream);
  41825. $core.addMethod(
  41826. $core.method({
  41827. selector: "nextPutIf:then:else:",
  41828. protocol: "streaming",
  41829. fn: function (aBlock,ifBlock,elseBlock){
  41830. var self=this,$self=this;
  41831. return $core.withContext(function($ctx1) {
  41832. var $1,$2,$3;
  41833. $recv($self["@stream"])._nextPutAll_("if(");
  41834. $ctx1.sendIdx["nextPutAll:"]=1;
  41835. $recv(aBlock)._value();
  41836. $ctx1.sendIdx["value"]=1;
  41837. $1=$self["@stream"];
  41838. $recv($1)._nextPutAll_("){");
  41839. $ctx1.sendIdx["nextPutAll:"]=2;
  41840. $2=$recv($1)._lf();
  41841. $ctx1.sendIdx["lf"]=1;
  41842. $recv(ifBlock)._value();
  41843. $ctx1.sendIdx["value"]=2;
  41844. $3=$self["@stream"];
  41845. $recv($3)._nextPutAll_("} else {");
  41846. $ctx1.sendIdx["nextPutAll:"]=3;
  41847. $recv($3)._lf();
  41848. $recv(elseBlock)._value();
  41849. $recv($self["@stream"])._nextPutAll_("}");
  41850. $self._omitSemicolon_(true);
  41851. return self;
  41852. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  41853. },
  41854. args: ["aBlock", "ifBlock", "elseBlock"],
  41855. 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",
  41856. referencedClasses: [],
  41857. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  41858. }),
  41859. $globals.JSStream);
  41860. $core.addMethod(
  41861. $core.method({
  41862. selector: "nextPutMethodDeclaration:with:",
  41863. protocol: "streaming",
  41864. fn: function (aMethod,aBlock){
  41865. var self=this,$self=this;
  41866. return $core.withContext(function($ctx1) {
  41867. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  41868. $1=$self["@stream"];
  41869. $recv($1)._nextPutAll_("$core.method({");
  41870. $ctx1.sendIdx["nextPutAll:"]=1;
  41871. $recv($1)._lf();
  41872. $ctx1.sendIdx["lf"]=1;
  41873. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  41874. $ctx1.sendIdx["asJavaScriptSource"]=1;
  41875. $3="selector: ".__comma($4);
  41876. $ctx1.sendIdx[","]=2;
  41877. $2=$recv($3).__comma(",");
  41878. $ctx1.sendIdx[","]=1;
  41879. $recv($1)._nextPutAll_($2);
  41880. $ctx1.sendIdx["nextPutAll:"]=2;
  41881. $recv($1)._lf();
  41882. $ctx1.sendIdx["lf"]=2;
  41883. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  41884. $ctx1.sendIdx["asJavaScriptSource"]=2;
  41885. $6="source: ".__comma($7);
  41886. $ctx1.sendIdx[","]=4;
  41887. $5=$recv($6).__comma(",");
  41888. $ctx1.sendIdx[","]=3;
  41889. $recv($1)._nextPutAll_($5);
  41890. $ctx1.sendIdx["nextPutAll:"]=3;
  41891. $8=$recv($1)._lf();
  41892. $ctx1.sendIdx["lf"]=3;
  41893. $recv(aBlock)._value();
  41894. $ctx1.sendIdx["value"]=1;
  41895. $9=$self["@stream"];
  41896. $12=$recv($globals.String)._lf();
  41897. $ctx1.sendIdx["lf"]=4;
  41898. $11=",".__comma($12);
  41899. $ctx1.sendIdx[","]=6;
  41900. $10=$recv($11).__comma("messageSends: ");
  41901. $ctx1.sendIdx[","]=5;
  41902. $recv($9)._nextPutAll_($10);
  41903. $ctx1.sendIdx["nextPutAll:"]=4;
  41904. $15=$recv($recv(aMethod)._messageSends())._asArray();
  41905. $ctx1.sendIdx["asArray"]=1;
  41906. $14=$recv($15)._asJavaScriptSource();
  41907. $ctx1.sendIdx["asJavaScriptSource"]=3;
  41908. $13=$recv($14).__comma(",");
  41909. $ctx1.sendIdx[","]=7;
  41910. $recv($9)._nextPutAll_($13);
  41911. $ctx1.sendIdx["nextPutAll:"]=5;
  41912. $recv($9)._lf();
  41913. $ctx1.sendIdx["lf"]=5;
  41914. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  41915. return $core.withContext(function($ctx2) {
  41916. return $recv(each)._value();
  41917. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41918. })))._asArray())._asJavaScriptSource();
  41919. $ctx1.sendIdx["asJavaScriptSource"]=4;
  41920. $17="args: ".__comma($18);
  41921. $16=$recv($17).__comma(",");
  41922. $ctx1.sendIdx[","]=8;
  41923. $recv($9)._nextPutAll_($16);
  41924. $ctx1.sendIdx["nextPutAll:"]=6;
  41925. $recv($9)._lf();
  41926. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  41927. $ctx1.sendIdx["nextPutAll:"]=7;
  41928. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  41929. return $core.withContext(function($ctx2) {
  41930. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  41931. $ctx2.sendIdx["nextPutAll:"]=8;
  41932. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41933. }),(function(){
  41934. return $core.withContext(function($ctx2) {
  41935. return $recv($self["@stream"])._nextPutAll_(",");
  41936. $ctx2.sendIdx["nextPutAll:"]=9;
  41937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41938. }));
  41939. $20=$self["@stream"];
  41940. $recv($20)._nextPutAll_("]");
  41941. $ctx1.sendIdx["nextPutAll:"]=10;
  41942. $recv($20)._nextPutAll_("})");
  41943. return self;
  41944. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  41945. },
  41946. args: ["aMethod", "aBlock"],
  41947. 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: '})'",
  41948. referencedClasses: ["String"],
  41949. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  41950. }),
  41951. $globals.JSStream);
  41952. $core.addMethod(
  41953. $core.method({
  41954. selector: "nextPutNonLocalReturnHandlingWith:",
  41955. protocol: "streaming",
  41956. fn: function (aBlock){
  41957. var self=this,$self=this;
  41958. return $core.withContext(function($ctx1) {
  41959. var $1,$2,$3;
  41960. $1=$self["@stream"];
  41961. $recv($1)._nextPutAll_("var $early={};");
  41962. $ctx1.sendIdx["nextPutAll:"]=1;
  41963. $recv($1)._lf();
  41964. $ctx1.sendIdx["lf"]=1;
  41965. $recv($1)._nextPutAll_("try {");
  41966. $ctx1.sendIdx["nextPutAll:"]=2;
  41967. $2=$recv($1)._lf();
  41968. $ctx1.sendIdx["lf"]=2;
  41969. $recv(aBlock)._value();
  41970. $3=$self["@stream"];
  41971. $recv($3)._nextPutAll_("}");
  41972. $ctx1.sendIdx["nextPutAll:"]=3;
  41973. $recv($3)._lf();
  41974. $ctx1.sendIdx["lf"]=3;
  41975. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  41976. $recv($3)._lf();
  41977. return self;
  41978. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  41979. },
  41980. args: ["aBlock"],
  41981. 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",
  41982. referencedClasses: [],
  41983. messageSends: ["nextPutAll:", "lf", "value"]
  41984. }),
  41985. $globals.JSStream);
  41986. $core.addMethod(
  41987. $core.method({
  41988. selector: "nextPutNonLocalReturnWith:",
  41989. protocol: "streaming",
  41990. fn: function (aBlock){
  41991. var self=this,$self=this;
  41992. return $core.withContext(function($ctx1) {
  41993. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  41994. $ctx1.sendIdx["nextPutAll:"]=1;
  41995. $recv(aBlock)._value();
  41996. $recv($self["@stream"])._nextPutAll_("]");
  41997. return self;
  41998. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  41999. },
  42000. args: ["aBlock"],
  42001. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42002. referencedClasses: [],
  42003. messageSends: ["nextPutAll:", "value"]
  42004. }),
  42005. $globals.JSStream);
  42006. $core.addMethod(
  42007. $core.method({
  42008. selector: "nextPutReturnWith:",
  42009. protocol: "streaming",
  42010. fn: function (aBlock){
  42011. var self=this,$self=this;
  42012. return $core.withContext(function($ctx1) {
  42013. $recv($self["@stream"])._nextPutAll_("return ");
  42014. $recv(aBlock)._value();
  42015. return self;
  42016. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42017. },
  42018. args: ["aBlock"],
  42019. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42020. referencedClasses: [],
  42021. messageSends: ["nextPutAll:", "value"]
  42022. }),
  42023. $globals.JSStream);
  42024. $core.addMethod(
  42025. $core.method({
  42026. selector: "nextPutSendIndexFor:",
  42027. protocol: "streaming",
  42028. fn: function (anIRSend){
  42029. var self=this,$self=this;
  42030. return $core.withContext(function($ctx1) {
  42031. $self._nextPutAll_(";");
  42032. $ctx1.sendIdx["nextPutAll:"]=1;
  42033. $self._lf();
  42034. $ctx1.sendIdx["lf"]=1;
  42035. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42036. $ctx1.sendIdx["nextPutAll:"]=2;
  42037. $self._lf();
  42038. $ctx1.sendIdx["lf"]=2;
  42039. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42040. $ctx1.sendIdx["nextPutAll:"]=3;
  42041. $self._nextPutAll_(".sendIdx[");
  42042. $ctx1.sendIdx["nextPutAll:"]=4;
  42043. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42044. $ctx1.sendIdx["nextPutAll:"]=5;
  42045. $self._nextPutAll_("]=");
  42046. $ctx1.sendIdx["nextPutAll:"]=6;
  42047. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42048. $ctx1.sendIdx["nextPutAll:"]=7;
  42049. $self._nextPutAll_(";");
  42050. $ctx1.sendIdx["nextPutAll:"]=8;
  42051. $self._lf();
  42052. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42053. return self;
  42054. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42055. },
  42056. args: ["anIRSend"],
  42057. 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)'",
  42058. referencedClasses: [],
  42059. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42060. }),
  42061. $globals.JSStream);
  42062. $core.addMethod(
  42063. $core.method({
  42064. selector: "nextPutStatementWith:",
  42065. protocol: "streaming",
  42066. fn: function (aBlock){
  42067. var self=this,$self=this;
  42068. return $core.withContext(function($ctx1) {
  42069. var $1;
  42070. $self._omitSemicolon_(false);
  42071. $ctx1.sendIdx["omitSemicolon:"]=1;
  42072. $recv(aBlock)._value();
  42073. $1=$self._omitSemicolon();
  42074. if(!$core.assert($1)){
  42075. $recv($self["@stream"])._nextPutAll_(";");
  42076. }
  42077. $self._omitSemicolon_(false);
  42078. $recv($self["@stream"])._lf();
  42079. return self;
  42080. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42081. },
  42082. args: ["aBlock"],
  42083. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42084. referencedClasses: [],
  42085. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42086. }),
  42087. $globals.JSStream);
  42088. $core.addMethod(
  42089. $core.method({
  42090. selector: "nextPutVars:",
  42091. protocol: "streaming",
  42092. fn: function (aCollection){
  42093. var self=this,$self=this;
  42094. return $core.withContext(function($ctx1) {
  42095. var $1;
  42096. $recv(aCollection)._ifNotEmpty_((function(){
  42097. return $core.withContext(function($ctx2) {
  42098. $recv($self["@stream"])._nextPutAll_("var ");
  42099. $ctx2.sendIdx["nextPutAll:"]=1;
  42100. $recv(aCollection)._do_separatedBy_((function(each){
  42101. return $core.withContext(function($ctx3) {
  42102. return $recv($self["@stream"])._nextPutAll_(each);
  42103. $ctx3.sendIdx["nextPutAll:"]=2;
  42104. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42105. }),(function(){
  42106. return $core.withContext(function($ctx3) {
  42107. return $recv($self["@stream"])._nextPutAll_(",");
  42108. $ctx3.sendIdx["nextPutAll:"]=3;
  42109. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42110. }));
  42111. $1=$self["@stream"];
  42112. $recv($1)._nextPutAll_(";");
  42113. return $recv($1)._lf();
  42114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42115. }));
  42116. return self;
  42117. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42118. },
  42119. args: ["aCollection"],
  42120. 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 ]",
  42121. referencedClasses: [],
  42122. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42123. }),
  42124. $globals.JSStream);
  42125. $core.addMethod(
  42126. $core.method({
  42127. selector: "omitSemicolon",
  42128. protocol: "accessing",
  42129. fn: function (){
  42130. var self=this,$self=this;
  42131. return $self["@omitSemicolon"];
  42132. },
  42133. args: [],
  42134. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42135. referencedClasses: [],
  42136. messageSends: []
  42137. }),
  42138. $globals.JSStream);
  42139. $core.addMethod(
  42140. $core.method({
  42141. selector: "omitSemicolon:",
  42142. protocol: "accessing",
  42143. fn: function (aBoolean){
  42144. var self=this,$self=this;
  42145. $self["@omitSemicolon"]=aBoolean;
  42146. return self;
  42147. },
  42148. args: ["aBoolean"],
  42149. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42150. referencedClasses: [],
  42151. messageSends: []
  42152. }),
  42153. $globals.JSStream);
  42154. $core.addMethod(
  42155. $core.method({
  42156. selector: "isReferenced",
  42157. protocol: "*Compiler-IR",
  42158. fn: function (){
  42159. var self=this,$self=this;
  42160. return $core.withContext(function($ctx1) {
  42161. var $3,$2,$1;
  42162. $3=$self._parent();
  42163. $ctx1.sendIdx["parent"]=1;
  42164. $2=$recv($3)._isSequenceNode();
  42165. $1=$recv($2)._or_((function(){
  42166. return $core.withContext(function($ctx2) {
  42167. return $recv($self._parent())._isAssignmentNode();
  42168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42169. }));
  42170. return $recv($1)._not();
  42171. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42172. },
  42173. args: [],
  42174. 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",
  42175. referencedClasses: [],
  42176. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42177. }),
  42178. $globals.ASTNode);
  42179. $core.addMethod(
  42180. $core.method({
  42181. selector: "subtreeNeedsAliasing",
  42182. protocol: "*Compiler-IR",
  42183. fn: function (){
  42184. var self=this,$self=this;
  42185. return $core.withContext(function($ctx1) {
  42186. return $recv($self._shouldBeAliased())._or_((function(){
  42187. return $core.withContext(function($ctx2) {
  42188. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42189. return $core.withContext(function($ctx3) {
  42190. return $recv(each)._subtreeNeedsAliasing();
  42191. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42192. }));
  42193. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42194. }));
  42195. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42196. },
  42197. args: [],
  42198. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42199. referencedClasses: [],
  42200. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42201. }),
  42202. $globals.ASTNode);
  42203. $core.addMethod(
  42204. $core.method({
  42205. selector: "shouldBeAliased",
  42206. protocol: "*Compiler-IR",
  42207. fn: function (){
  42208. var self=this,$self=this;
  42209. return $core.withContext(function($ctx1) {
  42210. var $1;
  42211. $1=(
  42212. $ctx1.supercall = true,
  42213. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42214. $ctx1.supercall = false;
  42215. return $recv($1)._or_((function(){
  42216. return $core.withContext(function($ctx2) {
  42217. return $self._isReferenced();
  42218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42219. }));
  42220. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42221. },
  42222. args: [],
  42223. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42224. referencedClasses: [],
  42225. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42226. }),
  42227. $globals.AssignmentNode);
  42228. $core.addMethod(
  42229. $core.method({
  42230. selector: "appendToInstruction:",
  42231. protocol: "*Compiler-IR",
  42232. fn: function (anIRInstruction){
  42233. var self=this,$self=this;
  42234. return $core.withContext(function($ctx1) {
  42235. $recv(anIRInstruction)._appendBlock_(self);
  42236. return self;
  42237. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42238. },
  42239. args: ["anIRInstruction"],
  42240. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42241. referencedClasses: [],
  42242. messageSends: ["appendBlock:"]
  42243. }),
  42244. $globals.BlockClosure);
  42245. $core.addMethod(
  42246. $core.method({
  42247. selector: "subtreeNeedsAliasing",
  42248. protocol: "*Compiler-IR",
  42249. fn: function (){
  42250. var self=this,$self=this;
  42251. return $core.withContext(function($ctx1) {
  42252. return $self._shouldBeAliased();
  42253. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42254. },
  42255. args: [],
  42256. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42257. referencedClasses: [],
  42258. messageSends: ["shouldBeAliased"]
  42259. }),
  42260. $globals.BlockNode);
  42261. $core.addMethod(
  42262. $core.method({
  42263. selector: "subtreeNeedsAliasing",
  42264. protocol: "*Compiler-IR",
  42265. fn: function (){
  42266. var self=this,$self=this;
  42267. return $core.withContext(function($ctx1) {
  42268. return $recv($recv($self._parent())._isSequenceNode())._not();
  42269. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42270. },
  42271. args: [],
  42272. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42273. referencedClasses: [],
  42274. messageSends: ["not", "isSequenceNode", "parent"]
  42275. }),
  42276. $globals.CascadeNode);
  42277. $core.addMethod(
  42278. $core.method({
  42279. selector: "shouldBeAliased",
  42280. protocol: "*Compiler-IR",
  42281. fn: function (){
  42282. var self=this,$self=this;
  42283. var sends;
  42284. return $core.withContext(function($ctx1) {
  42285. var $2,$1;
  42286. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42287. $2=(
  42288. $ctx1.supercall = true,
  42289. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42290. $ctx1.supercall = false;
  42291. $1=$recv($2)._or_((function(){
  42292. return $core.withContext(function($ctx2) {
  42293. return $recv($self._isReferenced())._and_((function(){
  42294. return $core.withContext(function($ctx3) {
  42295. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42296. return $core.withContext(function($ctx4) {
  42297. return $self._superSend();
  42298. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42299. }));
  42300. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42301. }));
  42302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42303. }));
  42304. $ctx1.sendIdx["or:"]=1;
  42305. return $1;
  42306. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42307. },
  42308. args: [],
  42309. 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 ] ] ])",
  42310. referencedClasses: [],
  42311. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42312. }),
  42313. $globals.SendNode);
  42314. $core.addMethod(
  42315. $core.method({
  42316. selector: "subtreeNeedsAliasing",
  42317. protocol: "*Compiler-IR",
  42318. fn: function (){
  42319. var self=this,$self=this;
  42320. return $core.withContext(function($ctx1) {
  42321. return $recv($self._shouldBeInlined())._or_((function(){
  42322. return $core.withContext(function($ctx2) {
  42323. return (
  42324. $ctx2.supercall = true,
  42325. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42326. $ctx2.supercall = false;
  42327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42328. }));
  42329. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42330. },
  42331. args: [],
  42332. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42333. referencedClasses: [],
  42334. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42335. }),
  42336. $globals.SendNode);
  42337. });
  42338. 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";
  42339. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42340. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42341. $core.addPackage("Compiler-Inlining");
  42342. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  42343. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42344. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42345. $core.addMethod(
  42346. $core.method({
  42347. selector: "visitSendNode:",
  42348. protocol: "visiting",
  42349. fn: function (aNode){
  42350. var self=this,$self=this;
  42351. return $core.withContext(function($ctx1) {
  42352. var $1,$2,$3,$4,$receiver;
  42353. $1=$recv(aNode)._superSend();
  42354. if(!$core.assert($1)){
  42355. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42356. if($core.assert($2)){
  42357. $recv(aNode)._shouldBeInlined_(true);
  42358. $3=$recv(aNode)._receiver();
  42359. if(($receiver = $3) == null || $receiver.a$nil){
  42360. $3;
  42361. } else {
  42362. var receiver;
  42363. receiver=$receiver;
  42364. $recv(receiver)._shouldBeAliased_(true);
  42365. }
  42366. }
  42367. }
  42368. $4=(
  42369. $ctx1.supercall = true,
  42370. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42371. $ctx1.supercall = false;
  42372. return $4;
  42373. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42374. },
  42375. args: ["aNode"],
  42376. 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",
  42377. referencedClasses: ["IRSendInliner"],
  42378. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42379. }),
  42380. $globals.ASTPreInliner);
  42381. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42382. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42383. $core.addMethod(
  42384. $core.method({
  42385. selector: "acceptDagVisitor:",
  42386. protocol: "visiting",
  42387. fn: function (aVisitor){
  42388. var self=this,$self=this;
  42389. return $core.withContext(function($ctx1) {
  42390. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42391. return self;
  42392. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42393. },
  42394. args: ["aVisitor"],
  42395. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42396. referencedClasses: [],
  42397. messageSends: ["visitIRInlinedClosure:"]
  42398. }),
  42399. $globals.IRInlinedClosure);
  42400. $core.addMethod(
  42401. $core.method({
  42402. selector: "isInlined",
  42403. protocol: "testing",
  42404. fn: function (){
  42405. var self=this,$self=this;
  42406. return true;
  42407. },
  42408. args: [],
  42409. source: "isInlined\x0a\x09^ true",
  42410. referencedClasses: [],
  42411. messageSends: []
  42412. }),
  42413. $globals.IRInlinedClosure);
  42414. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42415. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42416. $core.addMethod(
  42417. $core.method({
  42418. selector: "acceptDagVisitor:",
  42419. protocol: "visiting",
  42420. fn: function (aVisitor){
  42421. var self=this,$self=this;
  42422. return $core.withContext(function($ctx1) {
  42423. $recv(aVisitor)._visitInlinedSend_(self);
  42424. return self;
  42425. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42426. },
  42427. args: ["aVisitor"],
  42428. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42429. referencedClasses: [],
  42430. messageSends: ["visitInlinedSend:"]
  42431. }),
  42432. $globals.IRInlinedSend);
  42433. $core.addMethod(
  42434. $core.method({
  42435. selector: "internalVariables",
  42436. protocol: "accessing",
  42437. fn: function (){
  42438. var self=this,$self=this;
  42439. return [];
  42440. },
  42441. args: [],
  42442. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42443. referencedClasses: [],
  42444. messageSends: []
  42445. }),
  42446. $globals.IRInlinedSend);
  42447. $core.addMethod(
  42448. $core.method({
  42449. selector: "isInlined",
  42450. protocol: "testing",
  42451. fn: function (){
  42452. var self=this,$self=this;
  42453. return true;
  42454. },
  42455. args: [],
  42456. source: "isInlined\x0a\x09^ true",
  42457. referencedClasses: [],
  42458. messageSends: []
  42459. }),
  42460. $globals.IRInlinedSend);
  42461. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42462. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42463. $core.addMethod(
  42464. $core.method({
  42465. selector: "acceptDagVisitor:",
  42466. protocol: "visiting",
  42467. fn: function (aVisitor){
  42468. var self=this,$self=this;
  42469. return $core.withContext(function($ctx1) {
  42470. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42471. return self;
  42472. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42473. },
  42474. args: ["aVisitor"],
  42475. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42476. referencedClasses: [],
  42477. messageSends: ["visitIRInlinedIfFalse:"]
  42478. }),
  42479. $globals.IRInlinedIfFalse);
  42480. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42481. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42482. $core.addMethod(
  42483. $core.method({
  42484. selector: "acceptDagVisitor:",
  42485. protocol: "visiting",
  42486. fn: function (aVisitor){
  42487. var self=this,$self=this;
  42488. return $core.withContext(function($ctx1) {
  42489. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42490. return self;
  42491. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42492. },
  42493. args: ["aVisitor"],
  42494. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42495. referencedClasses: [],
  42496. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42497. }),
  42498. $globals.IRInlinedIfNilIfNotNil);
  42499. $core.addMethod(
  42500. $core.method({
  42501. selector: "internalVariables",
  42502. protocol: "accessing",
  42503. fn: function (){
  42504. var self=this,$self=this;
  42505. return $core.withContext(function($ctx1) {
  42506. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42507. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42508. },
  42509. args: [],
  42510. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42511. referencedClasses: ["Array"],
  42512. messageSends: ["with:", "receiverInternalVariable"]
  42513. }),
  42514. $globals.IRInlinedIfNilIfNotNil);
  42515. $core.addMethod(
  42516. $core.method({
  42517. selector: "receiverInternalVariable",
  42518. protocol: "accessing",
  42519. fn: function (){
  42520. var self=this,$self=this;
  42521. return $core.withContext(function($ctx1) {
  42522. var $1;
  42523. $1=$recv($globals.IRVariable)._new();
  42524. $ctx1.sendIdx["new"]=1;
  42525. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  42526. return $recv($1)._yourself();
  42527. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  42528. },
  42529. args: [],
  42530. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  42531. referencedClasses: ["IRVariable", "AliasVar"],
  42532. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  42533. }),
  42534. $globals.IRInlinedIfNilIfNotNil);
  42535. $core.addMethod(
  42536. $core.method({
  42537. selector: "receiverInternalVariableName",
  42538. protocol: "accessing",
  42539. fn: function (){
  42540. var self=this,$self=this;
  42541. return "$receiver";
  42542. },
  42543. args: [],
  42544. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  42545. referencedClasses: [],
  42546. messageSends: []
  42547. }),
  42548. $globals.IRInlinedIfNilIfNotNil);
  42549. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42550. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  42551. $core.addMethod(
  42552. $core.method({
  42553. selector: "acceptDagVisitor:",
  42554. protocol: "visiting",
  42555. fn: function (aVisitor){
  42556. var self=this,$self=this;
  42557. return $core.withContext(function($ctx1) {
  42558. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  42559. return self;
  42560. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  42561. },
  42562. args: ["aVisitor"],
  42563. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  42564. referencedClasses: [],
  42565. messageSends: ["visitIRInlinedIfTrue:"]
  42566. }),
  42567. $globals.IRInlinedIfTrue);
  42568. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42569. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  42570. $core.addMethod(
  42571. $core.method({
  42572. selector: "acceptDagVisitor:",
  42573. protocol: "visiting",
  42574. fn: function (aVisitor){
  42575. var self=this,$self=this;
  42576. return $core.withContext(function($ctx1) {
  42577. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  42578. return self;
  42579. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  42580. },
  42581. args: ["aVisitor"],
  42582. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  42583. referencedClasses: [],
  42584. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  42585. }),
  42586. $globals.IRInlinedIfTrueIfFalse);
  42587. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  42588. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  42589. $core.addMethod(
  42590. $core.method({
  42591. selector: "acceptDagVisitor:",
  42592. protocol: "visiting",
  42593. fn: function (aVisitor){
  42594. var self=this,$self=this;
  42595. return $core.withContext(function($ctx1) {
  42596. $recv(aVisitor)._visitIRInlinedSequence_(self);
  42597. return self;
  42598. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  42599. },
  42600. args: ["aVisitor"],
  42601. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  42602. referencedClasses: [],
  42603. messageSends: ["visitIRInlinedSequence:"]
  42604. }),
  42605. $globals.IRInlinedSequence);
  42606. $core.addMethod(
  42607. $core.method({
  42608. selector: "isInlined",
  42609. protocol: "testing",
  42610. fn: function (){
  42611. var self=this,$self=this;
  42612. return true;
  42613. },
  42614. args: [],
  42615. source: "isInlined\x0a\x09^ true",
  42616. referencedClasses: [],
  42617. messageSends: []
  42618. }),
  42619. $globals.IRInlinedSequence);
  42620. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  42621. $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`";
  42622. $core.addMethod(
  42623. $core.method({
  42624. selector: "assignmentInliner",
  42625. protocol: "factory",
  42626. fn: function (){
  42627. var self=this,$self=this;
  42628. return $core.withContext(function($ctx1) {
  42629. var $1;
  42630. $1=$recv($globals.IRAssignmentInliner)._new();
  42631. $recv($1)._translator_(self);
  42632. return $recv($1)._yourself();
  42633. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  42634. },
  42635. args: [],
  42636. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42637. referencedClasses: ["IRAssignmentInliner"],
  42638. messageSends: ["translator:", "new", "yourself"]
  42639. }),
  42640. $globals.IRInliner);
  42641. $core.addMethod(
  42642. $core.method({
  42643. selector: "returnInliner",
  42644. protocol: "factory",
  42645. fn: function (){
  42646. var self=this,$self=this;
  42647. return $core.withContext(function($ctx1) {
  42648. var $1;
  42649. $1=$recv($globals.IRReturnInliner)._new();
  42650. $recv($1)._translator_(self);
  42651. return $recv($1)._yourself();
  42652. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  42653. },
  42654. args: [],
  42655. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42656. referencedClasses: ["IRReturnInliner"],
  42657. messageSends: ["translator:", "new", "yourself"]
  42658. }),
  42659. $globals.IRInliner);
  42660. $core.addMethod(
  42661. $core.method({
  42662. selector: "sendInliner",
  42663. protocol: "factory",
  42664. fn: function (){
  42665. var self=this,$self=this;
  42666. return $core.withContext(function($ctx1) {
  42667. var $1;
  42668. $1=$recv($globals.IRSendInliner)._new();
  42669. $recv($1)._translator_(self);
  42670. return $recv($1)._yourself();
  42671. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  42672. },
  42673. args: [],
  42674. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  42675. referencedClasses: ["IRSendInliner"],
  42676. messageSends: ["translator:", "new", "yourself"]
  42677. }),
  42678. $globals.IRInliner);
  42679. $core.addMethod(
  42680. $core.method({
  42681. selector: "shouldInlineAssignment:",
  42682. protocol: "testing",
  42683. fn: function (anIRAssignment){
  42684. var self=this,$self=this;
  42685. return $core.withContext(function($ctx1) {
  42686. var $3,$2,$1;
  42687. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  42688. return $core.withContext(function($ctx2) {
  42689. $3=$recv(anIRAssignment)._right();
  42690. $ctx2.sendIdx["right"]=1;
  42691. $2=$recv($3)._isSend();
  42692. return $recv($2)._and_((function(){
  42693. return $core.withContext(function($ctx3) {
  42694. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  42695. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42696. }));
  42697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42698. }));
  42699. $ctx1.sendIdx["and:"]=1;
  42700. return $1;
  42701. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  42702. },
  42703. args: ["anIRAssignment"],
  42704. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  42705. referencedClasses: [],
  42706. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  42707. }),
  42708. $globals.IRInliner);
  42709. $core.addMethod(
  42710. $core.method({
  42711. selector: "shouldInlineReturn:",
  42712. protocol: "testing",
  42713. fn: function (anIRReturn){
  42714. var self=this,$self=this;
  42715. return $core.withContext(function($ctx1) {
  42716. var $3,$2,$1;
  42717. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  42718. return $core.withContext(function($ctx2) {
  42719. $3=$recv(anIRReturn)._expression();
  42720. $ctx2.sendIdx["expression"]=1;
  42721. $2=$recv($3)._isSend();
  42722. return $recv($2)._and_((function(){
  42723. return $core.withContext(function($ctx3) {
  42724. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  42725. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42726. }));
  42727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42728. }));
  42729. $ctx1.sendIdx["and:"]=1;
  42730. return $1;
  42731. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  42732. },
  42733. args: ["anIRReturn"],
  42734. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  42735. referencedClasses: [],
  42736. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  42737. }),
  42738. $globals.IRInliner);
  42739. $core.addMethod(
  42740. $core.method({
  42741. selector: "shouldInlineSend:",
  42742. protocol: "testing",
  42743. fn: function (anIRSend){
  42744. var self=this,$self=this;
  42745. return $core.withContext(function($ctx1) {
  42746. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  42747. return $core.withContext(function($ctx2) {
  42748. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  42749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42750. }));
  42751. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  42752. },
  42753. args: ["anIRSend"],
  42754. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  42755. referencedClasses: ["IRSendInliner"],
  42756. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  42757. }),
  42758. $globals.IRInliner);
  42759. $core.addMethod(
  42760. $core.method({
  42761. selector: "visitIRAssignment:",
  42762. protocol: "visiting",
  42763. fn: function (anIRAssignment){
  42764. var self=this,$self=this;
  42765. return $core.withContext(function($ctx1) {
  42766. var $1;
  42767. $1=$self._shouldInlineAssignment_(anIRAssignment);
  42768. if($core.assert($1)){
  42769. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  42770. } else {
  42771. return (
  42772. $ctx1.supercall = true,
  42773. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  42774. $ctx1.supercall = false;
  42775. }
  42776. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  42777. },
  42778. args: ["anIRAssignment"],
  42779. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  42780. referencedClasses: [],
  42781. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  42782. }),
  42783. $globals.IRInliner);
  42784. $core.addMethod(
  42785. $core.method({
  42786. selector: "visitIRNonLocalReturn:",
  42787. protocol: "visiting",
  42788. fn: function (anIRNonLocalReturn){
  42789. var self=this,$self=this;
  42790. var localReturn;
  42791. return $core.withContext(function($ctx1) {
  42792. var $2,$1,$4,$3,$5,$6,$7;
  42793. $2=$recv(anIRNonLocalReturn)._scope();
  42794. $ctx1.sendIdx["scope"]=1;
  42795. $1=$recv($2)._canInlineNonLocalReturns();
  42796. if($core.assert($1)){
  42797. $4=$recv(anIRNonLocalReturn)._scope();
  42798. $ctx1.sendIdx["scope"]=2;
  42799. $3=$recv($4)._methodScope();
  42800. $5=$recv(anIRNonLocalReturn)._scope();
  42801. $ctx1.sendIdx["scope"]=3;
  42802. $recv($3)._removeNonLocalReturn_($5);
  42803. $6=$recv($globals.IRReturn)._new();
  42804. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  42805. localReturn=$recv($6)._yourself();
  42806. localReturn;
  42807. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  42808. return $core.withContext(function($ctx2) {
  42809. return $recv(localReturn)._add_(each);
  42810. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42811. }));
  42812. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  42813. return $self._visitIRReturn_(localReturn);
  42814. }
  42815. $7=(
  42816. $ctx1.supercall = true,
  42817. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  42818. $ctx1.supercall = false;
  42819. return $7;
  42820. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  42821. },
  42822. args: ["anIRNonLocalReturn"],
  42823. 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",
  42824. referencedClasses: ["IRReturn"],
  42825. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  42826. }),
  42827. $globals.IRInliner);
  42828. $core.addMethod(
  42829. $core.method({
  42830. selector: "visitIRReturn:",
  42831. protocol: "visiting",
  42832. fn: function (anIRReturn){
  42833. var self=this,$self=this;
  42834. return $core.withContext(function($ctx1) {
  42835. var $1;
  42836. $1=$self._shouldInlineReturn_(anIRReturn);
  42837. if($core.assert($1)){
  42838. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  42839. } else {
  42840. return (
  42841. $ctx1.supercall = true,
  42842. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  42843. $ctx1.supercall = false;
  42844. }
  42845. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  42846. },
  42847. args: ["anIRReturn"],
  42848. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  42849. referencedClasses: [],
  42850. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  42851. }),
  42852. $globals.IRInliner);
  42853. $core.addMethod(
  42854. $core.method({
  42855. selector: "visitIRSend:",
  42856. protocol: "visiting",
  42857. fn: function (anIRSend){
  42858. var self=this,$self=this;
  42859. return $core.withContext(function($ctx1) {
  42860. var $1;
  42861. $1=$self._shouldInlineSend_(anIRSend);
  42862. if($core.assert($1)){
  42863. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  42864. } else {
  42865. return (
  42866. $ctx1.supercall = true,
  42867. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  42868. $ctx1.supercall = false;
  42869. }
  42870. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  42871. },
  42872. args: ["anIRSend"],
  42873. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  42874. referencedClasses: [],
  42875. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  42876. }),
  42877. $globals.IRInliner);
  42878. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  42879. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  42880. $core.addMethod(
  42881. $core.method({
  42882. selector: "visitIRInlinedClosure:",
  42883. protocol: "visiting",
  42884. fn: function (anIRInlinedClosure){
  42885. var self=this,$self=this;
  42886. return $core.withContext(function($ctx1) {
  42887. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  42888. return $core.withContext(function($ctx2) {
  42889. return $recv($recv(each)._name())._asVariableName();
  42890. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42891. })));
  42892. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  42893. return self;
  42894. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  42895. },
  42896. args: ["anIRInlinedClosure"],
  42897. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  42898. referencedClasses: [],
  42899. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  42900. }),
  42901. $globals.IRInliningJSTranslator);
  42902. $core.addMethod(
  42903. $core.method({
  42904. selector: "visitIRInlinedIfFalse:",
  42905. protocol: "visiting",
  42906. fn: function (anIRInlinedIfFalse){
  42907. var self=this,$self=this;
  42908. return $core.withContext(function($ctx1) {
  42909. var $1,$2,$4,$3;
  42910. $1=$self._stream();
  42911. $ctx1.sendIdx["stream"]=1;
  42912. $recv($1)._nextPutIf_then_((function(){
  42913. return $core.withContext(function($ctx2) {
  42914. $2=$self._stream();
  42915. $ctx2.sendIdx["stream"]=2;
  42916. $recv($2)._nextPutAll_("!$core.assert(");
  42917. $ctx2.sendIdx["nextPutAll:"]=1;
  42918. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  42919. $ctx2.sendIdx["dagChildren"]=1;
  42920. $3=$recv($4)._first();
  42921. $self._visit_($3);
  42922. $ctx2.sendIdx["visit:"]=1;
  42923. return $recv($self._stream())._nextPutAll_(")");
  42924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42925. }),(function(){
  42926. return $core.withContext(function($ctx2) {
  42927. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  42928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42929. }));
  42930. return self;
  42931. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  42932. },
  42933. args: ["anIRInlinedIfFalse"],
  42934. 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 ]",
  42935. referencedClasses: [],
  42936. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  42937. }),
  42938. $globals.IRInliningJSTranslator);
  42939. $core.addMethod(
  42940. $core.method({
  42941. selector: "visitIRInlinedIfNilIfNotNil:",
  42942. protocol: "visiting",
  42943. fn: function (anIRInlinedIfNilIfNotNil){
  42944. var self=this,$self=this;
  42945. return $core.withContext(function($ctx1) {
  42946. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  42947. $1=$self._stream();
  42948. $ctx1.sendIdx["stream"]=1;
  42949. $recv($1)._nextPutIf_then_else_((function(){
  42950. var recvVarName;
  42951. return $core.withContext(function($ctx2) {
  42952. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  42953. recvVarName;
  42954. $2=$self._stream();
  42955. $ctx2.sendIdx["stream"]=2;
  42956. $4="(".__comma(recvVarName);
  42957. $ctx2.sendIdx[","]=2;
  42958. $3=$recv($4).__comma(" = ");
  42959. $ctx2.sendIdx[","]=1;
  42960. $recv($2)._nextPutAll_($3);
  42961. $ctx2.sendIdx["nextPutAll:"]=1;
  42962. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  42963. $ctx2.sendIdx["dagChildren"]=1;
  42964. $5=$recv($6)._first();
  42965. $self._visit_($5);
  42966. $ctx2.sendIdx["visit:"]=1;
  42967. $7=$self._stream();
  42968. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  42969. $ctx2.sendIdx[","]=3;
  42970. return $recv($7)._nextPutAll_($8);
  42971. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  42972. }),(function(){
  42973. return $core.withContext(function($ctx2) {
  42974. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  42975. $ctx2.sendIdx["dagChildren"]=2;
  42976. $9=$recv($10)._second();
  42977. return $self._visit_($9);
  42978. $ctx2.sendIdx["visit:"]=2;
  42979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42980. }),(function(){
  42981. return $core.withContext(function($ctx2) {
  42982. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  42983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42984. }));
  42985. return self;
  42986. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  42987. },
  42988. args: ["anIRInlinedIfNilIfNotNil"],
  42989. 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 ]",
  42990. referencedClasses: [],
  42991. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  42992. }),
  42993. $globals.IRInliningJSTranslator);
  42994. $core.addMethod(
  42995. $core.method({
  42996. selector: "visitIRInlinedIfTrue:",
  42997. protocol: "visiting",
  42998. fn: function (anIRInlinedIfTrue){
  42999. var self=this,$self=this;
  43000. return $core.withContext(function($ctx1) {
  43001. var $1,$2,$4,$3;
  43002. $1=$self._stream();
  43003. $ctx1.sendIdx["stream"]=1;
  43004. $recv($1)._nextPutIf_then_((function(){
  43005. return $core.withContext(function($ctx2) {
  43006. $2=$self._stream();
  43007. $ctx2.sendIdx["stream"]=2;
  43008. $recv($2)._nextPutAll_("$core.assert(");
  43009. $ctx2.sendIdx["nextPutAll:"]=1;
  43010. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43011. $ctx2.sendIdx["dagChildren"]=1;
  43012. $3=$recv($4)._first();
  43013. $self._visit_($3);
  43014. $ctx2.sendIdx["visit:"]=1;
  43015. return $recv($self._stream())._nextPutAll_(")");
  43016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43017. }),(function(){
  43018. return $core.withContext(function($ctx2) {
  43019. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43021. }));
  43022. return self;
  43023. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43024. },
  43025. args: ["anIRInlinedIfTrue"],
  43026. 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 ]",
  43027. referencedClasses: [],
  43028. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43029. }),
  43030. $globals.IRInliningJSTranslator);
  43031. $core.addMethod(
  43032. $core.method({
  43033. selector: "visitIRInlinedIfTrueIfFalse:",
  43034. protocol: "visiting",
  43035. fn: function (anIRInlinedIfTrueIfFalse){
  43036. var self=this,$self=this;
  43037. return $core.withContext(function($ctx1) {
  43038. var $1,$2,$4,$3,$6,$5;
  43039. $1=$self._stream();
  43040. $ctx1.sendIdx["stream"]=1;
  43041. $recv($1)._nextPutIf_then_else_((function(){
  43042. return $core.withContext(function($ctx2) {
  43043. $2=$self._stream();
  43044. $ctx2.sendIdx["stream"]=2;
  43045. $recv($2)._nextPutAll_("$core.assert(");
  43046. $ctx2.sendIdx["nextPutAll:"]=1;
  43047. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43048. $ctx2.sendIdx["dagChildren"]=1;
  43049. $3=$recv($4)._first();
  43050. $self._visit_($3);
  43051. $ctx2.sendIdx["visit:"]=1;
  43052. return $recv($self._stream())._nextPutAll_(")");
  43053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43054. }),(function(){
  43055. return $core.withContext(function($ctx2) {
  43056. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43057. $ctx2.sendIdx["dagChildren"]=2;
  43058. $5=$recv($6)._second();
  43059. return $self._visit_($5);
  43060. $ctx2.sendIdx["visit:"]=2;
  43061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43062. }),(function(){
  43063. return $core.withContext(function($ctx2) {
  43064. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43066. }));
  43067. return self;
  43068. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43069. },
  43070. args: ["anIRInlinedIfTrueIfFalse"],
  43071. 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 ]",
  43072. referencedClasses: [],
  43073. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43074. }),
  43075. $globals.IRInliningJSTranslator);
  43076. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43077. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43078. $core.addMethod(
  43079. $core.method({
  43080. selector: "ifFalse:",
  43081. protocol: "inlining",
  43082. fn: function (anIRInstruction){
  43083. var self=this,$self=this;
  43084. return $core.withContext(function($ctx1) {
  43085. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43086. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43087. },
  43088. args: ["anIRInstruction"],
  43089. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43090. referencedClasses: ["IRInlinedIfFalse"],
  43091. messageSends: ["inlinedSend:withBlock:", "new"]
  43092. }),
  43093. $globals.IRSendInliner);
  43094. $core.addMethod(
  43095. $core.method({
  43096. selector: "ifFalse:ifTrue:",
  43097. protocol: "inlining",
  43098. fn: function (anIRInstruction,anotherIRInstruction){
  43099. var self=this,$self=this;
  43100. return $core.withContext(function($ctx1) {
  43101. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43102. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43103. },
  43104. args: ["anIRInstruction", "anotherIRInstruction"],
  43105. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43106. referencedClasses: [],
  43107. messageSends: ["perform:withArguments:"]
  43108. }),
  43109. $globals.IRSendInliner);
  43110. $core.addMethod(
  43111. $core.method({
  43112. selector: "ifNil:",
  43113. protocol: "inlining",
  43114. fn: function (anIRInstruction){
  43115. var self=this,$self=this;
  43116. return $core.withContext(function($ctx1) {
  43117. var $1,$3,$5,$6,$4,$2;
  43118. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43119. $ctx1.sendIdx["new"]=1;
  43120. $3=$recv($globals.IRClosure)._new();
  43121. $ctx1.sendIdx["new"]=2;
  43122. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43123. $5=$recv($globals.IRBlockSequence)._new();
  43124. $recv($5)._add_($recv($self._send())._receiver());
  43125. $6=$recv($5)._yourself();
  43126. $ctx1.sendIdx["yourself"]=1;
  43127. $4=$6;
  43128. $recv($3)._add_($4);
  43129. $ctx1.sendIdx["add:"]=1;
  43130. $2=$recv($3)._yourself();
  43131. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43132. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43133. },
  43134. args: ["anIRInstruction"],
  43135. 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)",
  43136. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43137. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43138. }),
  43139. $globals.IRSendInliner);
  43140. $core.addMethod(
  43141. $core.method({
  43142. selector: "ifNil:ifNotNil:",
  43143. protocol: "inlining",
  43144. fn: function (anIRInstruction,anotherIRInstruction){
  43145. var self=this,$self=this;
  43146. return $core.withContext(function($ctx1) {
  43147. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43148. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43149. },
  43150. args: ["anIRInstruction", "anotherIRInstruction"],
  43151. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43152. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43153. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43154. }),
  43155. $globals.IRSendInliner);
  43156. $core.addMethod(
  43157. $core.method({
  43158. selector: "ifNotNil:",
  43159. protocol: "inlining",
  43160. fn: function (anIRInstruction){
  43161. var self=this,$self=this;
  43162. return $core.withContext(function($ctx1) {
  43163. var $1,$3,$5,$6,$4,$2;
  43164. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43165. $ctx1.sendIdx["new"]=1;
  43166. $3=$recv($globals.IRClosure)._new();
  43167. $ctx1.sendIdx["new"]=2;
  43168. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43169. $5=$recv($globals.IRBlockSequence)._new();
  43170. $recv($5)._add_($recv($self._send())._receiver());
  43171. $6=$recv($5)._yourself();
  43172. $ctx1.sendIdx["yourself"]=1;
  43173. $4=$6;
  43174. $recv($3)._add_($4);
  43175. $ctx1.sendIdx["add:"]=1;
  43176. $2=$recv($3)._yourself();
  43177. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43178. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43179. },
  43180. args: ["anIRInstruction"],
  43181. 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",
  43182. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43183. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43184. }),
  43185. $globals.IRSendInliner);
  43186. $core.addMethod(
  43187. $core.method({
  43188. selector: "ifNotNil:ifNil:",
  43189. protocol: "inlining",
  43190. fn: function (anIRInstruction,anotherIRInstruction){
  43191. var self=this,$self=this;
  43192. return $core.withContext(function($ctx1) {
  43193. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43194. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43195. },
  43196. args: ["anIRInstruction", "anotherIRInstruction"],
  43197. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43198. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43199. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43200. }),
  43201. $globals.IRSendInliner);
  43202. $core.addMethod(
  43203. $core.method({
  43204. selector: "ifTrue:",
  43205. protocol: "inlining",
  43206. fn: function (anIRInstruction){
  43207. var self=this,$self=this;
  43208. return $core.withContext(function($ctx1) {
  43209. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43210. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43211. },
  43212. args: ["anIRInstruction"],
  43213. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43214. referencedClasses: ["IRInlinedIfTrue"],
  43215. messageSends: ["inlinedSend:withBlock:", "new"]
  43216. }),
  43217. $globals.IRSendInliner);
  43218. $core.addMethod(
  43219. $core.method({
  43220. selector: "ifTrue:ifFalse:",
  43221. protocol: "inlining",
  43222. fn: function (anIRInstruction,anotherIRInstruction){
  43223. var self=this,$self=this;
  43224. return $core.withContext(function($ctx1) {
  43225. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43226. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43227. },
  43228. args: ["anIRInstruction", "anotherIRInstruction"],
  43229. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43230. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43231. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43232. }),
  43233. $globals.IRSendInliner);
  43234. $core.addMethod(
  43235. $core.method({
  43236. selector: "inlineClosure:",
  43237. protocol: "inlining",
  43238. fn: function (anIRClosure){
  43239. var self=this,$self=this;
  43240. var inlinedClosure,sequence,statements;
  43241. return $core.withContext(function($ctx1) {
  43242. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43243. inlinedClosure=$self._inlinedClosure();
  43244. $1=inlinedClosure;
  43245. $2=$recv(anIRClosure)._scope();
  43246. $ctx1.sendIdx["scope"]=1;
  43247. $recv($1)._scope_($2);
  43248. $ctx1.sendIdx["scope:"]=1;
  43249. $recv($1)._parent_($recv(anIRClosure)._parent());
  43250. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43251. return $core.withContext(function($ctx2) {
  43252. return $recv(inlinedClosure)._add_(each);
  43253. $ctx2.sendIdx["add:"]=1;
  43254. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43255. }));
  43256. $ctx1.sendIdx["do:"]=1;
  43257. sequence=$self._inlinedSequence();
  43258. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43259. return $core.withContext(function($ctx2) {
  43260. $3=inlinedClosure;
  43261. $5=$recv($globals.IRTempDeclaration)._new();
  43262. $ctx2.sendIdx["new"]=1;
  43263. $recv($5)._name_(each);
  43264. $ctx2.sendIdx["name:"]=1;
  43265. $6=$recv($5)._yourself();
  43266. $ctx2.sendIdx["yourself"]=1;
  43267. $4=$6;
  43268. $recv($3)._add_($4);
  43269. $ctx2.sendIdx["add:"]=2;
  43270. $7=sequence;
  43271. $9=$recv($globals.IRAssignment)._new();
  43272. $ctx2.sendIdx["new"]=2;
  43273. $11=$recv($globals.IRVariable)._new();
  43274. $ctx2.sendIdx["new"]=3;
  43275. $13=$recv($globals.AliasVar)._new();
  43276. $ctx2.sendIdx["new"]=4;
  43277. $14=$recv(inlinedClosure)._scope();
  43278. $ctx2.sendIdx["scope"]=2;
  43279. $recv($13)._scope_($14);
  43280. $ctx2.sendIdx["scope:"]=2;
  43281. $recv($13)._name_(each);
  43282. $ctx2.sendIdx["name:"]=2;
  43283. $15=$recv($13)._yourself();
  43284. $ctx2.sendIdx["yourself"]=2;
  43285. $12=$15;
  43286. $10=$recv($11)._variable_($12);
  43287. $ctx2.sendIdx["variable:"]=1;
  43288. $recv($9)._add_($10);
  43289. $ctx2.sendIdx["add:"]=4;
  43290. $17=$recv($globals.IRVariable)._new();
  43291. $ctx2.sendIdx["new"]=5;
  43292. $19=$recv($globals.AliasVar)._new();
  43293. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43294. $recv($19)._name_("$receiver");
  43295. $20=$recv($19)._yourself();
  43296. $ctx2.sendIdx["yourself"]=3;
  43297. $18=$20;
  43298. $16=$recv($17)._variable_($18);
  43299. $recv($9)._add_($16);
  43300. $ctx2.sendIdx["add:"]=5;
  43301. $8=$recv($9)._yourself();
  43302. return $recv($7)._add_($8);
  43303. $ctx2.sendIdx["add:"]=3;
  43304. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43305. }));
  43306. $ctx1.sendIdx["do:"]=2;
  43307. $recv(inlinedClosure)._add_(sequence);
  43308. $ctx1.sendIdx["add:"]=6;
  43309. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43310. $recv(statements)._ifNotEmpty_((function(){
  43311. return $core.withContext(function($ctx2) {
  43312. $recv($recv(statements)._allButLast())._do_((function(each){
  43313. return $core.withContext(function($ctx3) {
  43314. return $recv(sequence)._add_(each);
  43315. $ctx3.sendIdx["add:"]=7;
  43316. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43317. }));
  43318. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43320. }));
  43321. return inlinedClosure;
  43322. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43323. },
  43324. args: ["anIRClosure"],
  43325. 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",
  43326. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43327. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43328. }),
  43329. $globals.IRSendInliner);
  43330. $core.addMethod(
  43331. $core.method({
  43332. selector: "inlineSend:",
  43333. protocol: "inlining",
  43334. fn: function (anIRSend){
  43335. var self=this,$self=this;
  43336. return $core.withContext(function($ctx1) {
  43337. var $2,$1;
  43338. $self._send_(anIRSend);
  43339. $2=$self._send();
  43340. $ctx1.sendIdx["send"]=1;
  43341. $1=$recv($2)._selector();
  43342. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43343. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43344. },
  43345. args: ["anIRSend"],
  43346. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43347. referencedClasses: [],
  43348. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43349. }),
  43350. $globals.IRSendInliner);
  43351. $core.addMethod(
  43352. $core.method({
  43353. selector: "inlineSend:andReplace:",
  43354. protocol: "private",
  43355. fn: function (anIRSend,anIRInstruction){
  43356. var self=this,$self=this;
  43357. return $core.withContext(function($ctx1) {
  43358. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43359. return $self._inlineSend_(anIRSend);
  43360. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43361. },
  43362. args: ["anIRSend", "anIRInstruction"],
  43363. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43364. referencedClasses: [],
  43365. messageSends: ["replaceWith:", "inlineSend:"]
  43366. }),
  43367. $globals.IRSendInliner);
  43368. $core.addMethod(
  43369. $core.method({
  43370. selector: "inlinedClosure",
  43371. protocol: "factory",
  43372. fn: function (){
  43373. var self=this,$self=this;
  43374. return $core.withContext(function($ctx1) {
  43375. return $recv($globals.IRInlinedClosure)._new();
  43376. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43377. },
  43378. args: [],
  43379. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43380. referencedClasses: ["IRInlinedClosure"],
  43381. messageSends: ["new"]
  43382. }),
  43383. $globals.IRSendInliner);
  43384. $core.addMethod(
  43385. $core.method({
  43386. selector: "inlinedSend:withBlock:",
  43387. protocol: "private",
  43388. fn: function (inlinedSend,anIRInstruction){
  43389. var self=this,$self=this;
  43390. var inlinedClosure;
  43391. return $core.withContext(function($ctx1) {
  43392. var $1,$2,$4,$3,$5;
  43393. $1=$recv(anIRInstruction)._isClosure();
  43394. if(!$core.assert($1)){
  43395. $self._inliningError_("Message argument should be a block");
  43396. $ctx1.sendIdx["inliningError:"]=1;
  43397. }
  43398. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43399. if(!$core.assert($2)){
  43400. $self._inliningError_("Inlined block should have zero argument");
  43401. }
  43402. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43403. $4=$self._send();
  43404. $ctx1.sendIdx["send"]=1;
  43405. $3=$recv($4)._receiver();
  43406. $recv(inlinedSend)._add_($3);
  43407. $ctx1.sendIdx["add:"]=1;
  43408. $recv(inlinedSend)._add_(inlinedClosure);
  43409. $recv($self._send())._replaceWith_(inlinedSend);
  43410. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43411. $ctx1.sendIdx["internalVariables"]=1;
  43412. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43413. return inlinedSend;
  43414. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43415. },
  43416. args: ["inlinedSend", "anIRInstruction"],
  43417. 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",
  43418. referencedClasses: [],
  43419. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43420. }),
  43421. $globals.IRSendInliner);
  43422. $core.addMethod(
  43423. $core.method({
  43424. selector: "inlinedSend:withBlock:withBlock:",
  43425. protocol: "private",
  43426. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43427. var self=this,$self=this;
  43428. var inlinedClosure1,inlinedClosure2;
  43429. return $core.withContext(function($ctx1) {
  43430. var $1,$2,$3,$4,$6,$5,$7;
  43431. $1=$recv(anIRInstruction)._isClosure();
  43432. $ctx1.sendIdx["isClosure"]=1;
  43433. if(!$core.assert($1)){
  43434. $self._inliningError_("Message argument should be a block");
  43435. $ctx1.sendIdx["inliningError:"]=1;
  43436. }
  43437. $2=$recv(anotherIRInstruction)._isClosure();
  43438. if(!$core.assert($2)){
  43439. $self._inliningError_("Message argument should be a block");
  43440. }
  43441. $3=$self._translator();
  43442. $ctx1.sendIdx["translator"]=1;
  43443. $4=$self._inlineClosure_(anIRInstruction);
  43444. $ctx1.sendIdx["inlineClosure:"]=1;
  43445. inlinedClosure1=$recv($3)._visit_($4);
  43446. $ctx1.sendIdx["visit:"]=1;
  43447. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43448. $6=$self._send();
  43449. $ctx1.sendIdx["send"]=1;
  43450. $5=$recv($6)._receiver();
  43451. $recv(inlinedSend)._add_($5);
  43452. $ctx1.sendIdx["add:"]=1;
  43453. $recv(inlinedSend)._add_(inlinedClosure1);
  43454. $ctx1.sendIdx["add:"]=2;
  43455. $recv(inlinedSend)._add_(inlinedClosure2);
  43456. $recv($self._send())._replaceWith_(inlinedSend);
  43457. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43458. $ctx1.sendIdx["internalVariables"]=1;
  43459. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43460. return inlinedSend;
  43461. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43462. },
  43463. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43464. 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",
  43465. referencedClasses: [],
  43466. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43467. }),
  43468. $globals.IRSendInliner);
  43469. $core.addMethod(
  43470. $core.method({
  43471. selector: "inlinedSequence",
  43472. protocol: "factory",
  43473. fn: function (){
  43474. var self=this,$self=this;
  43475. return $core.withContext(function($ctx1) {
  43476. return $recv($globals.IRInlinedSequence)._new();
  43477. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43478. },
  43479. args: [],
  43480. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43481. referencedClasses: ["IRInlinedSequence"],
  43482. messageSends: ["new"]
  43483. }),
  43484. $globals.IRSendInliner);
  43485. $core.addMethod(
  43486. $core.method({
  43487. selector: "inliningError:",
  43488. protocol: "error handling",
  43489. fn: function (aString){
  43490. var self=this,$self=this;
  43491. return $core.withContext(function($ctx1) {
  43492. $recv($globals.InliningError)._signal_(aString);
  43493. return self;
  43494. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43495. },
  43496. args: ["aString"],
  43497. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43498. referencedClasses: ["InliningError"],
  43499. messageSends: ["signal:"]
  43500. }),
  43501. $globals.IRSendInliner);
  43502. $core.addMethod(
  43503. $core.method({
  43504. selector: "send",
  43505. protocol: "accessing",
  43506. fn: function (){
  43507. var self=this,$self=this;
  43508. return $self["@send"];
  43509. },
  43510. args: [],
  43511. source: "send\x0a\x09^ send",
  43512. referencedClasses: [],
  43513. messageSends: []
  43514. }),
  43515. $globals.IRSendInliner);
  43516. $core.addMethod(
  43517. $core.method({
  43518. selector: "send:",
  43519. protocol: "accessing",
  43520. fn: function (anIRSend){
  43521. var self=this,$self=this;
  43522. $self["@send"]=anIRSend;
  43523. return self;
  43524. },
  43525. args: ["anIRSend"],
  43526. source: "send: anIRSend\x0a\x09send := anIRSend",
  43527. referencedClasses: [],
  43528. messageSends: []
  43529. }),
  43530. $globals.IRSendInliner);
  43531. $core.addMethod(
  43532. $core.method({
  43533. selector: "translator",
  43534. protocol: "accessing",
  43535. fn: function (){
  43536. var self=this,$self=this;
  43537. return $self["@translator"];
  43538. },
  43539. args: [],
  43540. source: "translator\x0a\x09^ translator",
  43541. referencedClasses: [],
  43542. messageSends: []
  43543. }),
  43544. $globals.IRSendInliner);
  43545. $core.addMethod(
  43546. $core.method({
  43547. selector: "translator:",
  43548. protocol: "accessing",
  43549. fn: function (anASTTranslator){
  43550. var self=this,$self=this;
  43551. $self["@translator"]=anASTTranslator;
  43552. return self;
  43553. },
  43554. args: ["anASTTranslator"],
  43555. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  43556. referencedClasses: [],
  43557. messageSends: []
  43558. }),
  43559. $globals.IRSendInliner);
  43560. $core.addMethod(
  43561. $core.method({
  43562. selector: "inlinedSelectors",
  43563. protocol: "accessing",
  43564. fn: function (){
  43565. var self=this,$self=this;
  43566. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  43567. },
  43568. args: [],
  43569. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  43570. referencedClasses: [],
  43571. messageSends: []
  43572. }),
  43573. $globals.IRSendInliner.a$cls);
  43574. $core.addMethod(
  43575. $core.method({
  43576. selector: "shouldInline:",
  43577. protocol: "accessing",
  43578. fn: function (anIRSend){
  43579. var self=this,$self=this;
  43580. return $core.withContext(function($ctx1) {
  43581. var $1;
  43582. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  43583. if(!$core.assert($1)){
  43584. return false;
  43585. }
  43586. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  43587. return $core.withContext(function($ctx2) {
  43588. return $recv(each)._isClosure();
  43589. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43590. }));
  43591. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  43592. },
  43593. args: ["anIRSend"],
  43594. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  43595. referencedClasses: [],
  43596. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  43597. }),
  43598. $globals.IRSendInliner.a$cls);
  43599. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  43600. $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};";
  43601. $core.addMethod(
  43602. $core.method({
  43603. selector: "inlineAssignment:",
  43604. protocol: "inlining",
  43605. fn: function (anIRAssignment){
  43606. var self=this,$self=this;
  43607. return $core.withContext(function($ctx1) {
  43608. $self._target_($recv(anIRAssignment)._left());
  43609. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  43610. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  43611. },
  43612. args: ["anIRAssignment"],
  43613. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  43614. referencedClasses: [],
  43615. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  43616. }),
  43617. $globals.IRAssignmentInliner);
  43618. $core.addMethod(
  43619. $core.method({
  43620. selector: "inlineClosure:",
  43621. protocol: "inlining",
  43622. fn: function (anIRClosure){
  43623. var self=this,$self=this;
  43624. var closure,sequence,statements;
  43625. return $core.withContext(function($ctx1) {
  43626. var $1,$2,$3,$5,$4;
  43627. closure=(
  43628. $ctx1.supercall = true,
  43629. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43630. $ctx1.supercall = false;
  43631. sequence=$recv(closure)._sequence();
  43632. statements=$recv(sequence)._dagChildren();
  43633. $recv(statements)._ifNotEmpty_((function(){
  43634. var final;
  43635. return $core.withContext(function($ctx2) {
  43636. final=$recv(statements)._last();
  43637. final;
  43638. $1=$recv(final)._yieldsValue();
  43639. if($core.assert($1)){
  43640. $2=sequence;
  43641. $3=final;
  43642. $5=$recv($globals.IRAssignment)._new();
  43643. $recv($5)._add_($self._target());
  43644. $ctx2.sendIdx["add:"]=1;
  43645. $recv($5)._add_($recv(final)._copy());
  43646. $4=$recv($5)._yourself();
  43647. return $recv($2)._replace_with_($3,$4);
  43648. }
  43649. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  43650. }));
  43651. return closure;
  43652. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  43653. },
  43654. args: ["anIRClosure"],
  43655. 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",
  43656. referencedClasses: ["IRAssignment"],
  43657. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  43658. }),
  43659. $globals.IRAssignmentInliner);
  43660. $core.addMethod(
  43661. $core.method({
  43662. selector: "target",
  43663. protocol: "accessing",
  43664. fn: function (){
  43665. var self=this,$self=this;
  43666. return $self["@target"];
  43667. },
  43668. args: [],
  43669. source: "target\x0a\x09^ target",
  43670. referencedClasses: [],
  43671. messageSends: []
  43672. }),
  43673. $globals.IRAssignmentInliner);
  43674. $core.addMethod(
  43675. $core.method({
  43676. selector: "target:",
  43677. protocol: "accessing",
  43678. fn: function (anObject){
  43679. var self=this,$self=this;
  43680. $self["@target"]=anObject;
  43681. return self;
  43682. },
  43683. args: ["anObject"],
  43684. source: "target: anObject\x0a\x09target := anObject",
  43685. referencedClasses: [],
  43686. messageSends: []
  43687. }),
  43688. $globals.IRAssignmentInliner);
  43689. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  43690. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  43691. $core.addMethod(
  43692. $core.method({
  43693. selector: "inlineClosure:",
  43694. protocol: "inlining",
  43695. fn: function (anIRClosure){
  43696. var self=this,$self=this;
  43697. var closure,sequence,statements;
  43698. return $core.withContext(function($ctx1) {
  43699. var $1,$2,$3,$5,$4;
  43700. closure=(
  43701. $ctx1.supercall = true,
  43702. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  43703. $ctx1.supercall = false;
  43704. sequence=$recv(closure)._sequence();
  43705. statements=$recv(sequence)._dagChildren();
  43706. $recv(statements)._ifNotEmpty_((function(){
  43707. var final;
  43708. return $core.withContext(function($ctx2) {
  43709. final=$recv(statements)._last();
  43710. final;
  43711. $1=$recv(final)._yieldsValue();
  43712. if($core.assert($1)){
  43713. $2=sequence;
  43714. $3=final;
  43715. $5=$recv($globals.IRReturn)._new();
  43716. $recv($5)._add_($recv(final)._copy());
  43717. $4=$recv($5)._yourself();
  43718. return $recv($2)._replace_with_($3,$4);
  43719. }
  43720. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  43721. }));
  43722. return closure;
  43723. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  43724. },
  43725. args: ["anIRClosure"],
  43726. 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",
  43727. referencedClasses: ["IRReturn"],
  43728. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  43729. }),
  43730. $globals.IRReturnInliner);
  43731. $core.addMethod(
  43732. $core.method({
  43733. selector: "inlineReturn:",
  43734. protocol: "inlining",
  43735. fn: function (anIRReturn){
  43736. var self=this,$self=this;
  43737. return $core.withContext(function($ctx1) {
  43738. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  43739. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  43740. },
  43741. args: ["anIRReturn"],
  43742. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  43743. referencedClasses: [],
  43744. messageSends: ["inlineSend:andReplace:", "expression"]
  43745. }),
  43746. $globals.IRReturnInliner);
  43747. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  43748. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  43749. $core.addMethod(
  43750. $core.method({
  43751. selector: "inliner",
  43752. protocol: "compiling",
  43753. fn: function (){
  43754. var self=this,$self=this;
  43755. return $core.withContext(function($ctx1) {
  43756. return $recv($globals.IRInliner)._new();
  43757. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  43758. },
  43759. args: [],
  43760. source: "inliner\x0a\x09^ IRInliner new",
  43761. referencedClasses: ["IRInliner"],
  43762. messageSends: ["new"]
  43763. }),
  43764. $globals.InliningCodeGenerator);
  43765. $core.addMethod(
  43766. $core.method({
  43767. selector: "irTranslatorClass",
  43768. protocol: "compiling",
  43769. fn: function (){
  43770. var self=this,$self=this;
  43771. return $globals.IRInliningJSTranslator;
  43772. },
  43773. args: [],
  43774. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  43775. referencedClasses: ["IRInliningJSTranslator"],
  43776. messageSends: []
  43777. }),
  43778. $globals.InliningCodeGenerator);
  43779. $core.addMethod(
  43780. $core.method({
  43781. selector: "preInliner",
  43782. protocol: "compiling",
  43783. fn: function (){
  43784. var self=this,$self=this;
  43785. return $core.withContext(function($ctx1) {
  43786. return $recv($globals.ASTPreInliner)._new();
  43787. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  43788. },
  43789. args: [],
  43790. source: "preInliner\x0a\x09^ ASTPreInliner new",
  43791. referencedClasses: ["ASTPreInliner"],
  43792. messageSends: ["new"]
  43793. }),
  43794. $globals.InliningCodeGenerator);
  43795. $core.addMethod(
  43796. $core.method({
  43797. selector: "transformersDictionary",
  43798. protocol: "compiling",
  43799. fn: function (){
  43800. var self=this,$self=this;
  43801. return $core.withContext(function($ctx1) {
  43802. var $1,$2,$receiver;
  43803. $1=$self["@transformersDictionary"];
  43804. if(($receiver = $1) == null || $receiver.a$nil){
  43805. $2=(
  43806. $ctx1.supercall = true,
  43807. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  43808. $ctx1.supercall = false;
  43809. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  43810. $ctx1.sendIdx["at:put:"]=1;
  43811. $recv($2)._at_put_("6000-inliner",$self._inliner());
  43812. $ctx1.sendIdx["at:put:"]=2;
  43813. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  43814. $self["@transformersDictionary"]=$recv($2)._yourself();
  43815. return $self["@transformersDictionary"];
  43816. } else {
  43817. return $1;
  43818. }
  43819. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  43820. },
  43821. args: [],
  43822. 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 ]",
  43823. referencedClasses: [],
  43824. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  43825. }),
  43826. $globals.InliningCodeGenerator);
  43827. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  43828. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  43829. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  43830. $core.addMethod(
  43831. $core.method({
  43832. selector: "visitSendNode:",
  43833. protocol: "visiting",
  43834. fn: function (aNode){
  43835. var self=this,$self=this;
  43836. return $core.withContext(function($ctx1) {
  43837. var $1,$2,$3,$receiver;
  43838. $1=$recv(aNode)._superSend();
  43839. if(!$core.assert($1)){
  43840. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  43841. if($core.assert($2)){
  43842. $recv(aNode)._shouldBeInlined_(true);
  43843. $3=$recv(aNode)._receiver();
  43844. if(($receiver = $3) == null || $receiver.a$nil){
  43845. $3;
  43846. } else {
  43847. var receiver;
  43848. receiver=$receiver;
  43849. $recv(receiver)._shouldBeAliased_(true);
  43850. }
  43851. }
  43852. }
  43853. (
  43854. $ctx1.supercall = true,
  43855. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  43856. $ctx1.supercall = false;
  43857. return self;
  43858. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  43859. },
  43860. args: ["aNode"],
  43861. 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",
  43862. referencedClasses: ["IRSendInliner"],
  43863. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  43864. }),
  43865. $globals.InliningSemanticAnalyzer);
  43866. $core.addMethod(
  43867. $core.method({
  43868. selector: "asInlinedBlockResult",
  43869. protocol: "*Compiler-Inlining",
  43870. fn: function (){
  43871. var self=this,$self=this;
  43872. return $core.withContext(function($ctx1) {
  43873. return $self._expression();
  43874. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  43875. },
  43876. args: [],
  43877. source: "asInlinedBlockResult\x0a\x09^ self expression",
  43878. referencedClasses: [],
  43879. messageSends: ["expression"]
  43880. }),
  43881. $globals.IRBlockReturn);
  43882. $core.addMethod(
  43883. $core.method({
  43884. selector: "asInlinedBlockResult",
  43885. protocol: "*Compiler-Inlining",
  43886. fn: function (){
  43887. var self=this,$self=this;
  43888. return self;
  43889. },
  43890. args: [],
  43891. source: "asInlinedBlockResult\x0a\x09^ self",
  43892. referencedClasses: [],
  43893. messageSends: []
  43894. }),
  43895. $globals.IRInstruction);
  43896. });
  43897. 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";
  43898. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  43899. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43900. $core.addPackage("Compiler-Interpreter");
  43901. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  43902. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43903. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  43904. $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`).";
  43905. $core.addMethod(
  43906. $core.method({
  43907. selector: "applyTo:arguments:",
  43908. protocol: "evaluating",
  43909. fn: function (anObject,aCollection){
  43910. var self=this,$self=this;
  43911. return $core.withContext(function($ctx1) {
  43912. $self._interpreterError();
  43913. return self;
  43914. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  43915. },
  43916. args: ["anObject", "aCollection"],
  43917. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  43918. referencedClasses: [],
  43919. messageSends: ["interpreterError"]
  43920. }),
  43921. $globals.AIBlockClosure);
  43922. $core.addMethod(
  43923. $core.method({
  43924. selector: "compiledSource",
  43925. protocol: "accessing",
  43926. fn: function (){
  43927. var self=this,$self=this;
  43928. return "[ AST Block closure ]";
  43929. },
  43930. args: [],
  43931. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  43932. referencedClasses: [],
  43933. messageSends: []
  43934. }),
  43935. $globals.AIBlockClosure);
  43936. $core.addMethod(
  43937. $core.method({
  43938. selector: "currySelf",
  43939. protocol: "converting",
  43940. fn: function (){
  43941. var self=this,$self=this;
  43942. return $core.withContext(function($ctx1) {
  43943. $self._interpreterError();
  43944. return self;
  43945. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  43946. },
  43947. args: [],
  43948. source: "currySelf\x0a\x09self interpreterError",
  43949. referencedClasses: [],
  43950. messageSends: ["interpreterError"]
  43951. }),
  43952. $globals.AIBlockClosure);
  43953. $core.addMethod(
  43954. $core.method({
  43955. selector: "initializeWithContext:node:",
  43956. protocol: "initialization",
  43957. fn: function (aContext,aNode){
  43958. var self=this,$self=this;
  43959. $self["@node"]=aNode;
  43960. $self["@outerContext"]=aContext;
  43961. return self;
  43962. },
  43963. args: ["aContext", "aNode"],
  43964. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  43965. referencedClasses: [],
  43966. messageSends: []
  43967. }),
  43968. $globals.AIBlockClosure);
  43969. $core.addMethod(
  43970. $core.method({
  43971. selector: "interpreterError",
  43972. protocol: "error handling",
  43973. fn: function (){
  43974. var self=this,$self=this;
  43975. return $core.withContext(function($ctx1) {
  43976. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  43977. return self;
  43978. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  43979. },
  43980. args: [],
  43981. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  43982. referencedClasses: ["ASTInterpreterError"],
  43983. messageSends: ["signal:"]
  43984. }),
  43985. $globals.AIBlockClosure);
  43986. $core.addMethod(
  43987. $core.method({
  43988. selector: "numArgs",
  43989. protocol: "accessing",
  43990. fn: function (){
  43991. var self=this,$self=this;
  43992. return $core.withContext(function($ctx1) {
  43993. return $recv($recv($self["@node"])._temps())._size();
  43994. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  43995. },
  43996. args: [],
  43997. source: "numArgs\x0a\x09^ node temps size",
  43998. referencedClasses: [],
  43999. messageSends: ["size", "temps"]
  44000. }),
  44001. $globals.AIBlockClosure);
  44002. $core.addMethod(
  44003. $core.method({
  44004. selector: "value",
  44005. protocol: "evaluating",
  44006. fn: function (){
  44007. var self=this,$self=this;
  44008. return $core.withContext(function($ctx1) {
  44009. return $self._valueWithPossibleArguments_([]);
  44010. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44011. },
  44012. args: [],
  44013. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44014. referencedClasses: [],
  44015. messageSends: ["valueWithPossibleArguments:"]
  44016. }),
  44017. $globals.AIBlockClosure);
  44018. $core.addMethod(
  44019. $core.method({
  44020. selector: "value:",
  44021. protocol: "evaluating",
  44022. fn: function (anArgument){
  44023. var self=this,$self=this;
  44024. return $core.withContext(function($ctx1) {
  44025. return $self._valueWithPossibleArguments_([anArgument]);
  44026. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44027. },
  44028. args: ["anArgument"],
  44029. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44030. referencedClasses: [],
  44031. messageSends: ["valueWithPossibleArguments:"]
  44032. }),
  44033. $globals.AIBlockClosure);
  44034. $core.addMethod(
  44035. $core.method({
  44036. selector: "value:value:",
  44037. protocol: "evaluating",
  44038. fn: function (firstArgument,secondArgument){
  44039. var self=this,$self=this;
  44040. return $core.withContext(function($ctx1) {
  44041. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44042. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44043. },
  44044. args: ["firstArgument", "secondArgument"],
  44045. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44046. referencedClasses: [],
  44047. messageSends: ["valueWithPossibleArguments:"]
  44048. }),
  44049. $globals.AIBlockClosure);
  44050. $core.addMethod(
  44051. $core.method({
  44052. selector: "value:value:value:",
  44053. protocol: "evaluating",
  44054. fn: function (firstArgument,secondArgument,thirdArgument){
  44055. var self=this,$self=this;
  44056. return $core.withContext(function($ctx1) {
  44057. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44058. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44059. },
  44060. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44061. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44062. referencedClasses: [],
  44063. messageSends: ["valueWithPossibleArguments:"]
  44064. }),
  44065. $globals.AIBlockClosure);
  44066. $core.addMethod(
  44067. $core.method({
  44068. selector: "valueWithPossibleArguments:",
  44069. protocol: "evaluating",
  44070. fn: function (aCollection){
  44071. var self=this,$self=this;
  44072. var context,sequenceNode;
  44073. return $core.withContext(function($ctx1) {
  44074. var $1,$2,$3;
  44075. context=$recv($self["@outerContext"])._newInnerContext();
  44076. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44077. $recv($1)._parent_(nil);
  44078. sequenceNode=$recv($1)._yourself();
  44079. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44080. return $core.withContext(function($ctx2) {
  44081. return $recv(context)._defineLocal_(each);
  44082. $ctx2.sendIdx["defineLocal:"]=1;
  44083. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44084. }));
  44085. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44086. return $core.withContext(function($ctx2) {
  44087. $recv(context)._defineLocal_(each);
  44088. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44089. return nil;
  44090. })));
  44091. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44092. }));
  44093. $2=$recv(context)._interpreter();
  44094. $ctx1.sendIdx["interpreter"]=1;
  44095. $recv($2)._node_(sequenceNode);
  44096. $recv($2)._enterNode();
  44097. $recv($2)._proceed();
  44098. $3=$recv($self["@outerContext"])._interpreter();
  44099. $ctx1.sendIdx["interpreter"]=2;
  44100. $recv($3)._setNonLocalReturnFromContext_(context);
  44101. return $recv($recv(context)._interpreter())._pop();
  44102. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44103. },
  44104. args: ["aCollection"],
  44105. 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",
  44106. referencedClasses: [],
  44107. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44108. }),
  44109. $globals.AIBlockClosure);
  44110. $core.addMethod(
  44111. $core.method({
  44112. selector: "forContext:node:",
  44113. protocol: "instance creation",
  44114. fn: function (aContext,aNode){
  44115. var self=this,$self=this;
  44116. return $core.withContext(function($ctx1) {
  44117. var $1;
  44118. $1=$self._new();
  44119. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44120. return $recv($1)._yourself();
  44121. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44122. },
  44123. args: ["aContext", "aNode"],
  44124. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44125. referencedClasses: [],
  44126. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44127. }),
  44128. $globals.AIBlockClosure.a$cls);
  44129. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44130. $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)";
  44131. $core.addMethod(
  44132. $core.method({
  44133. selector: "arguments",
  44134. protocol: "interpreting",
  44135. fn: function (){
  44136. var self=this,$self=this;
  44137. return $core.withContext(function($ctx1) {
  44138. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44139. return $core.withContext(function($ctx2) {
  44140. return $self._localAt_ifAbsent_(each,(function(){
  44141. return $core.withContext(function($ctx3) {
  44142. return $self._error_("Argument not in context");
  44143. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44144. }));
  44145. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44146. }));
  44147. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44148. },
  44149. args: [],
  44150. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44151. referencedClasses: [],
  44152. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44153. }),
  44154. $globals.AIContext);
  44155. $core.addMethod(
  44156. $core.method({
  44157. selector: "ast",
  44158. protocol: "interpreting",
  44159. fn: function (){
  44160. var self=this,$self=this;
  44161. return $core.withContext(function($ctx1) {
  44162. var $1,$2,$3,$receiver;
  44163. $1=$self._isBlockContext();
  44164. if($core.assert($1)){
  44165. $2=$self._outerContext();
  44166. if(($receiver = $2) == null || $receiver.a$nil){
  44167. return $2;
  44168. } else {
  44169. var context;
  44170. context=$receiver;
  44171. return $recv(context)._ast();
  44172. }
  44173. }
  44174. $3=$self["@ast"];
  44175. if(($receiver = $3) == null || $receiver.a$nil){
  44176. $self._initializeAST();
  44177. } else {
  44178. $3;
  44179. }
  44180. return $self["@ast"];
  44181. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44182. },
  44183. args: [],
  44184. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44185. referencedClasses: [],
  44186. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44187. }),
  44188. $globals.AIContext);
  44189. $core.addMethod(
  44190. $core.method({
  44191. selector: "basicLocalAt:",
  44192. protocol: "private",
  44193. fn: function (aString){
  44194. var self=this,$self=this;
  44195. return $core.withContext(function($ctx1) {
  44196. return $recv($self._locals())._at_(aString);
  44197. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44198. },
  44199. args: ["aString"],
  44200. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44201. referencedClasses: [],
  44202. messageSends: ["at:", "locals"]
  44203. }),
  44204. $globals.AIContext);
  44205. $core.addMethod(
  44206. $core.method({
  44207. selector: "basicLocalAt:put:",
  44208. protocol: "private",
  44209. fn: function (aString,anObject){
  44210. var self=this,$self=this;
  44211. return $core.withContext(function($ctx1) {
  44212. $recv($self._locals())._at_put_(aString,anObject);
  44213. return self;
  44214. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44215. },
  44216. args: ["aString", "anObject"],
  44217. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44218. referencedClasses: [],
  44219. messageSends: ["at:put:", "locals"]
  44220. }),
  44221. $globals.AIContext);
  44222. $core.addMethod(
  44223. $core.method({
  44224. selector: "basicReceiver",
  44225. protocol: "interpreting",
  44226. fn: function (){
  44227. var self=this,$self=this;
  44228. return $core.withContext(function($ctx1) {
  44229. return $self._localAt_("self");
  44230. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44231. },
  44232. args: [],
  44233. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44234. referencedClasses: [],
  44235. messageSends: ["localAt:"]
  44236. }),
  44237. $globals.AIContext);
  44238. $core.addMethod(
  44239. $core.method({
  44240. selector: "defineLocal:",
  44241. protocol: "accessing",
  44242. fn: function (aString){
  44243. var self=this,$self=this;
  44244. return $core.withContext(function($ctx1) {
  44245. $recv($self._locals())._at_put_(aString,nil);
  44246. return self;
  44247. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44248. },
  44249. args: ["aString"],
  44250. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44251. referencedClasses: [],
  44252. messageSends: ["at:put:", "locals"]
  44253. }),
  44254. $globals.AIContext);
  44255. $core.addMethod(
  44256. $core.method({
  44257. selector: "evaluate:on:",
  44258. protocol: "evaluating",
  44259. fn: function (aString,anEvaluator){
  44260. var self=this,$self=this;
  44261. return $core.withContext(function($ctx1) {
  44262. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44263. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44264. },
  44265. args: ["aString", "anEvaluator"],
  44266. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44267. referencedClasses: [],
  44268. messageSends: ["evaluate:context:"]
  44269. }),
  44270. $globals.AIContext);
  44271. $core.addMethod(
  44272. $core.method({
  44273. selector: "evaluateNode:",
  44274. protocol: "evaluating",
  44275. fn: function (aNode){
  44276. var self=this,$self=this;
  44277. return $core.withContext(function($ctx1) {
  44278. var $1;
  44279. $1=$recv($globals.ASTInterpreter)._new();
  44280. $recv($1)._context_(self);
  44281. $recv($1)._node_(aNode);
  44282. $recv($1)._enterNode();
  44283. $recv($1)._proceed();
  44284. return $recv($1)._result();
  44285. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44286. },
  44287. args: ["aNode"],
  44288. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44289. referencedClasses: ["ASTInterpreter"],
  44290. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44291. }),
  44292. $globals.AIContext);
  44293. $core.addMethod(
  44294. $core.method({
  44295. selector: "evaluatedSelector",
  44296. protocol: "accessing",
  44297. fn: function (){
  44298. var self=this,$self=this;
  44299. return $self["@evaluatedSelector"];
  44300. },
  44301. args: [],
  44302. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44303. referencedClasses: [],
  44304. messageSends: []
  44305. }),
  44306. $globals.AIContext);
  44307. $core.addMethod(
  44308. $core.method({
  44309. selector: "evaluatedSelector:",
  44310. protocol: "accessing",
  44311. fn: function (aString){
  44312. var self=this,$self=this;
  44313. $self["@evaluatedSelector"]=aString;
  44314. return self;
  44315. },
  44316. args: ["aString"],
  44317. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44318. referencedClasses: [],
  44319. messageSends: []
  44320. }),
  44321. $globals.AIContext);
  44322. $core.addMethod(
  44323. $core.method({
  44324. selector: "index",
  44325. protocol: "accessing",
  44326. fn: function (){
  44327. var self=this,$self=this;
  44328. return $core.withContext(function($ctx1) {
  44329. var $1,$receiver;
  44330. $1=$self["@index"];
  44331. if(($receiver = $1) == null || $receiver.a$nil){
  44332. return (0);
  44333. } else {
  44334. return $1;
  44335. }
  44336. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44337. },
  44338. args: [],
  44339. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44340. referencedClasses: [],
  44341. messageSends: ["ifNil:"]
  44342. }),
  44343. $globals.AIContext);
  44344. $core.addMethod(
  44345. $core.method({
  44346. selector: "index:",
  44347. protocol: "accessing",
  44348. fn: function (anInteger){
  44349. var self=this,$self=this;
  44350. $self["@index"]=anInteger;
  44351. return self;
  44352. },
  44353. args: ["anInteger"],
  44354. source: "index: anInteger\x0a\x09index := anInteger",
  44355. referencedClasses: [],
  44356. messageSends: []
  44357. }),
  44358. $globals.AIContext);
  44359. $core.addMethod(
  44360. $core.method({
  44361. selector: "initializeAST",
  44362. protocol: "initialization",
  44363. fn: function (){
  44364. var self=this,$self=this;
  44365. return $core.withContext(function($ctx1) {
  44366. var $1;
  44367. $1=$self._method();
  44368. $ctx1.sendIdx["method"]=1;
  44369. $self["@ast"]=$recv($1)._ast();
  44370. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44371. return self;
  44372. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44373. },
  44374. args: [],
  44375. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44376. referencedClasses: ["SemanticAnalyzer"],
  44377. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44378. }),
  44379. $globals.AIContext);
  44380. $core.addMethod(
  44381. $core.method({
  44382. selector: "initializeFromMethodContext:",
  44383. protocol: "initialization",
  44384. fn: function (aMethodContext){
  44385. var self=this,$self=this;
  44386. return $core.withContext(function($ctx1) {
  44387. var $1,$2,$3,$receiver;
  44388. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44389. $self._index_($recv(aMethodContext)._index());
  44390. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44391. $self._receiver_($recv(aMethodContext)._receiver());
  44392. $self._supercall_($recv(aMethodContext)._supercall());
  44393. $self._selector_($recv(aMethodContext)._selector());
  44394. $1=$recv(aMethodContext)._outerContext();
  44395. $ctx1.sendIdx["outerContext"]=1;
  44396. if(($receiver = $1) == null || $receiver.a$nil){
  44397. $1;
  44398. } else {
  44399. var outer;
  44400. outer=$receiver;
  44401. $2=$recv(outer)._methodContext();
  44402. if(($receiver = $2) == null || $receiver.a$nil){
  44403. $2;
  44404. } else {
  44405. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44406. }
  44407. $3=$recv(aMethodContext)._locals();
  44408. $ctx1.sendIdx["locals"]=1;
  44409. $recv($3)._keysAndValuesDo_((function(key,value){
  44410. return $core.withContext(function($ctx2) {
  44411. return $recv($self._locals())._at_put_(key,value);
  44412. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44413. }));
  44414. }
  44415. return self;
  44416. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44417. },
  44418. args: ["aMethodContext"],
  44419. 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 ] ]",
  44420. referencedClasses: [],
  44421. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44422. }),
  44423. $globals.AIContext);
  44424. $core.addMethod(
  44425. $core.method({
  44426. selector: "initializeInterpreter",
  44427. protocol: "initialization",
  44428. fn: function (){
  44429. var self=this,$self=this;
  44430. return $core.withContext(function($ctx1) {
  44431. var $1,$2,$receiver;
  44432. $1=$recv($globals.ASTInterpreter)._new();
  44433. $recv($1)._context_(self);
  44434. $self["@interpreter"]=$recv($1)._yourself();
  44435. $2=$self._innerContext();
  44436. if(($receiver = $2) == null || $receiver.a$nil){
  44437. $2;
  44438. } else {
  44439. $self._setupInterpreter_($self["@interpreter"]);
  44440. }
  44441. return self;
  44442. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44443. },
  44444. args: [],
  44445. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44446. referencedClasses: ["ASTInterpreter"],
  44447. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44448. }),
  44449. $globals.AIContext);
  44450. $core.addMethod(
  44451. $core.method({
  44452. selector: "initializeLocals",
  44453. protocol: "initialization",
  44454. fn: function (){
  44455. var self=this,$self=this;
  44456. return $core.withContext(function($ctx1) {
  44457. $self["@locals"]=$recv($globals.Dictionary)._new();
  44458. $recv($self["@locals"])._at_put_("thisContext",self);
  44459. return self;
  44460. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44461. },
  44462. args: [],
  44463. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44464. referencedClasses: ["Dictionary"],
  44465. messageSends: ["new", "at:put:"]
  44466. }),
  44467. $globals.AIContext);
  44468. $core.addMethod(
  44469. $core.method({
  44470. selector: "innerContext",
  44471. protocol: "accessing",
  44472. fn: function (){
  44473. var self=this,$self=this;
  44474. return $self["@innerContext"];
  44475. },
  44476. args: [],
  44477. source: "innerContext\x0a\x09^ innerContext",
  44478. referencedClasses: [],
  44479. messageSends: []
  44480. }),
  44481. $globals.AIContext);
  44482. $core.addMethod(
  44483. $core.method({
  44484. selector: "innerContext:",
  44485. protocol: "accessing",
  44486. fn: function (anAIContext){
  44487. var self=this,$self=this;
  44488. $self["@innerContext"]=anAIContext;
  44489. return self;
  44490. },
  44491. args: ["anAIContext"],
  44492. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44493. referencedClasses: [],
  44494. messageSends: []
  44495. }),
  44496. $globals.AIContext);
  44497. $core.addMethod(
  44498. $core.method({
  44499. selector: "interpreter",
  44500. protocol: "interpreting",
  44501. fn: function (){
  44502. var self=this,$self=this;
  44503. return $core.withContext(function($ctx1) {
  44504. var $1,$receiver;
  44505. $1=$self["@interpreter"];
  44506. if(($receiver = $1) == null || $receiver.a$nil){
  44507. $self._initializeInterpreter();
  44508. } else {
  44509. $1;
  44510. }
  44511. return $self["@interpreter"];
  44512. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44513. },
  44514. args: [],
  44515. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44516. referencedClasses: [],
  44517. messageSends: ["ifNil:", "initializeInterpreter"]
  44518. }),
  44519. $globals.AIContext);
  44520. $core.addMethod(
  44521. $core.method({
  44522. selector: "interpreter:",
  44523. protocol: "interpreting",
  44524. fn: function (anInterpreter){
  44525. var self=this,$self=this;
  44526. $self["@interpreter"]=anInterpreter;
  44527. return self;
  44528. },
  44529. args: ["anInterpreter"],
  44530. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  44531. referencedClasses: [],
  44532. messageSends: []
  44533. }),
  44534. $globals.AIContext);
  44535. $core.addMethod(
  44536. $core.method({
  44537. selector: "isTopContext",
  44538. protocol: "testing",
  44539. fn: function (){
  44540. var self=this,$self=this;
  44541. return $core.withContext(function($ctx1) {
  44542. return $recv($self._innerContext())._isNil();
  44543. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  44544. },
  44545. args: [],
  44546. source: "isTopContext\x0a\x09^ self innerContext isNil",
  44547. referencedClasses: [],
  44548. messageSends: ["isNil", "innerContext"]
  44549. }),
  44550. $globals.AIContext);
  44551. $core.addMethod(
  44552. $core.method({
  44553. selector: "localAt:",
  44554. protocol: "accessing",
  44555. fn: function (aString){
  44556. var self=this,$self=this;
  44557. var context;
  44558. return $core.withContext(function($ctx1) {
  44559. context=$self._lookupContextForLocal_(aString);
  44560. return $recv(context)._basicLocalAt_(aString);
  44561. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  44562. },
  44563. args: ["aString"],
  44564. 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",
  44565. referencedClasses: [],
  44566. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  44567. }),
  44568. $globals.AIContext);
  44569. $core.addMethod(
  44570. $core.method({
  44571. selector: "localAt:ifAbsent:",
  44572. protocol: "accessing",
  44573. fn: function (aString,aBlock){
  44574. var self=this,$self=this;
  44575. var context;
  44576. return $core.withContext(function($ctx1) {
  44577. var $early={};
  44578. try {
  44579. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  44580. return $core.withContext(function($ctx2) {
  44581. throw $early=[$recv(aBlock)._value()];
  44582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44583. }));
  44584. return $recv(context)._basicLocalAt_(aString);
  44585. }
  44586. catch(e) {if(e===$early)return e[0]; throw e}
  44587. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  44588. },
  44589. args: ["aString", "aBlock"],
  44590. 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",
  44591. referencedClasses: [],
  44592. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  44593. }),
  44594. $globals.AIContext);
  44595. $core.addMethod(
  44596. $core.method({
  44597. selector: "localAt:put:",
  44598. protocol: "accessing",
  44599. fn: function (aString,anObject){
  44600. var self=this,$self=this;
  44601. var context;
  44602. return $core.withContext(function($ctx1) {
  44603. context=$self._lookupContextForLocal_(aString);
  44604. $recv(context)._basicLocalAt_put_(aString,anObject);
  44605. return self;
  44606. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  44607. },
  44608. args: ["aString", "anObject"],
  44609. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  44610. referencedClasses: [],
  44611. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  44612. }),
  44613. $globals.AIContext);
  44614. $core.addMethod(
  44615. $core.method({
  44616. selector: "locals",
  44617. protocol: "accessing",
  44618. fn: function (){
  44619. var self=this,$self=this;
  44620. return $core.withContext(function($ctx1) {
  44621. var $1,$receiver;
  44622. $1=$self["@locals"];
  44623. if(($receiver = $1) == null || $receiver.a$nil){
  44624. $self._initializeLocals();
  44625. } else {
  44626. $1;
  44627. }
  44628. return $self["@locals"];
  44629. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  44630. },
  44631. args: [],
  44632. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  44633. referencedClasses: [],
  44634. messageSends: ["ifNil:", "initializeLocals"]
  44635. }),
  44636. $globals.AIContext);
  44637. $core.addMethod(
  44638. $core.method({
  44639. selector: "lookupContextForLocal:",
  44640. protocol: "private",
  44641. fn: function (aString){
  44642. var self=this,$self=this;
  44643. return $core.withContext(function($ctx1) {
  44644. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  44645. return $core.withContext(function($ctx2) {
  44646. return $self._variableNotFound();
  44647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44648. }));
  44649. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  44650. },
  44651. args: ["aString"],
  44652. 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 ]",
  44653. referencedClasses: [],
  44654. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  44655. }),
  44656. $globals.AIContext);
  44657. $core.addMethod(
  44658. $core.method({
  44659. selector: "lookupContextForLocal:ifNone:",
  44660. protocol: "private",
  44661. fn: function (aString,aBlock){
  44662. var self=this,$self=this;
  44663. return $core.withContext(function($ctx1) {
  44664. var $1;
  44665. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  44666. return self;
  44667. }),(function(){
  44668. return $core.withContext(function($ctx2) {
  44669. $1=$self._outerContext();
  44670. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  44671. return $core.withContext(function($ctx3) {
  44672. return $recv(context)._lookupContextForLocal_(aString);
  44673. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  44674. }));
  44675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44676. }));
  44677. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  44678. },
  44679. args: ["aString", "aBlock"],
  44680. 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 ] ]",
  44681. referencedClasses: [],
  44682. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  44683. }),
  44684. $globals.AIContext);
  44685. $core.addMethod(
  44686. $core.method({
  44687. selector: "newInnerContext",
  44688. protocol: "factory",
  44689. fn: function (){
  44690. var self=this,$self=this;
  44691. return $core.withContext(function($ctx1) {
  44692. var $1;
  44693. $1=$recv($self._class())._new();
  44694. $recv($1)._outerContext_(self);
  44695. return $recv($1)._yourself();
  44696. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  44697. },
  44698. args: [],
  44699. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  44700. referencedClasses: [],
  44701. messageSends: ["outerContext:", "new", "class", "yourself"]
  44702. }),
  44703. $globals.AIContext);
  44704. $core.addMethod(
  44705. $core.method({
  44706. selector: "outerContext",
  44707. protocol: "accessing",
  44708. fn: function (){
  44709. var self=this,$self=this;
  44710. return $self["@outerContext"];
  44711. },
  44712. args: [],
  44713. source: "outerContext\x0a\x09^ outerContext",
  44714. referencedClasses: [],
  44715. messageSends: []
  44716. }),
  44717. $globals.AIContext);
  44718. $core.addMethod(
  44719. $core.method({
  44720. selector: "outerContext:",
  44721. protocol: "accessing",
  44722. fn: function (anAIContext){
  44723. var self=this,$self=this;
  44724. return $core.withContext(function($ctx1) {
  44725. var $1,$receiver;
  44726. $self["@outerContext"]=anAIContext;
  44727. $1=$self["@outerContext"];
  44728. if(($receiver = $1) == null || $receiver.a$nil){
  44729. $1;
  44730. } else {
  44731. var context;
  44732. context=$receiver;
  44733. $recv(context)._innerContext_(self);
  44734. }
  44735. return self;
  44736. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  44737. },
  44738. args: ["anAIContext"],
  44739. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  44740. referencedClasses: [],
  44741. messageSends: ["ifNotNil:", "innerContext:"]
  44742. }),
  44743. $globals.AIContext);
  44744. $core.addMethod(
  44745. $core.method({
  44746. selector: "receiver:",
  44747. protocol: "interpreting",
  44748. fn: function (anObject){
  44749. var self=this,$self=this;
  44750. return $core.withContext(function($ctx1) {
  44751. $recv($self._locals())._at_put_("self",anObject);
  44752. return self;
  44753. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  44754. },
  44755. args: ["anObject"],
  44756. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  44757. referencedClasses: [],
  44758. messageSends: ["at:put:", "locals"]
  44759. }),
  44760. $globals.AIContext);
  44761. $core.addMethod(
  44762. $core.method({
  44763. selector: "selector",
  44764. protocol: "accessing",
  44765. fn: function (){
  44766. var self=this,$self=this;
  44767. return $self["@selector"];
  44768. },
  44769. args: [],
  44770. source: "selector\x0a\x09^ selector",
  44771. referencedClasses: [],
  44772. messageSends: []
  44773. }),
  44774. $globals.AIContext);
  44775. $core.addMethod(
  44776. $core.method({
  44777. selector: "selector:",
  44778. protocol: "accessing",
  44779. fn: function (aString){
  44780. var self=this,$self=this;
  44781. $self["@selector"]=aString;
  44782. return self;
  44783. },
  44784. args: ["aString"],
  44785. source: "selector: aString\x0a\x09selector := aString",
  44786. referencedClasses: [],
  44787. messageSends: []
  44788. }),
  44789. $globals.AIContext);
  44790. $core.addMethod(
  44791. $core.method({
  44792. selector: "sendIndexAt:",
  44793. protocol: "accessing",
  44794. fn: function (aString){
  44795. var self=this,$self=this;
  44796. return $core.withContext(function($ctx1) {
  44797. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  44798. return (0);
  44799. }));
  44800. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  44801. },
  44802. args: ["aString"],
  44803. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  44804. referencedClasses: [],
  44805. messageSends: ["at:ifAbsent:", "sendIndexes"]
  44806. }),
  44807. $globals.AIContext);
  44808. $core.addMethod(
  44809. $core.method({
  44810. selector: "sendIndexes",
  44811. protocol: "accessing",
  44812. fn: function (){
  44813. var self=this,$self=this;
  44814. return $core.withContext(function($ctx1) {
  44815. var $1,$receiver;
  44816. $1=$self["@sendIndexes"];
  44817. if(($receiver = $1) == null || $receiver.a$nil){
  44818. return $recv($globals.Dictionary)._new();
  44819. } else {
  44820. return $1;
  44821. }
  44822. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  44823. },
  44824. args: [],
  44825. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  44826. referencedClasses: ["Dictionary"],
  44827. messageSends: ["ifNil:", "new"]
  44828. }),
  44829. $globals.AIContext);
  44830. $core.addMethod(
  44831. $core.method({
  44832. selector: "sendIndexes:",
  44833. protocol: "accessing",
  44834. fn: function (aDictionary){
  44835. var self=this,$self=this;
  44836. $self["@sendIndexes"]=aDictionary;
  44837. return self;
  44838. },
  44839. args: ["aDictionary"],
  44840. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  44841. referencedClasses: [],
  44842. messageSends: []
  44843. }),
  44844. $globals.AIContext);
  44845. $core.addMethod(
  44846. $core.method({
  44847. selector: "setupInterpreter:",
  44848. protocol: "interpreting",
  44849. fn: function (anInterpreter){
  44850. var self=this,$self=this;
  44851. var currentNode;
  44852. return $core.withContext(function($ctx1) {
  44853. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  44854. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44855. $2=$self._evaluatedSelector();
  44856. $ctx1.sendIdx["evaluatedSelector"]=1;
  44857. $recv($1)._selector_($2);
  44858. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  44859. $3=$self._ast();
  44860. $ctx1.sendIdx["ast"]=1;
  44861. $recv($1)._visit_($3);
  44862. currentNode=$recv($1)._currentNode();
  44863. $4=$recv($self._ast())._sequenceNode();
  44864. if(($receiver = $4) == null || $receiver.a$nil){
  44865. $4;
  44866. } else {
  44867. var sequence;
  44868. sequence=$receiver;
  44869. $recv($recv(sequence)._temps())._do_((function(each){
  44870. return $core.withContext(function($ctx2) {
  44871. return $self._defineLocal_(each);
  44872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44873. }));
  44874. $ctx1.sendIdx["do:"]=1;
  44875. }
  44876. $recv(anInterpreter)._node_(currentNode);
  44877. $7=$self._innerContext();
  44878. $ctx1.sendIdx["innerContext"]=1;
  44879. $6=$recv($7)._arguments();
  44880. $5=$recv($6)._reversed();
  44881. $recv($5)._do_((function(each){
  44882. return $core.withContext(function($ctx2) {
  44883. return $recv(anInterpreter)._push_(each);
  44884. $ctx2.sendIdx["push:"]=1;
  44885. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  44886. }));
  44887. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  44888. return self;
  44889. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  44890. },
  44891. args: ["anInterpreter"],
  44892. 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)",
  44893. referencedClasses: ["ASTPCNodeVisitor"],
  44894. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  44895. }),
  44896. $globals.AIContext);
  44897. $core.addMethod(
  44898. $core.method({
  44899. selector: "supercall",
  44900. protocol: "interpreting",
  44901. fn: function (){
  44902. var self=this,$self=this;
  44903. return $core.withContext(function($ctx1) {
  44904. var $1,$receiver;
  44905. $1=$self["@supercall"];
  44906. if(($receiver = $1) == null || $receiver.a$nil){
  44907. return false;
  44908. } else {
  44909. return $1;
  44910. }
  44911. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  44912. },
  44913. args: [],
  44914. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  44915. referencedClasses: [],
  44916. messageSends: ["ifNil:"]
  44917. }),
  44918. $globals.AIContext);
  44919. $core.addMethod(
  44920. $core.method({
  44921. selector: "supercall:",
  44922. protocol: "interpreting",
  44923. fn: function (aBoolean){
  44924. var self=this,$self=this;
  44925. $self["@supercall"]=aBoolean;
  44926. return self;
  44927. },
  44928. args: ["aBoolean"],
  44929. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  44930. referencedClasses: [],
  44931. messageSends: []
  44932. }),
  44933. $globals.AIContext);
  44934. $core.addMethod(
  44935. $core.method({
  44936. selector: "variableNotFound",
  44937. protocol: "error handling",
  44938. fn: function (){
  44939. var self=this,$self=this;
  44940. return $core.withContext(function($ctx1) {
  44941. $self._error_("Variable missing");
  44942. return self;
  44943. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  44944. },
  44945. args: [],
  44946. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  44947. referencedClasses: [],
  44948. messageSends: ["error:"]
  44949. }),
  44950. $globals.AIContext);
  44951. $core.addMethod(
  44952. $core.method({
  44953. selector: "fromMethodContext:",
  44954. protocol: "instance creation",
  44955. fn: function (aMethodContext){
  44956. var self=this,$self=this;
  44957. return $core.withContext(function($ctx1) {
  44958. var $1;
  44959. $1=$self._new();
  44960. $recv($1)._initializeFromMethodContext_(aMethodContext);
  44961. return $recv($1)._yourself();
  44962. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  44963. },
  44964. args: ["aMethodContext"],
  44965. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  44966. referencedClasses: [],
  44967. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  44968. }),
  44969. $globals.AIContext.a$cls);
  44970. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  44971. $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.";
  44972. $core.addMethod(
  44973. $core.method({
  44974. selector: "context",
  44975. protocol: "accessing",
  44976. fn: function (){
  44977. var self=this,$self=this;
  44978. return $self["@context"];
  44979. },
  44980. args: [],
  44981. source: "context\x0a\x09^ context",
  44982. referencedClasses: [],
  44983. messageSends: []
  44984. }),
  44985. $globals.AISemanticAnalyzer);
  44986. $core.addMethod(
  44987. $core.method({
  44988. selector: "context:",
  44989. protocol: "accessing",
  44990. fn: function (anAIContext){
  44991. var self=this,$self=this;
  44992. $self["@context"]=anAIContext;
  44993. return self;
  44994. },
  44995. args: ["anAIContext"],
  44996. source: "context: anAIContext\x0a\x09context := anAIContext",
  44997. referencedClasses: [],
  44998. messageSends: []
  44999. }),
  45000. $globals.AISemanticAnalyzer);
  45001. $core.addMethod(
  45002. $core.method({
  45003. selector: "visitVariableNode:",
  45004. protocol: "visiting",
  45005. fn: function (aNode){
  45006. var self=this,$self=this;
  45007. return $core.withContext(function($ctx1) {
  45008. var $1;
  45009. var $early={};
  45010. try {
  45011. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45012. return $core.withContext(function($ctx2) {
  45013. $1=(
  45014. $ctx2.supercall = true,
  45015. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45016. $ctx2.supercall = false;
  45017. throw $early=[$1];
  45018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45019. }));
  45020. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45021. return self;
  45022. }
  45023. catch(e) {if(e===$early)return e[0]; throw e}
  45024. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45025. },
  45026. args: ["aNode"],
  45027. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45028. referencedClasses: ["ASTContextVar"],
  45029. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45030. }),
  45031. $globals.AISemanticAnalyzer);
  45032. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45033. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45034. $core.addMethod(
  45035. $core.method({
  45036. selector: "context",
  45037. protocol: "accessing",
  45038. fn: function (){
  45039. var self=this,$self=this;
  45040. return $self["@context"];
  45041. },
  45042. args: [],
  45043. source: "context\x0a\x09^ context",
  45044. referencedClasses: [],
  45045. messageSends: []
  45046. }),
  45047. $globals.ASTContextVar);
  45048. $core.addMethod(
  45049. $core.method({
  45050. selector: "context:",
  45051. protocol: "accessing",
  45052. fn: function (anObject){
  45053. var self=this,$self=this;
  45054. $self["@context"]=anObject;
  45055. return self;
  45056. },
  45057. args: ["anObject"],
  45058. source: "context: anObject\x0a\x09context := anObject",
  45059. referencedClasses: [],
  45060. messageSends: []
  45061. }),
  45062. $globals.ASTContextVar);
  45063. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45064. $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.";
  45065. $core.addMethod(
  45066. $core.method({
  45067. selector: "atEnd",
  45068. protocol: "testing",
  45069. fn: function (){
  45070. var self=this,$self=this;
  45071. return $core.withContext(function($ctx1) {
  45072. var $1,$receiver;
  45073. $1=$self._context();
  45074. $ctx1.sendIdx["context"]=1;
  45075. if(($receiver = $1) == null || $receiver.a$nil){
  45076. return true;
  45077. } else {
  45078. $1;
  45079. }
  45080. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45081. return $core.withContext(function($ctx2) {
  45082. return $recv($self._context())._isTopContext();
  45083. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45084. }));
  45085. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45086. },
  45087. args: [],
  45088. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45089. referencedClasses: [],
  45090. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45091. }),
  45092. $globals.ASTDebugger);
  45093. $core.addMethod(
  45094. $core.method({
  45095. selector: "context",
  45096. protocol: "accessing",
  45097. fn: function (){
  45098. var self=this,$self=this;
  45099. return $self["@context"];
  45100. },
  45101. args: [],
  45102. source: "context\x0a\x09^ context",
  45103. referencedClasses: [],
  45104. messageSends: []
  45105. }),
  45106. $globals.ASTDebugger);
  45107. $core.addMethod(
  45108. $core.method({
  45109. selector: "context:",
  45110. protocol: "accessing",
  45111. fn: function (aContext){
  45112. var self=this,$self=this;
  45113. $self["@context"]=aContext;
  45114. return self;
  45115. },
  45116. args: ["aContext"],
  45117. source: "context: aContext\x0a\x09context := aContext",
  45118. referencedClasses: [],
  45119. messageSends: []
  45120. }),
  45121. $globals.ASTDebugger);
  45122. $core.addMethod(
  45123. $core.method({
  45124. selector: "flushInnerContexts",
  45125. protocol: "actions",
  45126. fn: function (){
  45127. var self=this,$self=this;
  45128. return $core.withContext(function($ctx1) {
  45129. var $1,$receiver;
  45130. $1=$self._context();
  45131. if(($receiver = $1) == null || $receiver.a$nil){
  45132. $1;
  45133. } else {
  45134. var cxt;
  45135. cxt=$receiver;
  45136. $recv(cxt)._innerContext_(nil);
  45137. }
  45138. return self;
  45139. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45140. },
  45141. args: [],
  45142. 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 ]",
  45143. referencedClasses: [],
  45144. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45145. }),
  45146. $globals.ASTDebugger);
  45147. $core.addMethod(
  45148. $core.method({
  45149. selector: "interpreter",
  45150. protocol: "accessing",
  45151. fn: function (){
  45152. var self=this,$self=this;
  45153. return $core.withContext(function($ctx1) {
  45154. var $1,$receiver;
  45155. $1=$self._context();
  45156. if(($receiver = $1) == null || $receiver.a$nil){
  45157. return $1;
  45158. } else {
  45159. var ctx;
  45160. ctx=$receiver;
  45161. return $recv(ctx)._interpreter();
  45162. }
  45163. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45164. },
  45165. args: [],
  45166. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45167. referencedClasses: [],
  45168. messageSends: ["ifNotNil:", "context", "interpreter"]
  45169. }),
  45170. $globals.ASTDebugger);
  45171. $core.addMethod(
  45172. $core.method({
  45173. selector: "method",
  45174. protocol: "accessing",
  45175. fn: function (){
  45176. var self=this,$self=this;
  45177. return $core.withContext(function($ctx1) {
  45178. return $recv($self._context())._method();
  45179. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45180. },
  45181. args: [],
  45182. source: "method\x0a\x09^ self context method",
  45183. referencedClasses: [],
  45184. messageSends: ["method", "context"]
  45185. }),
  45186. $globals.ASTDebugger);
  45187. $core.addMethod(
  45188. $core.method({
  45189. selector: "node",
  45190. protocol: "accessing",
  45191. fn: function (){
  45192. var self=this,$self=this;
  45193. return $core.withContext(function($ctx1) {
  45194. var $1,$receiver;
  45195. $1=$self._interpreter();
  45196. $ctx1.sendIdx["interpreter"]=1;
  45197. if(($receiver = $1) == null || $receiver.a$nil){
  45198. return $1;
  45199. } else {
  45200. return $recv($self._interpreter())._node();
  45201. }
  45202. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45203. },
  45204. args: [],
  45205. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45206. referencedClasses: [],
  45207. messageSends: ["ifNotNil:", "interpreter", "node"]
  45208. }),
  45209. $globals.ASTDebugger);
  45210. $core.addMethod(
  45211. $core.method({
  45212. selector: "onStep",
  45213. protocol: "private",
  45214. fn: function (){
  45215. var self=this,$self=this;
  45216. return $core.withContext(function($ctx1) {
  45217. var $1,$3,$2,$4,$6,$5,$receiver;
  45218. $1=$self._interpreter();
  45219. $ctx1.sendIdx["interpreter"]=1;
  45220. $self["@result"]=$recv($1)._result();
  45221. $3=$self._interpreter();
  45222. $ctx1.sendIdx["interpreter"]=2;
  45223. $2=$recv($3)._atEnd();
  45224. $ctx1.sendIdx["atEnd"]=1;
  45225. if($core.assert($2)){
  45226. $4=$recv($self._context())._outerContext();
  45227. if(($receiver = $4) == null || $receiver.a$nil){
  45228. $4;
  45229. } else {
  45230. var outerContext;
  45231. outerContext=$receiver;
  45232. $self._context_(outerContext);
  45233. }
  45234. $6=$self._interpreter();
  45235. $ctx1.sendIdx["interpreter"]=3;
  45236. $5=$recv($6)._atEnd();
  45237. if(!$core.assert($5)){
  45238. $recv($self._interpreter())._skip();
  45239. }
  45240. }
  45241. $self._flushInnerContexts();
  45242. return self;
  45243. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45244. },
  45245. args: [],
  45246. 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",
  45247. referencedClasses: [],
  45248. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45249. }),
  45250. $globals.ASTDebugger);
  45251. $core.addMethod(
  45252. $core.method({
  45253. selector: "proceed",
  45254. protocol: "stepping",
  45255. fn: function (){
  45256. var self=this,$self=this;
  45257. return $core.withContext(function($ctx1) {
  45258. $recv((function(){
  45259. return $core.withContext(function($ctx2) {
  45260. return $self._atEnd();
  45261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45262. }))._whileFalse_((function(){
  45263. return $core.withContext(function($ctx2) {
  45264. return $self._stepOver();
  45265. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45266. }));
  45267. return self;
  45268. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45269. },
  45270. args: [],
  45271. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45272. referencedClasses: [],
  45273. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45274. }),
  45275. $globals.ASTDebugger);
  45276. $core.addMethod(
  45277. $core.method({
  45278. selector: "restart",
  45279. protocol: "stepping",
  45280. fn: function (){
  45281. var self=this,$self=this;
  45282. return $core.withContext(function($ctx1) {
  45283. $recv($self._interpreter())._restart();
  45284. $self._flushInnerContexts();
  45285. return self;
  45286. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45287. },
  45288. args: [],
  45289. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45290. referencedClasses: [],
  45291. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45292. }),
  45293. $globals.ASTDebugger);
  45294. $core.addMethod(
  45295. $core.method({
  45296. selector: "result",
  45297. protocol: "accessing",
  45298. fn: function (){
  45299. var self=this,$self=this;
  45300. return $self["@result"];
  45301. },
  45302. args: [],
  45303. source: "result\x0a\x09^ result",
  45304. referencedClasses: [],
  45305. messageSends: []
  45306. }),
  45307. $globals.ASTDebugger);
  45308. $core.addMethod(
  45309. $core.method({
  45310. selector: "stepInto",
  45311. protocol: "stepping",
  45312. fn: function (){
  45313. var self=this,$self=this;
  45314. return $core.withContext(function($ctx1) {
  45315. $self._shouldBeImplemented();
  45316. return self;
  45317. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45318. },
  45319. args: [],
  45320. source: "stepInto\x0a\x09self shouldBeImplemented",
  45321. referencedClasses: [],
  45322. messageSends: ["shouldBeImplemented"]
  45323. }),
  45324. $globals.ASTDebugger);
  45325. $core.addMethod(
  45326. $core.method({
  45327. selector: "stepOver",
  45328. protocol: "stepping",
  45329. fn: function (){
  45330. var self=this,$self=this;
  45331. return $core.withContext(function($ctx1) {
  45332. var $1,$2;
  45333. $1=$recv($self._context())._isTopContext();
  45334. if($core.assert($1)){
  45335. $recv($self._interpreter())._stepOver();
  45336. } else {
  45337. $2=$self._interpreter();
  45338. $ctx1.sendIdx["interpreter"]=1;
  45339. $recv($2)._skip();
  45340. }
  45341. $self._onStep();
  45342. return self;
  45343. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45344. },
  45345. args: [],
  45346. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45347. referencedClasses: [],
  45348. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45349. }),
  45350. $globals.ASTDebugger);
  45351. $core.addMethod(
  45352. $core.method({
  45353. selector: "context:",
  45354. protocol: "instance creation",
  45355. fn: function (aContext){
  45356. var self=this,$self=this;
  45357. return $core.withContext(function($ctx1) {
  45358. var $1;
  45359. $1=$self._new();
  45360. $recv($1)._context_(aContext);
  45361. return $recv($1)._yourself();
  45362. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45363. },
  45364. args: ["aContext"],
  45365. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45366. referencedClasses: [],
  45367. messageSends: ["context:", "new", "yourself"]
  45368. }),
  45369. $globals.ASTDebugger.a$cls);
  45370. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45371. $core.addMethod(
  45372. $core.method({
  45373. selector: "interpreter",
  45374. protocol: "accessing",
  45375. fn: function (){
  45376. var self=this,$self=this;
  45377. return $self["@interpreter"];
  45378. },
  45379. args: [],
  45380. source: "interpreter\x0a\x09^ interpreter",
  45381. referencedClasses: [],
  45382. messageSends: []
  45383. }),
  45384. $globals.ASTEnterNode);
  45385. $core.addMethod(
  45386. $core.method({
  45387. selector: "interpreter:",
  45388. protocol: "accessing",
  45389. fn: function (anObject){
  45390. var self=this,$self=this;
  45391. $self["@interpreter"]=anObject;
  45392. return self;
  45393. },
  45394. args: ["anObject"],
  45395. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45396. referencedClasses: [],
  45397. messageSends: []
  45398. }),
  45399. $globals.ASTEnterNode);
  45400. $core.addMethod(
  45401. $core.method({
  45402. selector: "visitBlockNode:",
  45403. protocol: "visiting",
  45404. fn: function (aNode){
  45405. var self=this,$self=this;
  45406. return aNode;
  45407. },
  45408. args: ["aNode"],
  45409. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45410. referencedClasses: [],
  45411. messageSends: []
  45412. }),
  45413. $globals.ASTEnterNode);
  45414. $core.addMethod(
  45415. $core.method({
  45416. selector: "visitDagNode:",
  45417. protocol: "visiting",
  45418. fn: function (aNode){
  45419. var self=this,$self=this;
  45420. return $core.withContext(function($ctx1) {
  45421. var $early={};
  45422. try {
  45423. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45424. throw $early=[aNode];
  45425. }),(function(nodes){
  45426. return $core.withContext(function($ctx2) {
  45427. throw $early=[$self._visit_($recv(nodes)._first())];
  45428. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45429. }));
  45430. return self;
  45431. }
  45432. catch(e) {if(e===$early)return e[0]; throw e}
  45433. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45434. },
  45435. args: ["aNode"],
  45436. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45437. referencedClasses: [],
  45438. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45439. }),
  45440. $globals.ASTEnterNode);
  45441. $core.addMethod(
  45442. $core.method({
  45443. selector: "visitSequenceNode:",
  45444. protocol: "visiting",
  45445. fn: function (aNode){
  45446. var self=this,$self=this;
  45447. return $core.withContext(function($ctx1) {
  45448. var $1;
  45449. $recv($recv(aNode)._temps())._do_((function(each){
  45450. return $core.withContext(function($ctx2) {
  45451. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45452. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45453. }));
  45454. $1=(
  45455. $ctx1.supercall = true,
  45456. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45457. $ctx1.supercall = false;
  45458. return $1;
  45459. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45460. },
  45461. args: ["aNode"],
  45462. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45463. referencedClasses: [],
  45464. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45465. }),
  45466. $globals.ASTEnterNode);
  45467. $core.addMethod(
  45468. $core.method({
  45469. selector: "on:",
  45470. protocol: "instance creation",
  45471. fn: function (anInterpreter){
  45472. var self=this,$self=this;
  45473. return $core.withContext(function($ctx1) {
  45474. var $1;
  45475. $1=$self._new();
  45476. $recv($1)._interpreter_(anInterpreter);
  45477. return $recv($1)._yourself();
  45478. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45479. },
  45480. args: ["anInterpreter"],
  45481. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45482. referencedClasses: [],
  45483. messageSends: ["interpreter:", "new", "yourself"]
  45484. }),
  45485. $globals.ASTEnterNode.a$cls);
  45486. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45487. $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";
  45488. $core.addMethod(
  45489. $core.method({
  45490. selector: "assign:to:",
  45491. protocol: "private",
  45492. fn: function (aNode,anObject){
  45493. var self=this,$self=this;
  45494. return $core.withContext(function($ctx1) {
  45495. var $1,$3,$2,$4;
  45496. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45497. if($core.assert($1)){
  45498. $3=$self._context();
  45499. $ctx1.sendIdx["context"]=1;
  45500. $2=$recv($3)._receiver();
  45501. $4=$recv(aNode)._value();
  45502. $ctx1.sendIdx["value"]=1;
  45503. $recv($2)._instVarAt_put_($4,anObject);
  45504. } else {
  45505. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45506. }
  45507. return self;
  45508. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45509. },
  45510. args: ["aNode", "anObject"],
  45511. 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 ]",
  45512. referencedClasses: [],
  45513. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45514. }),
  45515. $globals.ASTInterpreter);
  45516. $core.addMethod(
  45517. $core.method({
  45518. selector: "atEnd",
  45519. protocol: "testing",
  45520. fn: function (){
  45521. var self=this,$self=this;
  45522. return $core.withContext(function($ctx1) {
  45523. var $1;
  45524. $1=$self["@forceAtEnd"];
  45525. if($core.assert($1)){
  45526. return true;
  45527. }
  45528. return $recv($self._hasReturned())._or_((function(){
  45529. return $core.withContext(function($ctx2) {
  45530. return $recv($self._node())._isNil();
  45531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45532. }));
  45533. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  45534. },
  45535. args: [],
  45536. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  45537. referencedClasses: [],
  45538. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  45539. }),
  45540. $globals.ASTInterpreter);
  45541. $core.addMethod(
  45542. $core.method({
  45543. selector: "context",
  45544. protocol: "accessing",
  45545. fn: function (){
  45546. var self=this,$self=this;
  45547. return $self["@context"];
  45548. },
  45549. args: [],
  45550. source: "context\x0a\x09^ context",
  45551. referencedClasses: [],
  45552. messageSends: []
  45553. }),
  45554. $globals.ASTInterpreter);
  45555. $core.addMethod(
  45556. $core.method({
  45557. selector: "context:",
  45558. protocol: "accessing",
  45559. fn: function (aContext){
  45560. var self=this,$self=this;
  45561. $self["@context"]=aContext;
  45562. return self;
  45563. },
  45564. args: ["aContext"],
  45565. source: "context: aContext\x0a\x09context := aContext",
  45566. referencedClasses: [],
  45567. messageSends: []
  45568. }),
  45569. $globals.ASTInterpreter);
  45570. $core.addMethod(
  45571. $core.method({
  45572. selector: "enterNode",
  45573. protocol: "interpreting",
  45574. fn: function (){
  45575. var self=this,$self=this;
  45576. return $core.withContext(function($ctx1) {
  45577. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  45578. return self;
  45579. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  45580. },
  45581. args: [],
  45582. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  45583. referencedClasses: ["ASTEnterNode"],
  45584. messageSends: ["node:", "visit:", "on:", "node"]
  45585. }),
  45586. $globals.ASTInterpreter);
  45587. $core.addMethod(
  45588. $core.method({
  45589. selector: "eval:",
  45590. protocol: "private",
  45591. fn: function (aString){
  45592. var self=this,$self=this;
  45593. var source,function_;
  45594. return $core.withContext(function($ctx1) {
  45595. var $3,$2,$1;
  45596. source=$recv($globals.String)._streamContents_((function(str){
  45597. return $core.withContext(function($ctx2) {
  45598. $recv(str)._nextPutAll_("0,(function(");
  45599. $ctx2.sendIdx["nextPutAll:"]=1;
  45600. $3=$self._context();
  45601. $ctx2.sendIdx["context"]=1;
  45602. $2=$recv($3)._locals();
  45603. $ctx2.sendIdx["locals"]=1;
  45604. $1=$recv($2)._keys();
  45605. $recv($1)._do_separatedBy_((function(each){
  45606. return $core.withContext(function($ctx3) {
  45607. return $recv(str)._nextPutAll_(each);
  45608. $ctx3.sendIdx["nextPutAll:"]=2;
  45609. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  45610. }),(function(){
  45611. return $core.withContext(function($ctx3) {
  45612. return $recv(str)._nextPutAll_(",");
  45613. $ctx3.sendIdx["nextPutAll:"]=3;
  45614. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  45615. }));
  45616. $recv(str)._nextPutAll_("){ return (function() {");
  45617. $ctx2.sendIdx["nextPutAll:"]=4;
  45618. $recv(str)._nextPutAll_(aString);
  45619. $ctx2.sendIdx["nextPutAll:"]=5;
  45620. return $recv(str)._nextPutAll_("})()})");
  45621. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  45622. }));
  45623. function_=$recv($globals.Compiler)._eval_(source);
  45624. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  45625. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  45626. },
  45627. args: ["aString"],
  45628. 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",
  45629. referencedClasses: ["String", "Compiler"],
  45630. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  45631. }),
  45632. $globals.ASTInterpreter);
  45633. $core.addMethod(
  45634. $core.method({
  45635. selector: "hasReturned",
  45636. protocol: "testing",
  45637. fn: function (){
  45638. var self=this,$self=this;
  45639. return $core.withContext(function($ctx1) {
  45640. var $1,$receiver;
  45641. $1=$self["@returned"];
  45642. if(($receiver = $1) == null || $receiver.a$nil){
  45643. return false;
  45644. } else {
  45645. return $1;
  45646. }
  45647. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  45648. },
  45649. args: [],
  45650. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  45651. referencedClasses: [],
  45652. messageSends: ["ifNil:"]
  45653. }),
  45654. $globals.ASTInterpreter);
  45655. $core.addMethod(
  45656. $core.method({
  45657. selector: "initialize",
  45658. protocol: "initialization",
  45659. fn: function (){
  45660. var self=this,$self=this;
  45661. return $core.withContext(function($ctx1) {
  45662. (
  45663. $ctx1.supercall = true,
  45664. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  45665. $ctx1.supercall = false;
  45666. $self["@forceAtEnd"]=false;
  45667. return self;
  45668. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  45669. },
  45670. args: [],
  45671. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  45672. referencedClasses: [],
  45673. messageSends: ["initialize"]
  45674. }),
  45675. $globals.ASTInterpreter);
  45676. $core.addMethod(
  45677. $core.method({
  45678. selector: "interpret",
  45679. protocol: "interpreting",
  45680. fn: function (){
  45681. var self=this,$self=this;
  45682. return $core.withContext(function($ctx1) {
  45683. $self._visit_($self._node());
  45684. return self;
  45685. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  45686. },
  45687. args: [],
  45688. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  45689. referencedClasses: [],
  45690. messageSends: ["visit:", "node"]
  45691. }),
  45692. $globals.ASTInterpreter);
  45693. $core.addMethod(
  45694. $core.method({
  45695. selector: "messageFromSendNode:arguments:",
  45696. protocol: "private",
  45697. fn: function (aSendNode,aCollection){
  45698. var self=this,$self=this;
  45699. return $core.withContext(function($ctx1) {
  45700. var $1;
  45701. $1=$recv($globals.Message)._new();
  45702. $recv($1)._selector_($recv(aSendNode)._selector());
  45703. $recv($1)._arguments_(aCollection);
  45704. return $recv($1)._yourself();
  45705. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  45706. },
  45707. args: ["aSendNode", "aCollection"],
  45708. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  45709. referencedClasses: ["Message"],
  45710. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  45711. }),
  45712. $globals.ASTInterpreter);
  45713. $core.addMethod(
  45714. $core.method({
  45715. selector: "messageNotUnderstood:receiver:",
  45716. protocol: "private",
  45717. fn: function (aMessage,anObject){
  45718. var self=this,$self=this;
  45719. return $core.withContext(function($ctx1) {
  45720. var $1;
  45721. $1=$recv($globals.MessageNotUnderstood)._new();
  45722. $recv($1)._message_(aMessage);
  45723. $recv($1)._receiver_(anObject);
  45724. $recv($1)._signal();
  45725. return self;
  45726. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  45727. },
  45728. args: ["aMessage", "anObject"],
  45729. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  45730. referencedClasses: ["MessageNotUnderstood"],
  45731. messageSends: ["message:", "new", "receiver:", "signal"]
  45732. }),
  45733. $globals.ASTInterpreter);
  45734. $core.addMethod(
  45735. $core.method({
  45736. selector: "next",
  45737. protocol: "interpreting",
  45738. fn: function (){
  45739. var self=this,$self=this;
  45740. var nd,nextNode;
  45741. return $core.withContext(function($ctx1) {
  45742. var $1,$2,$receiver;
  45743. nd=$self._node();
  45744. $1=$recv(nd)._parent();
  45745. if(($receiver = $1) == null || $receiver.a$nil){
  45746. nextNode=$1;
  45747. } else {
  45748. var parent;
  45749. parent=$receiver;
  45750. $2=$recv(parent)._nextSiblingNode_(nd);
  45751. if(($receiver = $2) == null || $receiver.a$nil){
  45752. nextNode=parent;
  45753. } else {
  45754. var sibling;
  45755. sibling=$receiver;
  45756. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  45757. }
  45758. }
  45759. $self._node_(nextNode);
  45760. return self;
  45761. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  45762. },
  45763. args: [],
  45764. 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",
  45765. referencedClasses: ["ASTEnterNode"],
  45766. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  45767. }),
  45768. $globals.ASTInterpreter);
  45769. $core.addMethod(
  45770. $core.method({
  45771. selector: "node",
  45772. protocol: "accessing",
  45773. fn: function (){
  45774. var self=this,$self=this;
  45775. return $self["@node"];
  45776. },
  45777. args: [],
  45778. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  45779. referencedClasses: [],
  45780. messageSends: []
  45781. }),
  45782. $globals.ASTInterpreter);
  45783. $core.addMethod(
  45784. $core.method({
  45785. selector: "node:",
  45786. protocol: "accessing",
  45787. fn: function (aNode){
  45788. var self=this,$self=this;
  45789. $self["@node"]=aNode;
  45790. return self;
  45791. },
  45792. args: ["aNode"],
  45793. source: "node: aNode\x0a\x09node := aNode",
  45794. referencedClasses: [],
  45795. messageSends: []
  45796. }),
  45797. $globals.ASTInterpreter);
  45798. $core.addMethod(
  45799. $core.method({
  45800. selector: "peek",
  45801. protocol: "stack",
  45802. fn: function (){
  45803. var self=this,$self=this;
  45804. return $core.withContext(function($ctx1) {
  45805. var $1;
  45806. var $early={};
  45807. try {
  45808. $1=$self._stack();
  45809. $ctx1.sendIdx["stack"]=1;
  45810. $recv($1)._ifEmpty_((function(){
  45811. throw $early=[nil];
  45812. }));
  45813. return $recv($self._stack())._last();
  45814. }
  45815. catch(e) {if(e===$early)return e[0]; throw e}
  45816. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  45817. },
  45818. args: [],
  45819. 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",
  45820. referencedClasses: [],
  45821. messageSends: ["ifEmpty:", "stack", "last"]
  45822. }),
  45823. $globals.ASTInterpreter);
  45824. $core.addMethod(
  45825. $core.method({
  45826. selector: "pop",
  45827. protocol: "stack",
  45828. fn: function (){
  45829. var self=this,$self=this;
  45830. var peekedValue;
  45831. return $core.withContext(function($ctx1) {
  45832. peekedValue=$self._peek();
  45833. $recv($self._stack())._removeLast();
  45834. return peekedValue;
  45835. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  45836. },
  45837. args: [],
  45838. 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",
  45839. referencedClasses: [],
  45840. messageSends: ["peek", "removeLast", "stack"]
  45841. }),
  45842. $globals.ASTInterpreter);
  45843. $core.addMethod(
  45844. $core.method({
  45845. selector: "proceed",
  45846. protocol: "interpreting",
  45847. fn: function (){
  45848. var self=this,$self=this;
  45849. return $core.withContext(function($ctx1) {
  45850. $recv((function(){
  45851. return $core.withContext(function($ctx2) {
  45852. return $self._atEnd();
  45853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45854. }))._whileFalse_((function(){
  45855. return $core.withContext(function($ctx2) {
  45856. return $self._step();
  45857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45858. }));
  45859. return self;
  45860. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  45861. },
  45862. args: [],
  45863. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  45864. referencedClasses: [],
  45865. messageSends: ["whileFalse:", "atEnd", "step"]
  45866. }),
  45867. $globals.ASTInterpreter);
  45868. $core.addMethod(
  45869. $core.method({
  45870. selector: "push:",
  45871. protocol: "stack",
  45872. fn: function (anObject){
  45873. var self=this,$self=this;
  45874. return $core.withContext(function($ctx1) {
  45875. return $recv($self._stack())._add_(anObject);
  45876. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  45877. },
  45878. args: ["anObject"],
  45879. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  45880. referencedClasses: [],
  45881. messageSends: ["add:", "stack"]
  45882. }),
  45883. $globals.ASTInterpreter);
  45884. $core.addMethod(
  45885. $core.method({
  45886. selector: "restart",
  45887. protocol: "interpreting",
  45888. fn: function (){
  45889. var self=this,$self=this;
  45890. return $core.withContext(function($ctx1) {
  45891. $self._node_($recv($self._context())._ast());
  45892. $self._enterNode();
  45893. return self;
  45894. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  45895. },
  45896. args: [],
  45897. source: "restart\x0a\x09self node: self context ast; enterNode",
  45898. referencedClasses: [],
  45899. messageSends: ["node:", "ast", "context", "enterNode"]
  45900. }),
  45901. $globals.ASTInterpreter);
  45902. $core.addMethod(
  45903. $core.method({
  45904. selector: "result",
  45905. protocol: "accessing",
  45906. fn: function (){
  45907. var self=this,$self=this;
  45908. return $core.withContext(function($ctx1) {
  45909. var $1;
  45910. $1=$self._hasReturned();
  45911. if($core.assert($1)){
  45912. return $self._returnValue();
  45913. } else {
  45914. return $recv($self._context())._receiver();
  45915. }
  45916. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  45917. },
  45918. args: [],
  45919. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  45920. referencedClasses: [],
  45921. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  45922. }),
  45923. $globals.ASTInterpreter);
  45924. $core.addMethod(
  45925. $core.method({
  45926. selector: "returnValue",
  45927. protocol: "accessing",
  45928. fn: function (){
  45929. var self=this,$self=this;
  45930. return $self["@returnValue"];
  45931. },
  45932. args: [],
  45933. source: "returnValue\x0a\x09^ returnValue",
  45934. referencedClasses: [],
  45935. messageSends: []
  45936. }),
  45937. $globals.ASTInterpreter);
  45938. $core.addMethod(
  45939. $core.method({
  45940. selector: "returnValue:",
  45941. protocol: "accessing",
  45942. fn: function (anObject){
  45943. var self=this,$self=this;
  45944. $self["@returnValue"]=anObject;
  45945. return self;
  45946. },
  45947. args: ["anObject"],
  45948. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  45949. referencedClasses: [],
  45950. messageSends: []
  45951. }),
  45952. $globals.ASTInterpreter);
  45953. $core.addMethod(
  45954. $core.method({
  45955. selector: "sendMessage:to:superSend:",
  45956. protocol: "private",
  45957. fn: function (aMessage,anObject,aBoolean){
  45958. var self=this,$self=this;
  45959. var method;
  45960. return $core.withContext(function($ctx1) {
  45961. var $2,$1,$3,$receiver;
  45962. var $early={};
  45963. try {
  45964. if(!$core.assert(aBoolean)){
  45965. return $recv(aMessage)._sendTo_(anObject);
  45966. }
  45967. $2=$recv(anObject)._class();
  45968. $ctx1.sendIdx["class"]=1;
  45969. $1=$recv($2)._superclass();
  45970. $ctx1.sendIdx["superclass"]=1;
  45971. if(($receiver = $1) == null || $receiver.a$nil){
  45972. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  45973. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  45974. return $3;
  45975. } else {
  45976. $1;
  45977. }
  45978. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  45979. return $core.withContext(function($ctx2) {
  45980. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  45981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45982. }));
  45983. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  45984. }
  45985. catch(e) {if(e===$early)return e[0]; throw e}
  45986. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  45987. },
  45988. args: ["aMessage", "anObject", "aBoolean"],
  45989. 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",
  45990. referencedClasses: [],
  45991. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  45992. }),
  45993. $globals.ASTInterpreter);
  45994. $core.addMethod(
  45995. $core.method({
  45996. selector: "setNonLocalReturnFromContext:",
  45997. protocol: "interpreting",
  45998. fn: function (aContext){
  45999. var self=this,$self=this;
  46000. return $core.withContext(function($ctx1) {
  46001. var $2,$1;
  46002. $2=$recv(aContext)._interpreter();
  46003. $ctx1.sendIdx["interpreter"]=1;
  46004. $1=$recv($2)._hasReturned();
  46005. if($core.assert($1)){
  46006. $self["@returned"]=true;
  46007. $self["@returned"];
  46008. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46009. }
  46010. return self;
  46011. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46012. },
  46013. args: ["aContext"],
  46014. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46015. referencedClasses: [],
  46016. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46017. }),
  46018. $globals.ASTInterpreter);
  46019. $core.addMethod(
  46020. $core.method({
  46021. selector: "skip",
  46022. protocol: "interpreting",
  46023. fn: function (){
  46024. var self=this,$self=this;
  46025. return $core.withContext(function($ctx1) {
  46026. $self._next();
  46027. return self;
  46028. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46029. },
  46030. args: [],
  46031. source: "skip\x0a\x09self next",
  46032. referencedClasses: [],
  46033. messageSends: ["next"]
  46034. }),
  46035. $globals.ASTInterpreter);
  46036. $core.addMethod(
  46037. $core.method({
  46038. selector: "stack",
  46039. protocol: "accessing",
  46040. fn: function (){
  46041. var self=this,$self=this;
  46042. return $core.withContext(function($ctx1) {
  46043. var $1,$receiver;
  46044. $1=$self["@stack"];
  46045. if(($receiver = $1) == null || $receiver.a$nil){
  46046. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46047. return $self["@stack"];
  46048. } else {
  46049. return $1;
  46050. }
  46051. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46052. },
  46053. args: [],
  46054. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46055. referencedClasses: ["OrderedCollection"],
  46056. messageSends: ["ifNil:", "new"]
  46057. }),
  46058. $globals.ASTInterpreter);
  46059. $core.addMethod(
  46060. $core.method({
  46061. selector: "step",
  46062. protocol: "interpreting",
  46063. fn: function (){
  46064. var self=this,$self=this;
  46065. return $core.withContext(function($ctx1) {
  46066. $self._interpret();
  46067. $self._next();
  46068. return self;
  46069. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46070. },
  46071. args: [],
  46072. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46073. referencedClasses: [],
  46074. messageSends: ["interpret", "next"]
  46075. }),
  46076. $globals.ASTInterpreter);
  46077. $core.addMethod(
  46078. $core.method({
  46079. selector: "stepOver",
  46080. protocol: "interpreting",
  46081. fn: function (){
  46082. var self=this,$self=this;
  46083. return $core.withContext(function($ctx1) {
  46084. var $2,$1;
  46085. $self._step();
  46086. $ctx1.sendIdx["step"]=1;
  46087. $recv((function(){
  46088. return $core.withContext(function($ctx2) {
  46089. $2=$self._node();
  46090. $ctx2.sendIdx["node"]=1;
  46091. $1=$recv($2)._isNil();
  46092. return $recv($1)._or_((function(){
  46093. return $core.withContext(function($ctx3) {
  46094. return $recv($self._node())._isSteppingNode();
  46095. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46096. }));
  46097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46098. }))._whileFalse_((function(){
  46099. return $core.withContext(function($ctx2) {
  46100. return $self._step();
  46101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46102. }));
  46103. return self;
  46104. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46105. },
  46106. args: [],
  46107. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46108. referencedClasses: [],
  46109. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46110. }),
  46111. $globals.ASTInterpreter);
  46112. $core.addMethod(
  46113. $core.method({
  46114. selector: "visit:",
  46115. protocol: "visiting",
  46116. fn: function (aNode){
  46117. var self=this,$self=this;
  46118. return $core.withContext(function($ctx1) {
  46119. var $1;
  46120. $1=$self._hasReturned();
  46121. if(!$core.assert($1)){
  46122. (
  46123. $ctx1.supercall = true,
  46124. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46125. $ctx1.supercall = false;
  46126. }
  46127. return self;
  46128. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46129. },
  46130. args: ["aNode"],
  46131. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46132. referencedClasses: [],
  46133. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46134. }),
  46135. $globals.ASTInterpreter);
  46136. $core.addMethod(
  46137. $core.method({
  46138. selector: "visitAssignmentNode:",
  46139. protocol: "visiting",
  46140. fn: function (aNode){
  46141. var self=this,$self=this;
  46142. var poppedValue;
  46143. return $core.withContext(function($ctx1) {
  46144. poppedValue=$self._pop();
  46145. $ctx1.sendIdx["pop"]=1;
  46146. $self._pop();
  46147. $self._push_(poppedValue);
  46148. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46149. return self;
  46150. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46151. },
  46152. args: ["aNode"],
  46153. 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",
  46154. referencedClasses: [],
  46155. messageSends: ["pop", "push:", "assign:to:", "left"]
  46156. }),
  46157. $globals.ASTInterpreter);
  46158. $core.addMethod(
  46159. $core.method({
  46160. selector: "visitBlockNode:",
  46161. protocol: "visiting",
  46162. fn: function (aNode){
  46163. var self=this,$self=this;
  46164. var block;
  46165. return $core.withContext(function($ctx1) {
  46166. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46167. $self._push_(block);
  46168. return self;
  46169. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46170. },
  46171. args: ["aNode"],
  46172. 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",
  46173. referencedClasses: ["AIBlockClosure"],
  46174. messageSends: ["forContext:node:", "context", "push:"]
  46175. }),
  46176. $globals.ASTInterpreter);
  46177. $core.addMethod(
  46178. $core.method({
  46179. selector: "visitBlockSequenceNode:",
  46180. protocol: "visiting",
  46181. fn: function (aNode){
  46182. var self=this,$self=this;
  46183. return $core.withContext(function($ctx1) {
  46184. (
  46185. $ctx1.supercall = true,
  46186. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46187. $ctx1.supercall = false;
  46188. $self["@forceAtEnd"]=true;
  46189. return self;
  46190. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46191. },
  46192. args: ["aNode"],
  46193. 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",
  46194. referencedClasses: [],
  46195. messageSends: ["visitBlockSequenceNode:"]
  46196. }),
  46197. $globals.ASTInterpreter);
  46198. $core.addMethod(
  46199. $core.method({
  46200. selector: "visitDagNode:",
  46201. protocol: "visiting",
  46202. fn: function (aNode){
  46203. var self=this,$self=this;
  46204. return self;
  46205. },
  46206. args: ["aNode"],
  46207. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46208. referencedClasses: [],
  46209. messageSends: []
  46210. }),
  46211. $globals.ASTInterpreter);
  46212. $core.addMethod(
  46213. $core.method({
  46214. selector: "visitDynamicArrayNode:",
  46215. protocol: "visiting",
  46216. fn: function (aNode){
  46217. var self=this,$self=this;
  46218. var array;
  46219. return $core.withContext(function($ctx1) {
  46220. array=[];
  46221. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46222. return $core.withContext(function($ctx2) {
  46223. return $recv(array)._addFirst_($self._pop());
  46224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46225. }));
  46226. $self._push_(array);
  46227. return self;
  46228. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46229. },
  46230. args: ["aNode"],
  46231. 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",
  46232. referencedClasses: [],
  46233. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46234. }),
  46235. $globals.ASTInterpreter);
  46236. $core.addMethod(
  46237. $core.method({
  46238. selector: "visitDynamicDictionaryNode:",
  46239. protocol: "visiting",
  46240. fn: function (aNode){
  46241. var self=this,$self=this;
  46242. var keyValueList;
  46243. return $core.withContext(function($ctx1) {
  46244. keyValueList=$recv($globals.OrderedCollection)._new();
  46245. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46246. return $core.withContext(function($ctx2) {
  46247. return $recv(keyValueList)._add_($self._pop());
  46248. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46249. }));
  46250. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46251. return self;
  46252. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46253. },
  46254. args: ["aNode"],
  46255. 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)",
  46256. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46257. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46258. }),
  46259. $globals.ASTInterpreter);
  46260. $core.addMethod(
  46261. $core.method({
  46262. selector: "visitJSStatementNode:",
  46263. protocol: "visiting",
  46264. fn: function (aNode){
  46265. var self=this,$self=this;
  46266. return $core.withContext(function($ctx1) {
  46267. $self["@returned"]=true;
  46268. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46269. return self;
  46270. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46271. },
  46272. args: ["aNode"],
  46273. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46274. referencedClasses: [],
  46275. messageSends: ["returnValue:", "eval:", "source"]
  46276. }),
  46277. $globals.ASTInterpreter);
  46278. $core.addMethod(
  46279. $core.method({
  46280. selector: "visitReturnNode:",
  46281. protocol: "visiting",
  46282. fn: function (aNode){
  46283. var self=this,$self=this;
  46284. return $core.withContext(function($ctx1) {
  46285. $self["@returned"]=true;
  46286. $self._returnValue_($self._pop());
  46287. return self;
  46288. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46289. },
  46290. args: ["aNode"],
  46291. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46292. referencedClasses: [],
  46293. messageSends: ["returnValue:", "pop"]
  46294. }),
  46295. $globals.ASTInterpreter);
  46296. $core.addMethod(
  46297. $core.method({
  46298. selector: "visitSendNode:",
  46299. protocol: "visiting",
  46300. fn: function (aNode){
  46301. var self=this,$self=this;
  46302. var receiver,args,message,result;
  46303. return $core.withContext(function($ctx1) {
  46304. var $1;
  46305. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46306. return $core.withContext(function($ctx2) {
  46307. return $self._pop();
  46308. $ctx2.sendIdx["pop"]=1;
  46309. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46310. }));
  46311. receiver=$self._peek();
  46312. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46313. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46314. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46315. return $core.withContext(function($ctx2) {
  46316. return $recv($recv(aNode)._isLastChild())._not();
  46317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46318. }));
  46319. if(!$core.assert($1)){
  46320. $self._pop();
  46321. $self._push_(result);
  46322. }
  46323. return self;
  46324. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46325. },
  46326. args: ["aNode"],
  46327. 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 ]",
  46328. referencedClasses: [],
  46329. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46330. }),
  46331. $globals.ASTInterpreter);
  46332. $core.addMethod(
  46333. $core.method({
  46334. selector: "visitValueNode:",
  46335. protocol: "visiting",
  46336. fn: function (aNode){
  46337. var self=this,$self=this;
  46338. return $core.withContext(function($ctx1) {
  46339. $self._push_($recv(aNode)._value());
  46340. return self;
  46341. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46342. },
  46343. args: ["aNode"],
  46344. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46345. referencedClasses: [],
  46346. messageSends: ["push:", "value"]
  46347. }),
  46348. $globals.ASTInterpreter);
  46349. $core.addMethod(
  46350. $core.method({
  46351. selector: "visitVariableNode:",
  46352. protocol: "visiting",
  46353. fn: function (aNode){
  46354. var self=this,$self=this;
  46355. return $core.withContext(function($ctx1) {
  46356. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46357. $2=$recv(aNode)._binding();
  46358. $ctx1.sendIdx["binding"]=1;
  46359. $1=$recv($2)._isUnknownVar();
  46360. if($core.assert($1)){
  46361. $5=$recv($globals.Platform)._globals();
  46362. $ctx1.sendIdx["globals"]=1;
  46363. $6=$recv(aNode)._value();
  46364. $ctx1.sendIdx["value"]=1;
  46365. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46366. return $core.withContext(function($ctx2) {
  46367. return $self._error_("Unknown variable");
  46368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46369. }));
  46370. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46371. $3=$self._push_($4);
  46372. $ctx1.sendIdx["push:"]=1;
  46373. return $3;
  46374. }
  46375. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46376. if($core.assert($8)){
  46377. $10=$self._context();
  46378. $ctx1.sendIdx["context"]=1;
  46379. $9=$recv($10)._receiver();
  46380. $11=$recv(aNode)._value();
  46381. $ctx1.sendIdx["value"]=2;
  46382. $7=$recv($9)._instVarAt_($11);
  46383. } else {
  46384. $12=$self._context();
  46385. $13=$recv(aNode)._value();
  46386. $ctx1.sendIdx["value"]=3;
  46387. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46388. return $core.withContext(function($ctx2) {
  46389. $15=$recv(aNode)._value();
  46390. $ctx2.sendIdx["value"]=4;
  46391. $14=$recv($15)._isCapitalized();
  46392. if($core.assert($14)){
  46393. $16=$recv($globals.Smalltalk)._globals();
  46394. $ctx2.sendIdx["globals"]=2;
  46395. $17=$recv(aNode)._value();
  46396. $ctx2.sendIdx["value"]=5;
  46397. return $recv($16)._at_ifAbsent_($17,(function(){
  46398. return $core.withContext(function($ctx3) {
  46399. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46400. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46401. }));
  46402. }
  46403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46404. }));
  46405. }
  46406. $self._push_($7);
  46407. return self;
  46408. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46409. },
  46410. args: ["aNode"],
  46411. 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 ] ] ] ])",
  46412. referencedClasses: ["Platform", "Smalltalk"],
  46413. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46414. }),
  46415. $globals.ASTInterpreter);
  46416. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46417. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46418. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46419. $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`";
  46420. $core.addMethod(
  46421. $core.method({
  46422. selector: "currentNode",
  46423. protocol: "accessing",
  46424. fn: function (){
  46425. var self=this,$self=this;
  46426. return $self["@currentNode"];
  46427. },
  46428. args: [],
  46429. source: "currentNode\x0a\x09^ currentNode",
  46430. referencedClasses: [],
  46431. messageSends: []
  46432. }),
  46433. $globals.ASTPCNodeVisitor);
  46434. $core.addMethod(
  46435. $core.method({
  46436. selector: "increaseTrackedIndex",
  46437. protocol: "accessing",
  46438. fn: function (){
  46439. var self=this,$self=this;
  46440. return $core.withContext(function($ctx1) {
  46441. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46442. return self;
  46443. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46444. },
  46445. args: [],
  46446. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46447. referencedClasses: [],
  46448. messageSends: ["+", "trackedIndex"]
  46449. }),
  46450. $globals.ASTPCNodeVisitor);
  46451. $core.addMethod(
  46452. $core.method({
  46453. selector: "index",
  46454. protocol: "accessing",
  46455. fn: function (){
  46456. var self=this,$self=this;
  46457. return $self["@index"];
  46458. },
  46459. args: [],
  46460. source: "index\x0a\x09^ index",
  46461. referencedClasses: [],
  46462. messageSends: []
  46463. }),
  46464. $globals.ASTPCNodeVisitor);
  46465. $core.addMethod(
  46466. $core.method({
  46467. selector: "index:",
  46468. protocol: "accessing",
  46469. fn: function (aNumber){
  46470. var self=this,$self=this;
  46471. $self["@index"]=aNumber;
  46472. return self;
  46473. },
  46474. args: ["aNumber"],
  46475. source: "index: aNumber\x0a\x09index := aNumber",
  46476. referencedClasses: [],
  46477. messageSends: []
  46478. }),
  46479. $globals.ASTPCNodeVisitor);
  46480. $core.addMethod(
  46481. $core.method({
  46482. selector: "selector",
  46483. protocol: "accessing",
  46484. fn: function (){
  46485. var self=this,$self=this;
  46486. return $self["@selector"];
  46487. },
  46488. args: [],
  46489. source: "selector\x0a\x09^ selector",
  46490. referencedClasses: [],
  46491. messageSends: []
  46492. }),
  46493. $globals.ASTPCNodeVisitor);
  46494. $core.addMethod(
  46495. $core.method({
  46496. selector: "selector:",
  46497. protocol: "accessing",
  46498. fn: function (aString){
  46499. var self=this,$self=this;
  46500. $self["@selector"]=aString;
  46501. return self;
  46502. },
  46503. args: ["aString"],
  46504. source: "selector: aString\x0a\x09selector := aString",
  46505. referencedClasses: [],
  46506. messageSends: []
  46507. }),
  46508. $globals.ASTPCNodeVisitor);
  46509. $core.addMethod(
  46510. $core.method({
  46511. selector: "trackedIndex",
  46512. protocol: "accessing",
  46513. fn: function (){
  46514. var self=this,$self=this;
  46515. return $core.withContext(function($ctx1) {
  46516. var $1,$receiver;
  46517. $1=$self["@trackedIndex"];
  46518. if(($receiver = $1) == null || $receiver.a$nil){
  46519. $self["@trackedIndex"]=(0);
  46520. return $self["@trackedIndex"];
  46521. } else {
  46522. return $1;
  46523. }
  46524. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46525. },
  46526. args: [],
  46527. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46528. referencedClasses: [],
  46529. messageSends: ["ifNil:"]
  46530. }),
  46531. $globals.ASTPCNodeVisitor);
  46532. $core.addMethod(
  46533. $core.method({
  46534. selector: "visitJSStatementNode:",
  46535. protocol: "visiting",
  46536. fn: function (aNode){
  46537. var self=this,$self=this;
  46538. $self["@currentNode"]=aNode;
  46539. return self;
  46540. },
  46541. args: ["aNode"],
  46542. 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",
  46543. referencedClasses: [],
  46544. messageSends: []
  46545. }),
  46546. $globals.ASTPCNodeVisitor);
  46547. $core.addMethod(
  46548. $core.method({
  46549. selector: "visitSendNode:",
  46550. protocol: "visiting",
  46551. fn: function (aNode){
  46552. var self=this,$self=this;
  46553. return $core.withContext(function($ctx1) {
  46554. var $2,$1,$3;
  46555. (
  46556. $ctx1.supercall = true,
  46557. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  46558. $ctx1.supercall = false;
  46559. $2=$self._selector();
  46560. $ctx1.sendIdx["selector"]=1;
  46561. $1=$recv($2).__eq($recv(aNode)._selector());
  46562. $ctx1.sendIdx["="]=1;
  46563. if($core.assert($1)){
  46564. $3=$recv($self._trackedIndex()).__eq($self._index());
  46565. if($core.assert($3)){
  46566. $self["@currentNode"]=aNode;
  46567. $self["@currentNode"];
  46568. }
  46569. $self._increaseTrackedIndex();
  46570. }
  46571. return self;
  46572. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  46573. },
  46574. args: ["aNode"],
  46575. 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 ]",
  46576. referencedClasses: [],
  46577. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  46578. }),
  46579. $globals.ASTPCNodeVisitor);
  46580. $core.addMethod(
  46581. $core.method({
  46582. selector: "isLastChild",
  46583. protocol: "*Compiler-Interpreter",
  46584. fn: function (){
  46585. var self=this,$self=this;
  46586. return $core.withContext(function($ctx1) {
  46587. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  46588. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  46589. },
  46590. args: [],
  46591. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  46592. referencedClasses: [],
  46593. messageSends: ["=", "last", "dagChildren", "parent"]
  46594. }),
  46595. $globals.ASTNode);
  46596. $core.addMethod(
  46597. $core.method({
  46598. selector: "isSteppingNode",
  46599. protocol: "*Compiler-Interpreter",
  46600. fn: function (){
  46601. var self=this,$self=this;
  46602. return false;
  46603. },
  46604. args: [],
  46605. source: "isSteppingNode\x0a\x09^ false",
  46606. referencedClasses: [],
  46607. messageSends: []
  46608. }),
  46609. $globals.ASTNode);
  46610. $core.addMethod(
  46611. $core.method({
  46612. selector: "nextSiblingNode:",
  46613. protocol: "*Compiler-Interpreter",
  46614. fn: function (aNode){
  46615. var self=this,$self=this;
  46616. return $core.withContext(function($ctx1) {
  46617. var $1;
  46618. var $early={};
  46619. try {
  46620. $1=$self._dagChildren();
  46621. $ctx1.sendIdx["dagChildren"]=1;
  46622. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  46623. throw $early=[nil];
  46624. }));
  46625. }
  46626. catch(e) {if(e===$early)return e[0]; throw e}
  46627. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  46628. },
  46629. args: ["aNode"],
  46630. 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 ]",
  46631. referencedClasses: [],
  46632. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  46633. }),
  46634. $globals.ASTNode);
  46635. $core.addMethod(
  46636. $core.method({
  46637. selector: "isSteppingNode",
  46638. protocol: "*Compiler-Interpreter",
  46639. fn: function (){
  46640. var self=this,$self=this;
  46641. return true;
  46642. },
  46643. args: [],
  46644. source: "isSteppingNode\x0a\x09^ true",
  46645. referencedClasses: [],
  46646. messageSends: []
  46647. }),
  46648. $globals.AssignmentNode);
  46649. $core.addMethod(
  46650. $core.method({
  46651. selector: "isSteppingNode",
  46652. protocol: "*Compiler-Interpreter",
  46653. fn: function (){
  46654. var self=this,$self=this;
  46655. return true;
  46656. },
  46657. args: [],
  46658. source: "isSteppingNode\x0a\x09^ true",
  46659. referencedClasses: [],
  46660. messageSends: []
  46661. }),
  46662. $globals.BlockNode);
  46663. $core.addMethod(
  46664. $core.method({
  46665. selector: "nextSiblingNode:",
  46666. protocol: "*Compiler-Interpreter",
  46667. fn: function (aNode){
  46668. var self=this,$self=this;
  46669. return nil;
  46670. },
  46671. args: ["aNode"],
  46672. 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",
  46673. referencedClasses: [],
  46674. messageSends: []
  46675. }),
  46676. $globals.BlockNode);
  46677. $core.addMethod(
  46678. $core.method({
  46679. selector: "isSteppingNode",
  46680. protocol: "*Compiler-Interpreter",
  46681. fn: function (){
  46682. var self=this,$self=this;
  46683. return true;
  46684. },
  46685. args: [],
  46686. source: "isSteppingNode\x0a\x09^ true",
  46687. referencedClasses: [],
  46688. messageSends: []
  46689. }),
  46690. $globals.DynamicArrayNode);
  46691. $core.addMethod(
  46692. $core.method({
  46693. selector: "isSteppingNode",
  46694. protocol: "*Compiler-Interpreter",
  46695. fn: function (){
  46696. var self=this,$self=this;
  46697. return true;
  46698. },
  46699. args: [],
  46700. source: "isSteppingNode\x0a\x09^ true",
  46701. referencedClasses: [],
  46702. messageSends: []
  46703. }),
  46704. $globals.DynamicDictionaryNode);
  46705. $core.addMethod(
  46706. $core.method({
  46707. selector: "isSteppingNode",
  46708. protocol: "*Compiler-Interpreter",
  46709. fn: function (){
  46710. var self=this,$self=this;
  46711. return true;
  46712. },
  46713. args: [],
  46714. source: "isSteppingNode\x0a\x09^ true",
  46715. referencedClasses: [],
  46716. messageSends: []
  46717. }),
  46718. $globals.JSStatementNode);
  46719. $core.addMethod(
  46720. $core.method({
  46721. selector: "isCascadeSendNode",
  46722. protocol: "*Compiler-Interpreter",
  46723. fn: function (){
  46724. var self=this,$self=this;
  46725. return $core.withContext(function($ctx1) {
  46726. return $recv($self._parent())._isCascadeNode();
  46727. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  46728. },
  46729. args: [],
  46730. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  46731. referencedClasses: [],
  46732. messageSends: ["isCascadeNode", "parent"]
  46733. }),
  46734. $globals.SendNode);
  46735. $core.addMethod(
  46736. $core.method({
  46737. selector: "isSteppingNode",
  46738. protocol: "*Compiler-Interpreter",
  46739. fn: function (){
  46740. var self=this,$self=this;
  46741. return true;
  46742. },
  46743. args: [],
  46744. source: "isSteppingNode\x0a\x09^ true",
  46745. referencedClasses: [],
  46746. messageSends: []
  46747. }),
  46748. $globals.SendNode);
  46749. });
  46750. define('amber/lang',[
  46751. './deploy',
  46752. './boot', // pre-fetch, dep of ./helpers
  46753. './helpers', // pre-fetch, dep of ./deploy
  46754. './parser',
  46755. // --- packages for the Amber reflection begin here ---
  46756. 'amber_core/Platform-ImportExport',
  46757. 'amber_core/Compiler-Core',
  46758. 'amber_core/Compiler-AST',
  46759. 'amber_core/Compiler-Semantic',
  46760. 'amber_core/Compiler-IR',
  46761. 'amber_core/Compiler-Inlining',
  46762. 'amber_core/Compiler-Interpreter'
  46763. // --- packages for the Amber reflection end here ---
  46764. ], function (amber) {
  46765. return amber;
  46766. });
  46767. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  46768. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  46769. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46770. $core.addPackage("Platform-DOM");
  46771. ($core.packageDescriptors||$core.packages)["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  46772. ($core.packageDescriptors||$core.packages)["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46773. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  46774. $core.addMethod(
  46775. $core.method({
  46776. selector: "isDomNode:",
  46777. protocol: "testing",
  46778. fn: function (anObject){
  46779. var self=this,$self=this;
  46780. return $core.withContext(function($ctx1) {
  46781. return anObject.nodeType > 0 &&
  46782. Object.prototype.toString.call(anObject) !== "[object Object]";
  46783. return self;
  46784. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  46785. },
  46786. args: ["anObject"],
  46787. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  46788. referencedClasses: [],
  46789. messageSends: []
  46790. }),
  46791. $globals.PlatformDom.a$cls);
  46792. $core.addMethod(
  46793. $core.method({
  46794. selector: "isFeasible",
  46795. protocol: "testing",
  46796. fn: function (){
  46797. var self=this,$self=this;
  46798. return $core.withContext(function($ctx1) {
  46799. if (typeof document === "undefined") return false;
  46800. try {
  46801. var d = document.createElement("div"),
  46802. f = document.createDocumentFragment(),
  46803. t = document.createTextNode("Hello, Amber!");
  46804. f.appendChild(t);
  46805. d.insertBefore(f, null);
  46806. return d.innerHTML === "Hello, Amber!";
  46807. } catch (e) {
  46808. return false;
  46809. };
  46810. return self;
  46811. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  46812. },
  46813. args: [],
  46814. 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'>",
  46815. referencedClasses: [],
  46816. messageSends: []
  46817. }),
  46818. $globals.PlatformDom.a$cls);
  46819. $core.addMethod(
  46820. $core.method({
  46821. selector: "newCustomEvent:detail:",
  46822. protocol: "creation",
  46823. fn: function (aString,anObject){
  46824. var self=this,$self=this;
  46825. return $core.withContext(function($ctx1) {
  46826. return new CustomEvent(aString, {detail: anObject});
  46827. return self;
  46828. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  46829. },
  46830. args: ["aString", "anObject"],
  46831. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  46832. referencedClasses: [],
  46833. messageSends: []
  46834. }),
  46835. $globals.PlatformDom.a$cls);
  46836. $core.addMethod(
  46837. $core.method({
  46838. selector: "toArray:",
  46839. protocol: "converting",
  46840. fn: function (aDomList){
  46841. var self=this,$self=this;
  46842. return $core.withContext(function($ctx1) {
  46843. return Array.prototype.slice.call(aDomList);
  46844. return self;
  46845. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  46846. },
  46847. args: ["aDomList"],
  46848. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  46849. referencedClasses: [],
  46850. messageSends: []
  46851. }),
  46852. $globals.PlatformDom.a$cls);
  46853. $core.addMethod(
  46854. $core.method({
  46855. selector: "asDomNode",
  46856. protocol: "*Platform-DOM",
  46857. fn: function (){
  46858. var self=this,$self=this;
  46859. return $core.withContext(function($ctx1) {
  46860. return $recv(document)._createTextNode_($self._asString());
  46861. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  46862. },
  46863. args: [],
  46864. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  46865. referencedClasses: [],
  46866. messageSends: ["createTextNode:", "asString"]
  46867. }),
  46868. $globals.CharacterArray);
  46869. $core.addMethod(
  46870. $core.method({
  46871. selector: "asDomNode",
  46872. protocol: "*Platform-DOM",
  46873. fn: function (){
  46874. var self=this,$self=this;
  46875. var fragment;
  46876. return $core.withContext(function($ctx1) {
  46877. fragment=$recv(document)._createDocumentFragment();
  46878. $self._do_((function(each){
  46879. return $core.withContext(function($ctx2) {
  46880. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  46881. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46882. }));
  46883. return fragment;
  46884. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  46885. },
  46886. args: [],
  46887. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  46888. referencedClasses: [],
  46889. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  46890. }),
  46891. $globals.Collection);
  46892. $core.addMethod(
  46893. $core.method({
  46894. selector: "asDomNode",
  46895. protocol: "*Platform-DOM",
  46896. fn: function (){
  46897. var self=this,$self=this;
  46898. return $core.withContext(function($ctx1) {
  46899. var $1,$2;
  46900. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  46901. if($core.assert($1)){
  46902. return $self["@jsObject"];
  46903. } else {
  46904. $2=(
  46905. $ctx1.supercall = true,
  46906. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  46907. $ctx1.supercall = false;
  46908. return $2;
  46909. }
  46910. return self;
  46911. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  46912. },
  46913. args: [],
  46914. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  46915. referencedClasses: ["PlatformDom"],
  46916. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  46917. }),
  46918. $globals.JSObjectProxy);
  46919. $core.addMethod(
  46920. $core.method({
  46921. selector: "htmlTextContent",
  46922. protocol: "*Platform-DOM",
  46923. fn: function (){
  46924. var self=this,$self=this;
  46925. return $core.withContext(function($ctx1) {
  46926. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  46927. return self;
  46928. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  46929. },
  46930. args: [],
  46931. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  46932. referencedClasses: [],
  46933. messageSends: []
  46934. }),
  46935. $globals.String);
  46936. });
  46937. 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";
  46938. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  46939. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46940. $core.addPackage("SUnit");
  46941. ($core.packageDescriptors||$core.packages)["SUnit"].innerEval = function (expr) { return eval(expr); };
  46942. ($core.packageDescriptors||$core.packages)["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46943. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  46944. $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.";
  46945. $core.addMethod(
  46946. $core.method({
  46947. selector: "result",
  46948. protocol: "accessing",
  46949. fn: function (){
  46950. var self=this,$self=this;
  46951. return $self["@result"];
  46952. },
  46953. args: [],
  46954. source: "result\x0a\x09^ result",
  46955. referencedClasses: [],
  46956. messageSends: []
  46957. }),
  46958. $globals.ResultAnnouncement);
  46959. $core.addMethod(
  46960. $core.method({
  46961. selector: "result:",
  46962. protocol: "accessing",
  46963. fn: function (aTestResult){
  46964. var self=this,$self=this;
  46965. $self["@result"]=aTestResult;
  46966. return self;
  46967. },
  46968. args: ["aTestResult"],
  46969. source: "result: aTestResult\x0a\x09result := aTestResult",
  46970. referencedClasses: [],
  46971. messageSends: []
  46972. }),
  46973. $globals.ResultAnnouncement);
  46974. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  46975. $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.";
  46976. $core.addMethod(
  46977. $core.method({
  46978. selector: "assert:",
  46979. protocol: "testing",
  46980. fn: function (aBoolean){
  46981. var self=this,$self=this;
  46982. return $core.withContext(function($ctx1) {
  46983. $self._assert_description_(aBoolean,"Assertion failed");
  46984. return self;
  46985. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  46986. },
  46987. args: ["aBoolean"],
  46988. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  46989. referencedClasses: [],
  46990. messageSends: ["assert:description:"]
  46991. }),
  46992. $globals.TestCase);
  46993. $core.addMethod(
  46994. $core.method({
  46995. selector: "assert:description:",
  46996. protocol: "testing",
  46997. fn: function (aBoolean,aString){
  46998. var self=this,$self=this;
  46999. return $core.withContext(function($ctx1) {
  47000. if(!$core.assert(aBoolean)){
  47001. $self._signalFailure_(aString);
  47002. }
  47003. return self;
  47004. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47005. },
  47006. args: ["aBoolean", "aString"],
  47007. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47008. referencedClasses: [],
  47009. messageSends: ["ifFalse:", "signalFailure:"]
  47010. }),
  47011. $globals.TestCase);
  47012. $core.addMethod(
  47013. $core.method({
  47014. selector: "assert:equals:",
  47015. protocol: "testing",
  47016. fn: function (actual,expected){
  47017. var self=this,$self=this;
  47018. return $core.withContext(function($ctx1) {
  47019. var $1,$5,$4,$3,$2;
  47020. $1=$recv(actual).__eq(expected);
  47021. $5=$recv(expected)._printString();
  47022. $ctx1.sendIdx["printString"]=1;
  47023. $4="Expected: ".__comma($5);
  47024. $3=$recv($4).__comma(" but was: ");
  47025. $ctx1.sendIdx[","]=2;
  47026. $2=$recv($3).__comma($recv(actual)._printString());
  47027. $ctx1.sendIdx[","]=1;
  47028. return $self._assert_description_($1,$2);
  47029. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47030. },
  47031. args: ["actual", "expected"],
  47032. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47033. referencedClasses: [],
  47034. messageSends: ["assert:description:", "=", ",", "printString"]
  47035. }),
  47036. $globals.TestCase);
  47037. $core.addMethod(
  47038. $core.method({
  47039. selector: "async:",
  47040. protocol: "async",
  47041. fn: function (aBlock){
  47042. var self=this,$self=this;
  47043. var c;
  47044. return $core.withContext(function($ctx1) {
  47045. var $1;
  47046. $self._errorIfNotAsync_("#async");
  47047. c=$self["@context"];
  47048. return (function(){
  47049. return $core.withContext(function($ctx2) {
  47050. $1=$self._isAsync();
  47051. if($core.assert($1)){
  47052. return $recv(c)._execute_(aBlock);
  47053. }
  47054. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47055. });
  47056. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47057. },
  47058. args: ["aBlock"],
  47059. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47060. referencedClasses: [],
  47061. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47062. }),
  47063. $globals.TestCase);
  47064. $core.addMethod(
  47065. $core.method({
  47066. selector: "context:",
  47067. protocol: "accessing",
  47068. fn: function (aRunningTestContext){
  47069. var self=this,$self=this;
  47070. $self["@context"]=aRunningTestContext;
  47071. return self;
  47072. },
  47073. args: ["aRunningTestContext"],
  47074. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47075. referencedClasses: [],
  47076. messageSends: []
  47077. }),
  47078. $globals.TestCase);
  47079. $core.addMethod(
  47080. $core.method({
  47081. selector: "deny:",
  47082. protocol: "testing",
  47083. fn: function (aBoolean){
  47084. var self=this,$self=this;
  47085. return $core.withContext(function($ctx1) {
  47086. $self._assert_($recv(aBoolean)._not());
  47087. return self;
  47088. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47089. },
  47090. args: ["aBoolean"],
  47091. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47092. referencedClasses: [],
  47093. messageSends: ["assert:", "not"]
  47094. }),
  47095. $globals.TestCase);
  47096. $core.addMethod(
  47097. $core.method({
  47098. selector: "errorIfNotAsync:",
  47099. protocol: "error handling",
  47100. fn: function (aString){
  47101. var self=this,$self=this;
  47102. return $core.withContext(function($ctx1) {
  47103. var $1;
  47104. $1=$self._isAsync();
  47105. if(!$core.assert($1)){
  47106. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47107. }
  47108. return self;
  47109. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47110. },
  47111. args: ["aString"],
  47112. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47113. referencedClasses: [],
  47114. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47115. }),
  47116. $globals.TestCase);
  47117. $core.addMethod(
  47118. $core.method({
  47119. selector: "finished",
  47120. protocol: "async",
  47121. fn: function (){
  47122. var self=this,$self=this;
  47123. return $core.withContext(function($ctx1) {
  47124. $self._errorIfNotAsync_("#finished");
  47125. $self["@asyncTimeout"]=nil;
  47126. return self;
  47127. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47128. },
  47129. args: [],
  47130. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47131. referencedClasses: [],
  47132. messageSends: ["errorIfNotAsync:"]
  47133. }),
  47134. $globals.TestCase);
  47135. $core.addMethod(
  47136. $core.method({
  47137. selector: "isAsync",
  47138. protocol: "testing",
  47139. fn: function (){
  47140. var self=this,$self=this;
  47141. return $core.withContext(function($ctx1) {
  47142. return $recv($self["@asyncTimeout"])._notNil();
  47143. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47144. },
  47145. args: [],
  47146. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47147. referencedClasses: [],
  47148. messageSends: ["notNil"]
  47149. }),
  47150. $globals.TestCase);
  47151. $core.addMethod(
  47152. $core.method({
  47153. selector: "performTest",
  47154. protocol: "running",
  47155. fn: function (){
  47156. var self=this,$self=this;
  47157. return $core.withContext(function($ctx1) {
  47158. $self["@asyncTimeout"]=nil;
  47159. $self._perform_($self._selector());
  47160. return self;
  47161. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47162. },
  47163. args: [],
  47164. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47165. referencedClasses: [],
  47166. messageSends: ["perform:", "selector"]
  47167. }),
  47168. $globals.TestCase);
  47169. $core.addMethod(
  47170. $core.method({
  47171. selector: "runCase",
  47172. protocol: "running",
  47173. fn: function (){
  47174. var self=this,$self=this;
  47175. return $core.withContext(function($ctx1) {
  47176. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47177. return self;
  47178. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47179. },
  47180. args: [],
  47181. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47182. referencedClasses: ["TestContext"],
  47183. messageSends: ["start", "testCase:"]
  47184. }),
  47185. $globals.TestCase);
  47186. $core.addMethod(
  47187. $core.method({
  47188. selector: "selector",
  47189. protocol: "accessing",
  47190. fn: function (){
  47191. var self=this,$self=this;
  47192. return $self["@testSelector"];
  47193. },
  47194. args: [],
  47195. source: "selector\x0a\x09^ testSelector",
  47196. referencedClasses: [],
  47197. messageSends: []
  47198. }),
  47199. $globals.TestCase);
  47200. $core.addMethod(
  47201. $core.method({
  47202. selector: "setTestSelector:",
  47203. protocol: "accessing",
  47204. fn: function (aSelector){
  47205. var self=this,$self=this;
  47206. $self["@testSelector"]=aSelector;
  47207. return self;
  47208. },
  47209. args: ["aSelector"],
  47210. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47211. referencedClasses: [],
  47212. messageSends: []
  47213. }),
  47214. $globals.TestCase);
  47215. $core.addMethod(
  47216. $core.method({
  47217. selector: "setUp",
  47218. protocol: "running",
  47219. fn: function (){
  47220. var self=this,$self=this;
  47221. return self;
  47222. },
  47223. args: [],
  47224. source: "setUp",
  47225. referencedClasses: [],
  47226. messageSends: []
  47227. }),
  47228. $globals.TestCase);
  47229. $core.addMethod(
  47230. $core.method({
  47231. selector: "should:",
  47232. protocol: "testing",
  47233. fn: function (aBlock){
  47234. var self=this,$self=this;
  47235. return $core.withContext(function($ctx1) {
  47236. $self._assert_($recv(aBlock)._value());
  47237. return self;
  47238. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47239. },
  47240. args: ["aBlock"],
  47241. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47242. referencedClasses: [],
  47243. messageSends: ["assert:", "value"]
  47244. }),
  47245. $globals.TestCase);
  47246. $core.addMethod(
  47247. $core.method({
  47248. selector: "should:raise:",
  47249. protocol: "testing",
  47250. fn: function (aBlock,anExceptionClass){
  47251. var self=this,$self=this;
  47252. return $core.withContext(function($ctx1) {
  47253. $self._assert_($recv((function(){
  47254. return $core.withContext(function($ctx2) {
  47255. $recv(aBlock)._value();
  47256. return false;
  47257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47258. }))._on_do_(anExceptionClass,(function(ex){
  47259. return true;
  47260. })));
  47261. return self;
  47262. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47263. },
  47264. args: ["aBlock", "anExceptionClass"],
  47265. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47266. referencedClasses: [],
  47267. messageSends: ["assert:", "on:do:", "value"]
  47268. }),
  47269. $globals.TestCase);
  47270. $core.addMethod(
  47271. $core.method({
  47272. selector: "shouldnt:raise:",
  47273. protocol: "testing",
  47274. fn: function (aBlock,anExceptionClass){
  47275. var self=this,$self=this;
  47276. return $core.withContext(function($ctx1) {
  47277. $self._assert_($recv((function(){
  47278. return $core.withContext(function($ctx2) {
  47279. $recv(aBlock)._value();
  47280. return true;
  47281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47282. }))._on_do_(anExceptionClass,(function(ex){
  47283. return false;
  47284. })));
  47285. return self;
  47286. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47287. },
  47288. args: ["aBlock", "anExceptionClass"],
  47289. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47290. referencedClasses: [],
  47291. messageSends: ["assert:", "on:do:", "value"]
  47292. }),
  47293. $globals.TestCase);
  47294. $core.addMethod(
  47295. $core.method({
  47296. selector: "signalFailure:",
  47297. protocol: "private",
  47298. fn: function (aString){
  47299. var self=this,$self=this;
  47300. return $core.withContext(function($ctx1) {
  47301. var $1;
  47302. $1=$recv($globals.TestFailure)._new();
  47303. $recv($1)._messageText_(aString);
  47304. $recv($1)._signal();
  47305. return self;
  47306. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47307. },
  47308. args: ["aString"],
  47309. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47310. referencedClasses: ["TestFailure"],
  47311. messageSends: ["messageText:", "new", "signal"]
  47312. }),
  47313. $globals.TestCase);
  47314. $core.addMethod(
  47315. $core.method({
  47316. selector: "tearDown",
  47317. protocol: "running",
  47318. fn: function (){
  47319. var self=this,$self=this;
  47320. return self;
  47321. },
  47322. args: [],
  47323. source: "tearDown",
  47324. referencedClasses: [],
  47325. messageSends: []
  47326. }),
  47327. $globals.TestCase);
  47328. $core.addMethod(
  47329. $core.method({
  47330. selector: "timeout:",
  47331. protocol: "async",
  47332. fn: function (aNumber){
  47333. var self=this,$self=this;
  47334. return $core.withContext(function($ctx1) {
  47335. var $1,$receiver;
  47336. $1=$self["@asyncTimeout"];
  47337. if(($receiver = $1) == null || $receiver.a$nil){
  47338. $1;
  47339. } else {
  47340. $recv($self["@asyncTimeout"])._clearTimeout();
  47341. }
  47342. $self["@asyncTimeout"]=(0);
  47343. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47344. return $core.withContext(function($ctx2) {
  47345. return $self._assert_description_(false,"SUnit grace time exhausted");
  47346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47347. })))._valueWithTimeout_(aNumber);
  47348. return self;
  47349. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47350. },
  47351. args: ["aNumber"],
  47352. 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",
  47353. referencedClasses: [],
  47354. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47355. }),
  47356. $globals.TestCase);
  47357. $core.addMethod(
  47358. $core.method({
  47359. selector: "allTestSelectors",
  47360. protocol: "accessing",
  47361. fn: function (){
  47362. var self=this,$self=this;
  47363. var selectors;
  47364. return $core.withContext(function($ctx1) {
  47365. var $1;
  47366. selectors=$self._testSelectors();
  47367. $1=$self._shouldInheritSelectors();
  47368. if($core.assert($1)){
  47369. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47370. }
  47371. return selectors;
  47372. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47373. },
  47374. args: [],
  47375. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47376. referencedClasses: [],
  47377. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47378. }),
  47379. $globals.TestCase.a$cls);
  47380. $core.addMethod(
  47381. $core.method({
  47382. selector: "buildSuite",
  47383. protocol: "accessing",
  47384. fn: function (){
  47385. var self=this,$self=this;
  47386. return $core.withContext(function($ctx1) {
  47387. return $recv($self._allTestSelectors())._collect_((function(each){
  47388. return $core.withContext(function($ctx2) {
  47389. return $self._selector_(each);
  47390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47391. }));
  47392. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47393. },
  47394. args: [],
  47395. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47396. referencedClasses: [],
  47397. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47398. }),
  47399. $globals.TestCase.a$cls);
  47400. $core.addMethod(
  47401. $core.method({
  47402. selector: "classTag",
  47403. protocol: "accessing",
  47404. fn: function (){
  47405. var self=this,$self=this;
  47406. return "test";
  47407. },
  47408. args: [],
  47409. 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'",
  47410. referencedClasses: [],
  47411. messageSends: []
  47412. }),
  47413. $globals.TestCase.a$cls);
  47414. $core.addMethod(
  47415. $core.method({
  47416. selector: "isAbstract",
  47417. protocol: "testing",
  47418. fn: function (){
  47419. var self=this,$self=this;
  47420. return $core.withContext(function($ctx1) {
  47421. return $recv($self._name()).__eq("TestCase");
  47422. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47423. },
  47424. args: [],
  47425. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47426. referencedClasses: [],
  47427. messageSends: ["=", "name"]
  47428. }),
  47429. $globals.TestCase.a$cls);
  47430. $core.addMethod(
  47431. $core.method({
  47432. selector: "isTestClass",
  47433. protocol: "testing",
  47434. fn: function (){
  47435. var self=this,$self=this;
  47436. return $core.withContext(function($ctx1) {
  47437. return $recv($self._isAbstract())._not();
  47438. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47439. },
  47440. args: [],
  47441. source: "isTestClass\x0a\x09^ self isAbstract not",
  47442. referencedClasses: [],
  47443. messageSends: ["not", "isAbstract"]
  47444. }),
  47445. $globals.TestCase.a$cls);
  47446. $core.addMethod(
  47447. $core.method({
  47448. selector: "lookupHierarchyRoot",
  47449. protocol: "accessing",
  47450. fn: function (){
  47451. var self=this,$self=this;
  47452. return $globals.TestCase;
  47453. },
  47454. args: [],
  47455. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47456. referencedClasses: ["TestCase"],
  47457. messageSends: []
  47458. }),
  47459. $globals.TestCase.a$cls);
  47460. $core.addMethod(
  47461. $core.method({
  47462. selector: "selector:",
  47463. protocol: "accessing",
  47464. fn: function (aSelector){
  47465. var self=this,$self=this;
  47466. return $core.withContext(function($ctx1) {
  47467. var $1;
  47468. $1=$self._new();
  47469. $recv($1)._setTestSelector_(aSelector);
  47470. return $recv($1)._yourself();
  47471. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47472. },
  47473. args: ["aSelector"],
  47474. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47475. referencedClasses: [],
  47476. messageSends: ["setTestSelector:", "new", "yourself"]
  47477. }),
  47478. $globals.TestCase.a$cls);
  47479. $core.addMethod(
  47480. $core.method({
  47481. selector: "shouldInheritSelectors",
  47482. protocol: "testing",
  47483. fn: function (){
  47484. var self=this,$self=this;
  47485. return $core.withContext(function($ctx1) {
  47486. return $self.__tild_eq($self._lookupHierarchyRoot());
  47487. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47488. },
  47489. args: [],
  47490. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47491. referencedClasses: [],
  47492. messageSends: ["~=", "lookupHierarchyRoot"]
  47493. }),
  47494. $globals.TestCase.a$cls);
  47495. $core.addMethod(
  47496. $core.method({
  47497. selector: "testSelectors",
  47498. protocol: "accessing",
  47499. fn: function (){
  47500. var self=this,$self=this;
  47501. return $core.withContext(function($ctx1) {
  47502. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47503. return $core.withContext(function($ctx2) {
  47504. return $recv(each)._match_("^test");
  47505. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47506. }));
  47507. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47508. },
  47509. args: [],
  47510. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47511. referencedClasses: [],
  47512. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47513. }),
  47514. $globals.TestCase.a$cls);
  47515. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47516. $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).";
  47517. $core.addMethod(
  47518. $core.method({
  47519. selector: "execute:",
  47520. protocol: "running",
  47521. fn: function (aBlock){
  47522. var self=this,$self=this;
  47523. var failed;
  47524. return $core.withContext(function($ctx1) {
  47525. var $1,$2;
  47526. $recv($self["@testCase"])._context_(self);
  47527. $ctx1.sendIdx["context:"]=1;
  47528. $recv((function(){
  47529. return $core.withContext(function($ctx2) {
  47530. failed=true;
  47531. failed;
  47532. $recv(aBlock)._value();
  47533. failed=false;
  47534. return failed;
  47535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47536. }))._ensure_((function(){
  47537. return $core.withContext(function($ctx2) {
  47538. $recv($self["@testCase"])._context_(nil);
  47539. $1=$recv(failed)._and_((function(){
  47540. return $core.withContext(function($ctx3) {
  47541. return $recv($self["@testCase"])._isAsync();
  47542. $ctx3.sendIdx["isAsync"]=1;
  47543. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  47544. }));
  47545. if($core.assert($1)){
  47546. $recv($self["@testCase"])._finished();
  47547. }
  47548. $2=$recv($self["@testCase"])._isAsync();
  47549. if(!$core.assert($2)){
  47550. return $recv($self["@testCase"])._tearDown();
  47551. }
  47552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47553. }));
  47554. return self;
  47555. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  47556. },
  47557. args: ["aBlock"],
  47558. 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 ] ]",
  47559. referencedClasses: [],
  47560. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  47561. }),
  47562. $globals.TestContext);
  47563. $core.addMethod(
  47564. $core.method({
  47565. selector: "start",
  47566. protocol: "running",
  47567. fn: function (){
  47568. var self=this,$self=this;
  47569. return $core.withContext(function($ctx1) {
  47570. $self._execute_((function(){
  47571. return $core.withContext(function($ctx2) {
  47572. $recv($self["@testCase"])._setUp();
  47573. return $recv($self["@testCase"])._performTest();
  47574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47575. }));
  47576. return self;
  47577. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  47578. },
  47579. args: [],
  47580. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  47581. referencedClasses: [],
  47582. messageSends: ["execute:", "setUp", "performTest"]
  47583. }),
  47584. $globals.TestContext);
  47585. $core.addMethod(
  47586. $core.method({
  47587. selector: "testCase:",
  47588. protocol: "accessing",
  47589. fn: function (aTestCase){
  47590. var self=this,$self=this;
  47591. $self["@testCase"]=aTestCase;
  47592. return self;
  47593. },
  47594. args: ["aTestCase"],
  47595. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  47596. referencedClasses: [],
  47597. messageSends: []
  47598. }),
  47599. $globals.TestContext);
  47600. $core.addMethod(
  47601. $core.method({
  47602. selector: "testCase:",
  47603. protocol: "instance creation",
  47604. fn: function (aTestCase){
  47605. var self=this,$self=this;
  47606. return $core.withContext(function($ctx1) {
  47607. var $1;
  47608. $1=$self._new();
  47609. $recv($1)._testCase_(aTestCase);
  47610. return $recv($1)._yourself();
  47611. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  47612. },
  47613. args: ["aTestCase"],
  47614. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  47615. referencedClasses: [],
  47616. messageSends: ["testCase:", "new", "yourself"]
  47617. }),
  47618. $globals.TestContext.a$cls);
  47619. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  47620. $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`.";
  47621. $core.addMethod(
  47622. $core.method({
  47623. selector: "execute:",
  47624. protocol: "running",
  47625. fn: function (aBlock){
  47626. var self=this,$self=this;
  47627. return $core.withContext(function($ctx1) {
  47628. var $1;
  47629. $recv((function(){
  47630. return $core.withContext(function($ctx2) {
  47631. return $self._withErrorReporting_((function(){
  47632. return $core.withContext(function($ctx3) {
  47633. return (
  47634. $ctx3.supercall = true,
  47635. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  47636. $ctx3.supercall = false;
  47637. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47638. }));
  47639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47640. }))._ensure_((function(){
  47641. return $core.withContext(function($ctx2) {
  47642. $1=$recv($self["@testCase"])._isAsync();
  47643. if(!$core.assert($1)){
  47644. $recv($self["@result"])._increaseRuns();
  47645. return $recv($self["@finished"])._value();
  47646. }
  47647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47648. }));
  47649. return self;
  47650. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  47651. },
  47652. args: ["aBlock"],
  47653. 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 ] ]",
  47654. referencedClasses: [],
  47655. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  47656. }),
  47657. $globals.ReportingTestContext);
  47658. $core.addMethod(
  47659. $core.method({
  47660. selector: "finished:",
  47661. protocol: "accessing",
  47662. fn: function (aBlock){
  47663. var self=this,$self=this;
  47664. $self["@finished"]=aBlock;
  47665. return self;
  47666. },
  47667. args: ["aBlock"],
  47668. source: "finished: aBlock\x0a\x09finished := aBlock",
  47669. referencedClasses: [],
  47670. messageSends: []
  47671. }),
  47672. $globals.ReportingTestContext);
  47673. $core.addMethod(
  47674. $core.method({
  47675. selector: "result:",
  47676. protocol: "accessing",
  47677. fn: function (aTestResult){
  47678. var self=this,$self=this;
  47679. $self["@result"]=aTestResult;
  47680. return self;
  47681. },
  47682. args: ["aTestResult"],
  47683. source: "result: aTestResult\x0a\x09result := aTestResult",
  47684. referencedClasses: [],
  47685. messageSends: []
  47686. }),
  47687. $globals.ReportingTestContext);
  47688. $core.addMethod(
  47689. $core.method({
  47690. selector: "withErrorReporting:",
  47691. protocol: "private",
  47692. fn: function (aBlock){
  47693. var self=this,$self=this;
  47694. return $core.withContext(function($ctx1) {
  47695. $recv((function(){
  47696. return $core.withContext(function($ctx2) {
  47697. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  47698. return $core.withContext(function($ctx3) {
  47699. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  47700. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  47701. }));
  47702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47703. }))._on_do_($globals.Error,(function(ex){
  47704. return $core.withContext(function($ctx2) {
  47705. return $recv($self["@result"])._addError_($self["@testCase"]);
  47706. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  47707. }));
  47708. $ctx1.sendIdx["on:do:"]=1;
  47709. return self;
  47710. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  47711. },
  47712. args: ["aBlock"],
  47713. 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 ]",
  47714. referencedClasses: ["TestFailure", "Error"],
  47715. messageSends: ["on:do:", "addFailure:", "addError:"]
  47716. }),
  47717. $globals.ReportingTestContext);
  47718. $core.addMethod(
  47719. $core.method({
  47720. selector: "testCase:result:finished:",
  47721. protocol: "instance creation",
  47722. fn: function (aTestCase,aTestResult,aBlock){
  47723. var self=this,$self=this;
  47724. return $core.withContext(function($ctx1) {
  47725. var $1;
  47726. $1=(
  47727. $ctx1.supercall = true,
  47728. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  47729. $ctx1.supercall = false;
  47730. $recv($1)._result_(aTestResult);
  47731. $recv($1)._finished_(aBlock);
  47732. return $recv($1)._yourself();
  47733. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  47734. },
  47735. args: ["aTestCase", "aTestResult", "aBlock"],
  47736. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  47737. referencedClasses: [],
  47738. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  47739. }),
  47740. $globals.ReportingTestContext.a$cls);
  47741. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  47742. $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.";
  47743. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  47744. $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";
  47745. $core.addMethod(
  47746. $core.method({
  47747. selector: "addError:",
  47748. protocol: "accessing",
  47749. fn: function (anError){
  47750. var self=this,$self=this;
  47751. return $core.withContext(function($ctx1) {
  47752. $recv($self._errors())._add_(anError);
  47753. return self;
  47754. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  47755. },
  47756. args: ["anError"],
  47757. source: "addError: anError\x0a\x09self errors add: anError",
  47758. referencedClasses: [],
  47759. messageSends: ["add:", "errors"]
  47760. }),
  47761. $globals.TestResult);
  47762. $core.addMethod(
  47763. $core.method({
  47764. selector: "addFailure:",
  47765. protocol: "accessing",
  47766. fn: function (aFailure){
  47767. var self=this,$self=this;
  47768. return $core.withContext(function($ctx1) {
  47769. $recv($self._failures())._add_(aFailure);
  47770. return self;
  47771. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  47772. },
  47773. args: ["aFailure"],
  47774. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  47775. referencedClasses: [],
  47776. messageSends: ["add:", "failures"]
  47777. }),
  47778. $globals.TestResult);
  47779. $core.addMethod(
  47780. $core.method({
  47781. selector: "errors",
  47782. protocol: "accessing",
  47783. fn: function (){
  47784. var self=this,$self=this;
  47785. return $self["@errors"];
  47786. },
  47787. args: [],
  47788. source: "errors\x0a\x09^ errors",
  47789. referencedClasses: [],
  47790. messageSends: []
  47791. }),
  47792. $globals.TestResult);
  47793. $core.addMethod(
  47794. $core.method({
  47795. selector: "failures",
  47796. protocol: "accessing",
  47797. fn: function (){
  47798. var self=this,$self=this;
  47799. return $self["@failures"];
  47800. },
  47801. args: [],
  47802. source: "failures\x0a\x09^ failures",
  47803. referencedClasses: [],
  47804. messageSends: []
  47805. }),
  47806. $globals.TestResult);
  47807. $core.addMethod(
  47808. $core.method({
  47809. selector: "increaseRuns",
  47810. protocol: "accessing",
  47811. fn: function (){
  47812. var self=this,$self=this;
  47813. return $core.withContext(function($ctx1) {
  47814. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  47815. return self;
  47816. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  47817. },
  47818. args: [],
  47819. source: "increaseRuns\x0a\x09runs := runs + 1",
  47820. referencedClasses: [],
  47821. messageSends: ["+"]
  47822. }),
  47823. $globals.TestResult);
  47824. $core.addMethod(
  47825. $core.method({
  47826. selector: "initialize",
  47827. protocol: "initialization",
  47828. fn: function (){
  47829. var self=this,$self=this;
  47830. return $core.withContext(function($ctx1) {
  47831. (
  47832. $ctx1.supercall = true,
  47833. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  47834. $ctx1.supercall = false;
  47835. $self["@timestamp"]=$recv($globals.Date)._now();
  47836. $self["@runs"]=(0);
  47837. $self["@errors"]=$recv($globals.Array)._new();
  47838. $ctx1.sendIdx["new"]=1;
  47839. $self["@failures"]=$recv($globals.Array)._new();
  47840. $self["@total"]=(0);
  47841. return self;
  47842. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  47843. },
  47844. args: [],
  47845. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  47846. referencedClasses: ["Date", "Array"],
  47847. messageSends: ["initialize", "now", "new"]
  47848. }),
  47849. $globals.TestResult);
  47850. $core.addMethod(
  47851. $core.method({
  47852. selector: "nextRunDo:",
  47853. protocol: "running",
  47854. fn: function (aBlock){
  47855. var self=this,$self=this;
  47856. return $core.withContext(function($ctx1) {
  47857. var $2,$1;
  47858. $2=$self._runs();
  47859. $ctx1.sendIdx["runs"]=1;
  47860. $1=$recv($2).__eq_eq($self._total());
  47861. if(!$core.assert($1)){
  47862. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  47863. }
  47864. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  47865. },
  47866. args: ["aBlock"],
  47867. 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 ]",
  47868. referencedClasses: [],
  47869. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  47870. }),
  47871. $globals.TestResult);
  47872. $core.addMethod(
  47873. $core.method({
  47874. selector: "runCase:",
  47875. protocol: "running",
  47876. fn: function (aTestCase){
  47877. var self=this,$self=this;
  47878. return $core.withContext(function($ctx1) {
  47879. $recv((function(){
  47880. return $core.withContext(function($ctx2) {
  47881. return $recv((function(){
  47882. return $core.withContext(function($ctx3) {
  47883. $self._increaseRuns();
  47884. return $recv(aTestCase)._runCase();
  47885. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47886. }))._on_do_($globals.TestFailure,(function(ex){
  47887. return $core.withContext(function($ctx3) {
  47888. return $self._addFailure_(aTestCase);
  47889. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47890. }));
  47891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47892. }))._on_do_($globals.Error,(function(ex){
  47893. return $core.withContext(function($ctx2) {
  47894. return $self._addError_(aTestCase);
  47895. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  47896. }));
  47897. $ctx1.sendIdx["on:do:"]=1;
  47898. return self;
  47899. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  47900. },
  47901. args: ["aTestCase"],
  47902. 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 ]",
  47903. referencedClasses: ["TestFailure", "Error"],
  47904. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  47905. }),
  47906. $globals.TestResult);
  47907. $core.addMethod(
  47908. $core.method({
  47909. selector: "runs",
  47910. protocol: "accessing",
  47911. fn: function (){
  47912. var self=this,$self=this;
  47913. return $self["@runs"];
  47914. },
  47915. args: [],
  47916. source: "runs\x0a\x09^ runs",
  47917. referencedClasses: [],
  47918. messageSends: []
  47919. }),
  47920. $globals.TestResult);
  47921. $core.addMethod(
  47922. $core.method({
  47923. selector: "status",
  47924. protocol: "accessing",
  47925. fn: function (){
  47926. var self=this,$self=this;
  47927. return $core.withContext(function($ctx1) {
  47928. var $1;
  47929. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  47930. return "error";
  47931. }),(function(){
  47932. return $core.withContext(function($ctx2) {
  47933. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  47934. return "failure";
  47935. }),(function(){
  47936. return "success";
  47937. }));
  47938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47939. }));
  47940. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  47941. return $1;
  47942. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  47943. },
  47944. args: [],
  47945. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  47946. referencedClasses: [],
  47947. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  47948. }),
  47949. $globals.TestResult);
  47950. $core.addMethod(
  47951. $core.method({
  47952. selector: "timestamp",
  47953. protocol: "accessing",
  47954. fn: function (){
  47955. var self=this,$self=this;
  47956. return $self["@timestamp"];
  47957. },
  47958. args: [],
  47959. source: "timestamp\x0a\x09^ timestamp",
  47960. referencedClasses: [],
  47961. messageSends: []
  47962. }),
  47963. $globals.TestResult);
  47964. $core.addMethod(
  47965. $core.method({
  47966. selector: "total",
  47967. protocol: "accessing",
  47968. fn: function (){
  47969. var self=this,$self=this;
  47970. return $self["@total"];
  47971. },
  47972. args: [],
  47973. source: "total\x0a\x09^ total",
  47974. referencedClasses: [],
  47975. messageSends: []
  47976. }),
  47977. $globals.TestResult);
  47978. $core.addMethod(
  47979. $core.method({
  47980. selector: "total:",
  47981. protocol: "accessing",
  47982. fn: function (aNumber){
  47983. var self=this,$self=this;
  47984. $self["@total"]=aNumber;
  47985. return self;
  47986. },
  47987. args: ["aNumber"],
  47988. source: "total: aNumber\x0a\x09total := aNumber",
  47989. referencedClasses: [],
  47990. messageSends: []
  47991. }),
  47992. $globals.TestResult);
  47993. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  47994. $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`.";
  47995. $core.addMethod(
  47996. $core.method({
  47997. selector: "announcer",
  47998. protocol: "accessing",
  47999. fn: function (){
  48000. var self=this,$self=this;
  48001. return $self["@announcer"];
  48002. },
  48003. args: [],
  48004. source: "announcer\x0a\x09^ announcer",
  48005. referencedClasses: [],
  48006. messageSends: []
  48007. }),
  48008. $globals.TestSuiteRunner);
  48009. $core.addMethod(
  48010. $core.method({
  48011. selector: "contextOf:",
  48012. protocol: "private",
  48013. fn: function (anInteger){
  48014. var self=this,$self=this;
  48015. return $core.withContext(function($ctx1) {
  48016. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48017. return $core.withContext(function($ctx2) {
  48018. return $self._resume();
  48019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48020. }));
  48021. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48022. },
  48023. args: ["anInteger"],
  48024. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48025. referencedClasses: ["ReportingTestContext"],
  48026. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48027. }),
  48028. $globals.TestSuiteRunner);
  48029. $core.addMethod(
  48030. $core.method({
  48031. selector: "initialize",
  48032. protocol: "initialization",
  48033. fn: function (){
  48034. var self=this,$self=this;
  48035. return $core.withContext(function($ctx1) {
  48036. var $1;
  48037. (
  48038. $ctx1.supercall = true,
  48039. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48040. $ctx1.supercall = false;
  48041. $self["@announcer"]=$recv($globals.Announcer)._new();
  48042. $ctx1.sendIdx["new"]=1;
  48043. $self["@result"]=$recv($globals.TestResult)._new();
  48044. $self["@runNextTest"]=(function(){
  48045. var runs;
  48046. return $core.withContext(function($ctx2) {
  48047. runs=$recv($self["@result"])._runs();
  48048. runs;
  48049. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48050. if($core.assert($1)){
  48051. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48052. }
  48053. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48054. });
  48055. return self;
  48056. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48057. },
  48058. args: [],
  48059. 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 ] ].",
  48060. referencedClasses: ["Announcer", "TestResult"],
  48061. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48062. }),
  48063. $globals.TestSuiteRunner);
  48064. $core.addMethod(
  48065. $core.method({
  48066. selector: "result",
  48067. protocol: "accessing",
  48068. fn: function (){
  48069. var self=this,$self=this;
  48070. return $self["@result"];
  48071. },
  48072. args: [],
  48073. source: "result\x0a\x09^ result",
  48074. referencedClasses: [],
  48075. messageSends: []
  48076. }),
  48077. $globals.TestSuiteRunner);
  48078. $core.addMethod(
  48079. $core.method({
  48080. selector: "resume",
  48081. protocol: "actions",
  48082. fn: function (){
  48083. var self=this,$self=this;
  48084. return $core.withContext(function($ctx1) {
  48085. $recv($self["@runNextTest"])._fork();
  48086. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48087. return self;
  48088. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48089. },
  48090. args: [],
  48091. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48092. referencedClasses: ["ResultAnnouncement"],
  48093. messageSends: ["fork", "announce:", "result:", "new"]
  48094. }),
  48095. $globals.TestSuiteRunner);
  48096. $core.addMethod(
  48097. $core.method({
  48098. selector: "run",
  48099. protocol: "actions",
  48100. fn: function (){
  48101. var self=this,$self=this;
  48102. return $core.withContext(function($ctx1) {
  48103. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48104. $self._resume();
  48105. return self;
  48106. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48107. },
  48108. args: [],
  48109. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48110. referencedClasses: [],
  48111. messageSends: ["total:", "size", "resume"]
  48112. }),
  48113. $globals.TestSuiteRunner);
  48114. $core.addMethod(
  48115. $core.method({
  48116. selector: "suite:",
  48117. protocol: "accessing",
  48118. fn: function (aCollection){
  48119. var self=this,$self=this;
  48120. $self["@suite"]=aCollection;
  48121. return self;
  48122. },
  48123. args: ["aCollection"],
  48124. source: "suite: aCollection\x0a\x09suite := aCollection",
  48125. referencedClasses: [],
  48126. messageSends: []
  48127. }),
  48128. $globals.TestSuiteRunner);
  48129. $core.addMethod(
  48130. $core.method({
  48131. selector: "new",
  48132. protocol: "instance creation",
  48133. fn: function (){
  48134. var self=this,$self=this;
  48135. return $core.withContext(function($ctx1) {
  48136. $self._shouldNotImplement();
  48137. return self;
  48138. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48139. },
  48140. args: [],
  48141. source: "new\x0a\x09self shouldNotImplement",
  48142. referencedClasses: [],
  48143. messageSends: ["shouldNotImplement"]
  48144. }),
  48145. $globals.TestSuiteRunner.a$cls);
  48146. $core.addMethod(
  48147. $core.method({
  48148. selector: "on:",
  48149. protocol: "instance creation",
  48150. fn: function (aCollection){
  48151. var self=this,$self=this;
  48152. return $core.withContext(function($ctx1) {
  48153. var $1;
  48154. $1=(
  48155. $ctx1.supercall = true,
  48156. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48157. $ctx1.supercall = false;
  48158. return $recv($1)._suite_(aCollection);
  48159. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48160. },
  48161. args: ["aCollection"],
  48162. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48163. referencedClasses: [],
  48164. messageSends: ["suite:", "new"]
  48165. }),
  48166. $globals.TestSuiteRunner.a$cls);
  48167. $core.addMethod(
  48168. $core.method({
  48169. selector: "isTestPackage",
  48170. protocol: "*SUnit",
  48171. fn: function (){
  48172. var self=this,$self=this;
  48173. return $core.withContext(function($ctx1) {
  48174. return $recv($self._classes())._anySatisfy_((function(each){
  48175. return $core.withContext(function($ctx2) {
  48176. return $recv(each)._isTestClass();
  48177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48178. }));
  48179. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48180. },
  48181. args: [],
  48182. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48183. referencedClasses: [],
  48184. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48185. }),
  48186. $globals.Package);
  48187. $core.addMethod(
  48188. $core.method({
  48189. selector: "isTestClass",
  48190. protocol: "*SUnit",
  48191. fn: function (){
  48192. var self=this,$self=this;
  48193. return false;
  48194. },
  48195. args: [],
  48196. source: "isTestClass\x0a\x09^ false",
  48197. referencedClasses: [],
  48198. messageSends: []
  48199. }),
  48200. $globals.TBehaviorDefaults);
  48201. });
  48202. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48203. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48204. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48205. $core.addPackage("Compiler-Tests");
  48206. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  48207. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48208. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48209. $core.addMethod(
  48210. $core.method({
  48211. selector: "analyze:forClass:",
  48212. protocol: "convenience",
  48213. fn: function (aNode,aClass){
  48214. var self=this,$self=this;
  48215. return $core.withContext(function($ctx1) {
  48216. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  48217. return aNode;
  48218. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  48219. },
  48220. args: ["aNode", "aClass"],
  48221. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  48222. referencedClasses: ["SemanticAnalyzer"],
  48223. messageSends: ["visit:", "on:"]
  48224. }),
  48225. $globals.ASTParsingTest);
  48226. $core.addMethod(
  48227. $core.method({
  48228. selector: "parse:",
  48229. protocol: "parsing",
  48230. fn: function (aString){
  48231. var self=this,$self=this;
  48232. return $core.withContext(function($ctx1) {
  48233. return $recv($globals.Smalltalk)._parse_(aString);
  48234. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  48235. },
  48236. args: ["aString"],
  48237. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  48238. referencedClasses: ["Smalltalk"],
  48239. messageSends: ["parse:"]
  48240. }),
  48241. $globals.ASTParsingTest);
  48242. $core.addMethod(
  48243. $core.method({
  48244. selector: "parse:forClass:",
  48245. protocol: "parsing",
  48246. fn: function (aString,aClass){
  48247. var self=this,$self=this;
  48248. return $core.withContext(function($ctx1) {
  48249. return $self._analyze_forClass_($self._parse_(aString),aClass);
  48250. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48251. },
  48252. args: ["aString", "aClass"],
  48253. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  48254. referencedClasses: [],
  48255. messageSends: ["analyze:forClass:", "parse:"]
  48256. }),
  48257. $globals.ASTParsingTest);
  48258. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48259. $core.addMethod(
  48260. $core.method({
  48261. selector: "astPCNodeVisitor",
  48262. protocol: "factory",
  48263. fn: function (){
  48264. var self=this,$self=this;
  48265. return $core.withContext(function($ctx1) {
  48266. var $1;
  48267. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48268. $recv($1)._index_((0));
  48269. return $recv($1)._yourself();
  48270. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48271. },
  48272. args: [],
  48273. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48274. referencedClasses: ["ASTPCNodeVisitor"],
  48275. messageSends: ["index:", "new", "yourself"]
  48276. }),
  48277. $globals.ASTPCNodeVisitorTest);
  48278. $core.addMethod(
  48279. $core.method({
  48280. selector: "astPCNodeVisitorForSelector:",
  48281. protocol: "factory",
  48282. fn: function (aString){
  48283. var self=this,$self=this;
  48284. return $core.withContext(function($ctx1) {
  48285. var $1;
  48286. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48287. $recv($1)._selector_(aString);
  48288. $recv($1)._index_((0));
  48289. return $recv($1)._yourself();
  48290. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48291. },
  48292. args: ["aString"],
  48293. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48294. referencedClasses: ["ASTPCNodeVisitor"],
  48295. messageSends: ["selector:", "new", "index:", "yourself"]
  48296. }),
  48297. $globals.ASTPCNodeVisitorTest);
  48298. $core.addMethod(
  48299. $core.method({
  48300. selector: "testJSStatementNode",
  48301. protocol: "tests",
  48302. fn: function (){
  48303. var self=this,$self=this;
  48304. var ast,visitor;
  48305. return $core.withContext(function($ctx1) {
  48306. var $3,$2,$1;
  48307. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48308. $3=$self._astPCNodeVisitor();
  48309. $recv($3)._visit_(ast);
  48310. $2=$recv($3)._currentNode();
  48311. $1=$recv($2)._isJSStatementNode();
  48312. $self._assert_($1);
  48313. return self;
  48314. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48315. },
  48316. args: [],
  48317. 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",
  48318. referencedClasses: ["Object"],
  48319. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48320. }),
  48321. $globals.ASTPCNodeVisitorTest);
  48322. $core.addMethod(
  48323. $core.method({
  48324. selector: "testLegacyJSStatementNode",
  48325. protocol: "tests",
  48326. fn: function (){
  48327. var self=this,$self=this;
  48328. var ast,visitor;
  48329. return $core.withContext(function($ctx1) {
  48330. var $3,$2,$1;
  48331. ast=$self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  48332. $3=$self._astPCNodeVisitor();
  48333. $recv($3)._visit_(ast);
  48334. $2=$recv($3)._currentNode();
  48335. $1=$recv($2)._isJSStatementNode();
  48336. $self._assert_($1);
  48337. return self;
  48338. }, function($ctx1) {$ctx1.fill(self,"testLegacyJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48339. },
  48340. args: [],
  48341. source: "testLegacyJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  48342. referencedClasses: ["Object"],
  48343. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48344. }),
  48345. $globals.ASTPCNodeVisitorTest);
  48346. $core.addMethod(
  48347. $core.method({
  48348. selector: "testMessageSend",
  48349. protocol: "tests",
  48350. fn: function (){
  48351. var self=this,$self=this;
  48352. var ast;
  48353. return $core.withContext(function($ctx1) {
  48354. var $3,$2,$1;
  48355. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48356. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48357. $recv($3)._visit_(ast);
  48358. $2=$recv($3)._currentNode();
  48359. $1=$recv($2)._selector();
  48360. $self._assert_equals_($1,"yourself");
  48361. return self;
  48362. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48363. },
  48364. args: [],
  48365. 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'",
  48366. referencedClasses: ["Object"],
  48367. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48368. }),
  48369. $globals.ASTPCNodeVisitorTest);
  48370. $core.addMethod(
  48371. $core.method({
  48372. selector: "testMessageSendWithBlocks",
  48373. protocol: "tests",
  48374. fn: function (){
  48375. var self=this,$self=this;
  48376. var ast;
  48377. return $core.withContext(function($ctx1) {
  48378. var $3,$2,$1;
  48379. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48380. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48381. $recv($3)._visit_(ast);
  48382. $2=$recv($3)._currentNode();
  48383. $1=$recv($2)._selector();
  48384. $self._assert_equals_($1,"yourself");
  48385. return self;
  48386. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48387. },
  48388. args: [],
  48389. 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'",
  48390. referencedClasses: ["Object"],
  48391. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48392. }),
  48393. $globals.ASTPCNodeVisitorTest);
  48394. $core.addMethod(
  48395. $core.method({
  48396. selector: "testMessageSendWithInlining",
  48397. protocol: "tests",
  48398. fn: function (){
  48399. var self=this,$self=this;
  48400. var ast;
  48401. return $core.withContext(function($ctx1) {
  48402. var $3,$4,$2,$1,$7,$6,$5;
  48403. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48404. $ctx1.sendIdx["parse:forClass:"]=1;
  48405. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48406. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48407. $recv($3)._visit_(ast);
  48408. $ctx1.sendIdx["visit:"]=1;
  48409. $4=$recv($3)._currentNode();
  48410. $ctx1.sendIdx["currentNode"]=1;
  48411. $2=$4;
  48412. $1=$recv($2)._selector();
  48413. $ctx1.sendIdx["selector"]=1;
  48414. $self._assert_equals_($1,"yourself");
  48415. $ctx1.sendIdx["assert:equals:"]=1;
  48416. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48417. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48418. $recv($7)._visit_(ast);
  48419. $6=$recv($7)._currentNode();
  48420. $5=$recv($6)._selector();
  48421. $self._assert_equals_($5,"asBoolean");
  48422. return self;
  48423. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48424. },
  48425. args: [],
  48426. 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'",
  48427. referencedClasses: ["Object"],
  48428. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48429. }),
  48430. $globals.ASTPCNodeVisitorTest);
  48431. $core.addMethod(
  48432. $core.method({
  48433. selector: "testNoMessageSend",
  48434. protocol: "tests",
  48435. fn: function (){
  48436. var self=this,$self=this;
  48437. var ast;
  48438. return $core.withContext(function($ctx1) {
  48439. var $3,$2,$1;
  48440. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48441. $3=$self._astPCNodeVisitor();
  48442. $recv($3)._visit_(ast);
  48443. $2=$recv($3)._currentNode();
  48444. $1=$recv($2)._isNil();
  48445. $self._assert_($1);
  48446. return self;
  48447. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48448. },
  48449. args: [],
  48450. 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",
  48451. referencedClasses: ["Object"],
  48452. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48453. }),
  48454. $globals.ASTPCNodeVisitorTest);
  48455. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48456. $core.addMethod(
  48457. $core.method({
  48458. selector: "testNodeAtPosition",
  48459. protocol: "tests",
  48460. fn: function (){
  48461. var self=this,$self=this;
  48462. var node;
  48463. return $core.withContext(function($ctx1) {
  48464. var $3,$4,$2,$1,$7,$8,$6,$5;
  48465. node=$self._parse_("yourself\x0a\x09^ self");
  48466. $ctx1.sendIdx["parse:"]=1;
  48467. $3=node;
  48468. $4=(2).__at((4));
  48469. $ctx1.sendIdx["@"]=1;
  48470. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48471. return nil;
  48472. }));
  48473. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48474. $1=$recv($2)._source();
  48475. $self._assert_equals_($1,"self");
  48476. $ctx1.sendIdx["assert:equals:"]=1;
  48477. node=$self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  48478. $ctx1.sendIdx["parse:"]=2;
  48479. $7=node;
  48480. $8=(2).__at((7));
  48481. $ctx1.sendIdx["@"]=2;
  48482. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48483. return nil;
  48484. }));
  48485. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48486. $5=$recv($6)._selector();
  48487. $ctx1.sendIdx["selector"]=1;
  48488. $self._assert_equals_($5,"ifTrue:");
  48489. $ctx1.sendIdx["assert:equals:"]=2;
  48490. node=$self._parse_("foo\x0a\x09self foo; bar; baz");
  48491. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48492. return nil;
  48493. })))._selector(),"foo");
  48494. return self;
  48495. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48496. },
  48497. args: [],
  48498. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\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 ]'.\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'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48499. referencedClasses: [],
  48500. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48501. }),
  48502. $globals.ASTPositionTest);
  48503. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48504. $core.addMethod(
  48505. $core.method({
  48506. selector: "codeGeneratorClass",
  48507. protocol: "accessing",
  48508. fn: function (){
  48509. var self=this,$self=this;
  48510. return $globals.CodeGenerator;
  48511. },
  48512. args: [],
  48513. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48514. referencedClasses: ["CodeGenerator"],
  48515. messageSends: []
  48516. }),
  48517. $globals.CodeGeneratorTest);
  48518. $core.addMethod(
  48519. $core.method({
  48520. selector: "compiler",
  48521. protocol: "factory",
  48522. fn: function (){
  48523. var self=this,$self=this;
  48524. return $core.withContext(function($ctx1) {
  48525. var $1;
  48526. $1=$recv($globals.Compiler)._new();
  48527. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48528. return $recv($1)._yourself();
  48529. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48530. },
  48531. args: [],
  48532. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48533. referencedClasses: ["Compiler"],
  48534. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48535. }),
  48536. $globals.CodeGeneratorTest);
  48537. $core.addMethod(
  48538. $core.method({
  48539. selector: "setUp",
  48540. protocol: "initialization",
  48541. fn: function (){
  48542. var self=this,$self=this;
  48543. return $core.withContext(function($ctx1) {
  48544. $self["@receiver"]=$recv($globals.DoIt)._new();
  48545. return self;
  48546. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48547. },
  48548. args: [],
  48549. source: "setUp\x0a\x09receiver := DoIt new",
  48550. referencedClasses: ["DoIt"],
  48551. messageSends: ["new"]
  48552. }),
  48553. $globals.CodeGeneratorTest);
  48554. $core.addMethod(
  48555. $core.method({
  48556. selector: "should:receiver:raise:",
  48557. protocol: "testing",
  48558. fn: function (aString,anObject,anErrorClass){
  48559. var self=this,$self=this;
  48560. var method,result;
  48561. return $core.withContext(function($ctx1) {
  48562. var $1,$2,$3,$receiver;
  48563. $self["@receiver"]=anObject;
  48564. $recv((function(){
  48565. return $core.withContext(function($ctx2) {
  48566. return $self._should_raise_((function(){
  48567. return $core.withContext(function($ctx3) {
  48568. $1=$self._compiler();
  48569. $2=$recv(anObject)._class();
  48570. $ctx3.sendIdx["class"]=1;
  48571. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48572. method;
  48573. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48574. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48575. }),anErrorClass);
  48576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48577. }))._ensure_((function(){
  48578. return $core.withContext(function($ctx2) {
  48579. $3=method;
  48580. if(($receiver = $3) == null || $receiver.a$nil){
  48581. return $3;
  48582. } else {
  48583. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48584. }
  48585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48586. }));
  48587. return self;
  48588. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48589. },
  48590. args: ["aString", "anObject", "anErrorClass"],
  48591. 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 ] ]",
  48592. referencedClasses: [],
  48593. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  48594. }),
  48595. $globals.CodeGeneratorTest);
  48596. $core.addMethod(
  48597. $core.method({
  48598. selector: "should:receiver:return:",
  48599. protocol: "testing",
  48600. fn: function (aString,anObject,aResult){
  48601. var self=this,$self=this;
  48602. var method,result;
  48603. return $core.withContext(function($ctx1) {
  48604. var $1,$2;
  48605. $self["@receiver"]=anObject;
  48606. $1=$self._compiler();
  48607. $2=$recv(anObject)._class();
  48608. $ctx1.sendIdx["class"]=1;
  48609. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48610. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  48611. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48612. $self._assert_equals_(aResult,result);
  48613. return self;
  48614. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  48615. },
  48616. args: ["aString", "anObject", "aResult"],
  48617. 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",
  48618. referencedClasses: [],
  48619. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  48620. }),
  48621. $globals.CodeGeneratorTest);
  48622. $core.addMethod(
  48623. $core.method({
  48624. selector: "should:return:",
  48625. protocol: "testing",
  48626. fn: function (aString,anObject){
  48627. var self=this,$self=this;
  48628. return $core.withContext(function($ctx1) {
  48629. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  48630. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  48631. },
  48632. args: ["aString", "anObject"],
  48633. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  48634. referencedClasses: [],
  48635. messageSends: ["should:receiver:return:"]
  48636. }),
  48637. $globals.CodeGeneratorTest);
  48638. $core.addMethod(
  48639. $core.method({
  48640. selector: "tearDown",
  48641. protocol: "initialization",
  48642. fn: function (){
  48643. var self=this,$self=this;
  48644. return self;
  48645. },
  48646. args: [],
  48647. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  48648. referencedClasses: [],
  48649. messageSends: []
  48650. }),
  48651. $globals.CodeGeneratorTest);
  48652. $core.addMethod(
  48653. $core.method({
  48654. selector: "testAssignment",
  48655. protocol: "tests",
  48656. fn: function (){
  48657. var self=this,$self=this;
  48658. return $core.withContext(function($ctx1) {
  48659. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  48660. $ctx1.sendIdx["should:return:"]=1;
  48661. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  48662. $ctx1.sendIdx["should:return:"]=2;
  48663. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  48664. return self;
  48665. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  48666. },
  48667. args: [],
  48668. 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",
  48669. referencedClasses: [],
  48670. messageSends: ["should:return:"]
  48671. }),
  48672. $globals.CodeGeneratorTest);
  48673. $core.addMethod(
  48674. $core.method({
  48675. selector: "testBackslashSelectors",
  48676. protocol: "tests",
  48677. fn: function (){
  48678. var self=this,$self=this;
  48679. return $core.withContext(function($ctx1) {
  48680. $self._should_return_("\x5c arg ^ 4",(4));
  48681. $ctx1.sendIdx["should:return:"]=1;
  48682. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  48683. return self;
  48684. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  48685. },
  48686. args: [],
  48687. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  48688. referencedClasses: [],
  48689. messageSends: ["should:return:"]
  48690. }),
  48691. $globals.CodeGeneratorTest);
  48692. $core.addMethod(
  48693. $core.method({
  48694. selector: "testBlockReturn",
  48695. protocol: "tests",
  48696. fn: function (){
  48697. var self=this,$self=this;
  48698. return $core.withContext(function($ctx1) {
  48699. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  48700. $ctx1.sendIdx["should:return:"]=1;
  48701. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  48702. $ctx1.sendIdx["should:return:"]=2;
  48703. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  48704. return self;
  48705. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  48706. },
  48707. args: [],
  48708. 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).",
  48709. referencedClasses: [],
  48710. messageSends: ["should:return:"]
  48711. }),
  48712. $globals.CodeGeneratorTest);
  48713. $core.addMethod(
  48714. $core.method({
  48715. selector: "testCascades",
  48716. protocol: "tests",
  48717. fn: function (){
  48718. var self=this,$self=this;
  48719. return $core.withContext(function($ctx1) {
  48720. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  48721. return self;
  48722. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  48723. },
  48724. args: [],
  48725. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  48726. referencedClasses: [],
  48727. messageSends: ["should:return:"]
  48728. }),
  48729. $globals.CodeGeneratorTest);
  48730. $core.addMethod(
  48731. $core.method({
  48732. selector: "testCascadesInDynamicArray",
  48733. protocol: "tests",
  48734. fn: function (){
  48735. var self=this,$self=this;
  48736. return $core.withContext(function($ctx1) {
  48737. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  48738. return self;
  48739. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  48740. },
  48741. args: [],
  48742. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  48743. referencedClasses: [],
  48744. messageSends: ["should:return:"]
  48745. }),
  48746. $globals.CodeGeneratorTest);
  48747. $core.addMethod(
  48748. $core.method({
  48749. selector: "testCascadesInDynamicDictioary",
  48750. protocol: "tests",
  48751. fn: function (){
  48752. var self=this,$self=this;
  48753. return $core.withContext(function($ctx1) {
  48754. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  48755. return self;
  48756. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  48757. },
  48758. args: [],
  48759. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  48760. referencedClasses: [],
  48761. messageSends: ["should:return:"]
  48762. }),
  48763. $globals.CodeGeneratorTest);
  48764. $core.addMethod(
  48765. $core.method({
  48766. selector: "testCascadesInSend",
  48767. protocol: "tests",
  48768. fn: function (){
  48769. var self=this,$self=this;
  48770. return $core.withContext(function($ctx1) {
  48771. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  48772. return self;
  48773. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  48774. },
  48775. args: [],
  48776. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  48777. referencedClasses: [],
  48778. messageSends: ["should:return:"]
  48779. }),
  48780. $globals.CodeGeneratorTest);
  48781. $core.addMethod(
  48782. $core.method({
  48783. selector: "testCascadesWithInlining",
  48784. protocol: "tests",
  48785. fn: function (){
  48786. var self=this,$self=this;
  48787. return $core.withContext(function($ctx1) {
  48788. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  48789. $ctx1.sendIdx["should:return:"]=1;
  48790. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  48791. return self;
  48792. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  48793. },
  48794. args: [],
  48795. 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",
  48796. referencedClasses: [],
  48797. messageSends: ["should:return:"]
  48798. }),
  48799. $globals.CodeGeneratorTest);
  48800. $core.addMethod(
  48801. $core.method({
  48802. selector: "testDynamicArrayElementsOrdered",
  48803. protocol: "tests",
  48804. fn: function (){
  48805. var self=this,$self=this;
  48806. return $core.withContext(function($ctx1) {
  48807. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  48808. $ctx1.sendIdx["should:return:"]=1;
  48809. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  48810. return self;
  48811. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  48812. },
  48813. args: [],
  48814. 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).",
  48815. referencedClasses: [],
  48816. messageSends: ["should:return:"]
  48817. }),
  48818. $globals.CodeGeneratorTest);
  48819. $core.addMethod(
  48820. $core.method({
  48821. selector: "testDynamicDictionaryElementsOrdered",
  48822. protocol: "tests",
  48823. fn: function (){
  48824. var self=this,$self=this;
  48825. return $core.withContext(function($ctx1) {
  48826. $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)]));
  48827. return self;
  48828. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  48829. },
  48830. args: [],
  48831. 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}.",
  48832. referencedClasses: [],
  48833. messageSends: ["should:return:"]
  48834. }),
  48835. $globals.CodeGeneratorTest);
  48836. $core.addMethod(
  48837. $core.method({
  48838. selector: "testDynamicDictionaryWithMoreArrows",
  48839. protocol: "tests",
  48840. fn: function (){
  48841. var self=this,$self=this;
  48842. return $core.withContext(function($ctx1) {
  48843. var $2,$1;
  48844. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  48845. $ctx1.sendIdx["->"]=1;
  48846. $1=$recv($globals.HashedCollection)._with_($2);
  48847. $self._should_return_("foo ^ #{1->2->3}",$1);
  48848. return self;
  48849. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  48850. },
  48851. args: [],
  48852. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  48853. referencedClasses: ["HashedCollection"],
  48854. messageSends: ["should:return:", "with:", "->"]
  48855. }),
  48856. $globals.CodeGeneratorTest);
  48857. $core.addMethod(
  48858. $core.method({
  48859. selector: "testGlobalVar",
  48860. protocol: "tests",
  48861. fn: function (){
  48862. var self=this,$self=this;
  48863. return $core.withContext(function($ctx1) {
  48864. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  48865. $ctx1.sendIdx["should:return:"]=1;
  48866. $self._should_return_("foo ^ Math cos: 0",(1));
  48867. $ctx1.sendIdx["should:return:"]=2;
  48868. $self._should_return_("foo ^ NonExistingVar",nil);
  48869. return self;
  48870. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  48871. },
  48872. args: [],
  48873. 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",
  48874. referencedClasses: ["BlockClosure"],
  48875. messageSends: ["should:return:"]
  48876. }),
  48877. $globals.CodeGeneratorTest);
  48878. $core.addMethod(
  48879. $core.method({
  48880. selector: "testInnerTemporalDependentElementsOrdered",
  48881. protocol: "tests",
  48882. fn: function (){
  48883. var self=this,$self=this;
  48884. return $core.withContext(function($ctx1) {
  48885. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  48886. $2="foo".__minus_gt($globals.Array);
  48887. $ctx1.sendIdx["->"]=1;
  48888. $3="bar".__minus_gt((2));
  48889. $ctx1.sendIdx["->"]=2;
  48890. $1=[$2,$3];
  48891. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  48892. $ctx1.sendIdx["should:return:"]=1;
  48893. $5="foo".__minus_gt($globals.Array);
  48894. $ctx1.sendIdx["->"]=3;
  48895. $6="bar".__minus_gt((2));
  48896. $ctx1.sendIdx["->"]=4;
  48897. $4=[$5,$6];
  48898. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  48899. $ctx1.sendIdx["should:return:"]=2;
  48900. $8="foo".__minus_gt((1));
  48901. $ctx1.sendIdx["->"]=5;
  48902. $9="bar".__minus_gt((2));
  48903. $ctx1.sendIdx["->"]=6;
  48904. $7=[$8,$9];
  48905. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  48906. $ctx1.sendIdx["should:return:"]=3;
  48907. $11="foo".__minus_gt((1));
  48908. $ctx1.sendIdx["->"]=7;
  48909. $10=[$11,"bar".__minus_gt((2))];
  48910. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  48911. $ctx1.sendIdx["should:return:"]=4;
  48912. $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)]));
  48913. return self;
  48914. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  48915. },
  48916. args: [],
  48917. 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}.",
  48918. referencedClasses: ["Array"],
  48919. messageSends: ["should:return:", "->"]
  48920. }),
  48921. $globals.CodeGeneratorTest);
  48922. $core.addMethod(
  48923. $core.method({
  48924. selector: "testJSStatement",
  48925. protocol: "tests",
  48926. fn: function (){
  48927. var self=this,$self=this;
  48928. return $core.withContext(function($ctx1) {
  48929. $self._should_return_("foo <return 2+3>",(5));
  48930. return self;
  48931. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  48932. },
  48933. args: [],
  48934. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  48935. referencedClasses: [],
  48936. messageSends: ["should:return:"]
  48937. }),
  48938. $globals.CodeGeneratorTest);
  48939. $core.addMethod(
  48940. $core.method({
  48941. selector: "testLexicalScope",
  48942. protocol: "tests",
  48943. fn: function (){
  48944. var self=this,$self=this;
  48945. return $core.withContext(function($ctx1) {
  48946. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  48947. return self;
  48948. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  48949. },
  48950. args: [],
  48951. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  48952. referencedClasses: [],
  48953. messageSends: ["should:return:"]
  48954. }),
  48955. $globals.CodeGeneratorTest);
  48956. $core.addMethod(
  48957. $core.method({
  48958. selector: "testLiterals",
  48959. protocol: "tests",
  48960. fn: function (){
  48961. var self=this,$self=this;
  48962. return $core.withContext(function($ctx1) {
  48963. $self._should_return_("foo ^ 1",(1));
  48964. $ctx1.sendIdx["should:return:"]=1;
  48965. $self._should_return_("foo ^ 'hello'","hello");
  48966. $ctx1.sendIdx["should:return:"]=2;
  48967. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  48968. $ctx1.sendIdx["should:return:"]=3;
  48969. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  48970. $ctx1.sendIdx["should:return:"]=4;
  48971. $self._should_return_("foo ^ true",true);
  48972. $ctx1.sendIdx["should:return:"]=5;
  48973. $self._should_return_("foo ^ false",false);
  48974. $ctx1.sendIdx["should:return:"]=6;
  48975. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  48976. $ctx1.sendIdx["should:return:"]=7;
  48977. $self._should_return_("foo ^ #hello","hello");
  48978. $ctx1.sendIdx["should:return:"]=8;
  48979. $self._should_return_("foo ^ $h","h");
  48980. $ctx1.sendIdx["should:return:"]=9;
  48981. $self._should_return_("foo ^ -123.456",(-123.456));
  48982. $ctx1.sendIdx["should:return:"]=10;
  48983. $self._should_return_("foo ^ -2.5e4",(-25000));
  48984. return self;
  48985. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  48986. },
  48987. args: [],
  48988. 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.",
  48989. referencedClasses: [],
  48990. messageSends: ["should:return:"]
  48991. }),
  48992. $globals.CodeGeneratorTest);
  48993. $core.addMethod(
  48994. $core.method({
  48995. selector: "testLocalReturn",
  48996. protocol: "tests",
  48997. fn: function (){
  48998. var self=this,$self=this;
  48999. return $core.withContext(function($ctx1) {
  49000. $self._should_return_("foo ^ 1",(1));
  49001. $ctx1.sendIdx["should:return:"]=1;
  49002. $self._should_return_("foo ^ 1 + 1",(2));
  49003. $ctx1.sendIdx["should:return:"]=2;
  49004. $self._should_return_("foo ",$self["@receiver"]);
  49005. $ctx1.sendIdx["should:return:"]=3;
  49006. $self._should_return_("foo self asString",$self["@receiver"]);
  49007. $ctx1.sendIdx["should:return:"]=4;
  49008. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49009. return self;
  49010. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49011. },
  49012. args: [],
  49013. 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",
  49014. referencedClasses: [],
  49015. messageSends: ["should:return:"]
  49016. }),
  49017. $globals.CodeGeneratorTest);
  49018. $core.addMethod(
  49019. $core.method({
  49020. selector: "testMessageSends",
  49021. protocol: "tests",
  49022. fn: function (){
  49023. var self=this,$self=this;
  49024. return $core.withContext(function($ctx1) {
  49025. $self._should_return_("foo ^ 1 asString","1");
  49026. $ctx1.sendIdx["should:return:"]=1;
  49027. $self._should_return_("foo ^ 1 + 1",(2));
  49028. $ctx1.sendIdx["should:return:"]=2;
  49029. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49030. $ctx1.sendIdx["should:return:"]=3;
  49031. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49032. $ctx1.sendIdx["should:return:"]=4;
  49033. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49034. return self;
  49035. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49036. },
  49037. args: [],
  49038. 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)",
  49039. referencedClasses: [],
  49040. messageSends: ["should:return:"]
  49041. }),
  49042. $globals.CodeGeneratorTest);
  49043. $core.addMethod(
  49044. $core.method({
  49045. selector: "testMistypedPragmaJSStatement",
  49046. protocol: "tests",
  49047. fn: function (){
  49048. var self=this,$self=this;
  49049. return $core.withContext(function($ctx1) {
  49050. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49051. return self;
  49052. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49053. },
  49054. args: [],
  49055. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49056. referencedClasses: ["ParseError"],
  49057. messageSends: ["should:receiver:raise:"]
  49058. }),
  49059. $globals.CodeGeneratorTest);
  49060. $core.addMethod(
  49061. $core.method({
  49062. selector: "testMultipleSequences",
  49063. protocol: "tests",
  49064. fn: function (){
  49065. var self=this,$self=this;
  49066. return $core.withContext(function($ctx1) {
  49067. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49068. return self;
  49069. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49070. },
  49071. args: [],
  49072. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49073. referencedClasses: [],
  49074. messageSends: ["should:return:"]
  49075. }),
  49076. $globals.CodeGeneratorTest);
  49077. $core.addMethod(
  49078. $core.method({
  49079. selector: "testMutableLiterals",
  49080. protocol: "tests",
  49081. fn: function (){
  49082. var self=this,$self=this;
  49083. return $core.withContext(function($ctx1) {
  49084. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49085. return self;
  49086. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49087. },
  49088. args: [],
  49089. 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)",
  49090. referencedClasses: [],
  49091. messageSends: ["should:return:"]
  49092. }),
  49093. $globals.CodeGeneratorTest);
  49094. $core.addMethod(
  49095. $core.method({
  49096. selector: "testNestedIfTrue",
  49097. protocol: "tests",
  49098. fn: function (){
  49099. var self=this,$self=this;
  49100. return $core.withContext(function($ctx1) {
  49101. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49102. $ctx1.sendIdx["should:return:"]=1;
  49103. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49104. $ctx1.sendIdx["should:return:"]=2;
  49105. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49106. $ctx1.sendIdx["should:return:"]=3;
  49107. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49108. return self;
  49109. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49110. },
  49111. args: [],
  49112. 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.",
  49113. referencedClasses: [],
  49114. messageSends: ["should:return:"]
  49115. }),
  49116. $globals.CodeGeneratorTest);
  49117. $core.addMethod(
  49118. $core.method({
  49119. selector: "testNestedSends",
  49120. protocol: "tests",
  49121. fn: function (){
  49122. var self=this,$self=this;
  49123. return $core.withContext(function($ctx1) {
  49124. $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());
  49125. return self;
  49126. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49127. },
  49128. args: [],
  49129. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49130. referencedClasses: ["Point"],
  49131. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49132. }),
  49133. $globals.CodeGeneratorTest);
  49134. $core.addMethod(
  49135. $core.method({
  49136. selector: "testNonLocalReturn",
  49137. protocol: "tests",
  49138. fn: function (){
  49139. var self=this,$self=this;
  49140. return $core.withContext(function($ctx1) {
  49141. $self._should_return_("foo [ ^ 1 ] value",(1));
  49142. $ctx1.sendIdx["should:return:"]=1;
  49143. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49144. $ctx1.sendIdx["should:return:"]=2;
  49145. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49146. $ctx1.sendIdx["should:return:"]=3;
  49147. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49148. return self;
  49149. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49150. },
  49151. args: [],
  49152. 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",
  49153. referencedClasses: [],
  49154. messageSends: ["should:return:"]
  49155. }),
  49156. $globals.CodeGeneratorTest);
  49157. $core.addMethod(
  49158. $core.method({
  49159. selector: "testPascalCaseGlobal",
  49160. protocol: "tests",
  49161. fn: function (){
  49162. var self=this,$self=this;
  49163. return $core.withContext(function($ctx1) {
  49164. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49165. $ctx1.sendIdx["should:return:"]=1;
  49166. $self._should_return_("foo ^NonExistent",nil);
  49167. return self;
  49168. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49169. },
  49170. args: [],
  49171. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49172. referencedClasses: ["Smalltalk"],
  49173. messageSends: ["should:return:", "at:", "globals"]
  49174. }),
  49175. $globals.CodeGeneratorTest);
  49176. $core.addMethod(
  49177. $core.method({
  49178. selector: "testPragmaJSStatement",
  49179. protocol: "tests",
  49180. fn: function (){
  49181. var self=this,$self=this;
  49182. return $core.withContext(function($ctx1) {
  49183. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49184. return self;
  49185. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49186. },
  49187. args: [],
  49188. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49189. referencedClasses: [],
  49190. messageSends: ["should:return:"]
  49191. }),
  49192. $globals.CodeGeneratorTest);
  49193. $core.addMethod(
  49194. $core.method({
  49195. selector: "testRootSuperSend",
  49196. protocol: "tests",
  49197. fn: function (){
  49198. var self=this,$self=this;
  49199. return $core.withContext(function($ctx1) {
  49200. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49201. return self;
  49202. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49203. },
  49204. args: [],
  49205. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49206. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49207. messageSends: ["should:receiver:raise:", "new"]
  49208. }),
  49209. $globals.CodeGeneratorTest);
  49210. $core.addMethod(
  49211. $core.method({
  49212. selector: "testSendReceiverAndArgumentsOrdered",
  49213. protocol: "tests",
  49214. fn: function (){
  49215. var self=this,$self=this;
  49216. return $core.withContext(function($ctx1) {
  49217. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49218. $ctx1.sendIdx["should:return:"]=1;
  49219. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49220. return self;
  49221. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49222. },
  49223. args: [],
  49224. 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}.",
  49225. referencedClasses: ["Array"],
  49226. messageSends: ["should:return:"]
  49227. }),
  49228. $globals.CodeGeneratorTest);
  49229. $core.addMethod(
  49230. $core.method({
  49231. selector: "testSuperSend",
  49232. protocol: "tests",
  49233. fn: function (){
  49234. var self=this,$self=this;
  49235. return $core.withContext(function($ctx1) {
  49236. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49237. return self;
  49238. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49239. },
  49240. args: [],
  49241. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49242. referencedClasses: [],
  49243. messageSends: ["should:receiver:return:"]
  49244. }),
  49245. $globals.CodeGeneratorTest);
  49246. $core.addMethod(
  49247. $core.method({
  49248. selector: "testTempVariables",
  49249. protocol: "tests",
  49250. fn: function (){
  49251. var self=this,$self=this;
  49252. return $core.withContext(function($ctx1) {
  49253. $self._should_return_("foo | a | ^ a",nil);
  49254. $ctx1.sendIdx["should:return:"]=1;
  49255. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49256. $ctx1.sendIdx["should:return:"]=2;
  49257. $self._should_return_("foo | a b c | ^ c",nil);
  49258. $ctx1.sendIdx["should:return:"]=3;
  49259. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49260. $ctx1.sendIdx["should:return:"]=4;
  49261. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49262. $ctx1.sendIdx["should:return:"]=5;
  49263. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49264. return self;
  49265. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49266. },
  49267. args: [],
  49268. 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.",
  49269. referencedClasses: [],
  49270. messageSends: ["should:return:"]
  49271. }),
  49272. $globals.CodeGeneratorTest);
  49273. $core.addMethod(
  49274. $core.method({
  49275. selector: "testThisContext",
  49276. protocol: "tests",
  49277. fn: function (){
  49278. var self=this,$self=this;
  49279. return $core.withContext(function($ctx1) {
  49280. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49281. return self;
  49282. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49283. },
  49284. args: [],
  49285. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49286. referencedClasses: [],
  49287. messageSends: ["should:return:"]
  49288. }),
  49289. $globals.CodeGeneratorTest);
  49290. $core.addMethod(
  49291. $core.method({
  49292. selector: "testifFalse",
  49293. protocol: "tests",
  49294. fn: function (){
  49295. var self=this,$self=this;
  49296. return $core.withContext(function($ctx1) {
  49297. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49298. $ctx1.sendIdx["should:return:"]=1;
  49299. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49300. $ctx1.sendIdx["should:return:"]=2;
  49301. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49302. $ctx1.sendIdx["should:return:"]=3;
  49303. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49304. return self;
  49305. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49306. },
  49307. args: [],
  49308. 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.",
  49309. referencedClasses: [],
  49310. messageSends: ["should:return:"]
  49311. }),
  49312. $globals.CodeGeneratorTest);
  49313. $core.addMethod(
  49314. $core.method({
  49315. selector: "testifFalseIfTrue",
  49316. protocol: "tests",
  49317. fn: function (){
  49318. var self=this,$self=this;
  49319. return $core.withContext(function($ctx1) {
  49320. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49321. $ctx1.sendIdx["should:return:"]=1;
  49322. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49323. $ctx1.sendIdx["should:return:"]=2;
  49324. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49325. $ctx1.sendIdx["should:return:"]=3;
  49326. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49327. return self;
  49328. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49329. },
  49330. args: [],
  49331. 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.",
  49332. referencedClasses: [],
  49333. messageSends: ["should:return:"]
  49334. }),
  49335. $globals.CodeGeneratorTest);
  49336. $core.addMethod(
  49337. $core.method({
  49338. selector: "testifNil",
  49339. protocol: "tests",
  49340. fn: function (){
  49341. var self=this,$self=this;
  49342. return $core.withContext(function($ctx1) {
  49343. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49344. $ctx1.sendIdx["should:return:"]=1;
  49345. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49346. $ctx1.sendIdx["should:return:"]=2;
  49347. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49348. $ctx1.sendIdx["should:return:"]=3;
  49349. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49350. return self;
  49351. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49352. },
  49353. args: [],
  49354. 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.",
  49355. referencedClasses: [],
  49356. messageSends: ["should:return:"]
  49357. }),
  49358. $globals.CodeGeneratorTest);
  49359. $core.addMethod(
  49360. $core.method({
  49361. selector: "testifNilIfNotNil",
  49362. protocol: "tests",
  49363. fn: function (){
  49364. var self=this,$self=this;
  49365. return $core.withContext(function($ctx1) {
  49366. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49367. $ctx1.sendIdx["should:return:"]=1;
  49368. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49369. $ctx1.sendIdx["should:return:"]=2;
  49370. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49371. $ctx1.sendIdx["should:return:"]=3;
  49372. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49373. return self;
  49374. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49375. },
  49376. args: [],
  49377. 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.",
  49378. referencedClasses: [],
  49379. messageSends: ["should:return:"]
  49380. }),
  49381. $globals.CodeGeneratorTest);
  49382. $core.addMethod(
  49383. $core.method({
  49384. selector: "testifNotNil",
  49385. protocol: "tests",
  49386. fn: function (){
  49387. var self=this,$self=this;
  49388. return $core.withContext(function($ctx1) {
  49389. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49390. $ctx1.sendIdx["should:return:"]=1;
  49391. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49392. $ctx1.sendIdx["should:return:"]=2;
  49393. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49394. $ctx1.sendIdx["should:return:"]=3;
  49395. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49396. return self;
  49397. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49398. },
  49399. args: [],
  49400. 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.",
  49401. referencedClasses: [],
  49402. messageSends: ["should:return:"]
  49403. }),
  49404. $globals.CodeGeneratorTest);
  49405. $core.addMethod(
  49406. $core.method({
  49407. selector: "testifNotNilWithArgument",
  49408. protocol: "tests",
  49409. fn: function (){
  49410. var self=this,$self=this;
  49411. return $core.withContext(function($ctx1) {
  49412. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49413. $ctx1.sendIdx["should:return:"]=1;
  49414. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49415. $ctx1.sendIdx["should:return:"]=2;
  49416. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49417. $ctx1.sendIdx["should:return:"]=3;
  49418. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49419. $ctx1.sendIdx["should:return:"]=4;
  49420. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49421. $ctx1.sendIdx["should:return:"]=5;
  49422. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49423. return self;
  49424. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49425. },
  49426. args: [],
  49427. 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",
  49428. referencedClasses: [],
  49429. messageSends: ["should:return:"]
  49430. }),
  49431. $globals.CodeGeneratorTest);
  49432. $core.addMethod(
  49433. $core.method({
  49434. selector: "testifTrue",
  49435. protocol: "tests",
  49436. fn: function (){
  49437. var self=this,$self=this;
  49438. return $core.withContext(function($ctx1) {
  49439. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49440. $ctx1.sendIdx["should:return:"]=1;
  49441. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49442. $ctx1.sendIdx["should:return:"]=2;
  49443. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49444. $ctx1.sendIdx["should:return:"]=3;
  49445. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49446. return self;
  49447. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49448. },
  49449. args: [],
  49450. 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.",
  49451. referencedClasses: [],
  49452. messageSends: ["should:return:"]
  49453. }),
  49454. $globals.CodeGeneratorTest);
  49455. $core.addMethod(
  49456. $core.method({
  49457. selector: "testifTrueIfFalse",
  49458. protocol: "tests",
  49459. fn: function (){
  49460. var self=this,$self=this;
  49461. return $core.withContext(function($ctx1) {
  49462. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49463. $ctx1.sendIdx["should:return:"]=1;
  49464. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49465. $ctx1.sendIdx["should:return:"]=2;
  49466. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49467. $ctx1.sendIdx["should:return:"]=3;
  49468. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49469. return self;
  49470. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49471. },
  49472. args: [],
  49473. 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.",
  49474. referencedClasses: [],
  49475. messageSends: ["should:return:"]
  49476. }),
  49477. $globals.CodeGeneratorTest);
  49478. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49479. $core.addMethod(
  49480. $core.method({
  49481. selector: "analyze:forClass:",
  49482. protocol: "parsing",
  49483. fn: function (aNode,aClass){
  49484. var self=this,$self=this;
  49485. return $core.withContext(function($ctx1) {
  49486. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  49487. return aNode;
  49488. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  49489. },
  49490. args: ["aNode", "aClass"],
  49491. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  49492. referencedClasses: ["SemanticAnalyzer"],
  49493. messageSends: ["visit:", "on:"]
  49494. }),
  49495. $globals.ASTInterpreterTest);
  49496. $core.addMethod(
  49497. $core.method({
  49498. selector: "interpret:receiver:withArguments:",
  49499. protocol: "private",
  49500. fn: function (aString,anObject,aDictionary){
  49501. var self=this,$self=this;
  49502. var ctx,ast,interpreter;
  49503. return $core.withContext(function($ctx1) {
  49504. var $1,$2,$3,$receiver;
  49505. interpreter=$recv($globals.ASTInterpreter)._new();
  49506. $ctx1.sendIdx["new"]=1;
  49507. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49508. $1=$recv($globals.AIContext)._new();
  49509. $recv($1)._receiver_(anObject);
  49510. $recv($1)._interpreter_(interpreter);
  49511. ctx=$recv($1)._yourself();
  49512. $2=$recv(ast)._sequenceNode();
  49513. if(($receiver = $2) == null || $receiver.a$nil){
  49514. $2;
  49515. } else {
  49516. var sequence;
  49517. sequence=$receiver;
  49518. $recv($recv(sequence)._temps())._do_((function(each){
  49519. return $core.withContext(function($ctx2) {
  49520. return $recv(ctx)._defineLocal_(each);
  49521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49522. }));
  49523. }
  49524. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49525. return $core.withContext(function($ctx2) {
  49526. return $recv(ctx)._localAt_put_(key,value);
  49527. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49528. }));
  49529. $3=interpreter;
  49530. $recv($3)._context_(ctx);
  49531. $recv($3)._node_(ast);
  49532. $recv($3)._enterNode();
  49533. $recv($3)._proceed();
  49534. return $recv($3)._result();
  49535. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49536. },
  49537. args: ["aString", "anObject", "aDictionary"],
  49538. 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",
  49539. referencedClasses: ["ASTInterpreter", "AIContext"],
  49540. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49541. }),
  49542. $globals.ASTInterpreterTest);
  49543. $core.addMethod(
  49544. $core.method({
  49545. selector: "parse:",
  49546. protocol: "parsing",
  49547. fn: function (aString){
  49548. var self=this,$self=this;
  49549. return $core.withContext(function($ctx1) {
  49550. return $recv($globals.Smalltalk)._parse_(aString);
  49551. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  49552. },
  49553. args: ["aString"],
  49554. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  49555. referencedClasses: ["Smalltalk"],
  49556. messageSends: ["parse:"]
  49557. }),
  49558. $globals.ASTInterpreterTest);
  49559. $core.addMethod(
  49560. $core.method({
  49561. selector: "parse:forClass:",
  49562. protocol: "parsing",
  49563. fn: function (aString,aClass){
  49564. var self=this,$self=this;
  49565. return $core.withContext(function($ctx1) {
  49566. return $self._analyze_forClass_($self._parse_(aString),aClass);
  49567. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  49568. },
  49569. args: ["aString", "aClass"],
  49570. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  49571. referencedClasses: [],
  49572. messageSends: ["analyze:forClass:", "parse:"]
  49573. }),
  49574. $globals.ASTInterpreterTest);
  49575. $core.addMethod(
  49576. $core.method({
  49577. selector: "should:receiver:return:",
  49578. protocol: "testing",
  49579. fn: function (aString,anObject,aResult){
  49580. var self=this,$self=this;
  49581. return $core.withContext(function($ctx1) {
  49582. $self["@receiver"]=anObject;
  49583. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49584. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49585. },
  49586. args: ["aString", "anObject", "aResult"],
  49587. 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",
  49588. referencedClasses: [],
  49589. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49590. }),
  49591. $globals.ASTInterpreterTest);
  49592. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49593. $core.addMethod(
  49594. $core.method({
  49595. selector: "interpret:receiver:withArguments:",
  49596. protocol: "private",
  49597. fn: function (aString,anObject,aDictionary){
  49598. var self=this,$self=this;
  49599. var ctx,ast,debugger_;
  49600. return $core.withContext(function($ctx1) {
  49601. var $1,$2,$3,$4,$5,$receiver;
  49602. $1=$recv($globals.AIContext)._new();
  49603. $ctx1.sendIdx["new"]=1;
  49604. $recv($1)._receiver_(anObject);
  49605. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49606. ctx=$recv($1)._yourself();
  49607. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49608. $2=$recv(ast)._sequenceNode();
  49609. if(($receiver = $2) == null || $receiver.a$nil){
  49610. $2;
  49611. } else {
  49612. var sequence;
  49613. sequence=$receiver;
  49614. $recv($recv(sequence)._temps())._do_((function(each){
  49615. return $core.withContext(function($ctx2) {
  49616. return $recv(ctx)._defineLocal_(each);
  49617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49618. }));
  49619. }
  49620. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49621. return $core.withContext(function($ctx2) {
  49622. return $recv(ctx)._localAt_put_(key,value);
  49623. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49624. }));
  49625. $3=$recv(ctx)._interpreter();
  49626. $ctx1.sendIdx["interpreter"]=1;
  49627. $recv($3)._context_(ctx);
  49628. $ctx1.sendIdx["context:"]=1;
  49629. $4=$recv(ctx)._interpreter();
  49630. $recv($4)._node_(ast);
  49631. $recv($4)._enterNode();
  49632. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  49633. $5=debugger_;
  49634. $recv($5)._proceed();
  49635. return $recv($5)._result();
  49636. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  49637. },
  49638. args: ["aString", "anObject", "aDictionary"],
  49639. 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",
  49640. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  49641. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  49642. }),
  49643. $globals.ASTDebuggerTest);
  49644. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49645. $core.addMethod(
  49646. $core.method({
  49647. selector: "codeGeneratorClass",
  49648. protocol: "accessing",
  49649. fn: function (){
  49650. var self=this,$self=this;
  49651. return $globals.InliningCodeGenerator;
  49652. },
  49653. args: [],
  49654. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  49655. referencedClasses: ["InliningCodeGenerator"],
  49656. messageSends: []
  49657. }),
  49658. $globals.InliningCodeGeneratorTest);
  49659. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  49660. $core.addMethod(
  49661. $core.method({
  49662. selector: "testClassRefVar",
  49663. protocol: "tests",
  49664. fn: function (){
  49665. var self=this,$self=this;
  49666. var node;
  49667. return $core.withContext(function($ctx1) {
  49668. var $1,$2;
  49669. $1=$recv($globals.VariableNode)._new();
  49670. $ctx1.sendIdx["new"]=1;
  49671. $recv($1)._value_("Object");
  49672. node=$recv($1)._yourself();
  49673. $2=$recv($globals.SemanticAnalyzer)._new();
  49674. $ctx1.sendIdx["new"]=2;
  49675. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  49676. $recv($2)._visit_(node);
  49677. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  49678. return self;
  49679. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  49680. },
  49681. args: [],
  49682. 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",
  49683. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  49684. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  49685. }),
  49686. $globals.ScopeVarTest);
  49687. $core.addMethod(
  49688. $core.method({
  49689. selector: "testInstanceVar",
  49690. protocol: "tests",
  49691. fn: function (){
  49692. var self=this,$self=this;
  49693. var node,scope;
  49694. return $core.withContext(function($ctx1) {
  49695. var $1;
  49696. $1=$recv($globals.VariableNode)._new();
  49697. $ctx1.sendIdx["new"]=1;
  49698. $recv($1)._value_("bzzz");
  49699. node=$recv($1)._yourself();
  49700. scope=$recv($globals.MethodLexicalScope)._new();
  49701. $recv(scope)._addIVar_("bzzz");
  49702. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  49703. return self;
  49704. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49705. },
  49706. args: [],
  49707. 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",
  49708. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49709. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  49710. }),
  49711. $globals.ScopeVarTest);
  49712. $core.addMethod(
  49713. $core.method({
  49714. selector: "testPseudoVar",
  49715. protocol: "tests",
  49716. fn: function (){
  49717. var self=this,$self=this;
  49718. var node,pseudoVars;
  49719. return $core.withContext(function($ctx1) {
  49720. var $1;
  49721. pseudoVars=["self", "super", "true", "false", "nil"];
  49722. $recv(pseudoVars)._do_((function(each){
  49723. return $core.withContext(function($ctx2) {
  49724. $1=$recv($globals.VariableNode)._new();
  49725. $ctx2.sendIdx["new"]=1;
  49726. $recv($1)._value_(each);
  49727. node=$recv($1)._yourself();
  49728. node;
  49729. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  49730. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49731. }));
  49732. return self;
  49733. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  49734. },
  49735. args: [],
  49736. 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]",
  49737. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49738. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  49739. }),
  49740. $globals.ScopeVarTest);
  49741. $core.addMethod(
  49742. $core.method({
  49743. selector: "testTempVar",
  49744. protocol: "tests",
  49745. fn: function (){
  49746. var self=this,$self=this;
  49747. var node,scope;
  49748. return $core.withContext(function($ctx1) {
  49749. var $1;
  49750. $1=$recv($globals.VariableNode)._new();
  49751. $ctx1.sendIdx["new"]=1;
  49752. $recv($1)._value_("bzzz");
  49753. node=$recv($1)._yourself();
  49754. scope=$recv($globals.MethodLexicalScope)._new();
  49755. $recv(scope)._addTemp_("bzzz");
  49756. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  49757. return self;
  49758. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  49759. },
  49760. args: [],
  49761. 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",
  49762. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49763. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  49764. }),
  49765. $globals.ScopeVarTest);
  49766. $core.addMethod(
  49767. $core.method({
  49768. selector: "testUnknownVar",
  49769. protocol: "tests",
  49770. fn: function (){
  49771. var self=this,$self=this;
  49772. var node;
  49773. return $core.withContext(function($ctx1) {
  49774. var $1;
  49775. $1=$recv($globals.VariableNode)._new();
  49776. $ctx1.sendIdx["new"]=1;
  49777. $recv($1)._value_("bzzz");
  49778. node=$recv($1)._yourself();
  49779. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  49780. return self;
  49781. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  49782. },
  49783. args: [],
  49784. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  49785. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  49786. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  49787. }),
  49788. $globals.ScopeVarTest);
  49789. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  49790. $core.addMethod(
  49791. $core.method({
  49792. selector: "setUp",
  49793. protocol: "running",
  49794. fn: function (){
  49795. var self=this,$self=this;
  49796. return $core.withContext(function($ctx1) {
  49797. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  49798. return self;
  49799. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  49800. },
  49801. args: [],
  49802. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  49803. referencedClasses: ["SemanticAnalyzer", "Object"],
  49804. messageSends: ["on:"]
  49805. }),
  49806. $globals.SemanticAnalyzerTest);
  49807. $core.addMethod(
  49808. $core.method({
  49809. selector: "testAssignment",
  49810. protocol: "tests",
  49811. fn: function (){
  49812. var self=this,$self=this;
  49813. var src,ast;
  49814. return $core.withContext(function($ctx1) {
  49815. src="foo self := 1";
  49816. ast=$recv($globals.Smalltalk)._parse_(src);
  49817. $self._should_raise_((function(){
  49818. return $core.withContext(function($ctx2) {
  49819. return $recv($self["@analyzer"])._visit_(ast);
  49820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49821. }),$globals.InvalidAssignmentError);
  49822. return self;
  49823. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49824. },
  49825. args: [],
  49826. 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",
  49827. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  49828. messageSends: ["parse:", "should:raise:", "visit:"]
  49829. }),
  49830. $globals.SemanticAnalyzerTest);
  49831. $core.addMethod(
  49832. $core.method({
  49833. selector: "testNonLocalReturn",
  49834. protocol: "tests",
  49835. fn: function (){
  49836. var self=this,$self=this;
  49837. var src,ast;
  49838. return $core.withContext(function($ctx1) {
  49839. src="foo | a | a + 1. ^ a";
  49840. ast=$recv($globals.Smalltalk)._parse_(src);
  49841. $recv($self["@analyzer"])._visit_(ast);
  49842. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  49843. return self;
  49844. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49845. },
  49846. args: [],
  49847. 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",
  49848. referencedClasses: ["Smalltalk"],
  49849. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  49850. }),
  49851. $globals.SemanticAnalyzerTest);
  49852. $core.addMethod(
  49853. $core.method({
  49854. selector: "testNonLocalReturn2",
  49855. protocol: "tests",
  49856. fn: function (){
  49857. var self=this,$self=this;
  49858. var src,ast;
  49859. return $core.withContext(function($ctx1) {
  49860. src="foo | a | a + 1. [ [ ^ a] ]";
  49861. ast=$recv($globals.Smalltalk)._parse_(src);
  49862. $recv($self["@analyzer"])._visit_(ast);
  49863. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  49864. return self;
  49865. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49866. },
  49867. args: [],
  49868. 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",
  49869. referencedClasses: ["Smalltalk"],
  49870. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  49871. }),
  49872. $globals.SemanticAnalyzerTest);
  49873. $core.addMethod(
  49874. $core.method({
  49875. selector: "testScope",
  49876. protocol: "tests",
  49877. fn: function (){
  49878. var self=this,$self=this;
  49879. var src,ast;
  49880. return $core.withContext(function($ctx1) {
  49881. var $4,$3,$2,$1;
  49882. src="foo | a | a + 1. [ | b | b := a ]";
  49883. ast=$recv($globals.Smalltalk)._parse_(src);
  49884. $recv($self["@analyzer"])._visit_(ast);
  49885. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49886. $ctx1.sendIdx["dagChildren"]=1;
  49887. $3=$recv($4)._last();
  49888. $2=$recv($3)._scope();
  49889. $ctx1.sendIdx["scope"]=1;
  49890. $1=$recv($2).__eq_eq($recv(ast)._scope());
  49891. $self._deny_($1);
  49892. return self;
  49893. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49894. },
  49895. args: [],
  49896. 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.",
  49897. referencedClasses: ["Smalltalk"],
  49898. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  49899. }),
  49900. $globals.SemanticAnalyzerTest);
  49901. $core.addMethod(
  49902. $core.method({
  49903. selector: "testScope2",
  49904. protocol: "tests",
  49905. fn: function (){
  49906. var self=this,$self=this;
  49907. var src,ast;
  49908. return $core.withContext(function($ctx1) {
  49909. var $8,$7,$6,$5,$4,$3,$2,$1;
  49910. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  49911. ast=$recv($globals.Smalltalk)._parse_(src);
  49912. $recv($self["@analyzer"])._visit_(ast);
  49913. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49914. $ctx1.sendIdx["dagChildren"]=3;
  49915. $7=$recv($8)._last();
  49916. $6=$recv($7)._dagChildren();
  49917. $ctx1.sendIdx["dagChildren"]=2;
  49918. $5=$recv($6)._first();
  49919. $ctx1.sendIdx["first"]=2;
  49920. $4=$recv($5)._dagChildren();
  49921. $ctx1.sendIdx["dagChildren"]=1;
  49922. $3=$recv($4)._first();
  49923. $ctx1.sendIdx["first"]=1;
  49924. $2=$recv($3)._scope();
  49925. $ctx1.sendIdx["scope"]=1;
  49926. $1=$recv($2).__eq_eq($recv(ast)._scope());
  49927. $self._deny_($1);
  49928. return self;
  49929. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49930. },
  49931. args: [],
  49932. 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.",
  49933. referencedClasses: ["Smalltalk"],
  49934. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  49935. }),
  49936. $globals.SemanticAnalyzerTest);
  49937. $core.addMethod(
  49938. $core.method({
  49939. selector: "testScopeLevel",
  49940. protocol: "tests",
  49941. fn: function (){
  49942. var self=this,$self=this;
  49943. var src,ast;
  49944. return $core.withContext(function($ctx1) {
  49945. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  49946. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  49947. ast=$recv($globals.Smalltalk)._parse_(src);
  49948. $recv($self["@analyzer"])._visit_(ast);
  49949. $2=$recv(ast)._scope();
  49950. $ctx1.sendIdx["scope"]=1;
  49951. $1=$recv($2)._scopeLevel();
  49952. $ctx1.sendIdx["scopeLevel"]=1;
  49953. $self._assert_equals_($1,(1));
  49954. $ctx1.sendIdx["assert:equals:"]=1;
  49955. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  49956. $ctx1.sendIdx["dagChildren"]=3;
  49957. $9=$recv($10)._last();
  49958. $8=$recv($9)._dagChildren();
  49959. $ctx1.sendIdx["dagChildren"]=2;
  49960. $7=$recv($8)._first();
  49961. $ctx1.sendIdx["first"]=2;
  49962. $6=$recv($7)._dagChildren();
  49963. $ctx1.sendIdx["dagChildren"]=1;
  49964. $5=$recv($6)._first();
  49965. $ctx1.sendIdx["first"]=1;
  49966. $4=$recv($5)._scope();
  49967. $3=$recv($4)._scopeLevel();
  49968. $self._assert_equals_($3,(3));
  49969. return self;
  49970. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49971. },
  49972. args: [],
  49973. 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",
  49974. referencedClasses: ["Smalltalk"],
  49975. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  49976. }),
  49977. $globals.SemanticAnalyzerTest);
  49978. $core.addMethod(
  49979. $core.method({
  49980. selector: "testUnknownVariables",
  49981. protocol: "tests",
  49982. fn: function (){
  49983. var self=this,$self=this;
  49984. var src,ast;
  49985. return $core.withContext(function($ctx1) {
  49986. src="foo | a | b + a";
  49987. ast=$recv($globals.Smalltalk)._parse_(src);
  49988. $self._should_raise_((function(){
  49989. return $core.withContext(function($ctx2) {
  49990. return $recv($self["@analyzer"])._visit_(ast);
  49991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49992. }),$globals.UnknownVariableError);
  49993. return self;
  49994. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  49995. },
  49996. args: [],
  49997. 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",
  49998. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  49999. messageSends: ["parse:", "should:raise:", "visit:"]
  50000. }),
  50001. $globals.SemanticAnalyzerTest);
  50002. $core.addMethod(
  50003. $core.method({
  50004. selector: "testUnknownVariablesWithScope",
  50005. protocol: "tests",
  50006. fn: function (){
  50007. var self=this,$self=this;
  50008. var src,ast;
  50009. return $core.withContext(function($ctx1) {
  50010. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50011. ast=$recv($globals.Smalltalk)._parse_(src);
  50012. $self._should_raise_((function(){
  50013. return $core.withContext(function($ctx2) {
  50014. return $recv($self["@analyzer"])._visit_(ast);
  50015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50016. }),$globals.UnknownVariableError);
  50017. return self;
  50018. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50019. },
  50020. args: [],
  50021. 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",
  50022. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50023. messageSends: ["parse:", "should:raise:", "visit:"]
  50024. }),
  50025. $globals.SemanticAnalyzerTest);
  50026. $core.addMethod(
  50027. $core.method({
  50028. selector: "testVariableShadowing",
  50029. protocol: "tests",
  50030. fn: function (){
  50031. var self=this,$self=this;
  50032. var src,ast;
  50033. return $core.withContext(function($ctx1) {
  50034. src="foo | a | a + 1";
  50035. ast=$recv($globals.Smalltalk)._parse_(src);
  50036. $recv($self["@analyzer"])._visit_(ast);
  50037. return self;
  50038. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50039. },
  50040. args: [],
  50041. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50042. referencedClasses: ["Smalltalk"],
  50043. messageSends: ["parse:", "visit:"]
  50044. }),
  50045. $globals.SemanticAnalyzerTest);
  50046. $core.addMethod(
  50047. $core.method({
  50048. selector: "testVariableShadowing2",
  50049. protocol: "tests",
  50050. fn: function (){
  50051. var self=this,$self=this;
  50052. var src,ast;
  50053. return $core.withContext(function($ctx1) {
  50054. src="foo | a | a + 1. [ | a | a := 2 ]";
  50055. ast=$recv($globals.Smalltalk)._parse_(src);
  50056. $self._should_raise_((function(){
  50057. return $core.withContext(function($ctx2) {
  50058. return $recv($self["@analyzer"])._visit_(ast);
  50059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50060. }),$globals.ShadowingVariableError);
  50061. return self;
  50062. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50063. },
  50064. args: [],
  50065. 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",
  50066. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50067. messageSends: ["parse:", "should:raise:", "visit:"]
  50068. }),
  50069. $globals.SemanticAnalyzerTest);
  50070. $core.addMethod(
  50071. $core.method({
  50072. selector: "testVariableShadowing3",
  50073. protocol: "tests",
  50074. fn: function (){
  50075. var self=this,$self=this;
  50076. var src,ast;
  50077. return $core.withContext(function($ctx1) {
  50078. src="foo | a | a + 1. [ | b | b := 2 ]";
  50079. ast=$recv($globals.Smalltalk)._parse_(src);
  50080. $recv($self["@analyzer"])._visit_(ast);
  50081. return self;
  50082. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50083. },
  50084. args: [],
  50085. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50086. referencedClasses: ["Smalltalk"],
  50087. messageSends: ["parse:", "visit:"]
  50088. }),
  50089. $globals.SemanticAnalyzerTest);
  50090. $core.addMethod(
  50091. $core.method({
  50092. selector: "testVariableShadowing4",
  50093. protocol: "tests",
  50094. fn: function (){
  50095. var self=this,$self=this;
  50096. var src,ast;
  50097. return $core.withContext(function($ctx1) {
  50098. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50099. ast=$recv($globals.Smalltalk)._parse_(src);
  50100. $recv($self["@analyzer"])._visit_(ast);
  50101. return self;
  50102. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50103. },
  50104. args: [],
  50105. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50106. referencedClasses: ["Smalltalk"],
  50107. messageSends: ["parse:", "visit:"]
  50108. }),
  50109. $globals.SemanticAnalyzerTest);
  50110. $core.addMethod(
  50111. $core.method({
  50112. selector: "testVariableShadowing5",
  50113. protocol: "tests",
  50114. fn: function (){
  50115. var self=this,$self=this;
  50116. var src,ast;
  50117. return $core.withContext(function($ctx1) {
  50118. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50119. ast=$recv($globals.Smalltalk)._parse_(src);
  50120. $self._should_raise_((function(){
  50121. return $core.withContext(function($ctx2) {
  50122. return $recv($self["@analyzer"])._visit_(ast);
  50123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50124. }),$globals.ShadowingVariableError);
  50125. return self;
  50126. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50127. },
  50128. args: [],
  50129. 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",
  50130. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50131. messageSends: ["parse:", "should:raise:", "visit:"]
  50132. }),
  50133. $globals.SemanticAnalyzerTest);
  50134. $core.addMethod(
  50135. $core.method({
  50136. selector: "testVariablesLookup",
  50137. protocol: "tests",
  50138. fn: function (){
  50139. var self=this,$self=this;
  50140. var src,ast;
  50141. return $core.withContext(function($ctx1) {
  50142. 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;
  50143. src="foo | a | a + 1. [ | b | b := a ]";
  50144. ast=$recv($globals.Smalltalk)._parse_(src);
  50145. $recv($self["@analyzer"])._visit_(ast);
  50146. $7=$recv(ast)._dagChildren();
  50147. $ctx1.sendIdx["dagChildren"]=2;
  50148. $6=$recv($7)._first();
  50149. $ctx1.sendIdx["first"]=2;
  50150. $5=$recv($6)._dagChildren();
  50151. $ctx1.sendIdx["dagChildren"]=1;
  50152. $4=$recv($5)._first();
  50153. $ctx1.sendIdx["first"]=1;
  50154. $3=$recv($4)._receiver();
  50155. $ctx1.sendIdx["receiver"]=1;
  50156. $2=$recv($3)._binding();
  50157. $ctx1.sendIdx["binding"]=1;
  50158. $1=$recv($2)._isTempVar();
  50159. $ctx1.sendIdx["isTempVar"]=1;
  50160. $self._assert_($1);
  50161. $ctx1.sendIdx["assert:"]=1;
  50162. $15=$recv(ast)._dagChildren();
  50163. $ctx1.sendIdx["dagChildren"]=4;
  50164. $14=$recv($15)._first();
  50165. $ctx1.sendIdx["first"]=4;
  50166. $13=$recv($14)._dagChildren();
  50167. $ctx1.sendIdx["dagChildren"]=3;
  50168. $12=$recv($13)._first();
  50169. $ctx1.sendIdx["first"]=3;
  50170. $11=$recv($12)._receiver();
  50171. $10=$recv($11)._binding();
  50172. $ctx1.sendIdx["binding"]=2;
  50173. $9=$recv($10)._scope();
  50174. $ctx1.sendIdx["scope"]=1;
  50175. $16=$recv(ast)._scope();
  50176. $ctx1.sendIdx["scope"]=2;
  50177. $8=$recv($9).__eq_eq($16);
  50178. $ctx1.sendIdx["=="]=1;
  50179. $self._assert_($8);
  50180. $ctx1.sendIdx["assert:"]=2;
  50181. $27=$recv(ast)._dagChildren();
  50182. $ctx1.sendIdx["dagChildren"]=8;
  50183. $26=$recv($27)._first();
  50184. $ctx1.sendIdx["first"]=7;
  50185. $25=$recv($26)._dagChildren();
  50186. $ctx1.sendIdx["dagChildren"]=7;
  50187. $24=$recv($25)._last();
  50188. $ctx1.sendIdx["last"]=1;
  50189. $23=$recv($24)._dagChildren();
  50190. $ctx1.sendIdx["dagChildren"]=6;
  50191. $22=$recv($23)._first();
  50192. $ctx1.sendIdx["first"]=6;
  50193. $21=$recv($22)._dagChildren();
  50194. $ctx1.sendIdx["dagChildren"]=5;
  50195. $20=$recv($21)._first();
  50196. $ctx1.sendIdx["first"]=5;
  50197. $19=$recv($20)._left();
  50198. $ctx1.sendIdx["left"]=1;
  50199. $18=$recv($19)._binding();
  50200. $ctx1.sendIdx["binding"]=3;
  50201. $17=$recv($18)._isTempVar();
  50202. $self._assert_($17);
  50203. $ctx1.sendIdx["assert:"]=3;
  50204. $39=$recv(ast)._dagChildren();
  50205. $ctx1.sendIdx["dagChildren"]=12;
  50206. $38=$recv($39)._first();
  50207. $ctx1.sendIdx["first"]=10;
  50208. $37=$recv($38)._dagChildren();
  50209. $ctx1.sendIdx["dagChildren"]=11;
  50210. $36=$recv($37)._last();
  50211. $ctx1.sendIdx["last"]=2;
  50212. $35=$recv($36)._dagChildren();
  50213. $ctx1.sendIdx["dagChildren"]=10;
  50214. $34=$recv($35)._first();
  50215. $ctx1.sendIdx["first"]=9;
  50216. $33=$recv($34)._dagChildren();
  50217. $ctx1.sendIdx["dagChildren"]=9;
  50218. $32=$recv($33)._first();
  50219. $ctx1.sendIdx["first"]=8;
  50220. $31=$recv($32)._left();
  50221. $30=$recv($31)._binding();
  50222. $29=$recv($30)._scope();
  50223. $ctx1.sendIdx["scope"]=3;
  50224. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50225. $ctx1.sendIdx["dagChildren"]=13;
  50226. $41=$recv($42)._last();
  50227. $40=$recv($41)._scope();
  50228. $28=$recv($29).__eq_eq($40);
  50229. $self._assert_($28);
  50230. return self;
  50231. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50232. },
  50233. args: [],
  50234. 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.",
  50235. referencedClasses: ["Smalltalk"],
  50236. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50237. }),
  50238. $globals.SemanticAnalyzerTest);
  50239. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50240. $core.addMethod(
  50241. $core.method({
  50242. selector: "setUp",
  50243. protocol: "running",
  50244. fn: function (){
  50245. var self=this,$self=this;
  50246. return $core.withContext(function($ctx1) {
  50247. var $1,$3,$4,$2;
  50248. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50249. $3=$recv($globals.AIContext)._new();
  50250. $recv($3)._defineLocal_("local");
  50251. $recv($3)._localAt_put_("local",(3));
  50252. $4=$recv($3)._yourself();
  50253. $ctx1.sendIdx["yourself"]=1;
  50254. $2=$4;
  50255. $recv($1)._context_($2);
  50256. $self["@analyzer"]=$recv($1)._yourself();
  50257. return self;
  50258. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50259. },
  50260. args: [],
  50261. 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",
  50262. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50263. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50264. }),
  50265. $globals.AISemanticAnalyzerTest);
  50266. $core.addMethod(
  50267. $core.method({
  50268. selector: "testContextVariables",
  50269. protocol: "tests",
  50270. fn: function (){
  50271. var self=this,$self=this;
  50272. var src,ast;
  50273. return $core.withContext(function($ctx1) {
  50274. src="foo | a | local + a";
  50275. ast=$recv($globals.Smalltalk)._parse_(src);
  50276. $self._shouldnt_raise_((function(){
  50277. return $core.withContext(function($ctx2) {
  50278. return $recv($self["@analyzer"])._visit_(ast);
  50279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50280. }),$globals.UnknownVariableError);
  50281. return self;
  50282. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50283. },
  50284. args: [],
  50285. 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",
  50286. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50287. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50288. }),
  50289. $globals.AISemanticAnalyzerTest);
  50290. });
  50291. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50292. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50293. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50294. $core.addPackage("Kernel-Tests");
  50295. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  50296. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50297. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50298. $core.addMethod(
  50299. $core.method({
  50300. selector: "testAddExtensionMethod",
  50301. protocol: "tests",
  50302. fn: function (){
  50303. var self=this,$self=this;
  50304. var method,dirty;
  50305. return $core.withContext(function($ctx1) {
  50306. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50307. $2=$self._class();
  50308. $ctx1.sendIdx["class"]=1;
  50309. $1=$recv($2)._package();
  50310. $ctx1.sendIdx["package"]=1;
  50311. dirty=$recv($1)._isDirty();
  50312. $ctx1.sendIdx["isDirty"]=1;
  50313. $4=$self._class();
  50314. $ctx1.sendIdx["class"]=2;
  50315. $3=$recv($4)._package();
  50316. $ctx1.sendIdx["package"]=2;
  50317. $recv($3)._beClean();
  50318. $5=$self._class();
  50319. $ctx1.sendIdx["class"]=3;
  50320. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50321. $8=$self._class();
  50322. $ctx1.sendIdx["class"]=4;
  50323. $7=$recv($8)._package();
  50324. $ctx1.sendIdx["package"]=3;
  50325. $6=$recv($7)._isDirty();
  50326. $self._deny_($6);
  50327. $9=$self._class();
  50328. $ctx1.sendIdx["class"]=5;
  50329. $recv($9)._removeCompiledMethod_(method);
  50330. $10=dirty;
  50331. if($core.assert($10)){
  50332. $recv($recv($self._class())._package())._beDirty();
  50333. }
  50334. return self;
  50335. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50336. },
  50337. args: [],
  50338. 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 ]",
  50339. referencedClasses: [],
  50340. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50341. }),
  50342. $globals.AnnouncementSubscriptionTest);
  50343. $core.addMethod(
  50344. $core.method({
  50345. selector: "testHandlesAnnouncement",
  50346. protocol: "tests",
  50347. fn: function (){
  50348. var self=this,$self=this;
  50349. var subscription,announcementClass1,announcementClass2,classBuilder;
  50350. return $core.withContext(function($ctx1) {
  50351. var $1,$2;
  50352. classBuilder=$recv($globals.ClassBuilder)._new();
  50353. $ctx1.sendIdx["new"]=1;
  50354. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50355. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  50356. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  50357. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50358. $self._assert_equals_($1,true);
  50359. $ctx1.sendIdx["assert:equals:"]=1;
  50360. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  50361. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50362. $self._assert_equals_($2,true);
  50363. $ctx1.sendIdx["assert:equals:"]=2;
  50364. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  50365. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50366. return self;
  50367. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50368. },
  50369. args: [],
  50370. 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.",
  50371. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50372. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50373. }),
  50374. $globals.AnnouncementSubscriptionTest);
  50375. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50376. $core.addMethod(
  50377. $core.method({
  50378. selector: "testOnDo",
  50379. protocol: "tests",
  50380. fn: function (){
  50381. var self=this,$self=this;
  50382. var counter,announcer;
  50383. return $core.withContext(function($ctx1) {
  50384. var $1,$2;
  50385. counter=(0);
  50386. announcer=$recv($globals.Announcer)._new();
  50387. $ctx1.sendIdx["new"]=1;
  50388. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50389. return $core.withContext(function($ctx2) {
  50390. counter=$recv(counter).__plus((1));
  50391. return counter;
  50392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50393. }));
  50394. $1=announcer;
  50395. $2=$recv($globals.SystemAnnouncement)._new();
  50396. $ctx1.sendIdx["new"]=2;
  50397. $recv($1)._announce_($2);
  50398. $ctx1.sendIdx["announce:"]=1;
  50399. $self._assert_equals_(counter,(1));
  50400. $ctx1.sendIdx["assert:equals:"]=1;
  50401. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50402. $self._assert_equals_(counter,(2));
  50403. return self;
  50404. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50405. },
  50406. args: [],
  50407. 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.",
  50408. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50409. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50410. }),
  50411. $globals.AnnouncerTest);
  50412. $core.addMethod(
  50413. $core.method({
  50414. selector: "testOnDoFor",
  50415. protocol: "tests",
  50416. fn: function (){
  50417. var self=this,$self=this;
  50418. var counter,announcer;
  50419. return $core.withContext(function($ctx1) {
  50420. var $1,$2,$3,$4;
  50421. counter=(0);
  50422. announcer=$recv($globals.Announcer)._new();
  50423. $ctx1.sendIdx["new"]=1;
  50424. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50425. return $core.withContext(function($ctx2) {
  50426. counter=$recv(counter).__plus((1));
  50427. return counter;
  50428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50429. }),self);
  50430. $1=announcer;
  50431. $2=$recv($globals.SystemAnnouncement)._new();
  50432. $ctx1.sendIdx["new"]=2;
  50433. $recv($1)._announce_($2);
  50434. $ctx1.sendIdx["announce:"]=1;
  50435. $self._assert_equals_(counter,(1));
  50436. $ctx1.sendIdx["assert:equals:"]=1;
  50437. $3=announcer;
  50438. $4=$recv($globals.SystemAnnouncement)._new();
  50439. $ctx1.sendIdx["new"]=3;
  50440. $recv($3)._announce_($4);
  50441. $ctx1.sendIdx["announce:"]=2;
  50442. $self._assert_equals_(counter,(2));
  50443. $ctx1.sendIdx["assert:equals:"]=2;
  50444. $recv(announcer)._unsubscribe_(self);
  50445. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50446. $self._assert_equals_(counter,(2));
  50447. return self;
  50448. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50449. },
  50450. args: [],
  50451. 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.",
  50452. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50453. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50454. }),
  50455. $globals.AnnouncerTest);
  50456. $core.addMethod(
  50457. $core.method({
  50458. selector: "testOnDoOnce",
  50459. protocol: "tests",
  50460. fn: function (){
  50461. var self=this,$self=this;
  50462. var counter,announcer;
  50463. return $core.withContext(function($ctx1) {
  50464. var $1,$2;
  50465. counter=(0);
  50466. announcer=$recv($globals.Announcer)._new();
  50467. $ctx1.sendIdx["new"]=1;
  50468. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50469. return $core.withContext(function($ctx2) {
  50470. counter=$recv(counter).__plus((1));
  50471. return counter;
  50472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50473. }));
  50474. $1=announcer;
  50475. $2=$recv($globals.SystemAnnouncement)._new();
  50476. $ctx1.sendIdx["new"]=2;
  50477. $recv($1)._announce_($2);
  50478. $ctx1.sendIdx["announce:"]=1;
  50479. $self._assert_equals_(counter,(1));
  50480. $ctx1.sendIdx["assert:equals:"]=1;
  50481. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50482. $self._assert_equals_(counter,(1));
  50483. return self;
  50484. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50485. },
  50486. args: [],
  50487. 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.",
  50488. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50489. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50490. }),
  50491. $globals.AnnouncerTest);
  50492. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50493. $core.addMethod(
  50494. $core.method({
  50495. selector: "localReturnOnDoCatch",
  50496. protocol: "fixture",
  50497. fn: function (){
  50498. var self=this,$self=this;
  50499. return $core.withContext(function($ctx1) {
  50500. var $early={};
  50501. try {
  50502. $recv((function(){
  50503. throw $early=[(2)];
  50504. }))._on_do_($globals.Error,(function(){
  50505. }));
  50506. return (3);
  50507. }
  50508. catch(e) {if(e===$early)return e[0]; throw e}
  50509. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50510. },
  50511. args: [],
  50512. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50513. referencedClasses: ["Error"],
  50514. messageSends: ["on:do:"]
  50515. }),
  50516. $globals.BlockClosureTest);
  50517. $core.addMethod(
  50518. $core.method({
  50519. selector: "localReturnOnDoMiss",
  50520. protocol: "fixture",
  50521. fn: function (){
  50522. var self=this,$self=this;
  50523. return $core.withContext(function($ctx1) {
  50524. var $early={};
  50525. try {
  50526. $recv((function(){
  50527. throw $early=[(2)];
  50528. }))._on_do_($globals.Class,(function(){
  50529. }));
  50530. return (3);
  50531. }
  50532. catch(e) {if(e===$early)return e[0]; throw e}
  50533. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50534. },
  50535. args: [],
  50536. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50537. referencedClasses: ["Class"],
  50538. messageSends: ["on:do:"]
  50539. }),
  50540. $globals.BlockClosureTest);
  50541. $core.addMethod(
  50542. $core.method({
  50543. selector: "testCanClearInterval",
  50544. protocol: "tests",
  50545. fn: function (){
  50546. var self=this,$self=this;
  50547. return $core.withContext(function($ctx1) {
  50548. $self._shouldnt_raise_((function(){
  50549. return $core.withContext(function($ctx2) {
  50550. return $recv($recv((function(){
  50551. return $core.withContext(function($ctx3) {
  50552. return $recv($recv($globals.Error)._new())._signal();
  50553. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50554. }))._valueWithInterval_((0)))._clearInterval();
  50555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50556. }),$globals.Error);
  50557. return self;
  50558. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50559. },
  50560. args: [],
  50561. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50562. referencedClasses: ["Error"],
  50563. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50564. }),
  50565. $globals.BlockClosureTest);
  50566. $core.addMethod(
  50567. $core.method({
  50568. selector: "testCanClearTimeout",
  50569. protocol: "tests",
  50570. fn: function (){
  50571. var self=this,$self=this;
  50572. return $core.withContext(function($ctx1) {
  50573. $self._shouldnt_raise_((function(){
  50574. return $core.withContext(function($ctx2) {
  50575. return $recv($recv((function(){
  50576. return $core.withContext(function($ctx3) {
  50577. return $recv($recv($globals.Error)._new())._signal();
  50578. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50579. }))._valueWithTimeout_((0)))._clearTimeout();
  50580. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50581. }),$globals.Error);
  50582. return self;
  50583. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50584. },
  50585. args: [],
  50586. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50587. referencedClasses: ["Error"],
  50588. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50589. }),
  50590. $globals.BlockClosureTest);
  50591. $core.addMethod(
  50592. $core.method({
  50593. selector: "testCompiledSource",
  50594. protocol: "tests",
  50595. fn: function (){
  50596. var self=this,$self=this;
  50597. return $core.withContext(function($ctx1) {
  50598. $self._assert_($recv($recv((function(){
  50599. return $core.withContext(function($ctx2) {
  50600. return (1).__plus((1));
  50601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50602. }))._compiledSource())._includesSubString_("function"));
  50603. return self;
  50604. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50605. },
  50606. args: [],
  50607. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50608. referencedClasses: [],
  50609. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50610. }),
  50611. $globals.BlockClosureTest);
  50612. $core.addMethod(
  50613. $core.method({
  50614. selector: "testCurrySelf",
  50615. protocol: "tests",
  50616. fn: function (){
  50617. var self=this,$self=this;
  50618. var curriedMethod,array;
  50619. return $core.withContext(function($ctx1) {
  50620. curriedMethod=$recv($recv((function(selfarg,x){
  50621. return $core.withContext(function($ctx2) {
  50622. return $recv(selfarg)._at_(x);
  50623. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  50624. }))._currySelf())._asCompiledMethod_("foo:");
  50625. array=[(3), (1), (4)];
  50626. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  50627. $recv((function(){
  50628. return $core.withContext(function($ctx2) {
  50629. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  50630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50631. }))._ensure_((function(){
  50632. return $core.withContext(function($ctx2) {
  50633. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  50634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50635. }));
  50636. return self;
  50637. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  50638. },
  50639. args: [],
  50640. 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 ]",
  50641. referencedClasses: ["ClassBuilder", "Array"],
  50642. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  50643. }),
  50644. $globals.BlockClosureTest);
  50645. $core.addMethod(
  50646. $core.method({
  50647. selector: "testEnsure",
  50648. protocol: "tests",
  50649. fn: function (){
  50650. var self=this,$self=this;
  50651. return $core.withContext(function($ctx1) {
  50652. $self._assert_equals_($recv((function(){
  50653. return (3);
  50654. }))._ensure_((function(){
  50655. return (4);
  50656. })),(3));
  50657. return self;
  50658. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  50659. },
  50660. args: [],
  50661. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  50662. referencedClasses: [],
  50663. messageSends: ["assert:equals:", "ensure:"]
  50664. }),
  50665. $globals.BlockClosureTest);
  50666. $core.addMethod(
  50667. $core.method({
  50668. selector: "testEnsureRaises",
  50669. protocol: "tests",
  50670. fn: function (){
  50671. var self=this,$self=this;
  50672. return $core.withContext(function($ctx1) {
  50673. $self._should_raise_((function(){
  50674. return $core.withContext(function($ctx2) {
  50675. return $recv((function(){
  50676. return $core.withContext(function($ctx3) {
  50677. return $recv($recv($globals.Error)._new())._signal();
  50678. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50679. }))._ensure_((function(){
  50680. return true;
  50681. }));
  50682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50683. }),$globals.Error);
  50684. return self;
  50685. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  50686. },
  50687. args: [],
  50688. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  50689. referencedClasses: ["Error"],
  50690. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  50691. }),
  50692. $globals.BlockClosureTest);
  50693. $core.addMethod(
  50694. $core.method({
  50695. selector: "testExceptionSemantics",
  50696. protocol: "tests",
  50697. fn: function (){
  50698. var self=this,$self=this;
  50699. return $core.withContext(function($ctx1) {
  50700. $self._timeout_((100));
  50701. $recv($self._async_((function(){
  50702. return $core.withContext(function($ctx2) {
  50703. return $recv((function(){
  50704. return $core.withContext(function($ctx3) {
  50705. $self._assert_(true);
  50706. $recv($globals.Error)._signal();
  50707. $self._deny_(true);
  50708. return $self._finished();
  50709. $ctx3.sendIdx["finished"]=1;
  50710. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50711. }))._on_do_($globals.Error,(function(ex){
  50712. return $core.withContext(function($ctx3) {
  50713. return $self._finished();
  50714. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  50715. }));
  50716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50717. })))._valueWithTimeout_((0));
  50718. return self;
  50719. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  50720. },
  50721. args: [],
  50722. 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",
  50723. referencedClasses: ["Error"],
  50724. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  50725. }),
  50726. $globals.BlockClosureTest);
  50727. $core.addMethod(
  50728. $core.method({
  50729. selector: "testLocalReturnOnDoCatch",
  50730. protocol: "tests",
  50731. fn: function (){
  50732. var self=this,$self=this;
  50733. return $core.withContext(function($ctx1) {
  50734. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  50735. return self;
  50736. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50737. },
  50738. args: [],
  50739. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  50740. referencedClasses: [],
  50741. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  50742. }),
  50743. $globals.BlockClosureTest);
  50744. $core.addMethod(
  50745. $core.method({
  50746. selector: "testLocalReturnOnDoMiss",
  50747. protocol: "tests",
  50748. fn: function (){
  50749. var self=this,$self=this;
  50750. return $core.withContext(function($ctx1) {
  50751. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  50752. return self;
  50753. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50754. },
  50755. args: [],
  50756. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  50757. referencedClasses: [],
  50758. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  50759. }),
  50760. $globals.BlockClosureTest);
  50761. $core.addMethod(
  50762. $core.method({
  50763. selector: "testNewWithValues",
  50764. protocol: "tests",
  50765. fn: function (){
  50766. var self=this,$self=this;
  50767. return $core.withContext(function($ctx1) {
  50768. function TestConstructor(arg1, arg2, arg3) {}
  50769. TestConstructor.prototype.name = "theTestPrototype";
  50770. var wrappedConstructor = $recv(TestConstructor);
  50771. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  50772. $self._assert_(result instanceof TestConstructor);
  50773. $self._assert_equals_(result.name, "theTestPrototype");
  50774. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  50775. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  50776. return self;
  50777. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  50778. },
  50779. args: [],
  50780. 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'>",
  50781. referencedClasses: [],
  50782. messageSends: []
  50783. }),
  50784. $globals.BlockClosureTest);
  50785. $core.addMethod(
  50786. $core.method({
  50787. selector: "testNumArgs",
  50788. protocol: "tests",
  50789. fn: function (){
  50790. var self=this,$self=this;
  50791. return $core.withContext(function($ctx1) {
  50792. var $1;
  50793. $1=$recv((function(){
  50794. }))._numArgs();
  50795. $ctx1.sendIdx["numArgs"]=1;
  50796. $self._assert_equals_($1,(0));
  50797. $ctx1.sendIdx["assert:equals:"]=1;
  50798. $self._assert_equals_($recv((function(a,b){
  50799. }))._numArgs(),(2));
  50800. return self;
  50801. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  50802. },
  50803. args: [],
  50804. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  50805. referencedClasses: [],
  50806. messageSends: ["assert:equals:", "numArgs"]
  50807. }),
  50808. $globals.BlockClosureTest);
  50809. $core.addMethod(
  50810. $core.method({
  50811. selector: "testOnDo",
  50812. protocol: "tests",
  50813. fn: function (){
  50814. var self=this,$self=this;
  50815. return $core.withContext(function($ctx1) {
  50816. $self._assert_($recv((function(){
  50817. return $core.withContext(function($ctx2) {
  50818. return $recv($recv($globals.Error)._new())._signal();
  50819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50820. }))._on_do_($globals.Error,(function(ex){
  50821. return true;
  50822. })));
  50823. return self;
  50824. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  50825. },
  50826. args: [],
  50827. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  50828. referencedClasses: ["Error"],
  50829. messageSends: ["assert:", "on:do:", "signal", "new"]
  50830. }),
  50831. $globals.BlockClosureTest);
  50832. $core.addMethod(
  50833. $core.method({
  50834. selector: "testValue",
  50835. protocol: "tests",
  50836. fn: function (){
  50837. var self=this,$self=this;
  50838. return $core.withContext(function($ctx1) {
  50839. var $1;
  50840. $1=$recv((function(){
  50841. return $core.withContext(function($ctx2) {
  50842. return (1).__plus((1));
  50843. $ctx2.sendIdx["+"]=1;
  50844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50845. }))._value();
  50846. $ctx1.sendIdx["value"]=1;
  50847. $self._assert_equals_($1,(2));
  50848. $ctx1.sendIdx["assert:equals:"]=1;
  50849. $self._assert_equals_($recv((function(x){
  50850. return $core.withContext(function($ctx2) {
  50851. return $recv(x).__plus((1));
  50852. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  50853. }))._value_((2)),(3));
  50854. $ctx1.sendIdx["assert:equals:"]=2;
  50855. $self._assert_equals_($recv((function(x,y){
  50856. return $core.withContext(function($ctx2) {
  50857. return $recv(x).__star(y);
  50858. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  50859. }))._value_value_((2),(4)),(8));
  50860. $ctx1.sendIdx["assert:equals:"]=3;
  50861. $self._assert_equals_($recv((function(a,b,c){
  50862. return (1);
  50863. }))._value(),(1));
  50864. return self;
  50865. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  50866. },
  50867. args: [],
  50868. 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",
  50869. referencedClasses: [],
  50870. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  50871. }),
  50872. $globals.BlockClosureTest);
  50873. $core.addMethod(
  50874. $core.method({
  50875. selector: "testValueWithPossibleArguments",
  50876. protocol: "tests",
  50877. fn: function (){
  50878. var self=this,$self=this;
  50879. return $core.withContext(function($ctx1) {
  50880. var $1,$2;
  50881. $1=$recv((function(){
  50882. return (1);
  50883. }))._valueWithPossibleArguments_([(3), (4)]);
  50884. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  50885. $self._assert_equals_($1,(1));
  50886. $ctx1.sendIdx["assert:equals:"]=1;
  50887. $2=$recv((function(a){
  50888. return $core.withContext(function($ctx2) {
  50889. return $recv(a).__plus((4));
  50890. $ctx2.sendIdx["+"]=1;
  50891. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  50892. }))._valueWithPossibleArguments_([(3), (4)]);
  50893. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  50894. $self._assert_equals_($2,(7));
  50895. $ctx1.sendIdx["assert:equals:"]=2;
  50896. $self._assert_equals_($recv((function(a,b){
  50897. return $core.withContext(function($ctx2) {
  50898. return $recv(a).__plus(b);
  50899. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  50900. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  50901. return self;
  50902. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  50903. },
  50904. args: [],
  50905. 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.",
  50906. referencedClasses: [],
  50907. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  50908. }),
  50909. $globals.BlockClosureTest);
  50910. $core.addMethod(
  50911. $core.method({
  50912. selector: "testWhileFalse",
  50913. protocol: "tests",
  50914. fn: function (){
  50915. var self=this,$self=this;
  50916. var i;
  50917. return $core.withContext(function($ctx1) {
  50918. i=(0);
  50919. $recv((function(){
  50920. return $core.withContext(function($ctx2) {
  50921. return $recv(i).__gt((5));
  50922. $ctx2.sendIdx[">"]=1;
  50923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50924. }))._whileFalse_((function(){
  50925. return $core.withContext(function($ctx2) {
  50926. i=$recv(i).__plus((1));
  50927. $ctx2.sendIdx["+"]=1;
  50928. return i;
  50929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50930. }));
  50931. $self._assert_equals_(i,(6));
  50932. $ctx1.sendIdx["assert:equals:"]=1;
  50933. i=(0);
  50934. $recv((function(){
  50935. return $core.withContext(function($ctx2) {
  50936. i=$recv(i).__plus((1));
  50937. i;
  50938. return $recv(i).__gt((5));
  50939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50940. }))._whileFalse();
  50941. $self._assert_equals_(i,(6));
  50942. return self;
  50943. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  50944. },
  50945. args: [],
  50946. 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",
  50947. referencedClasses: [],
  50948. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  50949. }),
  50950. $globals.BlockClosureTest);
  50951. $core.addMethod(
  50952. $core.method({
  50953. selector: "testWhileTrue",
  50954. protocol: "tests",
  50955. fn: function (){
  50956. var self=this,$self=this;
  50957. var i;
  50958. return $core.withContext(function($ctx1) {
  50959. i=(0);
  50960. $recv((function(){
  50961. return $core.withContext(function($ctx2) {
  50962. return $recv(i).__lt((5));
  50963. $ctx2.sendIdx["<"]=1;
  50964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50965. }))._whileTrue_((function(){
  50966. return $core.withContext(function($ctx2) {
  50967. i=$recv(i).__plus((1));
  50968. $ctx2.sendIdx["+"]=1;
  50969. return i;
  50970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  50971. }));
  50972. $self._assert_equals_(i,(5));
  50973. $ctx1.sendIdx["assert:equals:"]=1;
  50974. i=(0);
  50975. $recv((function(){
  50976. return $core.withContext(function($ctx2) {
  50977. i=$recv(i).__plus((1));
  50978. i;
  50979. return $recv(i).__lt((5));
  50980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50981. }))._whileTrue();
  50982. $self._assert_equals_(i,(5));
  50983. return self;
  50984. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  50985. },
  50986. args: [],
  50987. 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",
  50988. referencedClasses: [],
  50989. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  50990. }),
  50991. $globals.BlockClosureTest);
  50992. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  50993. $core.addMethod(
  50994. $core.method({
  50995. selector: "testEquality",
  50996. protocol: "tests",
  50997. fn: function (){
  50998. var self=this,$self=this;
  50999. return $core.withContext(function($ctx1) {
  51000. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51001. $1=(0).__eq(false);
  51002. $ctx1.sendIdx["="]=1;
  51003. $self._deny_($1);
  51004. $ctx1.sendIdx["deny:"]=1;
  51005. $2=false.__eq((0));
  51006. $ctx1.sendIdx["="]=2;
  51007. $self._deny_($2);
  51008. $ctx1.sendIdx["deny:"]=2;
  51009. $3="".__eq(false);
  51010. $ctx1.sendIdx["="]=3;
  51011. $self._deny_($3);
  51012. $ctx1.sendIdx["deny:"]=3;
  51013. $4=false.__eq("");
  51014. $ctx1.sendIdx["="]=4;
  51015. $self._deny_($4);
  51016. $ctx1.sendIdx["deny:"]=4;
  51017. $5=true.__eq(true);
  51018. $ctx1.sendIdx["="]=5;
  51019. $self._assert_($5);
  51020. $ctx1.sendIdx["assert:"]=1;
  51021. $6=false.__eq(true);
  51022. $ctx1.sendIdx["="]=6;
  51023. $self._deny_($6);
  51024. $ctx1.sendIdx["deny:"]=5;
  51025. $7=true.__eq(false);
  51026. $ctx1.sendIdx["="]=7;
  51027. $self._deny_($7);
  51028. $8=false.__eq(false);
  51029. $ctx1.sendIdx["="]=8;
  51030. $self._assert_($8);
  51031. $ctx1.sendIdx["assert:"]=2;
  51032. $10=true._yourself();
  51033. $ctx1.sendIdx["yourself"]=1;
  51034. $9=$recv($10).__eq(true);
  51035. $ctx1.sendIdx["="]=9;
  51036. $self._assert_($9);
  51037. $ctx1.sendIdx["assert:"]=3;
  51038. $12=true._yourself();
  51039. $ctx1.sendIdx["yourself"]=2;
  51040. $11=$recv($12).__eq(true._yourself());
  51041. $self._assert_($11);
  51042. return self;
  51043. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51044. },
  51045. args: [],
  51046. 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)",
  51047. referencedClasses: [],
  51048. messageSends: ["deny:", "=", "assert:", "yourself"]
  51049. }),
  51050. $globals.BooleanTest);
  51051. $core.addMethod(
  51052. $core.method({
  51053. selector: "testIdentity",
  51054. protocol: "tests",
  51055. fn: function (){
  51056. var self=this,$self=this;
  51057. return $core.withContext(function($ctx1) {
  51058. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51059. $1=(0).__eq_eq(false);
  51060. $ctx1.sendIdx["=="]=1;
  51061. $self._deny_($1);
  51062. $ctx1.sendIdx["deny:"]=1;
  51063. $2=false.__eq_eq((0));
  51064. $ctx1.sendIdx["=="]=2;
  51065. $self._deny_($2);
  51066. $ctx1.sendIdx["deny:"]=2;
  51067. $3="".__eq_eq(false);
  51068. $ctx1.sendIdx["=="]=3;
  51069. $self._deny_($3);
  51070. $ctx1.sendIdx["deny:"]=3;
  51071. $4=false.__eq_eq("");
  51072. $ctx1.sendIdx["=="]=4;
  51073. $self._deny_($4);
  51074. $ctx1.sendIdx["deny:"]=4;
  51075. $5=true.__eq_eq(true);
  51076. $ctx1.sendIdx["=="]=5;
  51077. $self._assert_($5);
  51078. $ctx1.sendIdx["assert:"]=1;
  51079. $6=false.__eq_eq(true);
  51080. $ctx1.sendIdx["=="]=6;
  51081. $self._deny_($6);
  51082. $ctx1.sendIdx["deny:"]=5;
  51083. $7=true.__eq_eq(false);
  51084. $ctx1.sendIdx["=="]=7;
  51085. $self._deny_($7);
  51086. $8=false.__eq_eq(false);
  51087. $ctx1.sendIdx["=="]=8;
  51088. $self._assert_($8);
  51089. $ctx1.sendIdx["assert:"]=2;
  51090. $10=true._yourself();
  51091. $ctx1.sendIdx["yourself"]=1;
  51092. $9=$recv($10).__eq_eq(true);
  51093. $ctx1.sendIdx["=="]=9;
  51094. $self._assert_($9);
  51095. $ctx1.sendIdx["assert:"]=3;
  51096. $12=true._yourself();
  51097. $ctx1.sendIdx["yourself"]=2;
  51098. $11=$recv($12).__eq_eq(true._yourself());
  51099. $self._assert_($11);
  51100. return self;
  51101. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51102. },
  51103. args: [],
  51104. 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",
  51105. referencedClasses: [],
  51106. messageSends: ["deny:", "==", "assert:", "yourself"]
  51107. }),
  51108. $globals.BooleanTest);
  51109. $core.addMethod(
  51110. $core.method({
  51111. selector: "testIfTrueIfFalse",
  51112. protocol: "tests",
  51113. fn: function (){
  51114. var self=this,$self=this;
  51115. return $core.withContext(function($ctx1) {
  51116. var $1,$2,$3,$4,$5,$6,$7,$8;
  51117. if($core.assert(true)){
  51118. $1="alternative block";
  51119. }
  51120. $self._assert_equals_($1,"alternative block");
  51121. $ctx1.sendIdx["assert:equals:"]=1;
  51122. if(!$core.assert(true)){
  51123. $2="alternative block";
  51124. }
  51125. $self._assert_equals_($2,nil);
  51126. $ctx1.sendIdx["assert:equals:"]=2;
  51127. if($core.assert(false)){
  51128. $3="alternative block";
  51129. }
  51130. $self._assert_equals_($3,nil);
  51131. $ctx1.sendIdx["assert:equals:"]=3;
  51132. if(!$core.assert(false)){
  51133. $4="alternative block";
  51134. }
  51135. $self._assert_equals_($4,"alternative block");
  51136. $ctx1.sendIdx["assert:equals:"]=4;
  51137. if($core.assert(false)){
  51138. $5="alternative block";
  51139. } else {
  51140. $5="alternative block2";
  51141. }
  51142. $self._assert_equals_($5,"alternative block2");
  51143. $ctx1.sendIdx["assert:equals:"]=5;
  51144. if($core.assert(false)){
  51145. $6="alternative block2";
  51146. } else {
  51147. $6="alternative block";
  51148. }
  51149. $self._assert_equals_($6,"alternative block");
  51150. $ctx1.sendIdx["assert:equals:"]=6;
  51151. if($core.assert(true)){
  51152. $7="alternative block";
  51153. } else {
  51154. $7="alternative block2";
  51155. }
  51156. $self._assert_equals_($7,"alternative block");
  51157. $ctx1.sendIdx["assert:equals:"]=7;
  51158. if($core.assert(true)){
  51159. $8="alternative block2";
  51160. } else {
  51161. $8="alternative block";
  51162. }
  51163. $self._assert_equals_($8,"alternative block2");
  51164. return self;
  51165. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51166. },
  51167. args: [],
  51168. 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'.",
  51169. referencedClasses: [],
  51170. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51171. }),
  51172. $globals.BooleanTest);
  51173. $core.addMethod(
  51174. $core.method({
  51175. selector: "testIfTrueIfFalseWithBoxing",
  51176. protocol: "tests",
  51177. fn: function (){
  51178. var self=this,$self=this;
  51179. return $core.withContext(function($ctx1) {
  51180. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51181. $2=true._yourself();
  51182. $ctx1.sendIdx["yourself"]=1;
  51183. if($core.assert($2)){
  51184. $1="alternative block";
  51185. }
  51186. $self._assert_equals_($1,"alternative block");
  51187. $ctx1.sendIdx["assert:equals:"]=1;
  51188. $4=true._yourself();
  51189. $ctx1.sendIdx["yourself"]=2;
  51190. if(!$core.assert($4)){
  51191. $3="alternative block";
  51192. }
  51193. $self._assert_equals_($3,nil);
  51194. $ctx1.sendIdx["assert:equals:"]=2;
  51195. $6=false._yourself();
  51196. $ctx1.sendIdx["yourself"]=3;
  51197. if($core.assert($6)){
  51198. $5="alternative block";
  51199. }
  51200. $self._assert_equals_($5,nil);
  51201. $ctx1.sendIdx["assert:equals:"]=3;
  51202. $8=false._yourself();
  51203. $ctx1.sendIdx["yourself"]=4;
  51204. if(!$core.assert($8)){
  51205. $7="alternative block";
  51206. }
  51207. $self._assert_equals_($7,"alternative block");
  51208. $ctx1.sendIdx["assert:equals:"]=4;
  51209. $10=false._yourself();
  51210. $ctx1.sendIdx["yourself"]=5;
  51211. if($core.assert($10)){
  51212. $9="alternative block";
  51213. } else {
  51214. $9="alternative block2";
  51215. }
  51216. $self._assert_equals_($9,"alternative block2");
  51217. $ctx1.sendIdx["assert:equals:"]=5;
  51218. $12=false._yourself();
  51219. $ctx1.sendIdx["yourself"]=6;
  51220. if($core.assert($12)){
  51221. $11="alternative block2";
  51222. } else {
  51223. $11="alternative block";
  51224. }
  51225. $self._assert_equals_($11,"alternative block");
  51226. $ctx1.sendIdx["assert:equals:"]=6;
  51227. $14=true._yourself();
  51228. $ctx1.sendIdx["yourself"]=7;
  51229. if($core.assert($14)){
  51230. $13="alternative block";
  51231. } else {
  51232. $13="alternative block2";
  51233. }
  51234. $self._assert_equals_($13,"alternative block");
  51235. $ctx1.sendIdx["assert:equals:"]=7;
  51236. $16=true._yourself();
  51237. if($core.assert($16)){
  51238. $15="alternative block2";
  51239. } else {
  51240. $15="alternative block";
  51241. }
  51242. $self._assert_equals_($15,"alternative block2");
  51243. return self;
  51244. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51245. },
  51246. args: [],
  51247. 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'.",
  51248. referencedClasses: [],
  51249. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51250. }),
  51251. $globals.BooleanTest);
  51252. $core.addMethod(
  51253. $core.method({
  51254. selector: "testLogic",
  51255. protocol: "tests",
  51256. fn: function (){
  51257. var self=this,$self=this;
  51258. return $core.withContext(function($ctx1) {
  51259. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51260. $1=true.__and(true);
  51261. $ctx1.sendIdx["&"]=1;
  51262. $self._assert_($1);
  51263. $ctx1.sendIdx["assert:"]=1;
  51264. $2=true.__and(false);
  51265. $ctx1.sendIdx["&"]=2;
  51266. $self._deny_($2);
  51267. $ctx1.sendIdx["deny:"]=1;
  51268. $3=false.__and(true);
  51269. $ctx1.sendIdx["&"]=3;
  51270. $self._deny_($3);
  51271. $ctx1.sendIdx["deny:"]=2;
  51272. $5=false.__and(false);
  51273. $ctx1.sendIdx["&"]=4;
  51274. $4=$self._deny_($5);
  51275. $ctx1.sendIdx["deny:"]=3;
  51276. $6=true.__or(true);
  51277. $ctx1.sendIdx["|"]=1;
  51278. $self._assert_($6);
  51279. $ctx1.sendIdx["assert:"]=2;
  51280. $7=true.__or(false);
  51281. $ctx1.sendIdx["|"]=2;
  51282. $self._assert_($7);
  51283. $ctx1.sendIdx["assert:"]=3;
  51284. $8=false.__or(true);
  51285. $ctx1.sendIdx["|"]=3;
  51286. $self._assert_($8);
  51287. $ctx1.sendIdx["assert:"]=4;
  51288. $10=false.__or(false);
  51289. $ctx1.sendIdx["|"]=4;
  51290. $9=$self._deny_($10);
  51291. $ctx1.sendIdx["deny:"]=4;
  51292. $12=(1).__gt((0));
  51293. $ctx1.sendIdx[">"]=1;
  51294. $11=true.__and($12);
  51295. $ctx1.sendIdx["&"]=5;
  51296. $self._assert_($11);
  51297. $ctx1.sendIdx["assert:"]=5;
  51298. $14=(1).__gt((0));
  51299. $ctx1.sendIdx[">"]=2;
  51300. $13=$recv($14).__and(false);
  51301. $ctx1.sendIdx["&"]=6;
  51302. $self._deny_($13);
  51303. $ctx1.sendIdx["deny:"]=5;
  51304. $16=(1).__gt((0));
  51305. $ctx1.sendIdx[">"]=3;
  51306. $17=(1).__gt((2));
  51307. $ctx1.sendIdx[">"]=4;
  51308. $15=$recv($16).__and($17);
  51309. $self._deny_($15);
  51310. $19=(1).__gt((0));
  51311. $ctx1.sendIdx[">"]=5;
  51312. $18=false.__or($19);
  51313. $ctx1.sendIdx["|"]=5;
  51314. $self._assert_($18);
  51315. $ctx1.sendIdx["assert:"]=6;
  51316. $21=(1).__gt((0));
  51317. $ctx1.sendIdx[">"]=6;
  51318. $20=$recv($21).__or(false);
  51319. $ctx1.sendIdx["|"]=6;
  51320. $self._assert_($20);
  51321. $ctx1.sendIdx["assert:"]=7;
  51322. $23=(1).__gt((0));
  51323. $ctx1.sendIdx[">"]=7;
  51324. $22=$recv($23).__or((1).__gt((2)));
  51325. $self._assert_($22);
  51326. return self;
  51327. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51328. },
  51329. args: [],
  51330. 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))",
  51331. referencedClasses: [],
  51332. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51333. }),
  51334. $globals.BooleanTest);
  51335. $core.addMethod(
  51336. $core.method({
  51337. selector: "testLogicKeywords",
  51338. protocol: "tests",
  51339. fn: function (){
  51340. var self=this,$self=this;
  51341. return $core.withContext(function($ctx1) {
  51342. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51343. $1=true._and_((function(){
  51344. return true;
  51345. }));
  51346. $ctx1.sendIdx["and:"]=1;
  51347. $self._assert_($1);
  51348. $ctx1.sendIdx["assert:"]=1;
  51349. $2=true._and_((function(){
  51350. return false;
  51351. }));
  51352. $ctx1.sendIdx["and:"]=2;
  51353. $self._deny_($2);
  51354. $ctx1.sendIdx["deny:"]=1;
  51355. $3=false._and_((function(){
  51356. return true;
  51357. }));
  51358. $ctx1.sendIdx["and:"]=3;
  51359. $self._deny_($3);
  51360. $ctx1.sendIdx["deny:"]=2;
  51361. $5=false._and_((function(){
  51362. return false;
  51363. }));
  51364. $ctx1.sendIdx["and:"]=4;
  51365. $4=$self._deny_($5);
  51366. $ctx1.sendIdx["deny:"]=3;
  51367. $6=true._or_((function(){
  51368. return true;
  51369. }));
  51370. $ctx1.sendIdx["or:"]=1;
  51371. $self._assert_($6);
  51372. $ctx1.sendIdx["assert:"]=2;
  51373. $7=true._or_((function(){
  51374. return false;
  51375. }));
  51376. $ctx1.sendIdx["or:"]=2;
  51377. $self._assert_($7);
  51378. $ctx1.sendIdx["assert:"]=3;
  51379. $8=false._or_((function(){
  51380. return true;
  51381. }));
  51382. $ctx1.sendIdx["or:"]=3;
  51383. $self._assert_($8);
  51384. $ctx1.sendIdx["assert:"]=4;
  51385. $10=false._or_((function(){
  51386. return false;
  51387. }));
  51388. $ctx1.sendIdx["or:"]=4;
  51389. $9=$self._deny_($10);
  51390. $ctx1.sendIdx["deny:"]=4;
  51391. $11=true._and_((function(){
  51392. return $core.withContext(function($ctx2) {
  51393. return (1).__gt((0));
  51394. $ctx2.sendIdx[">"]=1;
  51395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51396. }));
  51397. $ctx1.sendIdx["and:"]=5;
  51398. $self._assert_($11);
  51399. $ctx1.sendIdx["assert:"]=5;
  51400. $13=(1).__gt((0));
  51401. $ctx1.sendIdx[">"]=2;
  51402. $12=$recv($13)._and_((function(){
  51403. return false;
  51404. }));
  51405. $ctx1.sendIdx["and:"]=6;
  51406. $self._deny_($12);
  51407. $ctx1.sendIdx["deny:"]=5;
  51408. $15=(1).__gt((0));
  51409. $ctx1.sendIdx[">"]=3;
  51410. $14=$recv($15)._and_((function(){
  51411. return $core.withContext(function($ctx2) {
  51412. return (1).__gt((2));
  51413. $ctx2.sendIdx[">"]=4;
  51414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51415. }));
  51416. $self._deny_($14);
  51417. $16=false._or_((function(){
  51418. return $core.withContext(function($ctx2) {
  51419. return (1).__gt((0));
  51420. $ctx2.sendIdx[">"]=5;
  51421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51422. }));
  51423. $ctx1.sendIdx["or:"]=5;
  51424. $self._assert_($16);
  51425. $ctx1.sendIdx["assert:"]=6;
  51426. $18=(1).__gt((0));
  51427. $ctx1.sendIdx[">"]=6;
  51428. $17=$recv($18)._or_((function(){
  51429. return false;
  51430. }));
  51431. $ctx1.sendIdx["or:"]=6;
  51432. $self._assert_($17);
  51433. $ctx1.sendIdx["assert:"]=7;
  51434. $20=(1).__gt((0));
  51435. $ctx1.sendIdx[">"]=7;
  51436. $19=$recv($20)._or_((function(){
  51437. return $core.withContext(function($ctx2) {
  51438. return (1).__gt((2));
  51439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51440. }));
  51441. $self._assert_($19);
  51442. return self;
  51443. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51444. },
  51445. args: [],
  51446. 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 ])",
  51447. referencedClasses: [],
  51448. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51449. }),
  51450. $globals.BooleanTest);
  51451. $core.addMethod(
  51452. $core.method({
  51453. selector: "testNonBooleanError",
  51454. protocol: "tests",
  51455. fn: function (){
  51456. var self=this,$self=this;
  51457. return $core.withContext(function($ctx1) {
  51458. $self._should_raise_((function(){
  51459. return $core.withContext(function($ctx2) {
  51460. if($core.assert("")){
  51461. } else {
  51462. }
  51463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51464. }),$globals.NonBooleanReceiver);
  51465. return self;
  51466. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51467. },
  51468. args: [],
  51469. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51470. referencedClasses: ["NonBooleanReceiver"],
  51471. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51472. }),
  51473. $globals.BooleanTest);
  51474. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51475. $core.addMethod(
  51476. $core.method({
  51477. selector: "setUp",
  51478. protocol: "running",
  51479. fn: function (){
  51480. var self=this,$self=this;
  51481. return $core.withContext(function($ctx1) {
  51482. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51483. return self;
  51484. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51485. },
  51486. args: [],
  51487. source: "setUp\x0a\x09builder := ClassBuilder new",
  51488. referencedClasses: ["ClassBuilder"],
  51489. messageSends: ["new"]
  51490. }),
  51491. $globals.ClassBuilderTest);
  51492. $core.addMethod(
  51493. $core.method({
  51494. selector: "tearDown",
  51495. protocol: "running",
  51496. fn: function (){
  51497. var self=this,$self=this;
  51498. return $core.withContext(function($ctx1) {
  51499. var $1,$receiver;
  51500. $1=$self["@theClass"];
  51501. if(($receiver = $1) == null || $receiver.a$nil){
  51502. $1;
  51503. } else {
  51504. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51505. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51506. $self["@theClass"]=nil;
  51507. $self["@theClass"];
  51508. }
  51509. return self;
  51510. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51511. },
  51512. args: [],
  51513. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51514. referencedClasses: ["Smalltalk"],
  51515. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51516. }),
  51517. $globals.ClassBuilderTest);
  51518. $core.addMethod(
  51519. $core.method({
  51520. selector: "testAddTrait",
  51521. protocol: "tests",
  51522. fn: function (){
  51523. var self=this,$self=this;
  51524. return $core.withContext(function($ctx1) {
  51525. var $3,$2,$1,$4;
  51526. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51527. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51528. $ctx1.sendIdx["assert:equals:"]=1;
  51529. $3=$recv($self["@theClass"])._package();
  51530. $ctx1.sendIdx["package"]=1;
  51531. $2=$recv($3)._classes();
  51532. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51533. $self._assert_equals_($1,(1));
  51534. $ctx1.sendIdx["assert:equals:"]=2;
  51535. $4=$recv($self["@theClass"])._package();
  51536. $ctx1.sendIdx["package"]=2;
  51537. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51538. return self;
  51539. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51540. },
  51541. args: [],
  51542. 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",
  51543. referencedClasses: ["ObjectMock"],
  51544. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51545. }),
  51546. $globals.ClassBuilderTest);
  51547. $core.addMethod(
  51548. $core.method({
  51549. selector: "testClassCopy",
  51550. protocol: "tests",
  51551. fn: function (){
  51552. var self=this,$self=this;
  51553. return $core.withContext(function($ctx1) {
  51554. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51555. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51556. $2=$recv($self["@theClass"])._superclass();
  51557. $ctx1.sendIdx["superclass"]=1;
  51558. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51559. $ctx1.sendIdx["=="]=1;
  51560. $self._assert_($1);
  51561. $ctx1.sendIdx["assert:"]=1;
  51562. $4=$recv($self["@theClass"])._instanceVariableNames();
  51563. $ctx1.sendIdx["instanceVariableNames"]=1;
  51564. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51565. $ctx1.sendIdx["=="]=2;
  51566. $self._assert_($3);
  51567. $ctx1.sendIdx["assert:"]=2;
  51568. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51569. $ctx1.sendIdx["assert:equals:"]=1;
  51570. $6=$recv($self["@theClass"])._package();
  51571. $ctx1.sendIdx["package"]=1;
  51572. $7=$recv($globals.ObjectMock)._package();
  51573. $ctx1.sendIdx["package"]=2;
  51574. $5=$recv($6).__eq_eq($7);
  51575. $self._assert_($5);
  51576. $ctx1.sendIdx["assert:"]=3;
  51577. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51578. $9=$recv($self["@theClass"])._methodDictionary();
  51579. $ctx1.sendIdx["methodDictionary"]=1;
  51580. $8=$recv($9)._keys();
  51581. $ctx1.sendIdx["keys"]=1;
  51582. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51583. return self;
  51584. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51585. },
  51586. args: [],
  51587. 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",
  51588. referencedClasses: ["ObjectMock"],
  51589. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51590. }),
  51591. $globals.ClassBuilderTest);
  51592. $core.addMethod(
  51593. $core.method({
  51594. selector: "testClassMigration",
  51595. protocol: "tests",
  51596. fn: function (){
  51597. var self=this,$self=this;
  51598. var instance,oldClass;
  51599. return $core.withContext(function($ctx1) {
  51600. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51601. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51602. $2=$recv($globals.Smalltalk)._globals();
  51603. $ctx1.sendIdx["globals"]=1;
  51604. $1=$recv($2)._at_("ObjectMock2");
  51605. $ctx1.sendIdx["at:"]=1;
  51606. instance=$recv($1)._new();
  51607. $4=$recv($globals.Smalltalk)._globals();
  51608. $ctx1.sendIdx["globals"]=2;
  51609. $3=$recv($4)._at_("ObjectMock2");
  51610. $ctx1.sendIdx["at:"]=2;
  51611. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51612. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51613. $ctx1.sendIdx["=="]=1;
  51614. $self._deny_($5);
  51615. $ctx1.sendIdx["deny:"]=1;
  51616. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51617. $ctx1.sendIdx["=="]=2;
  51618. $self._assert_($6);
  51619. $ctx1.sendIdx["assert:"]=1;
  51620. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51621. $ctx1.sendIdx["assert:"]=2;
  51622. $7=$recv($globals.ObjectMock2)._selectors();
  51623. $ctx1.sendIdx["selectors"]=1;
  51624. $self._assert_equals_($7,$recv(oldClass)._selectors());
  51625. $ctx1.sendIdx["assert:equals:"]=1;
  51626. $8=$recv($globals.ObjectMock2)._comment();
  51627. $ctx1.sendIdx["comment"]=1;
  51628. $self._assert_equals_($8,$recv(oldClass)._comment());
  51629. $ctx1.sendIdx["assert:equals:"]=2;
  51630. $10=$recv($globals.ObjectMock2)._package();
  51631. $ctx1.sendIdx["package"]=1;
  51632. $9=$recv($10)._name();
  51633. $ctx1.sendIdx["name"]=1;
  51634. $self._assert_equals_($9,"Kernel-Tests");
  51635. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  51636. $ctx1.sendIdx["assert:"]=3;
  51637. $12=$recv(instance)._class();
  51638. $ctx1.sendIdx["class"]=1;
  51639. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  51640. $self._deny_($11);
  51641. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  51642. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51643. return self;
  51644. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  51645. },
  51646. args: [],
  51647. 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",
  51648. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  51649. 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:"]
  51650. }),
  51651. $globals.ClassBuilderTest);
  51652. $core.addMethod(
  51653. $core.method({
  51654. selector: "testClassMigrationWithClassInstanceVariables",
  51655. protocol: "tests",
  51656. fn: function (){
  51657. var self=this,$self=this;
  51658. return $core.withContext(function($ctx1) {
  51659. var $1;
  51660. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51661. $1=$recv($globals.ObjectMock2)._class();
  51662. $ctx1.sendIdx["class"]=1;
  51663. $recv($1)._instanceVariableNames_("foo bar");
  51664. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51665. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  51666. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  51667. return self;
  51668. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  51669. },
  51670. args: [],
  51671. 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",
  51672. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  51673. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  51674. }),
  51675. $globals.ClassBuilderTest);
  51676. $core.addMethod(
  51677. $core.method({
  51678. selector: "testClassMigrationWithSubclasses",
  51679. protocol: "tests",
  51680. fn: function (){
  51681. var self=this,$self=this;
  51682. return $core.withContext(function($ctx1) {
  51683. var $2,$1,$4,$3;
  51684. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51685. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  51686. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  51687. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  51688. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  51689. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  51690. $2=$recv($globals.ObjectMock)._subclasses();
  51691. $ctx1.sendIdx["subclasses"]=1;
  51692. $1=$recv($2)._includes_($globals.ObjectMock2);
  51693. $ctx1.sendIdx["includes:"]=1;
  51694. $self._assert_($1);
  51695. $ctx1.sendIdx["assert:"]=1;
  51696. $4=$recv($globals.ObjectMock2)._subclasses();
  51697. $ctx1.sendIdx["subclasses"]=2;
  51698. $3=$recv($4)._includes_($globals.ObjectMock3);
  51699. $ctx1.sendIdx["includes:"]=2;
  51700. $self._assert_($3);
  51701. $ctx1.sendIdx["assert:"]=2;
  51702. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  51703. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  51704. return $core.withContext(function($ctx2) {
  51705. return $recv($globals.Smalltalk)._removeClass_(each);
  51706. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51707. }));
  51708. return self;
  51709. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  51710. },
  51711. args: [],
  51712. 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 ]",
  51713. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  51714. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  51715. }),
  51716. $globals.ClassBuilderTest);
  51717. $core.addMethod(
  51718. $core.method({
  51719. selector: "testInstanceVariableNames",
  51720. protocol: "tests",
  51721. fn: function (){
  51722. var self=this,$self=this;
  51723. return $core.withContext(function($ctx1) {
  51724. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  51725. return self;
  51726. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  51727. },
  51728. args: [],
  51729. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  51730. referencedClasses: [],
  51731. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  51732. }),
  51733. $globals.ClassBuilderTest);
  51734. $core.addMethod(
  51735. $core.method({
  51736. selector: "testSubclass",
  51737. protocol: "tests",
  51738. fn: function (){
  51739. var self=this,$self=this;
  51740. return $core.withContext(function($ctx1) {
  51741. var $3,$2,$1,$4;
  51742. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  51743. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  51744. $ctx1.sendIdx["assert:equals:"]=1;
  51745. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  51746. $ctx1.sendIdx["assert:equals:"]=2;
  51747. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51748. $ctx1.sendIdx["assert:equals:"]=3;
  51749. $3=$recv($self["@theClass"])._package();
  51750. $ctx1.sendIdx["package"]=1;
  51751. $2=$recv($3)._classes();
  51752. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51753. $self._assert_equals_($1,(1));
  51754. $ctx1.sendIdx["assert:equals:"]=4;
  51755. $4=$recv($self["@theClass"])._package();
  51756. $ctx1.sendIdx["package"]=2;
  51757. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51758. $ctx1.sendIdx["assert:equals:"]=5;
  51759. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  51760. return self;
  51761. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  51762. },
  51763. args: [],
  51764. 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",
  51765. referencedClasses: ["ObjectMock"],
  51766. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  51767. }),
  51768. $globals.ClassBuilderTest);
  51769. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51770. $core.addMethod(
  51771. $core.method({
  51772. selector: "jsConstructor",
  51773. protocol: "running",
  51774. fn: function (){
  51775. var self=this,$self=this;
  51776. return $core.withContext(function($ctx1) {
  51777. function Foo(){}
  51778. Foo.prototype.valueOf = function () {return 4;};
  51779. return Foo;
  51780. ;
  51781. return self;
  51782. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  51783. },
  51784. args: [],
  51785. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  51786. referencedClasses: [],
  51787. messageSends: []
  51788. }),
  51789. $globals.ClassTest);
  51790. $core.addMethod(
  51791. $core.method({
  51792. selector: "setUp",
  51793. protocol: "running",
  51794. fn: function (){
  51795. var self=this,$self=this;
  51796. return $core.withContext(function($ctx1) {
  51797. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51798. return self;
  51799. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  51800. },
  51801. args: [],
  51802. source: "setUp\x0a\x09builder := ClassBuilder new",
  51803. referencedClasses: ["ClassBuilder"],
  51804. messageSends: ["new"]
  51805. }),
  51806. $globals.ClassTest);
  51807. $core.addMethod(
  51808. $core.method({
  51809. selector: "tearDown",
  51810. protocol: "running",
  51811. fn: function (){
  51812. var self=this,$self=this;
  51813. return $core.withContext(function($ctx1) {
  51814. var $1,$receiver;
  51815. $1=$self["@theClass"];
  51816. if(($receiver = $1) == null || $receiver.a$nil){
  51817. $1;
  51818. } else {
  51819. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  51820. return $core.withContext(function($ctx2) {
  51821. return $recv($globals.Smalltalk)._removeClass_(each);
  51822. $ctx2.sendIdx["removeClass:"]=1;
  51823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51824. }));
  51825. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51826. $self["@theClass"]=nil;
  51827. $self["@theClass"];
  51828. }
  51829. return self;
  51830. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  51831. },
  51832. args: [],
  51833. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  51834. referencedClasses: ["Smalltalk"],
  51835. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  51836. }),
  51837. $globals.ClassTest);
  51838. $core.addMethod(
  51839. $core.method({
  51840. selector: "testAllSubclasses",
  51841. protocol: "tests",
  51842. fn: function (){
  51843. var self=this,$self=this;
  51844. var subclasses,index;
  51845. return $core.withContext(function($ctx1) {
  51846. subclasses=$recv($globals.Object)._subclasses();
  51847. $ctx1.sendIdx["subclasses"]=1;
  51848. index=(1);
  51849. $recv((function(){
  51850. return $core.withContext(function($ctx2) {
  51851. return $recv(index).__gt($recv(subclasses)._size());
  51852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51853. }))._whileFalse_((function(){
  51854. return $core.withContext(function($ctx2) {
  51855. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  51856. index=$recv(index).__plus((1));
  51857. return index;
  51858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51859. }));
  51860. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  51861. return self;
  51862. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  51863. },
  51864. args: [],
  51865. 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",
  51866. referencedClasses: ["Object"],
  51867. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  51868. }),
  51869. $globals.ClassTest);
  51870. $core.addMethod(
  51871. $core.method({
  51872. selector: "testMetaclassSubclasses",
  51873. protocol: "tests",
  51874. fn: function (){
  51875. var self=this,$self=this;
  51876. var subclasses;
  51877. return $core.withContext(function($ctx1) {
  51878. var $4,$3,$2,$1;
  51879. $4=$recv($globals.Object)._class();
  51880. $ctx1.sendIdx["class"]=1;
  51881. $3=$recv($4)._instanceClass();
  51882. $2=$recv($3)._subclasses();
  51883. $ctx1.sendIdx["subclasses"]=1;
  51884. $1=$recv($2)._select_((function(each){
  51885. return $core.withContext(function($ctx2) {
  51886. return $recv($recv(each)._isMetaclass())._not();
  51887. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  51888. }));
  51889. subclasses=$recv($1)._collect_((function(each){
  51890. return $core.withContext(function($ctx2) {
  51891. return $recv(each)._theMetaClass();
  51892. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  51893. }));
  51894. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  51895. return self;
  51896. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  51897. },
  51898. args: [],
  51899. 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",
  51900. referencedClasses: ["Object"],
  51901. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  51902. }),
  51903. $globals.ClassTest);
  51904. $core.addMethod(
  51905. $core.method({
  51906. selector: "testSetJavaScriptConstructor",
  51907. protocol: "tests",
  51908. fn: function (){
  51909. var self=this,$self=this;
  51910. var instance;
  51911. return $core.withContext(function($ctx1) {
  51912. var $2,$1,$4,$3,$6,$5,$8,$7;
  51913. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51914. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  51915. $2=$recv($self["@theClass"])._superclass();
  51916. $ctx1.sendIdx["superclass"]=1;
  51917. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51918. $ctx1.sendIdx["=="]=1;
  51919. $self._assert_($1);
  51920. $ctx1.sendIdx["assert:"]=1;
  51921. $4=$recv($self["@theClass"])._instanceVariableNames();
  51922. $ctx1.sendIdx["instanceVariableNames"]=1;
  51923. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51924. $ctx1.sendIdx["=="]=2;
  51925. $self._assert_($3);
  51926. $ctx1.sendIdx["assert:"]=2;
  51927. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51928. $ctx1.sendIdx["assert:equals:"]=1;
  51929. $6=$recv($self["@theClass"])._package();
  51930. $ctx1.sendIdx["package"]=1;
  51931. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  51932. $ctx1.sendIdx["=="]=3;
  51933. $self._assert_($5);
  51934. $ctx1.sendIdx["assert:"]=3;
  51935. $8=$recv($self["@theClass"])._methodDictionary();
  51936. $ctx1.sendIdx["methodDictionary"]=1;
  51937. $7=$recv($8)._keys();
  51938. $ctx1.sendIdx["keys"]=1;
  51939. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51940. $ctx1.sendIdx["assert:equals:"]=2;
  51941. instance=$recv($self["@theClass"])._new();
  51942. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  51943. $self._assert_equals_($recv(instance)._value(),(4));
  51944. $ctx1.sendIdx["assert:equals:"]=3;
  51945. $self._shouldnt_raise_((function(){
  51946. return $core.withContext(function($ctx2) {
  51947. return $recv(instance)._foo_((9));
  51948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51949. }),$globals.Error);
  51950. $self._assert_equals_($recv(instance)._foo(),(9));
  51951. return self;
  51952. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  51953. },
  51954. args: [],
  51955. 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",
  51956. referencedClasses: ["ObjectMock", "Error"],
  51957. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  51958. }),
  51959. $globals.ClassTest);
  51960. $core.addMethod(
  51961. $core.method({
  51962. selector: "testTrickySetJavaScriptConstructor",
  51963. protocol: "tests",
  51964. fn: function (){
  51965. var self=this,$self=this;
  51966. var instance;
  51967. return $core.withContext(function($ctx1) {
  51968. var $2,$1,$4,$3,$6,$5,$8,$7;
  51969. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51970. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  51971. $2=$recv($self["@theClass"])._superclass();
  51972. $ctx1.sendIdx["superclass"]=1;
  51973. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51974. $ctx1.sendIdx["=="]=1;
  51975. $self._assert_($1);
  51976. $ctx1.sendIdx["assert:"]=1;
  51977. $4=$recv($self["@theClass"])._instanceVariableNames();
  51978. $ctx1.sendIdx["instanceVariableNames"]=1;
  51979. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51980. $ctx1.sendIdx["=="]=2;
  51981. $self._assert_($3);
  51982. $ctx1.sendIdx["assert:"]=2;
  51983. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51984. $ctx1.sendIdx["assert:equals:"]=1;
  51985. $6=$recv($self["@theClass"])._package();
  51986. $ctx1.sendIdx["package"]=1;
  51987. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  51988. $ctx1.sendIdx["=="]=3;
  51989. $self._assert_($5);
  51990. $ctx1.sendIdx["assert:"]=3;
  51991. $8=$recv($self["@theClass"])._methodDictionary();
  51992. $ctx1.sendIdx["methodDictionary"]=1;
  51993. $7=$recv($8)._keys();
  51994. $ctx1.sendIdx["keys"]=1;
  51995. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51996. $ctx1.sendIdx["assert:equals:"]=2;
  51997. instance=$recv($self["@theClass"])._new();
  51998. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  51999. $self._assert_equals_($recv(instance)._value(),(4));
  52000. $ctx1.sendIdx["assert:equals:"]=3;
  52001. $self._shouldnt_raise_((function(){
  52002. return $core.withContext(function($ctx2) {
  52003. return $recv(instance)._foo_((9));
  52004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52005. }),$globals.Error);
  52006. $self._assert_equals_($recv(instance)._foo(),(9));
  52007. return self;
  52008. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52009. },
  52010. args: [],
  52011. 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",
  52012. referencedClasses: ["ObjectMock", "Error"],
  52013. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52014. }),
  52015. $globals.ClassTest);
  52016. $core.addMethod(
  52017. $core.method({
  52018. selector: "trickyJsConstructor",
  52019. protocol: "running",
  52020. fn: function (){
  52021. var self=this,$self=this;
  52022. return $core.withContext(function($ctx1) {
  52023. function Foo(){}
  52024. Foo.prototype.valueOf = function () {return 4;};
  52025. Foo.prototype._foo = function () {return "bar";};
  52026. return Foo;
  52027. ;
  52028. return self;
  52029. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52030. },
  52031. args: [],
  52032. 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'>",
  52033. referencedClasses: [],
  52034. messageSends: []
  52035. }),
  52036. $globals.ClassTest);
  52037. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52038. $core.addMethod(
  52039. $core.method({
  52040. selector: "assertSameContents:as:",
  52041. protocol: "convenience",
  52042. fn: function (aCollection,anotherCollection){
  52043. var self=this,$self=this;
  52044. return $core.withContext(function($ctx1) {
  52045. var $2,$1,$4,$3;
  52046. $2=$recv(aCollection)._size();
  52047. $ctx1.sendIdx["size"]=1;
  52048. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52049. $ctx1.sendIdx["="]=1;
  52050. $self._assert_($1);
  52051. $ctx1.sendIdx["assert:"]=1;
  52052. $recv(aCollection)._do_((function(each){
  52053. return $core.withContext(function($ctx2) {
  52054. $4=$recv(aCollection)._occurrencesOf_(each);
  52055. $ctx2.sendIdx["occurrencesOf:"]=1;
  52056. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52057. return $self._assert_($3);
  52058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52059. }));
  52060. return self;
  52061. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52062. },
  52063. args: ["aCollection", "anotherCollection"],
  52064. 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)) ]",
  52065. referencedClasses: [],
  52066. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52067. }),
  52068. $globals.CollectionTest);
  52069. $core.addMethod(
  52070. $core.method({
  52071. selector: "collection",
  52072. protocol: "fixture",
  52073. fn: function (){
  52074. var self=this,$self=this;
  52075. return $core.withContext(function($ctx1) {
  52076. $self._subclassResponsibility();
  52077. return self;
  52078. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52079. },
  52080. args: [],
  52081. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52082. referencedClasses: [],
  52083. messageSends: ["subclassResponsibility"]
  52084. }),
  52085. $globals.CollectionTest);
  52086. $core.addMethod(
  52087. $core.method({
  52088. selector: "collectionClass",
  52089. protocol: "fixture",
  52090. fn: function (){
  52091. var self=this,$self=this;
  52092. return $core.withContext(function($ctx1) {
  52093. return $recv($self._class())._collectionClass();
  52094. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52095. },
  52096. args: [],
  52097. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52098. referencedClasses: [],
  52099. messageSends: ["collectionClass", "class"]
  52100. }),
  52101. $globals.CollectionTest);
  52102. $core.addMethod(
  52103. $core.method({
  52104. selector: "collectionOfPrintStrings",
  52105. protocol: "fixture",
  52106. fn: function (){
  52107. var self=this,$self=this;
  52108. return $core.withContext(function($ctx1) {
  52109. $self._subclassResponsibility();
  52110. return self;
  52111. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52112. },
  52113. args: [],
  52114. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52115. referencedClasses: [],
  52116. messageSends: ["subclassResponsibility"]
  52117. }),
  52118. $globals.CollectionTest);
  52119. $core.addMethod(
  52120. $core.method({
  52121. selector: "collectionSize",
  52122. protocol: "fixture",
  52123. fn: function (){
  52124. var self=this,$self=this;
  52125. return $core.withContext(function($ctx1) {
  52126. $self._subclassResponsibility();
  52127. return self;
  52128. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52129. },
  52130. args: [],
  52131. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52132. referencedClasses: [],
  52133. messageSends: ["subclassResponsibility"]
  52134. }),
  52135. $globals.CollectionTest);
  52136. $core.addMethod(
  52137. $core.method({
  52138. selector: "collectionWithDuplicates",
  52139. protocol: "fixture",
  52140. fn: function (){
  52141. var self=this,$self=this;
  52142. return $core.withContext(function($ctx1) {
  52143. $self._subclassResponsibility();
  52144. return self;
  52145. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52146. },
  52147. args: [],
  52148. 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",
  52149. referencedClasses: [],
  52150. messageSends: ["subclassResponsibility"]
  52151. }),
  52152. $globals.CollectionTest);
  52153. $core.addMethod(
  52154. $core.method({
  52155. selector: "collectionWithNewValue",
  52156. protocol: "fixture",
  52157. fn: function (){
  52158. var self=this,$self=this;
  52159. return $core.withContext(function($ctx1) {
  52160. $self._subclassResponsibility();
  52161. return self;
  52162. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52163. },
  52164. args: [],
  52165. 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",
  52166. referencedClasses: [],
  52167. messageSends: ["subclassResponsibility"]
  52168. }),
  52169. $globals.CollectionTest);
  52170. $core.addMethod(
  52171. $core.method({
  52172. selector: "initialize",
  52173. protocol: "initialization",
  52174. fn: function (){
  52175. var self=this,$self=this;
  52176. return $core.withContext(function($ctx1) {
  52177. (
  52178. $ctx1.supercall = true,
  52179. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52180. $ctx1.supercall = false;
  52181. $self["@sampleBlock"]=(function(){
  52182. });
  52183. return self;
  52184. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52185. },
  52186. args: [],
  52187. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52188. referencedClasses: [],
  52189. messageSends: ["initialize"]
  52190. }),
  52191. $globals.CollectionTest);
  52192. $core.addMethod(
  52193. $core.method({
  52194. selector: "sampleNewValue",
  52195. protocol: "fixture",
  52196. fn: function (){
  52197. var self=this,$self=this;
  52198. return "N";
  52199. },
  52200. args: [],
  52201. 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'",
  52202. referencedClasses: [],
  52203. messageSends: []
  52204. }),
  52205. $globals.CollectionTest);
  52206. $core.addMethod(
  52207. $core.method({
  52208. selector: "sampleNewValueAsCollection",
  52209. protocol: "fixture",
  52210. fn: function (){
  52211. var self=this,$self=this;
  52212. return $core.withContext(function($ctx1) {
  52213. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52214. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52215. },
  52216. args: [],
  52217. 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",
  52218. referencedClasses: [],
  52219. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52220. }),
  52221. $globals.CollectionTest);
  52222. $core.addMethod(
  52223. $core.method({
  52224. selector: "testAddAll",
  52225. protocol: "tests",
  52226. fn: function (){
  52227. var self=this,$self=this;
  52228. return $core.withContext(function($ctx1) {
  52229. 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;
  52230. $2=$self._collection();
  52231. $ctx1.sendIdx["collection"]=1;
  52232. $4=$self._collectionClass();
  52233. $ctx1.sendIdx["collectionClass"]=1;
  52234. $3=$recv($4)._new();
  52235. $ctx1.sendIdx["new"]=1;
  52236. $recv($2)._addAll_($3);
  52237. $ctx1.sendIdx["addAll:"]=1;
  52238. $5=$recv($2)._yourself();
  52239. $ctx1.sendIdx["yourself"]=1;
  52240. $1=$5;
  52241. $6=$self._collection();
  52242. $ctx1.sendIdx["collection"]=2;
  52243. $self._assert_equals_($1,$6);
  52244. $ctx1.sendIdx["assert:equals:"]=1;
  52245. $9=$self._collectionClass();
  52246. $ctx1.sendIdx["collectionClass"]=2;
  52247. $8=$recv($9)._new();
  52248. $ctx1.sendIdx["new"]=2;
  52249. $10=$self._collection();
  52250. $ctx1.sendIdx["collection"]=3;
  52251. $recv($8)._addAll_($10);
  52252. $ctx1.sendIdx["addAll:"]=2;
  52253. $11=$recv($8)._yourself();
  52254. $ctx1.sendIdx["yourself"]=2;
  52255. $7=$11;
  52256. $12=$self._collection();
  52257. $ctx1.sendIdx["collection"]=4;
  52258. $self._assert_equals_($7,$12);
  52259. $ctx1.sendIdx["assert:equals:"]=2;
  52260. $15=$self._collectionClass();
  52261. $ctx1.sendIdx["collectionClass"]=3;
  52262. $14=$recv($15)._new();
  52263. $ctx1.sendIdx["new"]=3;
  52264. $17=$self._collectionClass();
  52265. $ctx1.sendIdx["collectionClass"]=4;
  52266. $16=$recv($17)._new();
  52267. $ctx1.sendIdx["new"]=4;
  52268. $recv($14)._addAll_($16);
  52269. $ctx1.sendIdx["addAll:"]=3;
  52270. $18=$recv($14)._yourself();
  52271. $ctx1.sendIdx["yourself"]=3;
  52272. $13=$18;
  52273. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52274. $ctx1.sendIdx["assert:equals:"]=3;
  52275. $20=$self._collection();
  52276. $ctx1.sendIdx["collection"]=5;
  52277. $21=$self._sampleNewValueAsCollection();
  52278. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52279. $recv($20)._addAll_($21);
  52280. $ctx1.sendIdx["addAll:"]=4;
  52281. $22=$recv($20)._yourself();
  52282. $ctx1.sendIdx["yourself"]=4;
  52283. $19=$22;
  52284. $23=$self._collectionWithNewValue();
  52285. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52286. $self._assert_equals_($19,$23);
  52287. $25=$self._sampleNewValueAsCollection();
  52288. $recv($25)._addAll_($self._collection());
  52289. $24=$recv($25)._yourself();
  52290. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52291. return self;
  52292. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52293. },
  52294. args: [],
  52295. 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",
  52296. referencedClasses: [],
  52297. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52298. }),
  52299. $globals.CollectionTest);
  52300. $core.addMethod(
  52301. $core.method({
  52302. selector: "testAllSatisfy",
  52303. protocol: "tests",
  52304. fn: function (){
  52305. var self=this,$self=this;
  52306. var collection,anyOne;
  52307. return $core.withContext(function($ctx1) {
  52308. var $1;
  52309. collection=$self._collection();
  52310. anyOne=$recv(collection)._anyOne();
  52311. $1=$recv(collection)._allSatisfy_((function(each){
  52312. return $core.withContext(function($ctx2) {
  52313. return $recv(collection)._includes_(each);
  52314. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52315. }));
  52316. $ctx1.sendIdx["allSatisfy:"]=1;
  52317. $self._assert_($1);
  52318. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52319. return $core.withContext(function($ctx2) {
  52320. return $recv(each).__tild_eq(anyOne);
  52321. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52322. })));
  52323. return self;
  52324. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52325. },
  52326. args: [],
  52327. 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 ])",
  52328. referencedClasses: [],
  52329. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52330. }),
  52331. $globals.CollectionTest);
  52332. $core.addMethod(
  52333. $core.method({
  52334. selector: "testAnyOne",
  52335. protocol: "tests",
  52336. fn: function (){
  52337. var self=this,$self=this;
  52338. return $core.withContext(function($ctx1) {
  52339. var $2,$1;
  52340. $self._should_raise_((function(){
  52341. return $core.withContext(function($ctx2) {
  52342. return $recv($recv($self._collectionClass())._new())._anyOne();
  52343. $ctx2.sendIdx["anyOne"]=1;
  52344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52345. }),$globals.Error);
  52346. $2=$self._collection();
  52347. $ctx1.sendIdx["collection"]=1;
  52348. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52349. $self._assert_($1);
  52350. return self;
  52351. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52352. },
  52353. args: [],
  52354. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52355. referencedClasses: ["Error"],
  52356. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52357. }),
  52358. $globals.CollectionTest);
  52359. $core.addMethod(
  52360. $core.method({
  52361. selector: "testAnySatisfy",
  52362. protocol: "tests",
  52363. fn: function (){
  52364. var self=this,$self=this;
  52365. var anyOne;
  52366. return $core.withContext(function($ctx1) {
  52367. var $1,$3,$2;
  52368. $1=$self._collection();
  52369. $ctx1.sendIdx["collection"]=1;
  52370. anyOne=$recv($1)._anyOne();
  52371. $3=$self._collection();
  52372. $ctx1.sendIdx["collection"]=2;
  52373. $2=$recv($3)._anySatisfy_((function(each){
  52374. return $core.withContext(function($ctx2) {
  52375. return $recv(each).__eq(anyOne);
  52376. $ctx2.sendIdx["="]=1;
  52377. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52378. }));
  52379. $ctx1.sendIdx["anySatisfy:"]=1;
  52380. $self._assert_($2);
  52381. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52382. return $core.withContext(function($ctx2) {
  52383. return $recv(each).__eq($recv($globals.Object)._new());
  52384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52385. })));
  52386. return self;
  52387. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52388. },
  52389. args: [],
  52390. 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 ])",
  52391. referencedClasses: ["Object"],
  52392. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52393. }),
  52394. $globals.CollectionTest);
  52395. $core.addMethod(
  52396. $core.method({
  52397. selector: "testAsArray",
  52398. protocol: "tests",
  52399. fn: function (){
  52400. var self=this,$self=this;
  52401. return $core.withContext(function($ctx1) {
  52402. var $1;
  52403. $1=$self._collection();
  52404. $ctx1.sendIdx["collection"]=1;
  52405. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52406. return self;
  52407. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52408. },
  52409. args: [],
  52410. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52411. referencedClasses: [],
  52412. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52413. }),
  52414. $globals.CollectionTest);
  52415. $core.addMethod(
  52416. $core.method({
  52417. selector: "testAsOrderedCollection",
  52418. protocol: "tests",
  52419. fn: function (){
  52420. var self=this,$self=this;
  52421. return $core.withContext(function($ctx1) {
  52422. var $1;
  52423. $1=$self._collection();
  52424. $ctx1.sendIdx["collection"]=1;
  52425. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52426. return self;
  52427. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52428. },
  52429. args: [],
  52430. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52431. referencedClasses: [],
  52432. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52433. }),
  52434. $globals.CollectionTest);
  52435. $core.addMethod(
  52436. $core.method({
  52437. selector: "testAsSet",
  52438. protocol: "tests",
  52439. fn: function (){
  52440. var self=this,$self=this;
  52441. var c,set;
  52442. return $core.withContext(function($ctx1) {
  52443. c=$self._collectionWithDuplicates();
  52444. set=$recv(c)._asSet();
  52445. $self._assert_equals_($recv(set)._size(),(6));
  52446. $recv(c)._do_((function(each){
  52447. return $core.withContext(function($ctx2) {
  52448. return $self._assert_($recv(set)._includes_(each));
  52449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52450. }));
  52451. return self;
  52452. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52453. },
  52454. args: [],
  52455. 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) ]",
  52456. referencedClasses: [],
  52457. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52458. }),
  52459. $globals.CollectionTest);
  52460. $core.addMethod(
  52461. $core.method({
  52462. selector: "testCollect",
  52463. protocol: "tests",
  52464. fn: function (){
  52465. var self=this,$self=this;
  52466. return $core.withContext(function($ctx1) {
  52467. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52468. $2=$self._collection();
  52469. $ctx1.sendIdx["collection"]=1;
  52470. $1=$recv($2)._collect_((function(each){
  52471. return each;
  52472. }));
  52473. $ctx1.sendIdx["collect:"]=1;
  52474. $3=$self._collection();
  52475. $ctx1.sendIdx["collection"]=2;
  52476. $self._assert_equals_($1,$3);
  52477. $ctx1.sendIdx["assert:equals:"]=1;
  52478. $5=$self._collectionWithNewValue();
  52479. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52480. $4=$recv($5)._collect_((function(each){
  52481. return each;
  52482. }));
  52483. $ctx1.sendIdx["collect:"]=2;
  52484. $self._assert_equals_($4,$self._collectionWithNewValue());
  52485. $ctx1.sendIdx["assert:equals:"]=2;
  52486. $8=$self._collectionClass();
  52487. $ctx1.sendIdx["collectionClass"]=1;
  52488. $7=$recv($8)._new();
  52489. $ctx1.sendIdx["new"]=1;
  52490. $6=$recv($7)._collect_((function(each){
  52491. return $core.withContext(function($ctx2) {
  52492. return $recv(each)._printString();
  52493. $ctx2.sendIdx["printString"]=1;
  52494. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52495. }));
  52496. $ctx1.sendIdx["collect:"]=3;
  52497. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52498. $ctx1.sendIdx["assert:equals:"]=3;
  52499. $11=$self._collection();
  52500. $ctx1.sendIdx["collection"]=3;
  52501. $10=$recv($11)._collect_((function(){
  52502. return $core.withContext(function($ctx2) {
  52503. return $self._sampleNewValue();
  52504. $ctx2.sendIdx["sampleNewValue"]=1;
  52505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52506. }));
  52507. $ctx1.sendIdx["collect:"]=4;
  52508. $9=$recv($10)._detect_((function(){
  52509. return true;
  52510. }));
  52511. $self._assert_equals_($9,$self._sampleNewValue());
  52512. $ctx1.sendIdx["assert:equals:"]=4;
  52513. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52514. return $core.withContext(function($ctx2) {
  52515. return $recv(each)._printString();
  52516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52517. })),$self._collectionOfPrintStrings());
  52518. return self;
  52519. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52520. },
  52521. args: [],
  52522. 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",
  52523. referencedClasses: [],
  52524. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52525. }),
  52526. $globals.CollectionTest);
  52527. $core.addMethod(
  52528. $core.method({
  52529. selector: "testComma",
  52530. protocol: "tests",
  52531. fn: function (){
  52532. var self=this,$self=this;
  52533. return $core.withContext(function($ctx1) {
  52534. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52535. $2=$self._collection();
  52536. $ctx1.sendIdx["collection"]=1;
  52537. $4=$self._collectionClass();
  52538. $ctx1.sendIdx["collectionClass"]=1;
  52539. $3=$recv($4)._new();
  52540. $ctx1.sendIdx["new"]=1;
  52541. $1=$recv($2).__comma($3);
  52542. $ctx1.sendIdx[","]=1;
  52543. $5=$self._collection();
  52544. $ctx1.sendIdx["collection"]=2;
  52545. $self._assert_equals_($1,$5);
  52546. $ctx1.sendIdx["assert:equals:"]=1;
  52547. $8=$self._collectionClass();
  52548. $ctx1.sendIdx["collectionClass"]=2;
  52549. $7=$recv($8)._new();
  52550. $ctx1.sendIdx["new"]=2;
  52551. $9=$self._collection();
  52552. $ctx1.sendIdx["collection"]=3;
  52553. $6=$recv($7).__comma($9);
  52554. $ctx1.sendIdx[","]=2;
  52555. $10=$self._collection();
  52556. $ctx1.sendIdx["collection"]=4;
  52557. $self._assert_equals_($6,$10);
  52558. $ctx1.sendIdx["assert:equals:"]=2;
  52559. $13=$self._collectionClass();
  52560. $ctx1.sendIdx["collectionClass"]=3;
  52561. $12=$recv($13)._new();
  52562. $ctx1.sendIdx["new"]=3;
  52563. $15=$self._collectionClass();
  52564. $ctx1.sendIdx["collectionClass"]=4;
  52565. $14=$recv($15)._new();
  52566. $ctx1.sendIdx["new"]=4;
  52567. $11=$recv($12).__comma($14);
  52568. $ctx1.sendIdx[","]=3;
  52569. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52570. $ctx1.sendIdx["assert:equals:"]=3;
  52571. $17=$self._collection();
  52572. $ctx1.sendIdx["collection"]=5;
  52573. $18=$self._sampleNewValueAsCollection();
  52574. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52575. $16=$recv($17).__comma($18);
  52576. $ctx1.sendIdx[","]=4;
  52577. $19=$self._collectionWithNewValue();
  52578. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52579. $self._assert_equals_($16,$19);
  52580. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52581. return self;
  52582. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52583. },
  52584. args: [],
  52585. 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",
  52586. referencedClasses: [],
  52587. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52588. }),
  52589. $globals.CollectionTest);
  52590. $core.addMethod(
  52591. $core.method({
  52592. selector: "testCopy",
  52593. protocol: "tests",
  52594. fn: function (){
  52595. var self=this,$self=this;
  52596. return $core.withContext(function($ctx1) {
  52597. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52598. $3=$self._collectionClass();
  52599. $ctx1.sendIdx["collectionClass"]=1;
  52600. $2=$recv($3)._new();
  52601. $ctx1.sendIdx["new"]=1;
  52602. $1=$recv($2)._copy();
  52603. $ctx1.sendIdx["copy"]=1;
  52604. $5=$self._collectionClass();
  52605. $ctx1.sendIdx["collectionClass"]=2;
  52606. $4=$recv($5)._new();
  52607. $ctx1.sendIdx["new"]=2;
  52608. $self._assert_equals_($1,$4);
  52609. $ctx1.sendIdx["assert:equals:"]=1;
  52610. $7=$self._collection();
  52611. $ctx1.sendIdx["collection"]=1;
  52612. $6=$recv($7)._copy();
  52613. $ctx1.sendIdx["copy"]=2;
  52614. $8=$self._collection();
  52615. $ctx1.sendIdx["collection"]=2;
  52616. $self._assert_equals_($6,$8);
  52617. $ctx1.sendIdx["assert:equals:"]=2;
  52618. $10=$self._collectionWithNewValue();
  52619. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52620. $9=$recv($10)._copy();
  52621. $ctx1.sendIdx["copy"]=3;
  52622. $11=$self._collectionWithNewValue();
  52623. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52624. $self._assert_equals_($9,$11);
  52625. $15=$self._collectionClass();
  52626. $ctx1.sendIdx["collectionClass"]=3;
  52627. $14=$recv($15)._new();
  52628. $ctx1.sendIdx["new"]=3;
  52629. $13=$recv($14)._copy();
  52630. $ctx1.sendIdx["copy"]=4;
  52631. $16=$self._collection();
  52632. $ctx1.sendIdx["collection"]=3;
  52633. $12=$recv($13).__eq($16);
  52634. $ctx1.sendIdx["="]=1;
  52635. $self._deny_($12);
  52636. $ctx1.sendIdx["deny:"]=1;
  52637. $19=$self._collection();
  52638. $ctx1.sendIdx["collection"]=4;
  52639. $18=$recv($19)._copy();
  52640. $ctx1.sendIdx["copy"]=5;
  52641. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  52642. $ctx1.sendIdx["="]=2;
  52643. $self._deny_($17);
  52644. $ctx1.sendIdx["deny:"]=2;
  52645. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  52646. return self;
  52647. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  52648. },
  52649. args: [],
  52650. 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",
  52651. referencedClasses: [],
  52652. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52653. }),
  52654. $globals.CollectionTest);
  52655. $core.addMethod(
  52656. $core.method({
  52657. selector: "testCopySeparates",
  52658. protocol: "tests",
  52659. fn: function (){
  52660. var self=this,$self=this;
  52661. var original,copy;
  52662. return $core.withContext(function($ctx1) {
  52663. original=$self._collection();
  52664. $ctx1.sendIdx["collection"]=1;
  52665. copy=$recv(original)._copy();
  52666. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  52667. $self._assert_($recv(original).__eq($self._collection()));
  52668. return self;
  52669. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  52670. },
  52671. args: [],
  52672. 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",
  52673. referencedClasses: [],
  52674. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  52675. }),
  52676. $globals.CollectionTest);
  52677. $core.addMethod(
  52678. $core.method({
  52679. selector: "testDetect",
  52680. protocol: "tests",
  52681. fn: function (){
  52682. var self=this,$self=this;
  52683. return $core.withContext(function($ctx1) {
  52684. var $1,$2,$3,$4,$6,$5,$7;
  52685. $self._shouldnt_raise_((function(){
  52686. return $core.withContext(function($ctx2) {
  52687. $1=$self._collection();
  52688. $ctx2.sendIdx["collection"]=1;
  52689. return $recv($1)._detect_((function(){
  52690. return true;
  52691. }));
  52692. $ctx2.sendIdx["detect:"]=1;
  52693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52694. }),$globals.Error);
  52695. $self._should_raise_((function(){
  52696. return $core.withContext(function($ctx2) {
  52697. $2=$self._collection();
  52698. $ctx2.sendIdx["collection"]=2;
  52699. return $recv($2)._detect_((function(){
  52700. return false;
  52701. }));
  52702. $ctx2.sendIdx["detect:"]=2;
  52703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  52704. }),$globals.Error);
  52705. $ctx1.sendIdx["should:raise:"]=1;
  52706. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  52707. return true;
  52708. }));
  52709. $ctx1.sendIdx["detect:"]=3;
  52710. $4=$self._sampleNewValue();
  52711. $ctx1.sendIdx["sampleNewValue"]=1;
  52712. $self._assert_equals_($3,$4);
  52713. $ctx1.sendIdx["assert:equals:"]=1;
  52714. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  52715. return $core.withContext(function($ctx2) {
  52716. $6=$self._sampleNewValue();
  52717. $ctx2.sendIdx["sampleNewValue"]=2;
  52718. return $recv(each).__eq($6);
  52719. $ctx2.sendIdx["="]=1;
  52720. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52721. }));
  52722. $ctx1.sendIdx["detect:"]=4;
  52723. $7=$self._sampleNewValue();
  52724. $ctx1.sendIdx["sampleNewValue"]=3;
  52725. $self._assert_equals_($5,$7);
  52726. $self._should_raise_((function(){
  52727. return $core.withContext(function($ctx2) {
  52728. return $recv($self._collection())._detect_((function(each){
  52729. return $core.withContext(function($ctx3) {
  52730. return $recv(each).__eq($self._sampleNewValue());
  52731. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  52732. }));
  52733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  52734. }),$globals.Error);
  52735. return self;
  52736. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  52737. },
  52738. args: [],
  52739. 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",
  52740. referencedClasses: ["Error"],
  52741. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52742. }),
  52743. $globals.CollectionTest);
  52744. $core.addMethod(
  52745. $core.method({
  52746. selector: "testDetectIfNone",
  52747. protocol: "tests",
  52748. fn: function (){
  52749. var self=this,$self=this;
  52750. var sentinel;
  52751. return $core.withContext(function($ctx1) {
  52752. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  52753. sentinel=$recv($globals.Object)._new();
  52754. $3=$self._collection();
  52755. $ctx1.sendIdx["collection"]=1;
  52756. $2=$recv($3)._detect_ifNone_((function(){
  52757. return true;
  52758. }),(function(){
  52759. return sentinel;
  52760. }));
  52761. $ctx1.sendIdx["detect:ifNone:"]=1;
  52762. $1=$recv($2).__tild_eq(sentinel);
  52763. $self._assert_($1);
  52764. $5=$self._collection();
  52765. $ctx1.sendIdx["collection"]=2;
  52766. $4=$recv($5)._detect_ifNone_((function(){
  52767. return false;
  52768. }),(function(){
  52769. return sentinel;
  52770. }));
  52771. $ctx1.sendIdx["detect:ifNone:"]=2;
  52772. $self._assert_equals_($4,sentinel);
  52773. $ctx1.sendIdx["assert:equals:"]=1;
  52774. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  52775. return true;
  52776. }),(function(){
  52777. return sentinel;
  52778. }));
  52779. $ctx1.sendIdx["detect:ifNone:"]=3;
  52780. $7=$self._sampleNewValue();
  52781. $ctx1.sendIdx["sampleNewValue"]=1;
  52782. $self._assert_equals_($6,$7);
  52783. $ctx1.sendIdx["assert:equals:"]=2;
  52784. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  52785. return $core.withContext(function($ctx2) {
  52786. $9=$self._sampleNewValue();
  52787. $ctx2.sendIdx["sampleNewValue"]=2;
  52788. return $recv(each).__eq($9);
  52789. $ctx2.sendIdx["="]=1;
  52790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  52791. }),(function(){
  52792. return sentinel;
  52793. }));
  52794. $ctx1.sendIdx["detect:ifNone:"]=4;
  52795. $10=$self._sampleNewValue();
  52796. $ctx1.sendIdx["sampleNewValue"]=3;
  52797. $self._assert_equals_($8,$10);
  52798. $ctx1.sendIdx["assert:equals:"]=3;
  52799. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  52800. return $core.withContext(function($ctx2) {
  52801. return $recv(each).__eq($self._sampleNewValue());
  52802. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  52803. }),(function(){
  52804. return sentinel;
  52805. })),sentinel);
  52806. return self;
  52807. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  52808. },
  52809. args: [],
  52810. 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",
  52811. referencedClasses: ["Object"],
  52812. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  52813. }),
  52814. $globals.CollectionTest);
  52815. $core.addMethod(
  52816. $core.method({
  52817. selector: "testDo",
  52818. protocol: "tests",
  52819. fn: function (){
  52820. var self=this,$self=this;
  52821. var newCollection;
  52822. return $core.withContext(function($ctx1) {
  52823. var $1,$2;
  52824. newCollection=$recv($globals.OrderedCollection)._new();
  52825. $ctx1.sendIdx["new"]=1;
  52826. $1=$self._collection();
  52827. $ctx1.sendIdx["collection"]=1;
  52828. $recv($1)._do_((function(each){
  52829. return $core.withContext(function($ctx2) {
  52830. return $recv(newCollection)._add_(each);
  52831. $ctx2.sendIdx["add:"]=1;
  52832. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52833. }));
  52834. $ctx1.sendIdx["do:"]=1;
  52835. $self._assertSameContents_as_($self._collection(),newCollection);
  52836. $ctx1.sendIdx["assertSameContents:as:"]=1;
  52837. newCollection=$recv($globals.OrderedCollection)._new();
  52838. $2=$self._collectionWithDuplicates();
  52839. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  52840. $recv($2)._do_((function(each){
  52841. return $core.withContext(function($ctx2) {
  52842. return $recv(newCollection)._add_(each);
  52843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52844. }));
  52845. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  52846. return self;
  52847. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  52848. },
  52849. args: [],
  52850. 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",
  52851. referencedClasses: ["OrderedCollection"],
  52852. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  52853. }),
  52854. $globals.CollectionTest);
  52855. $core.addMethod(
  52856. $core.method({
  52857. selector: "testEquality",
  52858. protocol: "tests",
  52859. fn: function (){
  52860. var self=this,$self=this;
  52861. return $core.withContext(function($ctx1) {
  52862. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  52863. $2=$self._collectionClass();
  52864. $ctx1.sendIdx["collectionClass"]=1;
  52865. $1=$recv($2)._new();
  52866. $ctx1.sendIdx["new"]=1;
  52867. $4=$self._collectionClass();
  52868. $ctx1.sendIdx["collectionClass"]=2;
  52869. $3=$recv($4)._new();
  52870. $ctx1.sendIdx["new"]=2;
  52871. $self._assert_equals_($1,$3);
  52872. $ctx1.sendIdx["assert:equals:"]=1;
  52873. $5=$self._collection();
  52874. $ctx1.sendIdx["collection"]=1;
  52875. $6=$self._collection();
  52876. $ctx1.sendIdx["collection"]=2;
  52877. $self._assert_equals_($5,$6);
  52878. $ctx1.sendIdx["assert:equals:"]=2;
  52879. $7=$self._collectionWithNewValue();
  52880. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52881. $8=$self._collectionWithNewValue();
  52882. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52883. $self._assert_equals_($7,$8);
  52884. $11=$self._collectionClass();
  52885. $ctx1.sendIdx["collectionClass"]=3;
  52886. $10=$recv($11)._new();
  52887. $ctx1.sendIdx["new"]=3;
  52888. $12=$self._collection();
  52889. $ctx1.sendIdx["collection"]=3;
  52890. $9=$recv($10).__eq($12);
  52891. $ctx1.sendIdx["="]=1;
  52892. $self._deny_($9);
  52893. $ctx1.sendIdx["deny:"]=1;
  52894. $14=$self._collection();
  52895. $ctx1.sendIdx["collection"]=4;
  52896. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  52897. $ctx1.sendIdx["="]=2;
  52898. $self._deny_($13);
  52899. $ctx1.sendIdx["deny:"]=2;
  52900. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  52901. return self;
  52902. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  52903. },
  52904. args: [],
  52905. 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",
  52906. referencedClasses: [],
  52907. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  52908. }),
  52909. $globals.CollectionTest);
  52910. $core.addMethod(
  52911. $core.method({
  52912. selector: "testIfEmptyFamily",
  52913. protocol: "tests",
  52914. fn: function (){
  52915. var self=this,$self=this;
  52916. return $core.withContext(function($ctx1) {
  52917. 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;
  52918. $3=$self._collectionClass();
  52919. $ctx1.sendIdx["collectionClass"]=1;
  52920. $2=$recv($3)._new();
  52921. $ctx1.sendIdx["new"]=1;
  52922. $1=$recv($2)._ifEmpty_((function(){
  52923. return (42);
  52924. }));
  52925. $ctx1.sendIdx["ifEmpty:"]=1;
  52926. $self._assert_equals_($1,(42));
  52927. $ctx1.sendIdx["assert:equals:"]=1;
  52928. $5=$self._collection();
  52929. $ctx1.sendIdx["collection"]=1;
  52930. $4=$recv($5)._ifEmpty_((function(){
  52931. return (42);
  52932. }));
  52933. $6=$self._collection();
  52934. $ctx1.sendIdx["collection"]=2;
  52935. $self._assert_equals_($4,$6);
  52936. $ctx1.sendIdx["assert:equals:"]=2;
  52937. $9=$self._collectionClass();
  52938. $ctx1.sendIdx["collectionClass"]=2;
  52939. $8=$recv($9)._new();
  52940. $ctx1.sendIdx["new"]=2;
  52941. $7=$recv($8)._ifNotEmpty_((function(){
  52942. return (42);
  52943. }));
  52944. $ctx1.sendIdx["ifNotEmpty:"]=1;
  52945. $11=$self._collectionClass();
  52946. $ctx1.sendIdx["collectionClass"]=3;
  52947. $10=$recv($11)._new();
  52948. $ctx1.sendIdx["new"]=3;
  52949. $self._assert_equals_($7,$10);
  52950. $ctx1.sendIdx["assert:equals:"]=3;
  52951. $13=$self._collection();
  52952. $ctx1.sendIdx["collection"]=3;
  52953. $12=$recv($13)._ifNotEmpty_((function(){
  52954. return (42);
  52955. }));
  52956. $ctx1.sendIdx["ifNotEmpty:"]=2;
  52957. $self._assert_equals_($12,(42));
  52958. $ctx1.sendIdx["assert:equals:"]=4;
  52959. $15=$self._collection();
  52960. $ctx1.sendIdx["collection"]=4;
  52961. $14=$recv($15)._ifNotEmpty_((function(col){
  52962. return col;
  52963. }));
  52964. $16=$self._collection();
  52965. $ctx1.sendIdx["collection"]=5;
  52966. $self._assert_equals_($14,$16);
  52967. $ctx1.sendIdx["assert:equals:"]=5;
  52968. $19=$self._collectionClass();
  52969. $ctx1.sendIdx["collectionClass"]=4;
  52970. $18=$recv($19)._new();
  52971. $ctx1.sendIdx["new"]=4;
  52972. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  52973. return (42);
  52974. }),(function(){
  52975. return (999);
  52976. }));
  52977. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  52978. $self._assert_equals_($17,(42));
  52979. $ctx1.sendIdx["assert:equals:"]=6;
  52980. $21=$self._collection();
  52981. $ctx1.sendIdx["collection"]=6;
  52982. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  52983. return (42);
  52984. }),(function(){
  52985. return (999);
  52986. }));
  52987. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  52988. $self._assert_equals_($20,(999));
  52989. $ctx1.sendIdx["assert:equals:"]=7;
  52990. $23=$self._collection();
  52991. $ctx1.sendIdx["collection"]=7;
  52992. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  52993. return (42);
  52994. }),(function(col){
  52995. return col;
  52996. }));
  52997. $24=$self._collection();
  52998. $ctx1.sendIdx["collection"]=8;
  52999. $self._assert_equals_($22,$24);
  53000. $ctx1.sendIdx["assert:equals:"]=8;
  53001. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53002. return (42);
  53003. }),(function(){
  53004. return (999);
  53005. }));
  53006. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53007. $self._assert_equals_($25,(999));
  53008. $ctx1.sendIdx["assert:equals:"]=9;
  53009. $27=$self._collection();
  53010. $ctx1.sendIdx["collection"]=9;
  53011. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53012. return (42);
  53013. }),(function(){
  53014. return (999);
  53015. }));
  53016. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53017. $self._assert_equals_($26,(42));
  53018. $ctx1.sendIdx["assert:equals:"]=10;
  53019. $29=$self._collection();
  53020. $ctx1.sendIdx["collection"]=10;
  53021. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53022. return col;
  53023. }),(function(){
  53024. return (999);
  53025. }));
  53026. $self._assert_equals_($28,$self._collection());
  53027. return self;
  53028. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53029. },
  53030. args: [],
  53031. 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.",
  53032. referencedClasses: [],
  53033. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53034. }),
  53035. $globals.CollectionTest);
  53036. $core.addMethod(
  53037. $core.method({
  53038. selector: "testIsEmpty",
  53039. protocol: "tests",
  53040. fn: function (){
  53041. var self=this,$self=this;
  53042. return $core.withContext(function($ctx1) {
  53043. var $1;
  53044. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53045. $ctx1.sendIdx["isEmpty"]=1;
  53046. $self._assert_($1);
  53047. $self._deny_($recv($self._collection())._isEmpty());
  53048. return self;
  53049. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53050. },
  53051. args: [],
  53052. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53053. referencedClasses: [],
  53054. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53055. }),
  53056. $globals.CollectionTest);
  53057. $core.addMethod(
  53058. $core.method({
  53059. selector: "testNoneSatisfy",
  53060. protocol: "tests",
  53061. fn: function (){
  53062. var self=this,$self=this;
  53063. var anyOne;
  53064. return $core.withContext(function($ctx1) {
  53065. var $1,$3,$2;
  53066. $1=$self._collection();
  53067. $ctx1.sendIdx["collection"]=1;
  53068. anyOne=$recv($1)._anyOne();
  53069. $3=$self._collection();
  53070. $ctx1.sendIdx["collection"]=2;
  53071. $2=$recv($3)._noneSatisfy_((function(each){
  53072. return $core.withContext(function($ctx2) {
  53073. return $recv(each).__eq(anyOne);
  53074. $ctx2.sendIdx["="]=1;
  53075. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53076. }));
  53077. $ctx1.sendIdx["noneSatisfy:"]=1;
  53078. $self._deny_($2);
  53079. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53080. return $core.withContext(function($ctx2) {
  53081. return $recv(each).__eq($recv($globals.Object)._new());
  53082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53083. })));
  53084. return self;
  53085. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53086. },
  53087. args: [],
  53088. 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 ])",
  53089. referencedClasses: ["Object"],
  53090. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53091. }),
  53092. $globals.CollectionTest);
  53093. $core.addMethod(
  53094. $core.method({
  53095. selector: "testRegression1224",
  53096. protocol: "tests",
  53097. fn: function (){
  53098. var self=this,$self=this;
  53099. return $core.withContext(function($ctx1) {
  53100. var $3,$2,$1;
  53101. $3=$recv($self._collectionClass())._new();
  53102. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53103. }));
  53104. $2=$recv($3)._yourself();
  53105. $1=$recv($2)._size();
  53106. $self._assert_equals_($1,(0));
  53107. return self;
  53108. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53109. },
  53110. args: [],
  53111. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53112. referencedClasses: [],
  53113. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53114. }),
  53115. $globals.CollectionTest);
  53116. $core.addMethod(
  53117. $core.method({
  53118. selector: "testRemoveAll",
  53119. protocol: "tests",
  53120. fn: function (){
  53121. var self=this,$self=this;
  53122. return $core.withContext(function($ctx1) {
  53123. var $2,$1;
  53124. $2=$self._collection();
  53125. $recv($2)._removeAll();
  53126. $1=$recv($2)._yourself();
  53127. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53128. return self;
  53129. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53130. },
  53131. args: [],
  53132. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53133. referencedClasses: [],
  53134. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53135. }),
  53136. $globals.CollectionTest);
  53137. $core.addMethod(
  53138. $core.method({
  53139. selector: "testSelect",
  53140. protocol: "tests",
  53141. fn: function (){
  53142. var self=this,$self=this;
  53143. return $core.withContext(function($ctx1) {
  53144. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53145. $2=$self._collection();
  53146. $ctx1.sendIdx["collection"]=1;
  53147. $1=$recv($2)._select_((function(){
  53148. return false;
  53149. }));
  53150. $ctx1.sendIdx["select:"]=1;
  53151. $4=$self._collectionClass();
  53152. $ctx1.sendIdx["collectionClass"]=1;
  53153. $3=$recv($4)._new();
  53154. $ctx1.sendIdx["new"]=1;
  53155. $self._assert_equals_($1,$3);
  53156. $ctx1.sendIdx["assert:equals:"]=1;
  53157. $6=$self._collection();
  53158. $ctx1.sendIdx["collection"]=2;
  53159. $5=$recv($6)._select_((function(){
  53160. return true;
  53161. }));
  53162. $ctx1.sendIdx["select:"]=2;
  53163. $7=$self._collection();
  53164. $ctx1.sendIdx["collection"]=3;
  53165. $self._assert_equals_($5,$7);
  53166. $ctx1.sendIdx["assert:equals:"]=2;
  53167. $9=$self._collectionWithNewValue();
  53168. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53169. $8=$recv($9)._select_((function(each){
  53170. return $core.withContext(function($ctx2) {
  53171. $10=$self._sampleNewValue();
  53172. $ctx2.sendIdx["sampleNewValue"]=1;
  53173. return $recv(each).__eq($10);
  53174. $ctx2.sendIdx["="]=1;
  53175. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53176. }));
  53177. $ctx1.sendIdx["select:"]=3;
  53178. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53179. $ctx1.sendIdx["assert:equals:"]=3;
  53180. $12=$self._collectionWithNewValue();
  53181. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53182. $11=$recv($12)._select_((function(each){
  53183. return $core.withContext(function($ctx2) {
  53184. $13=$self._sampleNewValue();
  53185. $ctx2.sendIdx["sampleNewValue"]=2;
  53186. return $recv(each).__tild_eq($13);
  53187. $ctx2.sendIdx["~="]=1;
  53188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53189. }));
  53190. $ctx1.sendIdx["select:"]=4;
  53191. $14=$self._collection();
  53192. $ctx1.sendIdx["collection"]=4;
  53193. $self._assert_equals_($11,$14);
  53194. $ctx1.sendIdx["assert:equals:"]=4;
  53195. $16=$self._collection();
  53196. $ctx1.sendIdx["collection"]=5;
  53197. $15=$recv($16)._select_((function(each){
  53198. return $core.withContext(function($ctx2) {
  53199. $17=$self._sampleNewValue();
  53200. $ctx2.sendIdx["sampleNewValue"]=3;
  53201. return $recv(each).__eq($17);
  53202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53203. }));
  53204. $ctx1.sendIdx["select:"]=5;
  53205. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53206. $ctx1.sendIdx["assert:equals:"]=5;
  53207. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53208. return $core.withContext(function($ctx2) {
  53209. return $recv(each).__tild_eq($self._sampleNewValue());
  53210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53211. })),$self._collection());
  53212. return self;
  53213. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53214. },
  53215. args: [],
  53216. 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",
  53217. referencedClasses: [],
  53218. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53219. }),
  53220. $globals.CollectionTest);
  53221. $core.addMethod(
  53222. $core.method({
  53223. selector: "testSelectThenCollect",
  53224. protocol: "tests",
  53225. fn: function (){
  53226. var self=this,$self=this;
  53227. return $core.withContext(function($ctx1) {
  53228. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53229. $2=$self._collection();
  53230. $ctx1.sendIdx["collection"]=1;
  53231. $1=$recv($2)._select_thenCollect_((function(){
  53232. return false;
  53233. }),"isString");
  53234. $ctx1.sendIdx["select:thenCollect:"]=1;
  53235. $4=$self._collectionClass();
  53236. $ctx1.sendIdx["collectionClass"]=1;
  53237. $3=$recv($4)._new();
  53238. $ctx1.sendIdx["new"]=1;
  53239. $self._assert_equals_($1,$3);
  53240. $ctx1.sendIdx["assert:equals:"]=1;
  53241. $6=$self._collection();
  53242. $ctx1.sendIdx["collection"]=2;
  53243. $5=$recv($6)._select_thenCollect_((function(){
  53244. return true;
  53245. }),(function(x){
  53246. return x;
  53247. }));
  53248. $ctx1.sendIdx["select:thenCollect:"]=2;
  53249. $7=$self._collection();
  53250. $ctx1.sendIdx["collection"]=3;
  53251. $self._assert_equals_($5,$7);
  53252. $ctx1.sendIdx["assert:equals:"]=2;
  53253. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53254. return $core.withContext(function($ctx2) {
  53255. $9=$self._sampleNewValue();
  53256. $ctx2.sendIdx["sampleNewValue"]=1;
  53257. return $recv(each).__eq($9);
  53258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53259. }),(function(x){
  53260. return x;
  53261. }));
  53262. $ctx1.sendIdx["select:thenCollect:"]=3;
  53263. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53264. $ctx1.sendIdx["assert:equals:"]=3;
  53265. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53266. return $core.withContext(function($ctx2) {
  53267. return $recv(each).__tild_eq($self._sampleNewValue());
  53268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53269. }),"printString"),$self._collectionOfPrintStrings());
  53270. return self;
  53271. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53272. },
  53273. args: [],
  53274. 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",
  53275. referencedClasses: [],
  53276. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53277. }),
  53278. $globals.CollectionTest);
  53279. $core.addMethod(
  53280. $core.method({
  53281. selector: "testSingle",
  53282. protocol: "tests",
  53283. fn: function (){
  53284. var self=this,$self=this;
  53285. return $core.withContext(function($ctx1) {
  53286. $self._should_raise_((function(){
  53287. return $core.withContext(function($ctx2) {
  53288. return $recv($recv($self._collectionClass())._new())._single();
  53289. $ctx2.sendIdx["single"]=1;
  53290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53291. }),$globals.Error);
  53292. $ctx1.sendIdx["should:raise:"]=1;
  53293. $self._should_raise_((function(){
  53294. return $core.withContext(function($ctx2) {
  53295. return $recv($self._collection())._single();
  53296. $ctx2.sendIdx["single"]=2;
  53297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53298. }),$globals.Error);
  53299. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53300. return self;
  53301. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53302. },
  53303. args: [],
  53304. 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",
  53305. referencedClasses: ["Error"],
  53306. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53307. }),
  53308. $globals.CollectionTest);
  53309. $core.addMethod(
  53310. $core.method({
  53311. selector: "testSize",
  53312. protocol: "tests",
  53313. fn: function (){
  53314. var self=this,$self=this;
  53315. return $core.withContext(function($ctx1) {
  53316. var $1,$2;
  53317. $1=$recv($recv($self._collectionClass())._new())._size();
  53318. $ctx1.sendIdx["size"]=1;
  53319. $self._assert_equals_($1,(0));
  53320. $ctx1.sendIdx["assert:equals:"]=1;
  53321. $2=$recv($self._sampleNewValueAsCollection())._size();
  53322. $ctx1.sendIdx["size"]=2;
  53323. $self._assert_equals_($2,(1));
  53324. $ctx1.sendIdx["assert:equals:"]=2;
  53325. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53326. return self;
  53327. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53328. },
  53329. args: [],
  53330. 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",
  53331. referencedClasses: [],
  53332. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53333. }),
  53334. $globals.CollectionTest);
  53335. $core.addMethod(
  53336. $core.method({
  53337. selector: "collectionClass",
  53338. protocol: "fixture",
  53339. fn: function (){
  53340. var self=this,$self=this;
  53341. return nil;
  53342. },
  53343. args: [],
  53344. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53345. referencedClasses: [],
  53346. messageSends: []
  53347. }),
  53348. $globals.CollectionTest.a$cls);
  53349. $core.addMethod(
  53350. $core.method({
  53351. selector: "isAbstract",
  53352. protocol: "testing",
  53353. fn: function (){
  53354. var self=this,$self=this;
  53355. return $core.withContext(function($ctx1) {
  53356. return $recv($self._collectionClass())._isNil();
  53357. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53358. },
  53359. args: [],
  53360. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53361. referencedClasses: [],
  53362. messageSends: ["isNil", "collectionClass"]
  53363. }),
  53364. $globals.CollectionTest.a$cls);
  53365. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53366. $core.addMethod(
  53367. $core.method({
  53368. selector: "collectionWithNewValue",
  53369. protocol: "fixture",
  53370. fn: function (){
  53371. var self=this,$self=this;
  53372. return $core.withContext(function($ctx1) {
  53373. $self._subclassResponsibility();
  53374. return self;
  53375. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53376. },
  53377. args: [],
  53378. 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",
  53379. referencedClasses: [],
  53380. messageSends: ["subclassResponsibility"]
  53381. }),
  53382. $globals.IndexableCollectionTest);
  53383. $core.addMethod(
  53384. $core.method({
  53385. selector: "nonIndexesDo:",
  53386. protocol: "fixture",
  53387. fn: function (aBlock){
  53388. var self=this,$self=this;
  53389. return $core.withContext(function($ctx1) {
  53390. $self._subclassResponsibility();
  53391. return self;
  53392. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53393. },
  53394. args: ["aBlock"],
  53395. 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",
  53396. referencedClasses: [],
  53397. messageSends: ["subclassResponsibility"]
  53398. }),
  53399. $globals.IndexableCollectionTest);
  53400. $core.addMethod(
  53401. $core.method({
  53402. selector: "sampleNewIndex",
  53403. protocol: "fixture",
  53404. fn: function (){
  53405. var self=this,$self=this;
  53406. return $core.withContext(function($ctx1) {
  53407. $self._subclassResponsibility();
  53408. return self;
  53409. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53410. },
  53411. args: [],
  53412. 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",
  53413. referencedClasses: [],
  53414. messageSends: ["subclassResponsibility"]
  53415. }),
  53416. $globals.IndexableCollectionTest);
  53417. $core.addMethod(
  53418. $core.method({
  53419. selector: "samplesDo:",
  53420. protocol: "fixture",
  53421. fn: function (aBlock){
  53422. var self=this,$self=this;
  53423. return $core.withContext(function($ctx1) {
  53424. $self._subclassResponsibility();
  53425. return self;
  53426. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53427. },
  53428. args: ["aBlock"],
  53429. 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",
  53430. referencedClasses: [],
  53431. messageSends: ["subclassResponsibility"]
  53432. }),
  53433. $globals.IndexableCollectionTest);
  53434. $core.addMethod(
  53435. $core.method({
  53436. selector: "testAt",
  53437. protocol: "tests",
  53438. fn: function (){
  53439. var self=this,$self=this;
  53440. return $core.withContext(function($ctx1) {
  53441. var $1;
  53442. $self._nonIndexesDo_((function(each){
  53443. return $core.withContext(function($ctx2) {
  53444. return $self._should_raise_((function(){
  53445. return $core.withContext(function($ctx3) {
  53446. $1=$self._collection();
  53447. $ctx3.sendIdx["collection"]=1;
  53448. return $recv($1)._at_(each);
  53449. $ctx3.sendIdx["at:"]=1;
  53450. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53451. }),$globals.Error);
  53452. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53453. }));
  53454. $self._samplesDo_((function(index,value){
  53455. return $core.withContext(function($ctx2) {
  53456. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53457. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53458. }));
  53459. return self;
  53460. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53461. },
  53462. args: [],
  53463. 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 ]",
  53464. referencedClasses: ["Error"],
  53465. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53466. }),
  53467. $globals.IndexableCollectionTest);
  53468. $core.addMethod(
  53469. $core.method({
  53470. selector: "testAtIfAbsent",
  53471. protocol: "tests",
  53472. fn: function (){
  53473. var self=this,$self=this;
  53474. return $core.withContext(function($ctx1) {
  53475. var $2,$1,$3;
  53476. $self._nonIndexesDo_((function(each){
  53477. return $core.withContext(function($ctx2) {
  53478. $2=$self._collection();
  53479. $ctx2.sendIdx["collection"]=1;
  53480. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53481. return $core.withContext(function($ctx3) {
  53482. return $self._sampleNewValue();
  53483. $ctx3.sendIdx["sampleNewValue"]=1;
  53484. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53485. }));
  53486. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53487. $3=$self._sampleNewValue();
  53488. $ctx2.sendIdx["sampleNewValue"]=2;
  53489. return $self._assert_equals_($1,$3);
  53490. $ctx2.sendIdx["assert:equals:"]=1;
  53491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53492. }));
  53493. $self._samplesDo_((function(index,value){
  53494. return $core.withContext(function($ctx2) {
  53495. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53496. return $core.withContext(function($ctx3) {
  53497. return $self._sampleNewValue();
  53498. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53499. })),value);
  53500. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53501. }));
  53502. return self;
  53503. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53504. },
  53505. args: [],
  53506. 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 ].",
  53507. referencedClasses: [],
  53508. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53509. }),
  53510. $globals.IndexableCollectionTest);
  53511. $core.addMethod(
  53512. $core.method({
  53513. selector: "testAtIfAbsentPut",
  53514. protocol: "tests",
  53515. fn: function (){
  53516. var self=this,$self=this;
  53517. var newCollection;
  53518. return $core.withContext(function($ctx1) {
  53519. var $1;
  53520. newCollection=$self._collection();
  53521. $ctx1.sendIdx["collection"]=1;
  53522. $self._samplesDo_((function(index,value){
  53523. return $core.withContext(function($ctx2) {
  53524. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53525. return $core.withContext(function($ctx3) {
  53526. return $self._sampleNewValue();
  53527. $ctx3.sendIdx["sampleNewValue"]=1;
  53528. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53529. }));
  53530. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53531. return $self._assert_equals_($1,value);
  53532. $ctx2.sendIdx["assert:equals:"]=1;
  53533. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53534. }));
  53535. $self._assert_equals_(newCollection,$self._collection());
  53536. $ctx1.sendIdx["assert:equals:"]=2;
  53537. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53538. return $core.withContext(function($ctx2) {
  53539. return $self._sampleNewValue();
  53540. $ctx2.sendIdx["sampleNewValue"]=2;
  53541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53542. })),$self._sampleNewValue());
  53543. $ctx1.sendIdx["assert:equals:"]=3;
  53544. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53545. return self;
  53546. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53547. },
  53548. args: [],
  53549. 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",
  53550. referencedClasses: [],
  53551. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53552. }),
  53553. $globals.IndexableCollectionTest);
  53554. $core.addMethod(
  53555. $core.method({
  53556. selector: "testAtIfPresent",
  53557. protocol: "tests",
  53558. fn: function (){
  53559. var self=this,$self=this;
  53560. var visited,sentinel;
  53561. return $core.withContext(function($ctx1) {
  53562. var $2,$1,$4,$3;
  53563. sentinel=$recv($globals.Object)._new();
  53564. $self._nonIndexesDo_((function(each){
  53565. return $core.withContext(function($ctx2) {
  53566. visited=nil;
  53567. visited;
  53568. $2=$self._collection();
  53569. $ctx2.sendIdx["collection"]=1;
  53570. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53571. visited=value1;
  53572. visited;
  53573. return sentinel;
  53574. }));
  53575. $ctx2.sendIdx["at:ifPresent:"]=1;
  53576. $self._assert_equals_($1,nil);
  53577. $ctx2.sendIdx["assert:equals:"]=1;
  53578. return $self._assert_($recv(visited)._isNil());
  53579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53580. }));
  53581. $self._samplesDo_((function(index,value){
  53582. return $core.withContext(function($ctx2) {
  53583. visited=nil;
  53584. visited;
  53585. $4=$self._collection();
  53586. $ctx2.sendIdx["collection"]=2;
  53587. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53588. visited=value2;
  53589. visited;
  53590. return sentinel;
  53591. }));
  53592. $self._assert_equals_($3,sentinel);
  53593. $ctx2.sendIdx["assert:equals:"]=2;
  53594. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53595. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53596. }));
  53597. return self;
  53598. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53599. },
  53600. args: [],
  53601. 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) ]",
  53602. referencedClasses: ["Object"],
  53603. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53604. }),
  53605. $globals.IndexableCollectionTest);
  53606. $core.addMethod(
  53607. $core.method({
  53608. selector: "testAtIfPresentIfAbsent",
  53609. protocol: "tests",
  53610. fn: function (){
  53611. var self=this,$self=this;
  53612. var visited,sentinel;
  53613. return $core.withContext(function($ctx1) {
  53614. var $2,$1,$3,$5,$4;
  53615. sentinel=$recv($globals.Object)._new();
  53616. $self._nonIndexesDo_((function(each){
  53617. return $core.withContext(function($ctx2) {
  53618. visited=nil;
  53619. visited;
  53620. $2=$self._collection();
  53621. $ctx2.sendIdx["collection"]=1;
  53622. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53623. visited=value1;
  53624. visited;
  53625. return sentinel;
  53626. }),(function(){
  53627. return $core.withContext(function($ctx3) {
  53628. return $self._sampleNewValue();
  53629. $ctx3.sendIdx["sampleNewValue"]=1;
  53630. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53631. }));
  53632. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53633. $3=$self._sampleNewValue();
  53634. $ctx2.sendIdx["sampleNewValue"]=2;
  53635. $self._assert_equals_($1,$3);
  53636. $ctx2.sendIdx["assert:equals:"]=1;
  53637. return $self._assert_($recv(visited)._isNil());
  53638. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53639. }));
  53640. $self._samplesDo_((function(index,value){
  53641. return $core.withContext(function($ctx2) {
  53642. visited=nil;
  53643. visited;
  53644. $5=$self._collection();
  53645. $ctx2.sendIdx["collection"]=2;
  53646. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  53647. visited=value2;
  53648. visited;
  53649. return sentinel;
  53650. }),(function(){
  53651. return $core.withContext(function($ctx3) {
  53652. return $self._sampleNewValue();
  53653. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  53654. }));
  53655. $self._assert_equals_($4,sentinel);
  53656. $ctx2.sendIdx["assert:equals:"]=2;
  53657. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53658. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  53659. }));
  53660. return self;
  53661. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53662. },
  53663. args: [],
  53664. 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) ]",
  53665. referencedClasses: ["Object"],
  53666. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  53667. }),
  53668. $globals.IndexableCollectionTest);
  53669. $core.addMethod(
  53670. $core.method({
  53671. selector: "testAtPut",
  53672. protocol: "tests",
  53673. fn: function (){
  53674. var self=this,$self=this;
  53675. var newCollection;
  53676. return $core.withContext(function($ctx1) {
  53677. newCollection=$self._collection();
  53678. $ctx1.sendIdx["collection"]=1;
  53679. $self._samplesDo_((function(index,value){
  53680. return $core.withContext(function($ctx2) {
  53681. return $recv(newCollection)._at_put_(index,value);
  53682. $ctx2.sendIdx["at:put:"]=1;
  53683. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53684. }));
  53685. $self._assert_equals_(newCollection,$self._collection());
  53686. $ctx1.sendIdx["assert:equals:"]=1;
  53687. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  53688. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53689. return self;
  53690. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53691. },
  53692. args: [],
  53693. 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",
  53694. referencedClasses: [],
  53695. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  53696. }),
  53697. $globals.IndexableCollectionTest);
  53698. $core.addMethod(
  53699. $core.method({
  53700. selector: "testIndexOf",
  53701. protocol: "tests",
  53702. fn: function (){
  53703. var self=this,$self=this;
  53704. return $core.withContext(function($ctx1) {
  53705. var $1;
  53706. $self._should_raise_((function(){
  53707. return $core.withContext(function($ctx2) {
  53708. $1=$self._collection();
  53709. $ctx2.sendIdx["collection"]=1;
  53710. return $recv($1)._indexOf_($self._sampleNewValue());
  53711. $ctx2.sendIdx["indexOf:"]=1;
  53712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53713. }),$globals.Error);
  53714. $self._samplesDo_((function(index,value){
  53715. return $core.withContext(function($ctx2) {
  53716. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  53717. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  53718. }));
  53719. return self;
  53720. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  53721. },
  53722. args: [],
  53723. 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 ]",
  53724. referencedClasses: ["Error"],
  53725. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  53726. }),
  53727. $globals.IndexableCollectionTest);
  53728. $core.addMethod(
  53729. $core.method({
  53730. selector: "testIndexOfWithNull",
  53731. protocol: "tests",
  53732. fn: function (){
  53733. var self=this,$self=this;
  53734. var jsNull;
  53735. return $core.withContext(function($ctx1) {
  53736. var $2,$1;
  53737. jsNull=$recv($globals.JSON)._parse_("null");
  53738. $self._samplesDo_((function(index,value){
  53739. return $core.withContext(function($ctx2) {
  53740. $2=$self._collection();
  53741. $recv($2)._at_put_(index,jsNull);
  53742. $1=$recv($2)._indexOf_(jsNull);
  53743. return $self._assert_equals_($1,index);
  53744. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53745. }));
  53746. return self;
  53747. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  53748. },
  53749. args: [],
  53750. 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 ]",
  53751. referencedClasses: ["JSON"],
  53752. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  53753. }),
  53754. $globals.IndexableCollectionTest);
  53755. $core.addMethod(
  53756. $core.method({
  53757. selector: "testWithIndexDo",
  53758. protocol: "tests",
  53759. fn: function (){
  53760. var self=this,$self=this;
  53761. var collection;
  53762. return $core.withContext(function($ctx1) {
  53763. collection=$self._collection();
  53764. $ctx1.sendIdx["collection"]=1;
  53765. $recv($self._collection())._withIndexDo_((function(each,index){
  53766. return $core.withContext(function($ctx2) {
  53767. return $self._assert_equals_($recv(collection)._at_(index),each);
  53768. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  53769. }));
  53770. return self;
  53771. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  53772. },
  53773. args: [],
  53774. 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 ]",
  53775. referencedClasses: [],
  53776. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  53777. }),
  53778. $globals.IndexableCollectionTest);
  53779. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  53780. $core.addMethod(
  53781. $core.method({
  53782. selector: "collectionKeys",
  53783. protocol: "fixture",
  53784. fn: function (){
  53785. var self=this,$self=this;
  53786. return $core.withContext(function($ctx1) {
  53787. $self._subclassResponsibility();
  53788. return self;
  53789. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  53790. },
  53791. args: [],
  53792. source: "collectionKeys\x0a\x09self subclassResponsibility",
  53793. referencedClasses: [],
  53794. messageSends: ["subclassResponsibility"]
  53795. }),
  53796. $globals.AssociativeCollectionTest);
  53797. $core.addMethod(
  53798. $core.method({
  53799. selector: "collectionValues",
  53800. protocol: "fixture",
  53801. fn: function (){
  53802. var self=this,$self=this;
  53803. return $core.withContext(function($ctx1) {
  53804. $self._subclassResponsibility();
  53805. return self;
  53806. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  53807. },
  53808. args: [],
  53809. source: "collectionValues\x0a\x09self subclassResponsibility",
  53810. referencedClasses: [],
  53811. messageSends: ["subclassResponsibility"]
  53812. }),
  53813. $globals.AssociativeCollectionTest);
  53814. $core.addMethod(
  53815. $core.method({
  53816. selector: "nonIndexesDo:",
  53817. protocol: "fixture",
  53818. fn: function (aBlock){
  53819. var self=this,$self=this;
  53820. return $core.withContext(function($ctx1) {
  53821. $recv(aBlock)._value_((5));
  53822. $ctx1.sendIdx["value:"]=1;
  53823. $recv(aBlock)._value_((function(){
  53824. }));
  53825. $ctx1.sendIdx["value:"]=2;
  53826. $recv(aBlock)._value_($recv($globals.Object)._new());
  53827. $ctx1.sendIdx["value:"]=3;
  53828. $recv(aBlock)._value_("z");
  53829. return self;
  53830. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  53831. },
  53832. args: ["aBlock"],
  53833. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  53834. referencedClasses: ["Object"],
  53835. messageSends: ["value:", "new"]
  53836. }),
  53837. $globals.AssociativeCollectionTest);
  53838. $core.addMethod(
  53839. $core.method({
  53840. selector: "sampleNewIndex",
  53841. protocol: "fixture",
  53842. fn: function (){
  53843. var self=this,$self=this;
  53844. return "new";
  53845. },
  53846. args: [],
  53847. source: "sampleNewIndex\x0a\x09^ 'new'",
  53848. referencedClasses: [],
  53849. messageSends: []
  53850. }),
  53851. $globals.AssociativeCollectionTest);
  53852. $core.addMethod(
  53853. $core.method({
  53854. selector: "samplesDo:",
  53855. protocol: "fixture",
  53856. fn: function (aBlock){
  53857. var self=this,$self=this;
  53858. return $core.withContext(function($ctx1) {
  53859. $recv(aBlock)._value_value_("a",(2));
  53860. return self;
  53861. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  53862. },
  53863. args: ["aBlock"],
  53864. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  53865. referencedClasses: [],
  53866. messageSends: ["value:value:"]
  53867. }),
  53868. $globals.AssociativeCollectionTest);
  53869. $core.addMethod(
  53870. $core.method({
  53871. selector: "testAddAll",
  53872. protocol: "tests",
  53873. fn: function (){
  53874. var self=this,$self=this;
  53875. return $core.withContext(function($ctx1) {
  53876. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  53877. (
  53878. $ctx1.supercall = true,
  53879. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  53880. $ctx1.supercall = false;
  53881. $2=$self._collection();
  53882. $ctx1.sendIdx["collection"]=1;
  53883. $3=$self._collection();
  53884. $ctx1.sendIdx["collection"]=2;
  53885. $recv($2)._addAll_($3);
  53886. $ctx1.sendIdx["addAll:"]=1;
  53887. $4=$recv($2)._yourself();
  53888. $ctx1.sendIdx["yourself"]=1;
  53889. $1=$4;
  53890. $5=$self._collection();
  53891. $ctx1.sendIdx["collection"]=3;
  53892. $self._assert_equals_($1,$5);
  53893. $ctx1.sendIdx["assert:equals:"]=1;
  53894. $7=$self._collection();
  53895. $ctx1.sendIdx["collection"]=4;
  53896. $8=$self._collectionWithNewValue();
  53897. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53898. $recv($7)._addAll_($8);
  53899. $ctx1.sendIdx["addAll:"]=2;
  53900. $9=$recv($7)._yourself();
  53901. $ctx1.sendIdx["yourself"]=2;
  53902. $6=$9;
  53903. $10=$self._collectionWithNewValue();
  53904. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53905. $self._assert_equals_($6,$10);
  53906. $ctx1.sendIdx["assert:equals:"]=2;
  53907. $12=$self._collectionWithNewValue();
  53908. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53909. $recv($12)._addAll_($self._collection());
  53910. $11=$recv($12)._yourself();
  53911. $self._assert_equals_($11,$self._collectionWithNewValue());
  53912. return self;
  53913. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  53914. },
  53915. args: [],
  53916. 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",
  53917. referencedClasses: [],
  53918. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53919. }),
  53920. $globals.AssociativeCollectionTest);
  53921. $core.addMethod(
  53922. $core.method({
  53923. selector: "testAsDictionary",
  53924. protocol: "tests",
  53925. fn: function (){
  53926. var self=this,$self=this;
  53927. return $core.withContext(function($ctx1) {
  53928. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  53929. return self;
  53930. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  53931. },
  53932. args: [],
  53933. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  53934. referencedClasses: ["Dictionary"],
  53935. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  53936. }),
  53937. $globals.AssociativeCollectionTest);
  53938. $core.addMethod(
  53939. $core.method({
  53940. selector: "testAsHashedCollection",
  53941. protocol: "tests",
  53942. fn: function (){
  53943. var self=this,$self=this;
  53944. return $core.withContext(function($ctx1) {
  53945. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  53946. return self;
  53947. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  53948. },
  53949. args: [],
  53950. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  53951. referencedClasses: ["HashedCollection"],
  53952. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  53953. }),
  53954. $globals.AssociativeCollectionTest);
  53955. $core.addMethod(
  53956. $core.method({
  53957. selector: "testComma",
  53958. protocol: "tests",
  53959. fn: function (){
  53960. var self=this,$self=this;
  53961. return $core.withContext(function($ctx1) {
  53962. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  53963. (
  53964. $ctx1.supercall = true,
  53965. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  53966. $ctx1.supercall = false;
  53967. $2=$self._collection();
  53968. $ctx1.sendIdx["collection"]=1;
  53969. $3=$self._collection();
  53970. $ctx1.sendIdx["collection"]=2;
  53971. $1=$recv($2).__comma($3);
  53972. $ctx1.sendIdx[","]=1;
  53973. $4=$self._collection();
  53974. $ctx1.sendIdx["collection"]=3;
  53975. $self._assert_equals_($1,$4);
  53976. $ctx1.sendIdx["assert:equals:"]=1;
  53977. $6=$self._collection();
  53978. $ctx1.sendIdx["collection"]=4;
  53979. $7=$self._collectionWithNewValue();
  53980. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53981. $5=$recv($6).__comma($7);
  53982. $ctx1.sendIdx[","]=2;
  53983. $8=$self._collectionWithNewValue();
  53984. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53985. $self._assert_equals_($5,$8);
  53986. $ctx1.sendIdx["assert:equals:"]=2;
  53987. $10=$self._collectionWithNewValue();
  53988. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53989. $9=$recv($10).__comma($self._collection());
  53990. $self._assert_equals_($9,$self._collectionWithNewValue());
  53991. return self;
  53992. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  53993. },
  53994. args: [],
  53995. 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",
  53996. referencedClasses: [],
  53997. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53998. }),
  53999. $globals.AssociativeCollectionTest);
  54000. $core.addMethod(
  54001. $core.method({
  54002. selector: "testFrom",
  54003. protocol: "tests",
  54004. fn: function (){
  54005. var self=this,$self=this;
  54006. var associations;
  54007. return $core.withContext(function($ctx1) {
  54008. var $1;
  54009. $1="a".__minus_gt((1));
  54010. $ctx1.sendIdx["->"]=1;
  54011. associations=[$1,"b".__minus_gt((2))];
  54012. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54013. return self;
  54014. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54015. },
  54016. args: [],
  54017. 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 }.",
  54018. referencedClasses: [],
  54019. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54020. }),
  54021. $globals.AssociativeCollectionTest);
  54022. $core.addMethod(
  54023. $core.method({
  54024. selector: "testKeys",
  54025. protocol: "tests",
  54026. fn: function (){
  54027. var self=this,$self=this;
  54028. return $core.withContext(function($ctx1) {
  54029. var $2,$1,$3,$4;
  54030. $2=$recv($recv($self._collectionClass())._new())._keys();
  54031. $ctx1.sendIdx["keys"]=1;
  54032. $1=$recv($2)._isEmpty();
  54033. $self._assert_($1);
  54034. $3=$recv($self._collection())._keys();
  54035. $ctx1.sendIdx["keys"]=2;
  54036. $4=$self._collectionKeys();
  54037. $ctx1.sendIdx["collectionKeys"]=1;
  54038. $self._assertSameContents_as_($3,$4);
  54039. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54040. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54041. return self;
  54042. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54043. },
  54044. args: [],
  54045. 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 }",
  54046. referencedClasses: [],
  54047. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54048. }),
  54049. $globals.AssociativeCollectionTest);
  54050. $core.addMethod(
  54051. $core.method({
  54052. selector: "testNewFromPairs",
  54053. protocol: "tests",
  54054. fn: function (){
  54055. var self=this,$self=this;
  54056. var flattenedAssociations;
  54057. return $core.withContext(function($ctx1) {
  54058. flattenedAssociations=["a",(1),"b",(2)];
  54059. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54060. return self;
  54061. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54062. },
  54063. args: [],
  54064. 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 }.",
  54065. referencedClasses: [],
  54066. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54067. }),
  54068. $globals.AssociativeCollectionTest);
  54069. $core.addMethod(
  54070. $core.method({
  54071. selector: "testPrintString",
  54072. protocol: "tests",
  54073. fn: function (){
  54074. var self=this,$self=this;
  54075. return $core.withContext(function($ctx1) {
  54076. var $3,$2,$1,$4;
  54077. $3=$self._collectionClass();
  54078. $ctx1.sendIdx["collectionClass"]=1;
  54079. $2=$recv($3)._new();
  54080. $recv($2)._at_put_("firstname","James");
  54081. $ctx1.sendIdx["at:put:"]=1;
  54082. $recv($2)._at_put_("lastname","Bond");
  54083. $1=$recv($2)._printString();
  54084. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54085. $ctx1.sendIdx[","]=1;
  54086. $self._assert_equals_($1,$4);
  54087. return self;
  54088. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54089. },
  54090. args: [],
  54091. 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'')'",
  54092. referencedClasses: [],
  54093. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54094. }),
  54095. $globals.AssociativeCollectionTest);
  54096. $core.addMethod(
  54097. $core.method({
  54098. selector: "testRemoveKey",
  54099. protocol: "tests",
  54100. fn: function (){
  54101. var self=this,$self=this;
  54102. return $core.withContext(function($ctx1) {
  54103. var $1,$2,$3,$5,$6,$4,$8,$7;
  54104. $self._nonIndexesDo_((function(each){
  54105. var collection;
  54106. return $core.withContext(function($ctx2) {
  54107. collection=$self._collection();
  54108. $ctx2.sendIdx["collection"]=1;
  54109. collection;
  54110. $self._should_raise_((function(){
  54111. return $core.withContext(function($ctx3) {
  54112. return $recv(collection)._removeKey_(each);
  54113. $ctx3.sendIdx["removeKey:"]=1;
  54114. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54115. }),$globals.Error);
  54116. $1=collection;
  54117. $2=$self._collection();
  54118. $ctx2.sendIdx["collection"]=2;
  54119. return $self._assert_equals_($1,$2);
  54120. $ctx2.sendIdx["assert:equals:"]=1;
  54121. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54122. }));
  54123. $self._samplesDo_((function(index,value){
  54124. var collection;
  54125. return $core.withContext(function($ctx2) {
  54126. collection=$self._collection();
  54127. $ctx2.sendIdx["collection"]=3;
  54128. collection;
  54129. $3=$recv(collection)._removeKey_(index);
  54130. $ctx2.sendIdx["removeKey:"]=2;
  54131. $self._assert_equals_($3,value);
  54132. $ctx2.sendIdx["assert:equals:"]=2;
  54133. $5=collection;
  54134. $6=$self._collection();
  54135. $ctx2.sendIdx["collection"]=4;
  54136. $4=$recv($5).__eq($6);
  54137. return $self._deny_($4);
  54138. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54139. }));
  54140. $8=$self._collectionWithNewValue();
  54141. $recv($8)._removeKey_($self._sampleNewIndex());
  54142. $7=$recv($8)._yourself();
  54143. $self._assert_equals_($7,$self._collection());
  54144. return self;
  54145. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54146. },
  54147. args: [],
  54148. 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",
  54149. referencedClasses: ["Error"],
  54150. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54151. }),
  54152. $globals.AssociativeCollectionTest);
  54153. $core.addMethod(
  54154. $core.method({
  54155. selector: "testRemoveKeyIfAbsent",
  54156. protocol: "tests",
  54157. fn: function (){
  54158. var self=this,$self=this;
  54159. return $core.withContext(function($ctx1) {
  54160. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54161. $self._nonIndexesDo_((function(each){
  54162. var collection;
  54163. return $core.withContext(function($ctx2) {
  54164. collection=$self._collection();
  54165. $ctx2.sendIdx["collection"]=1;
  54166. collection;
  54167. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54168. return $core.withContext(function($ctx3) {
  54169. return $self._sampleNewValue();
  54170. $ctx3.sendIdx["sampleNewValue"]=1;
  54171. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54172. }));
  54173. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54174. $2=$self._sampleNewValue();
  54175. $ctx2.sendIdx["sampleNewValue"]=2;
  54176. $self._assert_equals_($1,$2);
  54177. $ctx2.sendIdx["assert:equals:"]=1;
  54178. $3=collection;
  54179. $4=$self._collection();
  54180. $ctx2.sendIdx["collection"]=2;
  54181. return $self._assert_equals_($3,$4);
  54182. $ctx2.sendIdx["assert:equals:"]=2;
  54183. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54184. }));
  54185. $self._samplesDo_((function(index,value){
  54186. var collection;
  54187. return $core.withContext(function($ctx2) {
  54188. collection=$self._collection();
  54189. $ctx2.sendIdx["collection"]=3;
  54190. collection;
  54191. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54192. return $core.withContext(function($ctx3) {
  54193. return $self._sampleNewValue();
  54194. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54195. }));
  54196. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54197. $self._assert_equals_($5,value);
  54198. $ctx2.sendIdx["assert:equals:"]=3;
  54199. $7=collection;
  54200. $8=$self._collection();
  54201. $ctx2.sendIdx["collection"]=4;
  54202. $6=$recv($7).__eq($8);
  54203. return $self._deny_($6);
  54204. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54205. }));
  54206. $10=$self._collectionWithNewValue();
  54207. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54208. return $core.withContext(function($ctx2) {
  54209. return $self._assert_(false);
  54210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54211. }));
  54212. $9=$recv($10)._yourself();
  54213. $self._assert_equals_($9,$self._collection());
  54214. return self;
  54215. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54216. },
  54217. args: [],
  54218. 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",
  54219. referencedClasses: [],
  54220. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54221. }),
  54222. $globals.AssociativeCollectionTest);
  54223. $core.addMethod(
  54224. $core.method({
  54225. selector: "testValues",
  54226. protocol: "tests",
  54227. fn: function (){
  54228. var self=this,$self=this;
  54229. return $core.withContext(function($ctx1) {
  54230. var $2,$1,$3,$4;
  54231. $2=$recv($recv($self._collectionClass())._new())._values();
  54232. $ctx1.sendIdx["values"]=1;
  54233. $1=$recv($2)._isEmpty();
  54234. $self._assert_($1);
  54235. $3=$recv($self._collection())._values();
  54236. $ctx1.sendIdx["values"]=2;
  54237. $4=$self._collectionValues();
  54238. $ctx1.sendIdx["collectionValues"]=1;
  54239. $self._assertSameContents_as_($3,$4);
  54240. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54241. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54242. return self;
  54243. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54244. },
  54245. args: [],
  54246. 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 }",
  54247. referencedClasses: [],
  54248. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54249. }),
  54250. $globals.AssociativeCollectionTest);
  54251. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54252. $core.addMethod(
  54253. $core.method({
  54254. selector: "collection",
  54255. protocol: "fixture",
  54256. fn: function (){
  54257. var self=this,$self=this;
  54258. return $core.withContext(function($ctx1) {
  54259. var $1;
  54260. $1=$recv($globals.Dictionary)._new();
  54261. $recv($1)._at_put_((1),(1));
  54262. $ctx1.sendIdx["at:put:"]=1;
  54263. $recv($1)._at_put_("a",(2));
  54264. $ctx1.sendIdx["at:put:"]=2;
  54265. $recv($1)._at_put_(true,(3));
  54266. $ctx1.sendIdx["at:put:"]=3;
  54267. $recv($1)._at_put_((1).__at((3)),(-4));
  54268. $ctx1.sendIdx["at:put:"]=4;
  54269. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54270. return $recv($1)._yourself();
  54271. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54272. },
  54273. args: [],
  54274. 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",
  54275. referencedClasses: ["Dictionary"],
  54276. messageSends: ["at:put:", "new", "@", "yourself"]
  54277. }),
  54278. $globals.DictionaryTest);
  54279. $core.addMethod(
  54280. $core.method({
  54281. selector: "collectionKeys",
  54282. protocol: "fixture",
  54283. fn: function (){
  54284. var self=this,$self=this;
  54285. return $core.withContext(function($ctx1) {
  54286. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54287. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54288. },
  54289. args: [],
  54290. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54291. referencedClasses: [],
  54292. messageSends: ["@"]
  54293. }),
  54294. $globals.DictionaryTest);
  54295. $core.addMethod(
  54296. $core.method({
  54297. selector: "collectionOfPrintStrings",
  54298. protocol: "fixture",
  54299. fn: function (){
  54300. var self=this,$self=this;
  54301. return $core.withContext(function($ctx1) {
  54302. var $1;
  54303. $1=$recv($globals.Dictionary)._new();
  54304. $recv($1)._at_put_((1),"1");
  54305. $ctx1.sendIdx["at:put:"]=1;
  54306. $recv($1)._at_put_("a","2");
  54307. $ctx1.sendIdx["at:put:"]=2;
  54308. $recv($1)._at_put_(true,"3");
  54309. $ctx1.sendIdx["at:put:"]=3;
  54310. $recv($1)._at_put_((1).__at((3)),"-4");
  54311. $ctx1.sendIdx["at:put:"]=4;
  54312. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54313. return $recv($1)._yourself();
  54314. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54315. },
  54316. args: [],
  54317. 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",
  54318. referencedClasses: ["Dictionary"],
  54319. messageSends: ["at:put:", "new", "@", "yourself"]
  54320. }),
  54321. $globals.DictionaryTest);
  54322. $core.addMethod(
  54323. $core.method({
  54324. selector: "collectionSize",
  54325. protocol: "fixture",
  54326. fn: function (){
  54327. var self=this,$self=this;
  54328. return (5);
  54329. },
  54330. args: [],
  54331. source: "collectionSize\x0a\x09^ 5",
  54332. referencedClasses: [],
  54333. messageSends: []
  54334. }),
  54335. $globals.DictionaryTest);
  54336. $core.addMethod(
  54337. $core.method({
  54338. selector: "collectionValues",
  54339. protocol: "fixture",
  54340. fn: function (){
  54341. var self=this,$self=this;
  54342. return [(1),(2),(3),(-4),(9)];
  54343. },
  54344. args: [],
  54345. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54346. referencedClasses: [],
  54347. messageSends: []
  54348. }),
  54349. $globals.DictionaryTest);
  54350. $core.addMethod(
  54351. $core.method({
  54352. selector: "collectionWithDuplicates",
  54353. protocol: "fixture",
  54354. fn: function (){
  54355. var self=this,$self=this;
  54356. return $core.withContext(function($ctx1) {
  54357. var $1;
  54358. $1=$recv($globals.Dictionary)._new();
  54359. $recv($1)._at_put_((1),(1));
  54360. $ctx1.sendIdx["at:put:"]=1;
  54361. $recv($1)._at_put_("a",(2));
  54362. $ctx1.sendIdx["at:put:"]=2;
  54363. $recv($1)._at_put_(true,(3));
  54364. $ctx1.sendIdx["at:put:"]=3;
  54365. $recv($1)._at_put_((4),(-4));
  54366. $ctx1.sendIdx["at:put:"]=4;
  54367. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54368. $ctx1.sendIdx["at:put:"]=5;
  54369. $recv($1)._at_put_("b",(1));
  54370. $ctx1.sendIdx["at:put:"]=6;
  54371. $recv($1)._at_put_((3),(3));
  54372. $ctx1.sendIdx["at:put:"]=7;
  54373. $recv($1)._at_put_(false,(12));
  54374. return $recv($1)._yourself();
  54375. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54376. },
  54377. args: [],
  54378. 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",
  54379. referencedClasses: ["Dictionary"],
  54380. messageSends: ["at:put:", "new", "yourself"]
  54381. }),
  54382. $globals.DictionaryTest);
  54383. $core.addMethod(
  54384. $core.method({
  54385. selector: "collectionWithNewValue",
  54386. protocol: "fixture",
  54387. fn: function (){
  54388. var self=this,$self=this;
  54389. return $core.withContext(function($ctx1) {
  54390. var $1;
  54391. $1=$recv($globals.Dictionary)._new();
  54392. $recv($1)._at_put_((1),(1));
  54393. $ctx1.sendIdx["at:put:"]=1;
  54394. $recv($1)._at_put_("a",(2));
  54395. $ctx1.sendIdx["at:put:"]=2;
  54396. $recv($1)._at_put_(true,(3));
  54397. $ctx1.sendIdx["at:put:"]=3;
  54398. $recv($1)._at_put_((1).__at((3)),(-4));
  54399. $ctx1.sendIdx["at:put:"]=4;
  54400. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54401. $ctx1.sendIdx["at:put:"]=5;
  54402. $recv($1)._at_put_("new","N");
  54403. return $recv($1)._yourself();
  54404. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54405. },
  54406. args: [],
  54407. 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",
  54408. referencedClasses: ["Dictionary"],
  54409. messageSends: ["at:put:", "new", "@", "yourself"]
  54410. }),
  54411. $globals.DictionaryTest);
  54412. $core.addMethod(
  54413. $core.method({
  54414. selector: "sampleNewValueAsCollection",
  54415. protocol: "fixture",
  54416. fn: function (){
  54417. var self=this,$self=this;
  54418. return $core.withContext(function($ctx1) {
  54419. var $1;
  54420. $1=$recv($globals.Dictionary)._new();
  54421. $recv($1)._at_put_("new","N");
  54422. return $recv($1)._yourself();
  54423. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54424. },
  54425. args: [],
  54426. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54427. referencedClasses: ["Dictionary"],
  54428. messageSends: ["at:put:", "new", "yourself"]
  54429. }),
  54430. $globals.DictionaryTest);
  54431. $core.addMethod(
  54432. $core.method({
  54433. selector: "samplesDo:",
  54434. protocol: "fixture",
  54435. fn: function (aBlock){
  54436. var self=this,$self=this;
  54437. return $core.withContext(function($ctx1) {
  54438. (
  54439. $ctx1.supercall = true,
  54440. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54441. $ctx1.supercall = false;
  54442. $recv(aBlock)._value_value_(true,(3));
  54443. $ctx1.sendIdx["value:value:"]=1;
  54444. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54445. $ctx1.sendIdx["value:value:"]=2;
  54446. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54447. return self;
  54448. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54449. },
  54450. args: ["aBlock"],
  54451. 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",
  54452. referencedClasses: [],
  54453. messageSends: ["samplesDo:", "value:value:", "@"]
  54454. }),
  54455. $globals.DictionaryTest);
  54456. $core.addMethod(
  54457. $core.method({
  54458. selector: "testAccessing",
  54459. protocol: "tests",
  54460. fn: function (){
  54461. var self=this,$self=this;
  54462. var d;
  54463. return $core.withContext(function($ctx1) {
  54464. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54465. d=$recv($globals.Dictionary)._new();
  54466. $recv(d)._at_put_("hello","world");
  54467. $ctx1.sendIdx["at:put:"]=1;
  54468. $1=$recv(d)._at_("hello");
  54469. $ctx1.sendIdx["at:"]=1;
  54470. $self._assert_equals_($1,"world");
  54471. $ctx1.sendIdx["assert:equals:"]=1;
  54472. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54473. return nil;
  54474. }));
  54475. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54476. $self._assert_equals_($2,"world");
  54477. $ctx1.sendIdx["assert:equals:"]=2;
  54478. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54479. return nil;
  54480. }))).__eq("world"));
  54481. $ctx1.sendIdx["deny:"]=1;
  54482. $3=$recv(d)._includesKey_("hello");
  54483. $ctx1.sendIdx["includesKey:"]=1;
  54484. $self._assert_($3);
  54485. $ctx1.sendIdx["assert:"]=1;
  54486. $4=$recv(d)._includesKey_("foo");
  54487. $ctx1.sendIdx["includesKey:"]=2;
  54488. $self._deny_($4);
  54489. $ctx1.sendIdx["deny:"]=2;
  54490. $recv(d)._at_put_((1),(2));
  54491. $ctx1.sendIdx["at:put:"]=2;
  54492. $5=$recv(d)._at_((1));
  54493. $ctx1.sendIdx["at:"]=2;
  54494. $self._assert_equals_($5,(2));
  54495. $ctx1.sendIdx["assert:equals:"]=3;
  54496. $6=d;
  54497. $7=(1).__at((3));
  54498. $ctx1.sendIdx["@"]=1;
  54499. $recv($6)._at_put_($7,(3));
  54500. $9=d;
  54501. $10=(1).__at((3));
  54502. $ctx1.sendIdx["@"]=2;
  54503. $8=$recv($9)._at_($10);
  54504. $self._assert_equals_($8,(3));
  54505. $12=d;
  54506. $13=(1).__at((3));
  54507. $ctx1.sendIdx["@"]=3;
  54508. $11=$recv($12)._includesKey_($13);
  54509. $ctx1.sendIdx["includesKey:"]=3;
  54510. $self._assert_($11);
  54511. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54512. return self;
  54513. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54514. },
  54515. args: [],
  54516. 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)",
  54517. referencedClasses: ["Dictionary"],
  54518. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54519. }),
  54520. $globals.DictionaryTest);
  54521. $core.addMethod(
  54522. $core.method({
  54523. selector: "testDynamicDictionaries",
  54524. protocol: "tests",
  54525. fn: function (){
  54526. var self=this,$self=this;
  54527. return $core.withContext(function($ctx1) {
  54528. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54529. return self;
  54530. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54531. },
  54532. args: [],
  54533. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54534. referencedClasses: ["Dictionary"],
  54535. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54536. }),
  54537. $globals.DictionaryTest);
  54538. $core.addMethod(
  54539. $core.method({
  54540. selector: "collectionClass",
  54541. protocol: "fixture",
  54542. fn: function (){
  54543. var self=this,$self=this;
  54544. return $globals.Dictionary;
  54545. },
  54546. args: [],
  54547. source: "collectionClass\x0a\x09^ Dictionary",
  54548. referencedClasses: ["Dictionary"],
  54549. messageSends: []
  54550. }),
  54551. $globals.DictionaryTest.a$cls);
  54552. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54553. $core.addMethod(
  54554. $core.method({
  54555. selector: "collection",
  54556. protocol: "fixture",
  54557. fn: function (){
  54558. var self=this,$self=this;
  54559. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54560. },
  54561. args: [],
  54562. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54563. referencedClasses: [],
  54564. messageSends: []
  54565. }),
  54566. $globals.HashedCollectionTest);
  54567. $core.addMethod(
  54568. $core.method({
  54569. selector: "collectionKeys",
  54570. protocol: "fixture",
  54571. fn: function (){
  54572. var self=this,$self=this;
  54573. return ["b","a","c","d"];
  54574. },
  54575. args: [],
  54576. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54577. referencedClasses: [],
  54578. messageSends: []
  54579. }),
  54580. $globals.HashedCollectionTest);
  54581. $core.addMethod(
  54582. $core.method({
  54583. selector: "collectionOfPrintStrings",
  54584. protocol: "fixture",
  54585. fn: function (){
  54586. var self=this,$self=this;
  54587. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54588. },
  54589. args: [],
  54590. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54591. referencedClasses: [],
  54592. messageSends: []
  54593. }),
  54594. $globals.HashedCollectionTest);
  54595. $core.addMethod(
  54596. $core.method({
  54597. selector: "collectionSize",
  54598. protocol: "fixture",
  54599. fn: function (){
  54600. var self=this,$self=this;
  54601. return (4);
  54602. },
  54603. args: [],
  54604. source: "collectionSize\x0a\x09^ 4",
  54605. referencedClasses: [],
  54606. messageSends: []
  54607. }),
  54608. $globals.HashedCollectionTest);
  54609. $core.addMethod(
  54610. $core.method({
  54611. selector: "collectionValues",
  54612. protocol: "fixture",
  54613. fn: function (){
  54614. var self=this,$self=this;
  54615. return [(1),(2),(3),(-4)];
  54616. },
  54617. args: [],
  54618. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54619. referencedClasses: [],
  54620. messageSends: []
  54621. }),
  54622. $globals.HashedCollectionTest);
  54623. $core.addMethod(
  54624. $core.method({
  54625. selector: "collectionWithDuplicates",
  54626. protocol: "fixture",
  54627. fn: function (){
  54628. var self=this,$self=this;
  54629. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54630. },
  54631. args: [],
  54632. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54633. referencedClasses: [],
  54634. messageSends: []
  54635. }),
  54636. $globals.HashedCollectionTest);
  54637. $core.addMethod(
  54638. $core.method({
  54639. selector: "collectionWithNewValue",
  54640. protocol: "fixture",
  54641. fn: function (){
  54642. var self=this,$self=this;
  54643. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  54644. },
  54645. args: [],
  54646. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  54647. referencedClasses: [],
  54648. messageSends: []
  54649. }),
  54650. $globals.HashedCollectionTest);
  54651. $core.addMethod(
  54652. $core.method({
  54653. selector: "sampleNewValueAsCollection",
  54654. protocol: "fixture",
  54655. fn: function (){
  54656. var self=this,$self=this;
  54657. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  54658. },
  54659. args: [],
  54660. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  54661. referencedClasses: [],
  54662. messageSends: []
  54663. }),
  54664. $globals.HashedCollectionTest);
  54665. $core.addMethod(
  54666. $core.method({
  54667. selector: "testDynamicDictionaries",
  54668. protocol: "tests",
  54669. fn: function (){
  54670. var self=this,$self=this;
  54671. return $core.withContext(function($ctx1) {
  54672. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  54673. return self;
  54674. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  54675. },
  54676. args: [],
  54677. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  54678. referencedClasses: ["HashedCollection"],
  54679. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  54680. }),
  54681. $globals.HashedCollectionTest);
  54682. $core.addMethod(
  54683. $core.method({
  54684. selector: "collectionClass",
  54685. protocol: "fixture",
  54686. fn: function (){
  54687. var self=this,$self=this;
  54688. return $globals.HashedCollection;
  54689. },
  54690. args: [],
  54691. source: "collectionClass\x0a\x09^ HashedCollection",
  54692. referencedClasses: ["HashedCollection"],
  54693. messageSends: []
  54694. }),
  54695. $globals.HashedCollectionTest.a$cls);
  54696. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54697. $core.addMethod(
  54698. $core.method({
  54699. selector: "collectionFirst",
  54700. protocol: "fixture",
  54701. fn: function (){
  54702. var self=this,$self=this;
  54703. return $core.withContext(function($ctx1) {
  54704. $self._subclassResponsibility();
  54705. return self;
  54706. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  54707. },
  54708. args: [],
  54709. source: "collectionFirst\x0a\x09self subclassResponsibility",
  54710. referencedClasses: [],
  54711. messageSends: ["subclassResponsibility"]
  54712. }),
  54713. $globals.SequenceableCollectionTest);
  54714. $core.addMethod(
  54715. $core.method({
  54716. selector: "collectionFirstTwo",
  54717. protocol: "fixture",
  54718. fn: function (){
  54719. var self=this,$self=this;
  54720. return $core.withContext(function($ctx1) {
  54721. $self._subclassResponsibility();
  54722. return self;
  54723. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  54724. },
  54725. args: [],
  54726. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  54727. referencedClasses: [],
  54728. messageSends: ["subclassResponsibility"]
  54729. }),
  54730. $globals.SequenceableCollectionTest);
  54731. $core.addMethod(
  54732. $core.method({
  54733. selector: "collectionLast",
  54734. protocol: "fixture",
  54735. fn: function (){
  54736. var self=this,$self=this;
  54737. return $core.withContext(function($ctx1) {
  54738. $self._subclassResponsibility();
  54739. return self;
  54740. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  54741. },
  54742. args: [],
  54743. source: "collectionLast\x0a\x09self subclassResponsibility",
  54744. referencedClasses: [],
  54745. messageSends: ["subclassResponsibility"]
  54746. }),
  54747. $globals.SequenceableCollectionTest);
  54748. $core.addMethod(
  54749. $core.method({
  54750. selector: "collectionLastTwo",
  54751. protocol: "fixture",
  54752. fn: function (){
  54753. var self=this,$self=this;
  54754. return $core.withContext(function($ctx1) {
  54755. $self._subclassResponsibility();
  54756. return self;
  54757. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  54758. },
  54759. args: [],
  54760. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  54761. referencedClasses: [],
  54762. messageSends: ["subclassResponsibility"]
  54763. }),
  54764. $globals.SequenceableCollectionTest);
  54765. $core.addMethod(
  54766. $core.method({
  54767. selector: "nonIndexesDo:",
  54768. protocol: "fixture",
  54769. fn: function (aBlock){
  54770. var self=this,$self=this;
  54771. return $core.withContext(function($ctx1) {
  54772. $recv(aBlock)._value_((0));
  54773. $ctx1.sendIdx["value:"]=1;
  54774. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  54775. $ctx1.sendIdx["value:"]=2;
  54776. $recv(aBlock)._value_("z");
  54777. return self;
  54778. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  54779. },
  54780. args: ["aBlock"],
  54781. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  54782. referencedClasses: [],
  54783. messageSends: ["value:", "+", "collectionSize"]
  54784. }),
  54785. $globals.SequenceableCollectionTest);
  54786. $core.addMethod(
  54787. $core.method({
  54788. selector: "samplesDo:",
  54789. protocol: "fixture",
  54790. fn: function (aBlock){
  54791. var self=this,$self=this;
  54792. return $core.withContext(function($ctx1) {
  54793. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  54794. $ctx1.sendIdx["value:value:"]=1;
  54795. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  54796. return self;
  54797. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  54798. },
  54799. args: ["aBlock"],
  54800. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  54801. referencedClasses: [],
  54802. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  54803. }),
  54804. $globals.SequenceableCollectionTest);
  54805. $core.addMethod(
  54806. $core.method({
  54807. selector: "testBeginsWith",
  54808. protocol: "tests",
  54809. fn: function (){
  54810. var self=this,$self=this;
  54811. return $core.withContext(function($ctx1) {
  54812. var $2,$1,$4,$5,$3,$7,$6;
  54813. $2=$self._collection();
  54814. $ctx1.sendIdx["collection"]=1;
  54815. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  54816. $ctx1.sendIdx["beginsWith:"]=1;
  54817. $self._assert_($1);
  54818. $ctx1.sendIdx["assert:"]=1;
  54819. $4=$self._collection();
  54820. $ctx1.sendIdx["collection"]=2;
  54821. $5=$self._collection();
  54822. $ctx1.sendIdx["collection"]=3;
  54823. $3=$recv($4)._beginsWith_($5);
  54824. $ctx1.sendIdx["beginsWith:"]=2;
  54825. $self._assert_($3);
  54826. $ctx1.sendIdx["assert:"]=2;
  54827. $7=$self._collection();
  54828. $ctx1.sendIdx["collection"]=4;
  54829. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  54830. $ctx1.sendIdx["beginsWith:"]=3;
  54831. $self._assert_($6);
  54832. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  54833. return self;
  54834. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  54835. },
  54836. args: [],
  54837. 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)",
  54838. referencedClasses: [],
  54839. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  54840. }),
  54841. $globals.SequenceableCollectionTest);
  54842. $core.addMethod(
  54843. $core.method({
  54844. selector: "testEndsWith",
  54845. protocol: "tests",
  54846. fn: function (){
  54847. var self=this,$self=this;
  54848. return $core.withContext(function($ctx1) {
  54849. var $2,$1,$4,$5,$3,$7,$6;
  54850. $2=$self._collection();
  54851. $ctx1.sendIdx["collection"]=1;
  54852. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  54853. $ctx1.sendIdx["endsWith:"]=1;
  54854. $self._assert_($1);
  54855. $ctx1.sendIdx["assert:"]=1;
  54856. $4=$self._collection();
  54857. $ctx1.sendIdx["collection"]=2;
  54858. $5=$self._collection();
  54859. $ctx1.sendIdx["collection"]=3;
  54860. $3=$recv($4)._endsWith_($5);
  54861. $ctx1.sendIdx["endsWith:"]=2;
  54862. $self._assert_($3);
  54863. $ctx1.sendIdx["assert:"]=2;
  54864. $7=$self._collection();
  54865. $ctx1.sendIdx["collection"]=4;
  54866. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  54867. $ctx1.sendIdx["endsWith:"]=3;
  54868. $self._assert_($6);
  54869. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  54870. return self;
  54871. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  54872. },
  54873. args: [],
  54874. 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)",
  54875. referencedClasses: [],
  54876. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  54877. }),
  54878. $globals.SequenceableCollectionTest);
  54879. $core.addMethod(
  54880. $core.method({
  54881. selector: "testFirst",
  54882. protocol: "tests",
  54883. fn: function (){
  54884. var self=this,$self=this;
  54885. return $core.withContext(function($ctx1) {
  54886. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  54887. return self;
  54888. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  54889. },
  54890. args: [],
  54891. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  54892. referencedClasses: [],
  54893. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  54894. }),
  54895. $globals.SequenceableCollectionTest);
  54896. $core.addMethod(
  54897. $core.method({
  54898. selector: "testFirstN",
  54899. protocol: "tests",
  54900. fn: function (){
  54901. var self=this,$self=this;
  54902. return $core.withContext(function($ctx1) {
  54903. var $2,$1,$4,$3,$6,$5,$7;
  54904. $2=$self._collection();
  54905. $ctx1.sendIdx["collection"]=1;
  54906. $1=$recv($2)._first_((2));
  54907. $ctx1.sendIdx["first:"]=1;
  54908. $self._assert_equals_($1,$self._collectionFirstTwo());
  54909. $ctx1.sendIdx["assert:equals:"]=1;
  54910. $4=$self._collection();
  54911. $ctx1.sendIdx["collection"]=2;
  54912. $3=$recv($4)._first_((0));
  54913. $ctx1.sendIdx["first:"]=2;
  54914. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  54915. $ctx1.sendIdx["assert:equals:"]=2;
  54916. $6=$self._collection();
  54917. $ctx1.sendIdx["collection"]=3;
  54918. $5=$recv($6)._first_($self._collectionSize());
  54919. $ctx1.sendIdx["first:"]=3;
  54920. $7=$self._collection();
  54921. $ctx1.sendIdx["collection"]=4;
  54922. $self._assert_equals_($5,$7);
  54923. $self._should_raise_((function(){
  54924. return $core.withContext(function($ctx2) {
  54925. return $recv($self._collection())._first_((33));
  54926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54927. }),$globals.Error);
  54928. return self;
  54929. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  54930. },
  54931. args: [],
  54932. 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",
  54933. referencedClasses: ["Error"],
  54934. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  54935. }),
  54936. $globals.SequenceableCollectionTest);
  54937. $core.addMethod(
  54938. $core.method({
  54939. selector: "testFourth",
  54940. protocol: "tests",
  54941. fn: function (){
  54942. var self=this,$self=this;
  54943. return $core.withContext(function($ctx1) {
  54944. var $2,$1;
  54945. $2=$self._collection();
  54946. $ctx1.sendIdx["collection"]=1;
  54947. $1=$recv($2)._fourth();
  54948. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  54949. return self;
  54950. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  54951. },
  54952. args: [],
  54953. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  54954. referencedClasses: [],
  54955. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  54956. }),
  54957. $globals.SequenceableCollectionTest);
  54958. $core.addMethod(
  54959. $core.method({
  54960. selector: "testIndexOfStartingAt",
  54961. protocol: "tests",
  54962. fn: function (){
  54963. var self=this,$self=this;
  54964. var jsNull;
  54965. return $core.withContext(function($ctx1) {
  54966. var $2,$1,$4,$3;
  54967. jsNull=$recv($globals.JSON)._parse_("null");
  54968. $self._samplesDo_((function(index,value){
  54969. return $core.withContext(function($ctx2) {
  54970. $2=$self._collection();
  54971. $ctx2.sendIdx["collection"]=1;
  54972. $1=$recv($2)._indexOf_startingAt_(value,(1));
  54973. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  54974. $self._assert_equals_($1,index);
  54975. $ctx2.sendIdx["assert:equals:"]=1;
  54976. $4=$self._collection();
  54977. $ctx2.sendIdx["collection"]=2;
  54978. $3=$recv($4)._indexOf_startingAt_(value,index);
  54979. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  54980. $self._assert_equals_($3,index);
  54981. $ctx2.sendIdx["assert:equals:"]=2;
  54982. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  54983. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54984. }));
  54985. return self;
  54986. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  54987. },
  54988. args: [],
  54989. 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 ]",
  54990. referencedClasses: ["JSON"],
  54991. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  54992. }),
  54993. $globals.SequenceableCollectionTest);
  54994. $core.addMethod(
  54995. $core.method({
  54996. selector: "testIndexOfStartingAtWithNull",
  54997. protocol: "tests",
  54998. fn: function (){
  54999. var self=this,$self=this;
  55000. var jsNull;
  55001. return $core.withContext(function($ctx1) {
  55002. var $1,$2;
  55003. jsNull=$recv($globals.JSON)._parse_("null");
  55004. $self._samplesDo_((function(index,value){
  55005. var collection;
  55006. return $core.withContext(function($ctx2) {
  55007. collection=$self._collection();
  55008. collection;
  55009. $recv(collection)._at_put_(index,jsNull);
  55010. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55011. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55012. $self._assert_equals_($1,index);
  55013. $ctx2.sendIdx["assert:equals:"]=1;
  55014. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55015. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55016. $self._assert_equals_($2,index);
  55017. $ctx2.sendIdx["assert:equals:"]=2;
  55018. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55019. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55020. }));
  55021. return self;
  55022. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55023. },
  55024. args: [],
  55025. 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 ]",
  55026. referencedClasses: ["JSON"],
  55027. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55028. }),
  55029. $globals.SequenceableCollectionTest);
  55030. $core.addMethod(
  55031. $core.method({
  55032. selector: "testLast",
  55033. protocol: "tests",
  55034. fn: function (){
  55035. var self=this,$self=this;
  55036. return $core.withContext(function($ctx1) {
  55037. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55038. return self;
  55039. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55040. },
  55041. args: [],
  55042. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55043. referencedClasses: [],
  55044. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55045. }),
  55046. $globals.SequenceableCollectionTest);
  55047. $core.addMethod(
  55048. $core.method({
  55049. selector: "testLastN",
  55050. protocol: "tests",
  55051. fn: function (){
  55052. var self=this,$self=this;
  55053. return $core.withContext(function($ctx1) {
  55054. var $2,$1,$4,$3,$6,$5,$7;
  55055. $2=$self._collection();
  55056. $ctx1.sendIdx["collection"]=1;
  55057. $1=$recv($2)._last_((2));
  55058. $ctx1.sendIdx["last:"]=1;
  55059. $self._assert_equals_($1,$self._collectionLastTwo());
  55060. $ctx1.sendIdx["assert:equals:"]=1;
  55061. $4=$self._collection();
  55062. $ctx1.sendIdx["collection"]=2;
  55063. $3=$recv($4)._last_((0));
  55064. $ctx1.sendIdx["last:"]=2;
  55065. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55066. $ctx1.sendIdx["assert:equals:"]=2;
  55067. $6=$self._collection();
  55068. $ctx1.sendIdx["collection"]=3;
  55069. $5=$recv($6)._last_($self._collectionSize());
  55070. $ctx1.sendIdx["last:"]=3;
  55071. $7=$self._collection();
  55072. $ctx1.sendIdx["collection"]=4;
  55073. $self._assert_equals_($5,$7);
  55074. $self._should_raise_((function(){
  55075. return $core.withContext(function($ctx2) {
  55076. return $recv($self._collection())._last_((33));
  55077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55078. }),$globals.Error);
  55079. return self;
  55080. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55081. },
  55082. args: [],
  55083. 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",
  55084. referencedClasses: ["Error"],
  55085. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55086. }),
  55087. $globals.SequenceableCollectionTest);
  55088. $core.addMethod(
  55089. $core.method({
  55090. selector: "testSecond",
  55091. protocol: "tests",
  55092. fn: function (){
  55093. var self=this,$self=this;
  55094. return $core.withContext(function($ctx1) {
  55095. var $2,$1;
  55096. $2=$self._collection();
  55097. $ctx1.sendIdx["collection"]=1;
  55098. $1=$recv($2)._second();
  55099. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55100. return self;
  55101. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55102. },
  55103. args: [],
  55104. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55105. referencedClasses: [],
  55106. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55107. }),
  55108. $globals.SequenceableCollectionTest);
  55109. $core.addMethod(
  55110. $core.method({
  55111. selector: "testThird",
  55112. protocol: "tests",
  55113. fn: function (){
  55114. var self=this,$self=this;
  55115. return $core.withContext(function($ctx1) {
  55116. var $2,$1;
  55117. $2=$self._collection();
  55118. $ctx1.sendIdx["collection"]=1;
  55119. $1=$recv($2)._third();
  55120. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55121. return self;
  55122. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55123. },
  55124. args: [],
  55125. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55126. referencedClasses: [],
  55127. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55128. }),
  55129. $globals.SequenceableCollectionTest);
  55130. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55131. $core.addMethod(
  55132. $core.method({
  55133. selector: "collection",
  55134. protocol: "fixture",
  55135. fn: function (){
  55136. var self=this,$self=this;
  55137. return [(1), (2), (3), (-4)];
  55138. },
  55139. args: [],
  55140. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55141. referencedClasses: [],
  55142. messageSends: []
  55143. }),
  55144. $globals.ArrayTest);
  55145. $core.addMethod(
  55146. $core.method({
  55147. selector: "collectionFirst",
  55148. protocol: "fixture",
  55149. fn: function (){
  55150. var self=this,$self=this;
  55151. return (1);
  55152. },
  55153. args: [],
  55154. source: "collectionFirst\x0a\x09^ 1",
  55155. referencedClasses: [],
  55156. messageSends: []
  55157. }),
  55158. $globals.ArrayTest);
  55159. $core.addMethod(
  55160. $core.method({
  55161. selector: "collectionFirstTwo",
  55162. protocol: "fixture",
  55163. fn: function (){
  55164. var self=this,$self=this;
  55165. return [(1), (2)];
  55166. },
  55167. args: [],
  55168. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55169. referencedClasses: [],
  55170. messageSends: []
  55171. }),
  55172. $globals.ArrayTest);
  55173. $core.addMethod(
  55174. $core.method({
  55175. selector: "collectionLast",
  55176. protocol: "fixture",
  55177. fn: function (){
  55178. var self=this,$self=this;
  55179. return (-4);
  55180. },
  55181. args: [],
  55182. source: "collectionLast\x0a\x09^ -4",
  55183. referencedClasses: [],
  55184. messageSends: []
  55185. }),
  55186. $globals.ArrayTest);
  55187. $core.addMethod(
  55188. $core.method({
  55189. selector: "collectionLastTwo",
  55190. protocol: "fixture",
  55191. fn: function (){
  55192. var self=this,$self=this;
  55193. return [(3), (-4)];
  55194. },
  55195. args: [],
  55196. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55197. referencedClasses: [],
  55198. messageSends: []
  55199. }),
  55200. $globals.ArrayTest);
  55201. $core.addMethod(
  55202. $core.method({
  55203. selector: "collectionOfPrintStrings",
  55204. protocol: "fixture",
  55205. fn: function (){
  55206. var self=this,$self=this;
  55207. return ["1", "2", "3", "-4"];
  55208. },
  55209. args: [],
  55210. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55211. referencedClasses: [],
  55212. messageSends: []
  55213. }),
  55214. $globals.ArrayTest);
  55215. $core.addMethod(
  55216. $core.method({
  55217. selector: "collectionSize",
  55218. protocol: "fixture",
  55219. fn: function (){
  55220. var self=this,$self=this;
  55221. return (4);
  55222. },
  55223. args: [],
  55224. source: "collectionSize\x0a\x09^ 4",
  55225. referencedClasses: [],
  55226. messageSends: []
  55227. }),
  55228. $globals.ArrayTest);
  55229. $core.addMethod(
  55230. $core.method({
  55231. selector: "collectionWithDuplicates",
  55232. protocol: "fixture",
  55233. fn: function (){
  55234. var self=this,$self=this;
  55235. return ["a", "b", "c", (1), (2), (1), "a", []];
  55236. },
  55237. args: [],
  55238. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55239. referencedClasses: [],
  55240. messageSends: []
  55241. }),
  55242. $globals.ArrayTest);
  55243. $core.addMethod(
  55244. $core.method({
  55245. selector: "collectionWithNewValue",
  55246. protocol: "fixture",
  55247. fn: function (){
  55248. var self=this,$self=this;
  55249. return [(1), (2), (3), (-4), "N"];
  55250. },
  55251. args: [],
  55252. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55253. referencedClasses: [],
  55254. messageSends: []
  55255. }),
  55256. $globals.ArrayTest);
  55257. $core.addMethod(
  55258. $core.method({
  55259. selector: "sampleNewIndex",
  55260. protocol: "fixture",
  55261. fn: function (){
  55262. var self=this,$self=this;
  55263. return (5);
  55264. },
  55265. args: [],
  55266. source: "sampleNewIndex\x0a\x09^ 5",
  55267. referencedClasses: [],
  55268. messageSends: []
  55269. }),
  55270. $globals.ArrayTest);
  55271. $core.addMethod(
  55272. $core.method({
  55273. selector: "samplesDo:",
  55274. protocol: "fixture",
  55275. fn: function (aBlock){
  55276. var self=this,$self=this;
  55277. return $core.withContext(function($ctx1) {
  55278. (
  55279. $ctx1.supercall = true,
  55280. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55281. $ctx1.supercall = false;
  55282. $recv(aBlock)._value_value_((3),(3));
  55283. return self;
  55284. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55285. },
  55286. args: ["aBlock"],
  55287. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55288. referencedClasses: [],
  55289. messageSends: ["samplesDo:", "value:value:"]
  55290. }),
  55291. $globals.ArrayTest);
  55292. $core.addMethod(
  55293. $core.method({
  55294. selector: "testAdd",
  55295. protocol: "tests",
  55296. fn: function (){
  55297. var self=this,$self=this;
  55298. var array;
  55299. return $core.withContext(function($ctx1) {
  55300. array=$self._collection();
  55301. $recv(array)._add_((6));
  55302. $self._assert_equals_($recv(array)._last(),(6));
  55303. return self;
  55304. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55305. },
  55306. args: [],
  55307. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55308. referencedClasses: [],
  55309. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55310. }),
  55311. $globals.ArrayTest);
  55312. $core.addMethod(
  55313. $core.method({
  55314. selector: "testAddFirst",
  55315. protocol: "tests",
  55316. fn: function (){
  55317. var self=this,$self=this;
  55318. return $core.withContext(function($ctx1) {
  55319. var $3,$2,$1;
  55320. $3=$self._collection();
  55321. $recv($3)._addFirst_((0));
  55322. $2=$recv($3)._yourself();
  55323. $1=$recv($2)._first();
  55324. $self._assert_equals_($1,(0));
  55325. return self;
  55326. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55327. },
  55328. args: [],
  55329. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55330. referencedClasses: [],
  55331. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55332. }),
  55333. $globals.ArrayTest);
  55334. $core.addMethod(
  55335. $core.method({
  55336. selector: "testPrintString",
  55337. protocol: "tests",
  55338. fn: function (){
  55339. var self=this,$self=this;
  55340. var array;
  55341. return $core.withContext(function($ctx1) {
  55342. var $1,$2,$3,$4,$5,$6,$7,$8;
  55343. array=$recv($globals.Array)._new();
  55344. $1=$recv(array)._printString();
  55345. $ctx1.sendIdx["printString"]=1;
  55346. $self._assert_equals_($1,"an Array ()");
  55347. $ctx1.sendIdx["assert:equals:"]=1;
  55348. $2=array;
  55349. $recv($2)._add_((1));
  55350. $ctx1.sendIdx["add:"]=1;
  55351. $3=$recv($2)._add_((3));
  55352. $ctx1.sendIdx["add:"]=2;
  55353. $4=$recv(array)._printString();
  55354. $ctx1.sendIdx["printString"]=2;
  55355. $self._assert_equals_($4,"an Array (1 3)");
  55356. $ctx1.sendIdx["assert:equals:"]=2;
  55357. $recv(array)._add_("foo");
  55358. $5=$recv(array)._printString();
  55359. $ctx1.sendIdx["printString"]=3;
  55360. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55361. $ctx1.sendIdx["assert:equals:"]=3;
  55362. $6=array;
  55363. $recv($6)._remove_((1));
  55364. $ctx1.sendIdx["remove:"]=1;
  55365. $recv($6)._remove_((3));
  55366. $7=$recv(array)._printString();
  55367. $ctx1.sendIdx["printString"]=4;
  55368. $self._assert_equals_($7,"an Array ('foo')");
  55369. $ctx1.sendIdx["assert:equals:"]=4;
  55370. $recv(array)._addLast_((3));
  55371. $ctx1.sendIdx["addLast:"]=1;
  55372. $8=$recv(array)._printString();
  55373. $ctx1.sendIdx["printString"]=5;
  55374. $self._assert_equals_($8,"an Array ('foo' 3)");
  55375. $ctx1.sendIdx["assert:equals:"]=5;
  55376. $recv(array)._addLast_((3));
  55377. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55378. return self;
  55379. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55380. },
  55381. args: [],
  55382. 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)'.",
  55383. referencedClasses: ["Array"],
  55384. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55385. }),
  55386. $globals.ArrayTest);
  55387. $core.addMethod(
  55388. $core.method({
  55389. selector: "testRemove",
  55390. protocol: "tests",
  55391. fn: function (){
  55392. var self=this,$self=this;
  55393. var array;
  55394. return $core.withContext(function($ctx1) {
  55395. array=[(1), (2), (3), (4), (5)];
  55396. $recv(array)._remove_((3));
  55397. $ctx1.sendIdx["remove:"]=1;
  55398. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55399. $self._should_raise_((function(){
  55400. return $core.withContext(function($ctx2) {
  55401. return $recv(array)._remove_((3));
  55402. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55403. }),$globals.Error);
  55404. return self;
  55405. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55406. },
  55407. args: [],
  55408. 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",
  55409. referencedClasses: ["Error"],
  55410. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55411. }),
  55412. $globals.ArrayTest);
  55413. $core.addMethod(
  55414. $core.method({
  55415. selector: "testRemoveFromTo",
  55416. protocol: "tests",
  55417. fn: function (){
  55418. var self=this,$self=this;
  55419. return $core.withContext(function($ctx1) {
  55420. var $1,$2;
  55421. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55422. $ctx1.sendIdx["removeFrom:to:"]=1;
  55423. $self._assert_equals_($1,[(4)]);
  55424. $ctx1.sendIdx["assert:equals:"]=1;
  55425. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55426. $ctx1.sendIdx["removeFrom:to:"]=2;
  55427. $self._assert_equals_($2,[(1), (4)]);
  55428. $ctx1.sendIdx["assert:equals:"]=2;
  55429. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55430. return self;
  55431. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55432. },
  55433. args: [],
  55434. 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)",
  55435. referencedClasses: [],
  55436. messageSends: ["assert:equals:", "removeFrom:to:"]
  55437. }),
  55438. $globals.ArrayTest);
  55439. $core.addMethod(
  55440. $core.method({
  55441. selector: "testRemoveIndex",
  55442. protocol: "tests",
  55443. fn: function (){
  55444. var self=this,$self=this;
  55445. return $core.withContext(function($ctx1) {
  55446. var $1,$2;
  55447. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55448. $ctx1.sendIdx["removeIndex:"]=1;
  55449. $self._assert_equals_($1,[(1), (3), (4)]);
  55450. $ctx1.sendIdx["assert:equals:"]=1;
  55451. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55452. $ctx1.sendIdx["removeIndex:"]=2;
  55453. $self._assert_equals_($2,[(2), (3), (4)]);
  55454. $ctx1.sendIdx["assert:equals:"]=2;
  55455. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55456. return self;
  55457. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55458. },
  55459. args: [],
  55460. 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: #()",
  55461. referencedClasses: [],
  55462. messageSends: ["assert:equals:", "removeIndex:"]
  55463. }),
  55464. $globals.ArrayTest);
  55465. $core.addMethod(
  55466. $core.method({
  55467. selector: "testRemoveLast",
  55468. protocol: "tests",
  55469. fn: function (){
  55470. var self=this,$self=this;
  55471. var array;
  55472. return $core.withContext(function($ctx1) {
  55473. array=[(1), (2)];
  55474. $recv(array)._removeLast();
  55475. $self._assert_equals_($recv(array)._last(),(1));
  55476. return self;
  55477. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55478. },
  55479. args: [],
  55480. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55481. referencedClasses: [],
  55482. messageSends: ["removeLast", "assert:equals:", "last"]
  55483. }),
  55484. $globals.ArrayTest);
  55485. $core.addMethod(
  55486. $core.method({
  55487. selector: "testReversed",
  55488. protocol: "tests",
  55489. fn: function (){
  55490. var self=this,$self=this;
  55491. var array;
  55492. return $core.withContext(function($ctx1) {
  55493. array=[(5), (4), (3), (2), (1)];
  55494. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55495. return self;
  55496. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55497. },
  55498. args: [],
  55499. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55500. referencedClasses: [],
  55501. messageSends: ["assert:equals:", "reversed"]
  55502. }),
  55503. $globals.ArrayTest);
  55504. $core.addMethod(
  55505. $core.method({
  55506. selector: "testSort",
  55507. protocol: "tests",
  55508. fn: function (){
  55509. var self=this,$self=this;
  55510. var array;
  55511. return $core.withContext(function($ctx1) {
  55512. array=[(10), (1), (5)];
  55513. $recv(array)._sort();
  55514. $self._assert_equals_(array,[(1), (5), (10)]);
  55515. return self;
  55516. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55517. },
  55518. args: [],
  55519. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55520. referencedClasses: [],
  55521. messageSends: ["sort", "assert:equals:"]
  55522. }),
  55523. $globals.ArrayTest);
  55524. $core.addMethod(
  55525. $core.method({
  55526. selector: "collectionClass",
  55527. protocol: "fixture",
  55528. fn: function (){
  55529. var self=this,$self=this;
  55530. return $globals.Array;
  55531. },
  55532. args: [],
  55533. source: "collectionClass\x0a\x09^ Array",
  55534. referencedClasses: ["Array"],
  55535. messageSends: []
  55536. }),
  55537. $globals.ArrayTest.a$cls);
  55538. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55539. $core.addMethod(
  55540. $core.method({
  55541. selector: "collection",
  55542. protocol: "fixture",
  55543. fn: function (){
  55544. var self=this,$self=this;
  55545. return "helLo";
  55546. },
  55547. args: [],
  55548. source: "collection\x0a\x09^ 'helLo'",
  55549. referencedClasses: [],
  55550. messageSends: []
  55551. }),
  55552. $globals.StringTest);
  55553. $core.addMethod(
  55554. $core.method({
  55555. selector: "collectionFirst",
  55556. protocol: "fixture",
  55557. fn: function (){
  55558. var self=this,$self=this;
  55559. return "h";
  55560. },
  55561. args: [],
  55562. source: "collectionFirst\x0a\x09^ 'h'",
  55563. referencedClasses: [],
  55564. messageSends: []
  55565. }),
  55566. $globals.StringTest);
  55567. $core.addMethod(
  55568. $core.method({
  55569. selector: "collectionFirstTwo",
  55570. protocol: "fixture",
  55571. fn: function (){
  55572. var self=this,$self=this;
  55573. return "he";
  55574. },
  55575. args: [],
  55576. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55577. referencedClasses: [],
  55578. messageSends: []
  55579. }),
  55580. $globals.StringTest);
  55581. $core.addMethod(
  55582. $core.method({
  55583. selector: "collectionLast",
  55584. protocol: "fixture",
  55585. fn: function (){
  55586. var self=this,$self=this;
  55587. return "o";
  55588. },
  55589. args: [],
  55590. source: "collectionLast\x0a\x09^ 'o'",
  55591. referencedClasses: [],
  55592. messageSends: []
  55593. }),
  55594. $globals.StringTest);
  55595. $core.addMethod(
  55596. $core.method({
  55597. selector: "collectionLastTwo",
  55598. protocol: "fixture",
  55599. fn: function (){
  55600. var self=this,$self=this;
  55601. return "Lo";
  55602. },
  55603. args: [],
  55604. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55605. referencedClasses: [],
  55606. messageSends: []
  55607. }),
  55608. $globals.StringTest);
  55609. $core.addMethod(
  55610. $core.method({
  55611. selector: "collectionOfPrintStrings",
  55612. protocol: "fixture",
  55613. fn: function (){
  55614. var self=this,$self=this;
  55615. return "'h''e''l''L''o'";
  55616. },
  55617. args: [],
  55618. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55619. referencedClasses: [],
  55620. messageSends: []
  55621. }),
  55622. $globals.StringTest);
  55623. $core.addMethod(
  55624. $core.method({
  55625. selector: "collectionSize",
  55626. protocol: "fixture",
  55627. fn: function (){
  55628. var self=this,$self=this;
  55629. return (5);
  55630. },
  55631. args: [],
  55632. source: "collectionSize\x0a\x09^ 5",
  55633. referencedClasses: [],
  55634. messageSends: []
  55635. }),
  55636. $globals.StringTest);
  55637. $core.addMethod(
  55638. $core.method({
  55639. selector: "collectionWithDuplicates",
  55640. protocol: "fixture",
  55641. fn: function (){
  55642. var self=this,$self=this;
  55643. return "abbaerten";
  55644. },
  55645. args: [],
  55646. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  55647. referencedClasses: [],
  55648. messageSends: []
  55649. }),
  55650. $globals.StringTest);
  55651. $core.addMethod(
  55652. $core.method({
  55653. selector: "collectionWithNewValue",
  55654. protocol: "fixture",
  55655. fn: function (){
  55656. var self=this,$self=this;
  55657. return "helLoN";
  55658. },
  55659. args: [],
  55660. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  55661. referencedClasses: [],
  55662. messageSends: []
  55663. }),
  55664. $globals.StringTest);
  55665. $core.addMethod(
  55666. $core.method({
  55667. selector: "sampleNewValueAsCollection",
  55668. protocol: "fixture",
  55669. fn: function (){
  55670. var self=this,$self=this;
  55671. return "N";
  55672. },
  55673. args: [],
  55674. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  55675. referencedClasses: [],
  55676. messageSends: []
  55677. }),
  55678. $globals.StringTest);
  55679. $core.addMethod(
  55680. $core.method({
  55681. selector: "samplesDo:",
  55682. protocol: "fixture",
  55683. fn: function (aBlock){
  55684. var self=this,$self=this;
  55685. return $core.withContext(function($ctx1) {
  55686. (
  55687. $ctx1.supercall = true,
  55688. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55689. $ctx1.supercall = false;
  55690. $recv(aBlock)._value_value_((3),"l");
  55691. return self;
  55692. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  55693. },
  55694. args: ["aBlock"],
  55695. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  55696. referencedClasses: [],
  55697. messageSends: ["samplesDo:", "value:value:"]
  55698. }),
  55699. $globals.StringTest);
  55700. $core.addMethod(
  55701. $core.method({
  55702. selector: "testAddAll",
  55703. protocol: "tests",
  55704. fn: function (){
  55705. var self=this,$self=this;
  55706. return $core.withContext(function($ctx1) {
  55707. var $1;
  55708. $self._should_raise_((function(){
  55709. return $core.withContext(function($ctx2) {
  55710. $1=$self._collection();
  55711. $ctx2.sendIdx["collection"]=1;
  55712. return $recv($1)._addAll_($self._collection());
  55713. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55714. }),$globals.Error);
  55715. return self;
  55716. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  55717. },
  55718. args: [],
  55719. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  55720. referencedClasses: ["Error"],
  55721. messageSends: ["should:raise:", "addAll:", "collection"]
  55722. }),
  55723. $globals.StringTest);
  55724. $core.addMethod(
  55725. $core.method({
  55726. selector: "testAddRemove",
  55727. protocol: "tests",
  55728. fn: function (){
  55729. var self=this,$self=this;
  55730. return $core.withContext(function($ctx1) {
  55731. $self._should_raise_((function(){
  55732. return $core.withContext(function($ctx2) {
  55733. return "hello"._add_("a");
  55734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55735. }),$globals.Error);
  55736. $ctx1.sendIdx["should:raise:"]=1;
  55737. $self._should_raise_((function(){
  55738. return $core.withContext(function($ctx2) {
  55739. return "hello"._remove_("h");
  55740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55741. }),$globals.Error);
  55742. return self;
  55743. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  55744. },
  55745. args: [],
  55746. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  55747. referencedClasses: ["Error"],
  55748. messageSends: ["should:raise:", "add:", "remove:"]
  55749. }),
  55750. $globals.StringTest);
  55751. $core.addMethod(
  55752. $core.method({
  55753. selector: "testAsArray",
  55754. protocol: "tests",
  55755. fn: function (){
  55756. var self=this,$self=this;
  55757. return $core.withContext(function($ctx1) {
  55758. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  55759. return self;
  55760. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  55761. },
  55762. args: [],
  55763. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  55764. referencedClasses: [],
  55765. messageSends: ["assert:equals:", "asArray"]
  55766. }),
  55767. $globals.StringTest);
  55768. $core.addMethod(
  55769. $core.method({
  55770. selector: "testAsLowerCase",
  55771. protocol: "tests",
  55772. fn: function (){
  55773. var self=this,$self=this;
  55774. return $core.withContext(function($ctx1) {
  55775. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  55776. return self;
  55777. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  55778. },
  55779. args: [],
  55780. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  55781. referencedClasses: [],
  55782. messageSends: ["assert:equals:", "asLowercase"]
  55783. }),
  55784. $globals.StringTest);
  55785. $core.addMethod(
  55786. $core.method({
  55787. selector: "testAsNumber",
  55788. protocol: "tests",
  55789. fn: function (){
  55790. var self=this,$self=this;
  55791. return $core.withContext(function($ctx1) {
  55792. var $1,$2;
  55793. $1="3"._asNumber();
  55794. $ctx1.sendIdx["asNumber"]=1;
  55795. $self._assert_equals_($1,(3));
  55796. $ctx1.sendIdx["assert:equals:"]=1;
  55797. $2="-3"._asNumber();
  55798. $ctx1.sendIdx["asNumber"]=2;
  55799. $self._assert_equals_($2,(-3));
  55800. $ctx1.sendIdx["assert:equals:"]=2;
  55801. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  55802. return self;
  55803. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  55804. },
  55805. args: [],
  55806. 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.",
  55807. referencedClasses: [],
  55808. messageSends: ["assert:equals:", "asNumber"]
  55809. }),
  55810. $globals.StringTest);
  55811. $core.addMethod(
  55812. $core.method({
  55813. selector: "testAsUpperCase",
  55814. protocol: "tests",
  55815. fn: function (){
  55816. var self=this,$self=this;
  55817. return $core.withContext(function($ctx1) {
  55818. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  55819. return self;
  55820. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  55821. },
  55822. args: [],
  55823. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  55824. referencedClasses: [],
  55825. messageSends: ["assert:equals:", "asUppercase"]
  55826. }),
  55827. $globals.StringTest);
  55828. $core.addMethod(
  55829. $core.method({
  55830. selector: "testAsciiValue",
  55831. protocol: "tests",
  55832. fn: function (){
  55833. var self=this,$self=this;
  55834. var characterA,characterU;
  55835. return $core.withContext(function($ctx1) {
  55836. var $1;
  55837. characterA="A";
  55838. characterU="U";
  55839. $1=$recv(characterA)._asciiValue();
  55840. $ctx1.sendIdx["asciiValue"]=1;
  55841. $self._assert_equals_($1,(65));
  55842. $ctx1.sendIdx["assert:equals:"]=1;
  55843. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  55844. return self;
  55845. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  55846. },
  55847. args: [],
  55848. 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",
  55849. referencedClasses: [],
  55850. messageSends: ["assert:equals:", "asciiValue"]
  55851. }),
  55852. $globals.StringTest);
  55853. $core.addMethod(
  55854. $core.method({
  55855. selector: "testAtIfAbsentPut",
  55856. protocol: "tests",
  55857. fn: function (){
  55858. var self=this,$self=this;
  55859. return $core.withContext(function($ctx1) {
  55860. $self._should_raise_((function(){
  55861. return $core.withContext(function($ctx2) {
  55862. return "hello"._at_ifAbsentPut_((6),(function(){
  55863. return "a";
  55864. }));
  55865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55866. }),$globals.Error);
  55867. return self;
  55868. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  55869. },
  55870. args: [],
  55871. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  55872. referencedClasses: ["Error"],
  55873. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  55874. }),
  55875. $globals.StringTest);
  55876. $core.addMethod(
  55877. $core.method({
  55878. selector: "testAtPut",
  55879. protocol: "tests",
  55880. fn: function (){
  55881. var self=this,$self=this;
  55882. return $core.withContext(function($ctx1) {
  55883. $self._should_raise_((function(){
  55884. return $core.withContext(function($ctx2) {
  55885. return "hello"._at_put_((1),"a");
  55886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55887. }),$globals.Error);
  55888. return self;
  55889. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  55890. },
  55891. args: [],
  55892. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  55893. referencedClasses: ["Error"],
  55894. messageSends: ["should:raise:", "at:put:"]
  55895. }),
  55896. $globals.StringTest);
  55897. $core.addMethod(
  55898. $core.method({
  55899. selector: "testCapitalized",
  55900. protocol: "tests",
  55901. fn: function (){
  55902. var self=this,$self=this;
  55903. return $core.withContext(function($ctx1) {
  55904. var $1,$2,$3;
  55905. $1="test"._capitalized();
  55906. $ctx1.sendIdx["capitalized"]=1;
  55907. $self._assert_equals_($1,"Test");
  55908. $ctx1.sendIdx["assert:equals:"]=1;
  55909. $2="Test"._capitalized();
  55910. $ctx1.sendIdx["capitalized"]=2;
  55911. $self._assert_equals_($2,"Test");
  55912. $ctx1.sendIdx["assert:equals:"]=2;
  55913. $self._assert_equals_(""._capitalized(),"");
  55914. $ctx1.sendIdx["assert:equals:"]=3;
  55915. $3="Test"._isCapitalized();
  55916. $ctx1.sendIdx["isCapitalized"]=1;
  55917. $self._assert_equals_($3,true);
  55918. $ctx1.sendIdx["assert:equals:"]=4;
  55919. $self._assert_equals_("test"._isCapitalized(),false);
  55920. return self;
  55921. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  55922. },
  55923. args: [],
  55924. 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.",
  55925. referencedClasses: [],
  55926. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  55927. }),
  55928. $globals.StringTest);
  55929. $core.addMethod(
  55930. $core.method({
  55931. selector: "testCharCodeAt",
  55932. protocol: "tests",
  55933. fn: function (){
  55934. var self=this,$self=this;
  55935. return $core.withContext(function($ctx1) {
  55936. var $1,$2,$3,$4,$5;
  55937. $1="jackie"._charCodeAt_((1));
  55938. $ctx1.sendIdx["charCodeAt:"]=1;
  55939. $self._assert_equals_($1,(106));
  55940. $ctx1.sendIdx["assert:equals:"]=1;
  55941. $2="jackie"._charCodeAt_((2));
  55942. $ctx1.sendIdx["charCodeAt:"]=2;
  55943. $self._assert_equals_($2,(97));
  55944. $ctx1.sendIdx["assert:equals:"]=2;
  55945. $3="jackie"._charCodeAt_((3));
  55946. $ctx1.sendIdx["charCodeAt:"]=3;
  55947. $self._assert_equals_($3,(99));
  55948. $ctx1.sendIdx["assert:equals:"]=3;
  55949. $4="jackie"._charCodeAt_((4));
  55950. $ctx1.sendIdx["charCodeAt:"]=4;
  55951. $self._assert_equals_($4,(107));
  55952. $ctx1.sendIdx["assert:equals:"]=4;
  55953. $5="jackie"._charCodeAt_((5));
  55954. $ctx1.sendIdx["charCodeAt:"]=5;
  55955. $self._assert_equals_($5,(105));
  55956. $ctx1.sendIdx["assert:equals:"]=5;
  55957. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  55958. return self;
  55959. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  55960. },
  55961. args: [],
  55962. 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",
  55963. referencedClasses: [],
  55964. messageSends: ["assert:equals:", "charCodeAt:"]
  55965. }),
  55966. $globals.StringTest);
  55967. $core.addMethod(
  55968. $core.method({
  55969. selector: "testCopyFromTo",
  55970. protocol: "tests",
  55971. fn: function (){
  55972. var self=this,$self=this;
  55973. return $core.withContext(function($ctx1) {
  55974. var $1;
  55975. $1="jackie"._copyFrom_to_((1),(3));
  55976. $ctx1.sendIdx["copyFrom:to:"]=1;
  55977. $self._assert_equals_($1,"jac");
  55978. $ctx1.sendIdx["assert:equals:"]=1;
  55979. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  55980. return self;
  55981. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  55982. },
  55983. args: [],
  55984. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  55985. referencedClasses: [],
  55986. messageSends: ["assert:equals:", "copyFrom:to:"]
  55987. }),
  55988. $globals.StringTest);
  55989. $core.addMethod(
  55990. $core.method({
  55991. selector: "testCopySeparates",
  55992. protocol: "tests",
  55993. fn: function (){
  55994. var self=this,$self=this;
  55995. return $core.withContext(function($ctx1) {
  55996. var $3,$2,$1;
  55997. $3=$self._collection();
  55998. $ctx1.sendIdx["collection"]=1;
  55999. $2=$recv($3)._copy();
  56000. $1=$recv($2).__eq_eq($self._collection());
  56001. $self._assert_($1);
  56002. return self;
  56003. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56004. },
  56005. args: [],
  56006. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56007. referencedClasses: [],
  56008. messageSends: ["assert:", "==", "copy", "collection"]
  56009. }),
  56010. $globals.StringTest);
  56011. $core.addMethod(
  56012. $core.method({
  56013. selector: "testCopyWithoutAll",
  56014. protocol: "tests",
  56015. fn: function (){
  56016. var self=this,$self=this;
  56017. return $core.withContext(function($ctx1) {
  56018. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56019. return self;
  56020. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56021. },
  56022. args: [],
  56023. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56024. referencedClasses: [],
  56025. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56026. }),
  56027. $globals.StringTest);
  56028. $core.addMethod(
  56029. $core.method({
  56030. selector: "testEquality",
  56031. protocol: "tests",
  56032. fn: function (){
  56033. var self=this,$self=this;
  56034. return $core.withContext(function($ctx1) {
  56035. var $1,$2,$3;
  56036. $self._assert_equals_("hello","hello");
  56037. $ctx1.sendIdx["assert:equals:"]=1;
  56038. $1="hello".__eq("world");
  56039. $ctx1.sendIdx["="]=1;
  56040. $self._deny_($1);
  56041. $ctx1.sendIdx["deny:"]=1;
  56042. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56043. })));
  56044. $ctx1.sendIdx["="]=2;
  56045. $self._deny_($2);
  56046. $ctx1.sendIdx["deny:"]=2;
  56047. $3="hello"._yourself();
  56048. $ctx1.sendIdx["yourself"]=1;
  56049. $self._assert_equals_("hello",$3);
  56050. $ctx1.sendIdx["assert:equals:"]=2;
  56051. $self._assert_equals_("hello"._yourself(),"hello");
  56052. $self._deny_("".__eq((0)));
  56053. return self;
  56054. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56055. },
  56056. args: [],
  56057. 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",
  56058. referencedClasses: [],
  56059. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56060. }),
  56061. $globals.StringTest);
  56062. $core.addMethod(
  56063. $core.method({
  56064. selector: "testIdentity",
  56065. protocol: "tests",
  56066. fn: function (){
  56067. var self=this,$self=this;
  56068. return $core.withContext(function($ctx1) {
  56069. var $1,$2,$4,$3,$5;
  56070. $1="hello".__eq_eq("hello");
  56071. $ctx1.sendIdx["=="]=1;
  56072. $self._assert_($1);
  56073. $ctx1.sendIdx["assert:"]=1;
  56074. $2="hello".__eq_eq("world");
  56075. $ctx1.sendIdx["=="]=2;
  56076. $self._deny_($2);
  56077. $ctx1.sendIdx["deny:"]=1;
  56078. $4="hello"._yourself();
  56079. $ctx1.sendIdx["yourself"]=1;
  56080. $3="hello".__eq_eq($4);
  56081. $ctx1.sendIdx["=="]=3;
  56082. $self._assert_($3);
  56083. $ctx1.sendIdx["assert:"]=2;
  56084. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56085. $ctx1.sendIdx["=="]=4;
  56086. $self._assert_($5);
  56087. $self._deny_("".__eq_eq((0)));
  56088. return self;
  56089. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56090. },
  56091. args: [],
  56092. 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",
  56093. referencedClasses: [],
  56094. messageSends: ["assert:", "==", "deny:", "yourself"]
  56095. }),
  56096. $globals.StringTest);
  56097. $core.addMethod(
  56098. $core.method({
  56099. selector: "testIncludesSubString",
  56100. protocol: "tests",
  56101. fn: function (){
  56102. var self=this,$self=this;
  56103. return $core.withContext(function($ctx1) {
  56104. var $1;
  56105. $1="amber"._includesSubString_("ber");
  56106. $ctx1.sendIdx["includesSubString:"]=1;
  56107. $self._assert_($1);
  56108. $self._deny_("amber"._includesSubString_("zork"));
  56109. return self;
  56110. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56111. },
  56112. args: [],
  56113. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56114. referencedClasses: [],
  56115. messageSends: ["assert:", "includesSubString:", "deny:"]
  56116. }),
  56117. $globals.StringTest);
  56118. $core.addMethod(
  56119. $core.method({
  56120. selector: "testIndexOfStartingAtWithNull",
  56121. protocol: "tests",
  56122. fn: function (){
  56123. var self=this,$self=this;
  56124. return self;
  56125. },
  56126. args: [],
  56127. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56128. referencedClasses: [],
  56129. messageSends: []
  56130. }),
  56131. $globals.StringTest);
  56132. $core.addMethod(
  56133. $core.method({
  56134. selector: "testIndexOfWithNull",
  56135. protocol: "tests",
  56136. fn: function (){
  56137. var self=this,$self=this;
  56138. return self;
  56139. },
  56140. args: [],
  56141. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56142. referencedClasses: [],
  56143. messageSends: []
  56144. }),
  56145. $globals.StringTest);
  56146. $core.addMethod(
  56147. $core.method({
  56148. selector: "testIsVowel",
  56149. protocol: "tests",
  56150. fn: function (){
  56151. var self=this,$self=this;
  56152. var vowel,consonant;
  56153. return $core.withContext(function($ctx1) {
  56154. var $1;
  56155. vowel="u";
  56156. consonant="z";
  56157. $1=$recv(vowel)._isVowel();
  56158. $ctx1.sendIdx["isVowel"]=1;
  56159. $self._assert_equals_($1,true);
  56160. $ctx1.sendIdx["assert:equals:"]=1;
  56161. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56162. return self;
  56163. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56164. },
  56165. args: [],
  56166. 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",
  56167. referencedClasses: [],
  56168. messageSends: ["assert:equals:", "isVowel"]
  56169. }),
  56170. $globals.StringTest);
  56171. $core.addMethod(
  56172. $core.method({
  56173. selector: "testJoin",
  56174. protocol: "tests",
  56175. fn: function (){
  56176. var self=this,$self=this;
  56177. return $core.withContext(function($ctx1) {
  56178. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56179. return self;
  56180. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56181. },
  56182. args: [],
  56183. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56184. referencedClasses: [],
  56185. messageSends: ["assert:equals:", "join:"]
  56186. }),
  56187. $globals.StringTest);
  56188. $core.addMethod(
  56189. $core.method({
  56190. selector: "testRegression1224",
  56191. protocol: "tests",
  56192. fn: function (){
  56193. var self=this,$self=this;
  56194. return $core.withContext(function($ctx1) {
  56195. var $2,$1;
  56196. $self._should_raise_((function(){
  56197. return $core.withContext(function($ctx2) {
  56198. $2=$recv($self._collectionClass())._new();
  56199. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56200. }));
  56201. $1=$recv($2)._yourself();
  56202. return $recv($1)._size();
  56203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56204. }),$globals.Error);
  56205. return self;
  56206. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56207. },
  56208. args: [],
  56209. 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",
  56210. referencedClasses: ["Error"],
  56211. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56212. }),
  56213. $globals.StringTest);
  56214. $core.addMethod(
  56215. $core.method({
  56216. selector: "testRemoveAll",
  56217. protocol: "tests",
  56218. fn: function (){
  56219. var self=this,$self=this;
  56220. return $core.withContext(function($ctx1) {
  56221. $self._should_raise_((function(){
  56222. return $core.withContext(function($ctx2) {
  56223. return $recv($self._collection())._removeAll();
  56224. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56225. }),$globals.Error);
  56226. return self;
  56227. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56228. },
  56229. args: [],
  56230. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56231. referencedClasses: ["Error"],
  56232. messageSends: ["should:raise:", "removeAll", "collection"]
  56233. }),
  56234. $globals.StringTest);
  56235. $core.addMethod(
  56236. $core.method({
  56237. selector: "testReversed",
  56238. protocol: "tests",
  56239. fn: function (){
  56240. var self=this,$self=this;
  56241. return $core.withContext(function($ctx1) {
  56242. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56243. return self;
  56244. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56245. },
  56246. args: [],
  56247. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56248. referencedClasses: [],
  56249. messageSends: ["assert:equals:", "reversed"]
  56250. }),
  56251. $globals.StringTest);
  56252. $core.addMethod(
  56253. $core.method({
  56254. selector: "testStreamContents",
  56255. protocol: "tests",
  56256. fn: function (){
  56257. var self=this,$self=this;
  56258. return $core.withContext(function($ctx1) {
  56259. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56260. return $core.withContext(function($ctx2) {
  56261. $recv(aStream)._nextPutAll_("hello");
  56262. $ctx2.sendIdx["nextPutAll:"]=1;
  56263. $recv(aStream)._space();
  56264. return $recv(aStream)._nextPutAll_("world");
  56265. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56266. })),"hello world");
  56267. return self;
  56268. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56269. },
  56270. args: [],
  56271. 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'",
  56272. referencedClasses: ["String"],
  56273. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56274. }),
  56275. $globals.StringTest);
  56276. $core.addMethod(
  56277. $core.method({
  56278. selector: "testSubStrings",
  56279. protocol: "tests",
  56280. fn: function (){
  56281. var self=this,$self=this;
  56282. return $core.withContext(function($ctx1) {
  56283. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56284. return self;
  56285. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56286. },
  56287. args: [],
  56288. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56289. referencedClasses: [],
  56290. messageSends: ["assert:equals:", "subStrings:"]
  56291. }),
  56292. $globals.StringTest);
  56293. $core.addMethod(
  56294. $core.method({
  56295. selector: "testTrim",
  56296. protocol: "tests",
  56297. fn: function (){
  56298. var self=this,$self=this;
  56299. return $core.withContext(function($ctx1) {
  56300. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56301. $ctx1.sendIdx["assert:equals:"]=1;
  56302. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56303. return self;
  56304. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56305. },
  56306. args: [],
  56307. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56308. referencedClasses: [],
  56309. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56310. }),
  56311. $globals.StringTest);
  56312. $core.addMethod(
  56313. $core.method({
  56314. selector: "testValue",
  56315. protocol: "tests",
  56316. fn: function (){
  56317. var self=this,$self=this;
  56318. return $core.withContext(function($ctx1) {
  56319. $self._assert_equals_("asString"._value_((1)),"1");
  56320. $ctx1.sendIdx["assert:equals:"]=1;
  56321. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56322. return self;
  56323. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56324. },
  56325. args: [],
  56326. 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')",
  56327. referencedClasses: [],
  56328. messageSends: ["assert:equals:", "value:", "collect:"]
  56329. }),
  56330. $globals.StringTest);
  56331. $core.addMethod(
  56332. $core.method({
  56333. selector: "collectionClass",
  56334. protocol: "fixture",
  56335. fn: function (){
  56336. var self=this,$self=this;
  56337. return $globals.String;
  56338. },
  56339. args: [],
  56340. source: "collectionClass\x0a\x09^ String",
  56341. referencedClasses: ["String"],
  56342. messageSends: []
  56343. }),
  56344. $globals.StringTest.a$cls);
  56345. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56346. $core.addMethod(
  56347. $core.method({
  56348. selector: "collection",
  56349. protocol: "fixture",
  56350. fn: function (){
  56351. var self=this,$self=this;
  56352. return $core.withContext(function($ctx1) {
  56353. var $1;
  56354. $1=$recv($globals.Set)._new();
  56355. $recv($1)._add_($globals.Smalltalk);
  56356. $ctx1.sendIdx["add:"]=1;
  56357. $recv($1)._add_(nil);
  56358. $ctx1.sendIdx["add:"]=2;
  56359. $recv($1)._add_((3).__at((3)));
  56360. $ctx1.sendIdx["add:"]=3;
  56361. $recv($1)._add_(false);
  56362. $ctx1.sendIdx["add:"]=4;
  56363. $recv($1)._add_($self["@sampleBlock"]);
  56364. return $recv($1)._yourself();
  56365. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56366. },
  56367. args: [],
  56368. 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",
  56369. referencedClasses: ["Set", "Smalltalk"],
  56370. messageSends: ["add:", "new", "@", "yourself"]
  56371. }),
  56372. $globals.SetTest);
  56373. $core.addMethod(
  56374. $core.method({
  56375. selector: "collectionOfPrintStrings",
  56376. protocol: "fixture",
  56377. fn: function (){
  56378. var self=this,$self=this;
  56379. return $core.withContext(function($ctx1) {
  56380. var $1;
  56381. $1=$recv($globals.Set)._new();
  56382. $recv($1)._add_("a SmalltalkImage");
  56383. $ctx1.sendIdx["add:"]=1;
  56384. $recv($1)._add_("nil");
  56385. $ctx1.sendIdx["add:"]=2;
  56386. $recv($1)._add_("3@3");
  56387. $ctx1.sendIdx["add:"]=3;
  56388. $recv($1)._add_("false");
  56389. $ctx1.sendIdx["add:"]=4;
  56390. $recv($1)._add_("a BlockClosure");
  56391. return $recv($1)._yourself();
  56392. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56393. },
  56394. args: [],
  56395. 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",
  56396. referencedClasses: ["Set"],
  56397. messageSends: ["add:", "new", "yourself"]
  56398. }),
  56399. $globals.SetTest);
  56400. $core.addMethod(
  56401. $core.method({
  56402. selector: "collectionSize",
  56403. protocol: "fixture",
  56404. fn: function (){
  56405. var self=this,$self=this;
  56406. return (5);
  56407. },
  56408. args: [],
  56409. source: "collectionSize\x0a\x09^ 5",
  56410. referencedClasses: [],
  56411. messageSends: []
  56412. }),
  56413. $globals.SetTest);
  56414. $core.addMethod(
  56415. $core.method({
  56416. selector: "collectionWithDuplicates",
  56417. protocol: "fixture",
  56418. fn: function (){
  56419. var self=this,$self=this;
  56420. return $core.withContext(function($ctx1) {
  56421. var $1;
  56422. $1=$self._collection();
  56423. $recv($1)._add_((0));
  56424. return $recv($1)._yourself();
  56425. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56426. },
  56427. args: [],
  56428. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56429. referencedClasses: [],
  56430. messageSends: ["add:", "collection", "yourself"]
  56431. }),
  56432. $globals.SetTest);
  56433. $core.addMethod(
  56434. $core.method({
  56435. selector: "collectionWithNewValue",
  56436. protocol: "fixture",
  56437. fn: function (){
  56438. var self=this,$self=this;
  56439. return $core.withContext(function($ctx1) {
  56440. var $1;
  56441. $1=$recv($globals.Set)._new();
  56442. $recv($1)._add_($globals.Smalltalk);
  56443. $ctx1.sendIdx["add:"]=1;
  56444. $recv($1)._add_(nil);
  56445. $ctx1.sendIdx["add:"]=2;
  56446. $recv($1)._add_((3).__at((3)));
  56447. $ctx1.sendIdx["add:"]=3;
  56448. $recv($1)._add_("N");
  56449. $ctx1.sendIdx["add:"]=4;
  56450. $recv($1)._add_(false);
  56451. $ctx1.sendIdx["add:"]=5;
  56452. $recv($1)._add_($self["@sampleBlock"]);
  56453. return $recv($1)._yourself();
  56454. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56455. },
  56456. args: [],
  56457. 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",
  56458. referencedClasses: ["Set", "Smalltalk"],
  56459. messageSends: ["add:", "new", "@", "yourself"]
  56460. }),
  56461. $globals.SetTest);
  56462. $core.addMethod(
  56463. $core.method({
  56464. selector: "testAddAll",
  56465. protocol: "tests",
  56466. fn: function (){
  56467. var self=this,$self=this;
  56468. return $core.withContext(function($ctx1) {
  56469. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56470. (
  56471. $ctx1.supercall = true,
  56472. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56473. $ctx1.supercall = false;
  56474. $2=$self._collection();
  56475. $ctx1.sendIdx["collection"]=1;
  56476. $3=$self._collection();
  56477. $ctx1.sendIdx["collection"]=2;
  56478. $recv($2)._addAll_($3);
  56479. $ctx1.sendIdx["addAll:"]=1;
  56480. $4=$recv($2)._yourself();
  56481. $ctx1.sendIdx["yourself"]=1;
  56482. $1=$4;
  56483. $5=$self._collection();
  56484. $ctx1.sendIdx["collection"]=3;
  56485. $self._assert_equals_($1,$5);
  56486. $ctx1.sendIdx["assert:equals:"]=1;
  56487. $7=$self._collection();
  56488. $ctx1.sendIdx["collection"]=4;
  56489. $8=$self._collectionWithNewValue();
  56490. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56491. $recv($7)._addAll_($8);
  56492. $ctx1.sendIdx["addAll:"]=2;
  56493. $9=$recv($7)._yourself();
  56494. $ctx1.sendIdx["yourself"]=2;
  56495. $6=$9;
  56496. $10=$self._collectionWithNewValue();
  56497. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56498. $self._assert_equals_($6,$10);
  56499. $ctx1.sendIdx["assert:equals:"]=2;
  56500. $12=$self._collectionWithNewValue();
  56501. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56502. $recv($12)._addAll_($self._collection());
  56503. $11=$recv($12)._yourself();
  56504. $self._assert_equals_($11,$self._collectionWithNewValue());
  56505. return self;
  56506. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56507. },
  56508. args: [],
  56509. 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",
  56510. referencedClasses: [],
  56511. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56512. }),
  56513. $globals.SetTest);
  56514. $core.addMethod(
  56515. $core.method({
  56516. selector: "testAddRemove",
  56517. protocol: "tests",
  56518. fn: function (){
  56519. var self=this,$self=this;
  56520. var set;
  56521. return $core.withContext(function($ctx1) {
  56522. var $1,$2;
  56523. set=$recv($globals.Set)._new();
  56524. $self._assert_($recv(set)._isEmpty());
  56525. $ctx1.sendIdx["assert:"]=1;
  56526. $recv(set)._add_((3));
  56527. $ctx1.sendIdx["add:"]=1;
  56528. $1=$recv(set)._includes_((3));
  56529. $ctx1.sendIdx["includes:"]=1;
  56530. $self._assert_($1);
  56531. $ctx1.sendIdx["assert:"]=2;
  56532. $recv(set)._add_((5));
  56533. $2=$recv(set)._includes_((5));
  56534. $ctx1.sendIdx["includes:"]=2;
  56535. $self._assert_($2);
  56536. $recv(set)._remove_((3));
  56537. $self._deny_($recv(set)._includes_((3)));
  56538. return self;
  56539. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56540. },
  56541. args: [],
  56542. 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)",
  56543. referencedClasses: ["Set"],
  56544. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56545. }),
  56546. $globals.SetTest);
  56547. $core.addMethod(
  56548. $core.method({
  56549. selector: "testAt",
  56550. protocol: "tests",
  56551. fn: function (){
  56552. var self=this,$self=this;
  56553. return $core.withContext(function($ctx1) {
  56554. $self._should_raise_((function(){
  56555. return $core.withContext(function($ctx2) {
  56556. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56558. }),$globals.Error);
  56559. return self;
  56560. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56561. },
  56562. args: [],
  56563. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56564. referencedClasses: ["Set", "Error"],
  56565. messageSends: ["should:raise:", "at:put:", "new"]
  56566. }),
  56567. $globals.SetTest);
  56568. $core.addMethod(
  56569. $core.method({
  56570. selector: "testCollect",
  56571. protocol: "tests",
  56572. fn: function (){
  56573. var self=this,$self=this;
  56574. return $core.withContext(function($ctx1) {
  56575. var $2,$1;
  56576. (
  56577. $ctx1.supercall = true,
  56578. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56579. $ctx1.supercall = false;
  56580. $2=[(5), (6), (8)]._asSet();
  56581. $ctx1.sendIdx["asSet"]=1;
  56582. $1=$recv($2)._collect_((function(x){
  56583. return $core.withContext(function($ctx2) {
  56584. return $recv(x).__backslash_backslash((3));
  56585. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56586. }));
  56587. $self._assert_equals_($1,[(0), (2)]._asSet());
  56588. return self;
  56589. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56590. },
  56591. args: [],
  56592. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56593. referencedClasses: [],
  56594. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56595. }),
  56596. $globals.SetTest);
  56597. $core.addMethod(
  56598. $core.method({
  56599. selector: "testComma",
  56600. protocol: "tests",
  56601. fn: function (){
  56602. var self=this,$self=this;
  56603. return $core.withContext(function($ctx1) {
  56604. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56605. (
  56606. $ctx1.supercall = true,
  56607. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56608. $ctx1.supercall = false;
  56609. $2=$self._collection();
  56610. $ctx1.sendIdx["collection"]=1;
  56611. $3=$self._collection();
  56612. $ctx1.sendIdx["collection"]=2;
  56613. $1=$recv($2).__comma($3);
  56614. $ctx1.sendIdx[","]=1;
  56615. $4=$self._collection();
  56616. $ctx1.sendIdx["collection"]=3;
  56617. $self._assert_equals_($1,$4);
  56618. $ctx1.sendIdx["assert:equals:"]=1;
  56619. $6=$self._collection();
  56620. $ctx1.sendIdx["collection"]=4;
  56621. $7=$self._collectionWithNewValue();
  56622. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56623. $5=$recv($6).__comma($7);
  56624. $ctx1.sendIdx[","]=2;
  56625. $8=$self._collectionWithNewValue();
  56626. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56627. $self._assert_equals_($5,$8);
  56628. $ctx1.sendIdx["assert:equals:"]=2;
  56629. $10=$self._collectionWithNewValue();
  56630. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56631. $9=$recv($10).__comma($self._collection());
  56632. $self._assert_equals_($9,$self._collectionWithNewValue());
  56633. return self;
  56634. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56635. },
  56636. args: [],
  56637. 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",
  56638. referencedClasses: [],
  56639. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  56640. }),
  56641. $globals.SetTest);
  56642. $core.addMethod(
  56643. $core.method({
  56644. selector: "testComparing",
  56645. protocol: "tests",
  56646. fn: function (){
  56647. var self=this,$self=this;
  56648. return $core.withContext(function($ctx1) {
  56649. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  56650. $1=[(0), (2)]._asSet();
  56651. $ctx1.sendIdx["asSet"]=1;
  56652. $2=[(0), (2)]._asSet();
  56653. $ctx1.sendIdx["asSet"]=2;
  56654. $self._assert_equals_($1,$2);
  56655. $ctx1.sendIdx["assert:equals:"]=1;
  56656. $3=[(2), (0)]._asSet();
  56657. $ctx1.sendIdx["asSet"]=3;
  56658. $4=[(0), (2)]._asSet();
  56659. $ctx1.sendIdx["asSet"]=4;
  56660. $self._assert_equals_($3,$4);
  56661. $6=[(0), (2), (3)]._asSet();
  56662. $ctx1.sendIdx["asSet"]=5;
  56663. $7=[(0), (2)]._asSet();
  56664. $ctx1.sendIdx["asSet"]=6;
  56665. $5=$recv($6).__eq($7);
  56666. $ctx1.sendIdx["="]=1;
  56667. $self._deny_($5);
  56668. $ctx1.sendIdx["deny:"]=1;
  56669. $9=[(1), (2)]._asSet();
  56670. $ctx1.sendIdx["asSet"]=7;
  56671. $8=$recv($9).__eq([(0), (2)]._asSet());
  56672. $self._deny_($8);
  56673. return self;
  56674. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  56675. },
  56676. args: [],
  56677. 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",
  56678. referencedClasses: [],
  56679. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  56680. }),
  56681. $globals.SetTest);
  56682. $core.addMethod(
  56683. $core.method({
  56684. selector: "testPrintString",
  56685. protocol: "tests",
  56686. fn: function (){
  56687. var self=this,$self=this;
  56688. var set;
  56689. return $core.withContext(function($ctx1) {
  56690. var $1,$2,$3,$4,$5,$6,$7,$8;
  56691. set=$recv($globals.Set)._new();
  56692. $1=$recv(set)._printString();
  56693. $ctx1.sendIdx["printString"]=1;
  56694. $self._assert_equals_($1,"a Set ()");
  56695. $ctx1.sendIdx["assert:equals:"]=1;
  56696. $2=set;
  56697. $recv($2)._add_((1));
  56698. $ctx1.sendIdx["add:"]=1;
  56699. $3=$recv($2)._add_((3));
  56700. $ctx1.sendIdx["add:"]=2;
  56701. $4=$recv(set)._printString();
  56702. $ctx1.sendIdx["printString"]=2;
  56703. $self._assert_equals_($4,"a Set (1 3)");
  56704. $ctx1.sendIdx["assert:equals:"]=2;
  56705. $recv(set)._add_("foo");
  56706. $ctx1.sendIdx["add:"]=3;
  56707. $5=$recv(set)._printString();
  56708. $ctx1.sendIdx["printString"]=3;
  56709. $self._assert_equals_($5,"a Set (1 3 'foo')");
  56710. $ctx1.sendIdx["assert:equals:"]=3;
  56711. $6=set;
  56712. $recv($6)._remove_((1));
  56713. $ctx1.sendIdx["remove:"]=1;
  56714. $recv($6)._remove_((3));
  56715. $7=$recv(set)._printString();
  56716. $ctx1.sendIdx["printString"]=4;
  56717. $self._assert_equals_($7,"a Set ('foo')");
  56718. $ctx1.sendIdx["assert:equals:"]=4;
  56719. $recv(set)._add_((3));
  56720. $ctx1.sendIdx["add:"]=4;
  56721. $8=$recv(set)._printString();
  56722. $ctx1.sendIdx["printString"]=5;
  56723. $self._assert_equals_($8,"a Set (3 'foo')");
  56724. $ctx1.sendIdx["assert:equals:"]=5;
  56725. $recv(set)._add_((3));
  56726. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  56727. return self;
  56728. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  56729. },
  56730. args: [],
  56731. 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'')'",
  56732. referencedClasses: ["Set"],
  56733. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  56734. }),
  56735. $globals.SetTest);
  56736. $core.addMethod(
  56737. $core.method({
  56738. selector: "testUnboxedObjects",
  56739. protocol: "tests",
  56740. fn: function (){
  56741. var self=this,$self=this;
  56742. return $core.withContext(function($ctx1) {
  56743. var $4,$3,$2,$1;
  56744. $4="foo"._yourself();
  56745. $ctx1.sendIdx["yourself"]=1;
  56746. $3=[$4,"foo"._yourself()];
  56747. $2=$recv($3)._asSet();
  56748. $1=$recv($2)._asArray();
  56749. $self._assert_equals_($1,["foo"]);
  56750. return self;
  56751. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  56752. },
  56753. args: [],
  56754. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  56755. referencedClasses: [],
  56756. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  56757. }),
  56758. $globals.SetTest);
  56759. $core.addMethod(
  56760. $core.method({
  56761. selector: "testUnicity",
  56762. protocol: "tests",
  56763. fn: function (){
  56764. var self=this,$self=this;
  56765. var set;
  56766. return $core.withContext(function($ctx1) {
  56767. var $1;
  56768. set=$recv($globals.Set)._new();
  56769. $recv(set)._add_((21));
  56770. $ctx1.sendIdx["add:"]=1;
  56771. $recv(set)._add_("hello");
  56772. $ctx1.sendIdx["add:"]=2;
  56773. $recv(set)._add_((21));
  56774. $ctx1.sendIdx["add:"]=3;
  56775. $1=$recv(set)._size();
  56776. $ctx1.sendIdx["size"]=1;
  56777. $self._assert_equals_($1,(2));
  56778. $ctx1.sendIdx["assert:equals:"]=1;
  56779. $recv(set)._add_("hello");
  56780. $self._assert_equals_($recv(set)._size(),(2));
  56781. $ctx1.sendIdx["assert:equals:"]=2;
  56782. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  56783. return self;
  56784. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  56785. },
  56786. args: [],
  56787. 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')",
  56788. referencedClasses: ["Set"],
  56789. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  56790. }),
  56791. $globals.SetTest);
  56792. $core.addMethod(
  56793. $core.method({
  56794. selector: "collectionClass",
  56795. protocol: "fixture",
  56796. fn: function (){
  56797. var self=this,$self=this;
  56798. return $globals.Set;
  56799. },
  56800. args: [],
  56801. source: "collectionClass\x0a\x09^ Set",
  56802. referencedClasses: ["Set"],
  56803. messageSends: []
  56804. }),
  56805. $globals.SetTest.a$cls);
  56806. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  56807. $core.addMethod(
  56808. $core.method({
  56809. selector: "testShow",
  56810. protocol: "tests",
  56811. fn: function (){
  56812. var self=this,$self=this;
  56813. var originalTranscript;
  56814. return $core.withContext(function($ctx1) {
  56815. originalTranscript=$recv($globals.Transcript)._current();
  56816. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  56817. $ctx1.sendIdx["register:"]=1;
  56818. $self._shouldnt_raise_((function(){
  56819. return $core.withContext(function($ctx2) {
  56820. return $recv($globals.Transcript)._show_("Hello console!");
  56821. $ctx2.sendIdx["show:"]=1;
  56822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56823. }),$globals.Error);
  56824. $ctx1.sendIdx["shouldnt:raise:"]=1;
  56825. $self._shouldnt_raise_((function(){
  56826. return $core.withContext(function($ctx2) {
  56827. return $recv($globals.Transcript)._show_(console);
  56828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56829. }),$globals.Error);
  56830. $recv($globals.Transcript)._register_(originalTranscript);
  56831. return self;
  56832. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  56833. },
  56834. args: [],
  56835. 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.",
  56836. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  56837. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  56838. }),
  56839. $globals.ConsoleTranscriptTest);
  56840. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  56841. $core.addMethod(
  56842. $core.method({
  56843. selector: "testEquality",
  56844. protocol: "tests",
  56845. fn: function (){
  56846. var self=this,$self=this;
  56847. var now;
  56848. return $core.withContext(function($ctx1) {
  56849. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  56850. now=$recv($globals.Date)._new();
  56851. $1=$recv(now).__eq(now);
  56852. $ctx1.sendIdx["="]=1;
  56853. $self._assert_($1);
  56854. $ctx1.sendIdx["assert:"]=1;
  56855. $3=now;
  56856. $4=$recv($globals.Date)._fromMilliseconds_((0));
  56857. $ctx1.sendIdx["fromMilliseconds:"]=1;
  56858. $2=$recv($3).__eq($4);
  56859. $ctx1.sendIdx["="]=2;
  56860. $self._deny_($2);
  56861. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  56862. $ctx1.sendIdx["fromMilliseconds:"]=2;
  56863. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  56864. $ctx1.sendIdx["fromMilliseconds:"]=3;
  56865. $5=$recv($6).__eq($7);
  56866. $ctx1.sendIdx["="]=3;
  56867. $self._assert_($5);
  56868. $ctx1.sendIdx["assert:"]=2;
  56869. $9=now;
  56870. $11=$recv(now)._asMilliseconds();
  56871. $ctx1.sendIdx["asMilliseconds"]=1;
  56872. $10=$recv($globals.Date)._fromMilliseconds_($11);
  56873. $ctx1.sendIdx["fromMilliseconds:"]=4;
  56874. $8=$recv($9).__eq($10);
  56875. $ctx1.sendIdx["="]=4;
  56876. $self._assert_($8);
  56877. $ctx1.sendIdx["assert:"]=3;
  56878. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  56879. return self;
  56880. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  56881. },
  56882. args: [],
  56883. 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",
  56884. referencedClasses: ["Date"],
  56885. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56886. }),
  56887. $globals.DateTest);
  56888. $core.addMethod(
  56889. $core.method({
  56890. selector: "testIdentity",
  56891. protocol: "tests",
  56892. fn: function (){
  56893. var self=this,$self=this;
  56894. var now;
  56895. return $core.withContext(function($ctx1) {
  56896. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  56897. now=$recv($globals.Date)._new();
  56898. $1=$recv(now).__eq_eq(now);
  56899. $ctx1.sendIdx["=="]=1;
  56900. $self._assert_($1);
  56901. $3=now;
  56902. $4=$recv($globals.Date)._fromMilliseconds_((0));
  56903. $ctx1.sendIdx["fromMilliseconds:"]=1;
  56904. $2=$recv($3).__eq_eq($4);
  56905. $ctx1.sendIdx["=="]=2;
  56906. $self._deny_($2);
  56907. $ctx1.sendIdx["deny:"]=1;
  56908. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  56909. $ctx1.sendIdx["fromMilliseconds:"]=2;
  56910. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  56911. $ctx1.sendIdx["fromMilliseconds:"]=3;
  56912. $5=$recv($6).__eq_eq($7);
  56913. $ctx1.sendIdx["=="]=3;
  56914. $self._deny_($5);
  56915. $ctx1.sendIdx["deny:"]=2;
  56916. $9=now;
  56917. $11=$recv(now)._asMilliseconds();
  56918. $ctx1.sendIdx["asMilliseconds"]=1;
  56919. $10=$recv($globals.Date)._fromMilliseconds_($11);
  56920. $ctx1.sendIdx["fromMilliseconds:"]=4;
  56921. $8=$recv($9).__eq_eq($10);
  56922. $ctx1.sendIdx["=="]=4;
  56923. $self._deny_($8);
  56924. $ctx1.sendIdx["deny:"]=3;
  56925. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  56926. return self;
  56927. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  56928. },
  56929. args: [],
  56930. 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",
  56931. referencedClasses: ["Date"],
  56932. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  56933. }),
  56934. $globals.DateTest);
  56935. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  56936. $core.addMethod(
  56937. $core.method({
  56938. selector: "jsNull",
  56939. protocol: "accessing",
  56940. fn: function (){
  56941. var self=this,$self=this;
  56942. return $core.withContext(function($ctx1) {
  56943. return null;
  56944. return self;
  56945. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  56946. },
  56947. args: [],
  56948. source: "jsNull\x0a\x09<inlineJS: 'return null'>",
  56949. referencedClasses: [],
  56950. messageSends: []
  56951. }),
  56952. $globals.JSObjectProxyTest);
  56953. $core.addMethod(
  56954. $core.method({
  56955. selector: "jsObject",
  56956. protocol: "accessing",
  56957. fn: function (){
  56958. var self=this,$self=this;
  56959. return $core.withContext(function($ctx1) {
  56960. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  56961. return self;
  56962. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  56963. },
  56964. args: [],
  56965. 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}'>",
  56966. referencedClasses: [],
  56967. messageSends: []
  56968. }),
  56969. $globals.JSObjectProxyTest);
  56970. $core.addMethod(
  56971. $core.method({
  56972. selector: "jsUndefined",
  56973. protocol: "accessing",
  56974. fn: function (){
  56975. var self=this,$self=this;
  56976. return $core.withContext(function($ctx1) {
  56977. return;
  56978. return self;
  56979. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  56980. },
  56981. args: [],
  56982. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  56983. referencedClasses: [],
  56984. messageSends: []
  56985. }),
  56986. $globals.JSObjectProxyTest);
  56987. $core.addMethod(
  56988. $core.method({
  56989. selector: "testAtIfAbsent",
  56990. protocol: "tests",
  56991. fn: function (){
  56992. var self=this,$self=this;
  56993. var testObject;
  56994. return $core.withContext(function($ctx1) {
  56995. var $1,$2,$3;
  56996. testObject=$self._jsObject();
  56997. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  56998. return "Property does not exist";
  56999. }));
  57000. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57001. $self._assert_equals_($1,"Property does not exist");
  57002. $ctx1.sendIdx["assert:equals:"]=1;
  57003. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57004. return "Property does not exist";
  57005. }));
  57006. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57007. $self._assert_equals_($2,nil);
  57008. $ctx1.sendIdx["assert:equals:"]=2;
  57009. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57010. return "Property does not exist";
  57011. }));
  57012. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57013. $self._assert_equals_($3,(1));
  57014. $ctx1.sendIdx["assert:equals:"]=3;
  57015. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57016. return "Property does not exist";
  57017. })),nil);
  57018. return self;
  57019. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57020. },
  57021. args: [],
  57022. 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.",
  57023. referencedClasses: [],
  57024. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57025. }),
  57026. $globals.JSObjectProxyTest);
  57027. $core.addMethod(
  57028. $core.method({
  57029. selector: "testAtIfPresent",
  57030. protocol: "tests",
  57031. fn: function (){
  57032. var self=this,$self=this;
  57033. var testObject;
  57034. return $core.withContext(function($ctx1) {
  57035. var $2,$1,$4,$3,$6,$5;
  57036. testObject=$self._jsObject();
  57037. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57038. return $core.withContext(function($ctx2) {
  57039. $2=$recv(x)._asString();
  57040. $ctx2.sendIdx["asString"]=1;
  57041. return "hello ".__comma($2);
  57042. $ctx2.sendIdx[","]=1;
  57043. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57044. }));
  57045. $ctx1.sendIdx["at:ifPresent:"]=1;
  57046. $self._assert_equals_($1,nil);
  57047. $ctx1.sendIdx["assert:equals:"]=1;
  57048. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57049. return $core.withContext(function($ctx2) {
  57050. $4=$recv(x)._asString();
  57051. $ctx2.sendIdx["asString"]=2;
  57052. return "hello ".__comma($4);
  57053. $ctx2.sendIdx[","]=2;
  57054. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57055. }));
  57056. $ctx1.sendIdx["at:ifPresent:"]=2;
  57057. $self._assert_equals_($3,"hello nil");
  57058. $ctx1.sendIdx["assert:equals:"]=2;
  57059. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57060. return $core.withContext(function($ctx2) {
  57061. $6=$recv(x)._asString();
  57062. $ctx2.sendIdx["asString"]=3;
  57063. return "hello ".__comma($6);
  57064. $ctx2.sendIdx[","]=3;
  57065. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57066. }));
  57067. $ctx1.sendIdx["at:ifPresent:"]=3;
  57068. $self._assert_equals_($5,"hello 1");
  57069. $ctx1.sendIdx["assert:equals:"]=3;
  57070. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57071. return $core.withContext(function($ctx2) {
  57072. return "hello ".__comma($recv(x)._asString());
  57073. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57074. })),"hello nil");
  57075. return self;
  57076. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57077. },
  57078. args: [],
  57079. 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'.",
  57080. referencedClasses: [],
  57081. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57082. }),
  57083. $globals.JSObjectProxyTest);
  57084. $core.addMethod(
  57085. $core.method({
  57086. selector: "testAtIfPresentIfAbsent",
  57087. protocol: "tests",
  57088. fn: function (){
  57089. var self=this,$self=this;
  57090. var testObject;
  57091. return $core.withContext(function($ctx1) {
  57092. var $2,$1,$4,$3,$6,$5;
  57093. testObject=$self._jsObject();
  57094. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57095. return $core.withContext(function($ctx2) {
  57096. $2=$recv(x)._asString();
  57097. $ctx2.sendIdx["asString"]=1;
  57098. return "hello ".__comma($2);
  57099. $ctx2.sendIdx[","]=1;
  57100. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57101. }),(function(){
  57102. return "not present";
  57103. }));
  57104. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57105. $self._assert_equals_($1,"not present");
  57106. $ctx1.sendIdx["assert:equals:"]=1;
  57107. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57108. return $core.withContext(function($ctx2) {
  57109. $4=$recv(x)._asString();
  57110. $ctx2.sendIdx["asString"]=2;
  57111. return "hello ".__comma($4);
  57112. $ctx2.sendIdx[","]=2;
  57113. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57114. }),(function(){
  57115. return "not present";
  57116. }));
  57117. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57118. $self._assert_equals_($3,"hello nil");
  57119. $ctx1.sendIdx["assert:equals:"]=2;
  57120. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57121. return $core.withContext(function($ctx2) {
  57122. $6=$recv(x)._asString();
  57123. $ctx2.sendIdx["asString"]=3;
  57124. return "hello ".__comma($6);
  57125. $ctx2.sendIdx[","]=3;
  57126. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57127. }),(function(){
  57128. return "not present";
  57129. }));
  57130. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57131. $self._assert_equals_($5,"hello 1");
  57132. $ctx1.sendIdx["assert:equals:"]=3;
  57133. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57134. return $core.withContext(function($ctx2) {
  57135. return "hello ".__comma($recv(x)._asString());
  57136. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57137. }),(function(){
  57138. return "not present";
  57139. })),"hello nil");
  57140. return self;
  57141. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57142. },
  57143. args: [],
  57144. 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'.",
  57145. referencedClasses: [],
  57146. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57147. }),
  57148. $globals.JSObjectProxyTest);
  57149. $core.addMethod(
  57150. $core.method({
  57151. selector: "testAtPut",
  57152. protocol: "tests",
  57153. fn: function (){
  57154. var self=this,$self=this;
  57155. var testObject;
  57156. return $core.withContext(function($ctx1) {
  57157. var $2,$1;
  57158. testObject=$self._jsObject();
  57159. $2=$recv(testObject)._at_("abc");
  57160. $ctx1.sendIdx["at:"]=1;
  57161. $1=$recv($2).__tild_eq("xyz");
  57162. $self._assert_($1);
  57163. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57164. $ctx1.sendIdx["assert:equals:"]=1;
  57165. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57166. return self;
  57167. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57168. },
  57169. args: [],
  57170. 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'",
  57171. referencedClasses: [],
  57172. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57173. }),
  57174. $globals.JSObjectProxyTest);
  57175. $core.addMethod(
  57176. $core.method({
  57177. selector: "testComparison",
  57178. protocol: "tests",
  57179. fn: function (){
  57180. var self=this,$self=this;
  57181. return $core.withContext(function($ctx1) {
  57182. var $1,$2;
  57183. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57184. $1=$recv(console).__eq(console);
  57185. $ctx1.sendIdx["="]=1;
  57186. $self._assert_($1);
  57187. $2=$recv(console).__eq($recv($globals.Object)._new());
  57188. $ctx1.sendIdx["="]=2;
  57189. $self._deny_($2);
  57190. $ctx1.sendIdx["deny:"]=1;
  57191. $self._deny_($recv(console).__eq($self._jsObject()));
  57192. return self;
  57193. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57194. },
  57195. args: [],
  57196. 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",
  57197. referencedClasses: ["Object"],
  57198. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57199. }),
  57200. $globals.JSObjectProxyTest);
  57201. $core.addMethod(
  57202. $core.method({
  57203. selector: "testDNU",
  57204. protocol: "tests",
  57205. fn: function (){
  57206. var self=this,$self=this;
  57207. return $core.withContext(function($ctx1) {
  57208. $self._should_raise_((function(){
  57209. return $core.withContext(function($ctx2) {
  57210. return $recv($self._jsObject())._foo();
  57211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57212. }),$globals.MessageNotUnderstood);
  57213. return self;
  57214. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57215. },
  57216. args: [],
  57217. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57218. referencedClasses: ["MessageNotUnderstood"],
  57219. messageSends: ["should:raise:", "foo", "jsObject"]
  57220. }),
  57221. $globals.JSObjectProxyTest);
  57222. $core.addMethod(
  57223. $core.method({
  57224. selector: "testDNUWithAllowJavaScriptCalls",
  57225. protocol: "tests",
  57226. fn: function (){
  57227. var self=this,$self=this;
  57228. var jsObject;
  57229. return $core.withContext(function($ctx1) {
  57230. jsObject=[];
  57231. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57232. $self._should_raise_((function(){
  57233. return $core.withContext(function($ctx2) {
  57234. return $recv(jsObject)._foo();
  57235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57236. }),$globals.MessageNotUnderstood);
  57237. return self;
  57238. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57239. },
  57240. args: [],
  57241. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57242. referencedClasses: ["MessageNotUnderstood"],
  57243. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57244. }),
  57245. $globals.JSObjectProxyTest);
  57246. $core.addMethod(
  57247. $core.method({
  57248. selector: "testMessageSend",
  57249. protocol: "tests",
  57250. fn: function (){
  57251. var self=this,$self=this;
  57252. return $core.withContext(function($ctx1) {
  57253. var $2,$1,$4,$3;
  57254. $2=$self._jsObject();
  57255. $ctx1.sendIdx["jsObject"]=1;
  57256. $1=$recv($2)._a();
  57257. $self._assert_equals_($1,(1));
  57258. $ctx1.sendIdx["assert:equals:"]=1;
  57259. $4=$self._jsObject();
  57260. $ctx1.sendIdx["jsObject"]=2;
  57261. $3=$recv($4)._b();
  57262. $self._assert_equals_($3,(2));
  57263. $ctx1.sendIdx["assert:equals:"]=2;
  57264. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57265. return self;
  57266. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57267. },
  57268. args: [],
  57269. 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",
  57270. referencedClasses: [],
  57271. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57272. }),
  57273. $globals.JSObjectProxyTest);
  57274. $core.addMethod(
  57275. $core.method({
  57276. selector: "testMethodWithArguments",
  57277. protocol: "tests",
  57278. fn: function (){
  57279. var self=this,$self=this;
  57280. return $core.withContext(function($ctx1) {
  57281. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57282. return self;
  57283. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57284. },
  57285. args: [],
  57286. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57287. referencedClasses: [],
  57288. messageSends: ["assert:equals:", "c:", "jsObject"]
  57289. }),
  57290. $globals.JSObjectProxyTest);
  57291. $core.addMethod(
  57292. $core.method({
  57293. selector: "testPrinting",
  57294. protocol: "tests",
  57295. fn: function (){
  57296. var self=this,$self=this;
  57297. return $core.withContext(function($ctx1) {
  57298. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57299. return self;
  57300. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57301. },
  57302. args: [],
  57303. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57304. referencedClasses: [],
  57305. messageSends: ["assert:equals:", "printString", "jsObject"]
  57306. }),
  57307. $globals.JSObjectProxyTest);
  57308. $core.addMethod(
  57309. $core.method({
  57310. selector: "testPropertyThatReturnsEmptyString",
  57311. protocol: "tests",
  57312. fn: function (){
  57313. var self=this,$self=this;
  57314. var object;
  57315. return $core.withContext(function($ctx1) {
  57316. var $1;
  57317. object=$self._jsObject();
  57318. $1=$recv(object)._d();
  57319. $ctx1.sendIdx["d"]=1;
  57320. $self._assert_equals_($1,"");
  57321. $ctx1.sendIdx["assert:equals:"]=1;
  57322. $recv(object)._d_("hello");
  57323. $self._assert_equals_($recv(object)._d(),"hello");
  57324. return self;
  57325. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57326. },
  57327. args: [],
  57328. 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'",
  57329. referencedClasses: [],
  57330. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57331. }),
  57332. $globals.JSObjectProxyTest);
  57333. $core.addMethod(
  57334. $core.method({
  57335. selector: "testPropertyThatReturnsUndefined",
  57336. protocol: "tests",
  57337. fn: function (){
  57338. var self=this,$self=this;
  57339. var object;
  57340. return $core.withContext(function($ctx1) {
  57341. object=$self._jsObject();
  57342. $self._shouldnt_raise_((function(){
  57343. return $core.withContext(function($ctx2) {
  57344. return $recv(object)._e();
  57345. $ctx2.sendIdx["e"]=1;
  57346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57347. }),$globals.MessageNotUnderstood);
  57348. $self._assert_($recv($recv(object)._e())._isNil());
  57349. return self;
  57350. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57351. },
  57352. args: [],
  57353. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57354. referencedClasses: ["MessageNotUnderstood"],
  57355. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57356. }),
  57357. $globals.JSObjectProxyTest);
  57358. $core.addMethod(
  57359. $core.method({
  57360. selector: "testSetPropertyWithFalsyValue",
  57361. protocol: "tests",
  57362. fn: function (){
  57363. var self=this,$self=this;
  57364. var jsObject;
  57365. return $core.withContext(function($ctx1) {
  57366. var $1,$2,$3,$4,$5;
  57367. jsObject=$self._jsObject();
  57368. $1=$recv(jsObject)._a();
  57369. $ctx1.sendIdx["a"]=1;
  57370. $self._assert_equals_($1,(1));
  57371. $ctx1.sendIdx["assert:equals:"]=1;
  57372. $recv(jsObject)._a_($self._jsNull());
  57373. $ctx1.sendIdx["a:"]=1;
  57374. $2=$recv(jsObject)._a();
  57375. $ctx1.sendIdx["a"]=2;
  57376. $self._assert_equals_($2,nil);
  57377. $ctx1.sendIdx["assert:equals:"]=2;
  57378. $recv(jsObject)._a_((0));
  57379. $ctx1.sendIdx["a:"]=2;
  57380. $3=$recv(jsObject)._a();
  57381. $ctx1.sendIdx["a"]=3;
  57382. $self._assert_equals_($3,(0));
  57383. $ctx1.sendIdx["assert:equals:"]=3;
  57384. $recv(jsObject)._a_($self._jsUndefined());
  57385. $ctx1.sendIdx["a:"]=3;
  57386. $4=$recv(jsObject)._a();
  57387. $ctx1.sendIdx["a"]=4;
  57388. $self._assert_equals_($4,nil);
  57389. $ctx1.sendIdx["assert:equals:"]=4;
  57390. $recv(jsObject)._a_("");
  57391. $ctx1.sendIdx["a:"]=4;
  57392. $5=$recv(jsObject)._a();
  57393. $ctx1.sendIdx["a"]=5;
  57394. $self._assert_equals_($5,"");
  57395. $ctx1.sendIdx["assert:equals:"]=5;
  57396. $recv(jsObject)._a_(false);
  57397. $self._assert_equals_($recv(jsObject)._a(),false);
  57398. return self;
  57399. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57400. },
  57401. args: [],
  57402. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\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",
  57403. referencedClasses: [],
  57404. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  57405. }),
  57406. $globals.JSObjectProxyTest);
  57407. $core.addMethod(
  57408. $core.method({
  57409. selector: "testValue",
  57410. protocol: "tests",
  57411. fn: function (){
  57412. var self=this,$self=this;
  57413. var testObject;
  57414. return $core.withContext(function($ctx1) {
  57415. testObject=$self._jsObject();
  57416. $recv(testObject)._at_put_("value","aValue");
  57417. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57418. return self;
  57419. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57420. },
  57421. args: [],
  57422. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57423. referencedClasses: [],
  57424. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57425. }),
  57426. $globals.JSObjectProxyTest);
  57427. $core.addMethod(
  57428. $core.method({
  57429. selector: "testYourself",
  57430. protocol: "tests",
  57431. fn: function (){
  57432. var self=this,$self=this;
  57433. var object;
  57434. return $core.withContext(function($ctx1) {
  57435. var $1;
  57436. $1=$self._jsObject();
  57437. $recv($1)._d_("test");
  57438. object=$recv($1)._yourself();
  57439. $self._assert_equals_($recv(object)._d(),"test");
  57440. return self;
  57441. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57442. },
  57443. args: [],
  57444. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57445. referencedClasses: [],
  57446. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57447. }),
  57448. $globals.JSObjectProxyTest);
  57449. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57450. $core.addMethod(
  57451. $core.method({
  57452. selector: "testCatchingException",
  57453. protocol: "tests",
  57454. fn: function (){
  57455. var self=this,$self=this;
  57456. return $core.withContext(function($ctx1) {
  57457. $recv((function(){
  57458. return $core.withContext(function($ctx2) {
  57459. return $self._throwException();
  57460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57461. }))._on_do_($globals.Error,(function(error){
  57462. return $core.withContext(function($ctx2) {
  57463. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57464. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57465. }));
  57466. return self;
  57467. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57468. },
  57469. args: [],
  57470. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57471. referencedClasses: ["Error"],
  57472. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57473. }),
  57474. $globals.JavaScriptExceptionTest);
  57475. $core.addMethod(
  57476. $core.method({
  57477. selector: "testRaisingException",
  57478. protocol: "tests",
  57479. fn: function (){
  57480. var self=this,$self=this;
  57481. return $core.withContext(function($ctx1) {
  57482. $self._should_raise_((function(){
  57483. return $core.withContext(function($ctx2) {
  57484. return $self._throwException();
  57485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57486. }),$globals.JavaScriptException);
  57487. return self;
  57488. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57489. },
  57490. args: [],
  57491. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57492. referencedClasses: ["JavaScriptException"],
  57493. messageSends: ["should:raise:", "throwException"]
  57494. }),
  57495. $globals.JavaScriptExceptionTest);
  57496. $core.addMethod(
  57497. $core.method({
  57498. selector: "throwException",
  57499. protocol: "helpers",
  57500. fn: function (){
  57501. var self=this,$self=this;
  57502. return $core.withContext(function($ctx1) {
  57503. throw "test";
  57504. return self;
  57505. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57506. },
  57507. args: [],
  57508. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57509. referencedClasses: [],
  57510. messageSends: []
  57511. }),
  57512. $globals.JavaScriptExceptionTest);
  57513. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57514. $core.addMethod(
  57515. $core.method({
  57516. selector: "testValue",
  57517. protocol: "tests",
  57518. fn: function (){
  57519. var self=this,$self=this;
  57520. var messageSend;
  57521. return $core.withContext(function($ctx1) {
  57522. var $1;
  57523. $1=$recv($globals.MessageSend)._new();
  57524. $ctx1.sendIdx["new"]=1;
  57525. $recv($1)._receiver_($recv($globals.Object)._new());
  57526. $recv($1)._selector_("asString");
  57527. messageSend=$recv($1)._yourself();
  57528. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57529. return self;
  57530. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57531. },
  57532. args: [],
  57533. 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'",
  57534. referencedClasses: ["MessageSend", "Object"],
  57535. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57536. }),
  57537. $globals.MessageSendTest);
  57538. $core.addMethod(
  57539. $core.method({
  57540. selector: "testValueWithArguments",
  57541. protocol: "tests",
  57542. fn: function (){
  57543. var self=this,$self=this;
  57544. var messageSend;
  57545. return $core.withContext(function($ctx1) {
  57546. var $1;
  57547. $1=$recv($globals.MessageSend)._new();
  57548. $recv($1)._receiver_((2));
  57549. $recv($1)._selector_("+");
  57550. messageSend=$recv($1)._yourself();
  57551. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57552. $ctx1.sendIdx["assert:equals:"]=1;
  57553. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57554. return self;
  57555. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57556. },
  57557. args: [],
  57558. 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",
  57559. referencedClasses: ["MessageSend"],
  57560. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57561. }),
  57562. $globals.MessageSendTest);
  57563. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57564. $core.addMethod(
  57565. $core.method({
  57566. selector: "codeGeneratorClass",
  57567. protocol: "accessing",
  57568. fn: function (){
  57569. var self=this,$self=this;
  57570. return $globals.CodeGenerator;
  57571. },
  57572. args: [],
  57573. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57574. referencedClasses: ["CodeGenerator"],
  57575. messageSends: []
  57576. }),
  57577. $globals.MethodInheritanceTest);
  57578. $core.addMethod(
  57579. $core.method({
  57580. selector: "compiler",
  57581. protocol: "factory",
  57582. fn: function (){
  57583. var self=this,$self=this;
  57584. return $core.withContext(function($ctx1) {
  57585. var $1;
  57586. $1=$recv($globals.Compiler)._new();
  57587. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  57588. return $recv($1)._yourself();
  57589. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  57590. },
  57591. args: [],
  57592. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  57593. referencedClasses: ["Compiler"],
  57594. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  57595. }),
  57596. $globals.MethodInheritanceTest);
  57597. $core.addMethod(
  57598. $core.method({
  57599. selector: "deinstallBottom",
  57600. protocol: "testing",
  57601. fn: function (){
  57602. var self=this,$self=this;
  57603. return $core.withContext(function($ctx1) {
  57604. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  57605. return self;
  57606. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  57607. },
  57608. args: [],
  57609. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  57610. referencedClasses: [],
  57611. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  57612. }),
  57613. $globals.MethodInheritanceTest);
  57614. $core.addMethod(
  57615. $core.method({
  57616. selector: "deinstallMiddle",
  57617. protocol: "testing",
  57618. fn: function (){
  57619. var self=this,$self=this;
  57620. return $core.withContext(function($ctx1) {
  57621. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  57622. return self;
  57623. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  57624. },
  57625. args: [],
  57626. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  57627. referencedClasses: [],
  57628. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  57629. }),
  57630. $globals.MethodInheritanceTest);
  57631. $core.addMethod(
  57632. $core.method({
  57633. selector: "deinstallTop",
  57634. protocol: "testing",
  57635. fn: function (){
  57636. var self=this,$self=this;
  57637. return $core.withContext(function($ctx1) {
  57638. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  57639. return self;
  57640. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  57641. },
  57642. args: [],
  57643. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  57644. referencedClasses: [],
  57645. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  57646. }),
  57647. $globals.MethodInheritanceTest);
  57648. $core.addMethod(
  57649. $core.method({
  57650. selector: "installBottom:",
  57651. protocol: "testing",
  57652. fn: function (aString){
  57653. var self=this,$self=this;
  57654. return $core.withContext(function($ctx1) {
  57655. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  57656. return self;
  57657. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  57658. },
  57659. args: ["aString"],
  57660. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  57661. referencedClasses: [],
  57662. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  57663. }),
  57664. $globals.MethodInheritanceTest);
  57665. $core.addMethod(
  57666. $core.method({
  57667. selector: "installMiddle:",
  57668. protocol: "testing",
  57669. fn: function (aString){
  57670. var self=this,$self=this;
  57671. return $core.withContext(function($ctx1) {
  57672. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  57673. return self;
  57674. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  57675. },
  57676. args: ["aString"],
  57677. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  57678. referencedClasses: [],
  57679. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  57680. }),
  57681. $globals.MethodInheritanceTest);
  57682. $core.addMethod(
  57683. $core.method({
  57684. selector: "installTop:",
  57685. protocol: "testing",
  57686. fn: function (aString){
  57687. var self=this,$self=this;
  57688. return $core.withContext(function($ctx1) {
  57689. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  57690. return self;
  57691. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  57692. },
  57693. args: ["aString"],
  57694. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  57695. referencedClasses: [],
  57696. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  57697. }),
  57698. $globals.MethodInheritanceTest);
  57699. $core.addMethod(
  57700. $core.method({
  57701. selector: "setUp",
  57702. protocol: "initialization",
  57703. fn: function (){
  57704. var self=this,$self=this;
  57705. return $core.withContext(function($ctx1) {
  57706. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  57707. $ctx1.sendIdx["new"]=1;
  57708. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  57709. $ctx1.sendIdx["new"]=2;
  57710. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  57711. $self["@method"]=nil;
  57712. $self["@performBlock"]=(function(){
  57713. return $core.withContext(function($ctx2) {
  57714. return $self._error_("performBlock not initialized");
  57715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57716. });
  57717. return self;
  57718. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  57719. },
  57720. args: [],
  57721. 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' ]",
  57722. referencedClasses: [],
  57723. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  57724. }),
  57725. $globals.MethodInheritanceTest);
  57726. $core.addMethod(
  57727. $core.method({
  57728. selector: "shouldMNU",
  57729. protocol: "testing",
  57730. fn: function (){
  57731. var self=this,$self=this;
  57732. return $core.withContext(function($ctx1) {
  57733. $self._shouldMNUTop();
  57734. $self._shouldMNUMiddle();
  57735. $self._shouldMNUBottom();
  57736. return self;
  57737. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  57738. },
  57739. args: [],
  57740. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  57741. referencedClasses: [],
  57742. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  57743. }),
  57744. $globals.MethodInheritanceTest);
  57745. $core.addMethod(
  57746. $core.method({
  57747. selector: "shouldMNUBottom",
  57748. protocol: "testing",
  57749. fn: function (){
  57750. var self=this,$self=this;
  57751. return $core.withContext(function($ctx1) {
  57752. $self._should_raise_((function(){
  57753. return $core.withContext(function($ctx2) {
  57754. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57756. }),$globals.MessageNotUnderstood);
  57757. return self;
  57758. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  57759. },
  57760. args: [],
  57761. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  57762. referencedClasses: ["MessageNotUnderstood"],
  57763. messageSends: ["should:raise:", "value:"]
  57764. }),
  57765. $globals.MethodInheritanceTest);
  57766. $core.addMethod(
  57767. $core.method({
  57768. selector: "shouldMNUMiddle",
  57769. protocol: "testing",
  57770. fn: function (){
  57771. var self=this,$self=this;
  57772. return $core.withContext(function($ctx1) {
  57773. $self._should_raise_((function(){
  57774. return $core.withContext(function($ctx2) {
  57775. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57777. }),$globals.MessageNotUnderstood);
  57778. return self;
  57779. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  57780. },
  57781. args: [],
  57782. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  57783. referencedClasses: ["MessageNotUnderstood"],
  57784. messageSends: ["should:raise:", "value:"]
  57785. }),
  57786. $globals.MethodInheritanceTest);
  57787. $core.addMethod(
  57788. $core.method({
  57789. selector: "shouldMNUTop",
  57790. protocol: "testing",
  57791. fn: function (){
  57792. var self=this,$self=this;
  57793. return $core.withContext(function($ctx1) {
  57794. $self._should_raise_((function(){
  57795. return $core.withContext(function($ctx2) {
  57796. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57798. }),$globals.MessageNotUnderstood);
  57799. return self;
  57800. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  57801. },
  57802. args: [],
  57803. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  57804. referencedClasses: ["MessageNotUnderstood"],
  57805. messageSends: ["should:raise:", "value:"]
  57806. }),
  57807. $globals.MethodInheritanceTest);
  57808. $core.addMethod(
  57809. $core.method({
  57810. selector: "shouldReturn:",
  57811. protocol: "testing",
  57812. fn: function (anObject){
  57813. var self=this,$self=this;
  57814. var result;
  57815. return $core.withContext(function($ctx1) {
  57816. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57817. $ctx1.sendIdx["value:"]=1;
  57818. $self._assert_equals_(["top",anObject],["top",result]);
  57819. $ctx1.sendIdx["assert:equals:"]=1;
  57820. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57821. $ctx1.sendIdx["value:"]=2;
  57822. $self._assert_equals_(["middle",anObject],["middle",result]);
  57823. $ctx1.sendIdx["assert:equals:"]=2;
  57824. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57825. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  57826. return self;
  57827. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  57828. },
  57829. args: ["anObject"],
  57830. 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 }",
  57831. referencedClasses: [],
  57832. messageSends: ["value:", "assert:equals:"]
  57833. }),
  57834. $globals.MethodInheritanceTest);
  57835. $core.addMethod(
  57836. $core.method({
  57837. selector: "shouldReturn:and:and:",
  57838. protocol: "testing",
  57839. fn: function (anObject,anObject2,anObject3){
  57840. var self=this,$self=this;
  57841. var result;
  57842. return $core.withContext(function($ctx1) {
  57843. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  57844. $ctx1.sendIdx["value:"]=1;
  57845. $self._assert_equals_(["top",anObject],["top",result]);
  57846. $ctx1.sendIdx["assert:equals:"]=1;
  57847. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  57848. $ctx1.sendIdx["value:"]=2;
  57849. $self._assert_equals_(["middle",anObject2],["middle",result]);
  57850. $ctx1.sendIdx["assert:equals:"]=2;
  57851. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  57852. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  57853. return self;
  57854. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  57855. },
  57856. args: ["anObject", "anObject2", "anObject3"],
  57857. 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 }",
  57858. referencedClasses: [],
  57859. messageSends: ["value:", "assert:equals:"]
  57860. }),
  57861. $globals.MethodInheritanceTest);
  57862. $core.addMethod(
  57863. $core.method({
  57864. selector: "targetClassBottom",
  57865. protocol: "accessing",
  57866. fn: function (){
  57867. var self=this,$self=this;
  57868. return $globals.JavaScriptException;
  57869. },
  57870. args: [],
  57871. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  57872. referencedClasses: ["JavaScriptException"],
  57873. messageSends: []
  57874. }),
  57875. $globals.MethodInheritanceTest);
  57876. $core.addMethod(
  57877. $core.method({
  57878. selector: "targetClassMiddle",
  57879. protocol: "accessing",
  57880. fn: function (){
  57881. var self=this,$self=this;
  57882. return $globals.Error;
  57883. },
  57884. args: [],
  57885. source: "targetClassMiddle\x0a\x09^ Error",
  57886. referencedClasses: ["Error"],
  57887. messageSends: []
  57888. }),
  57889. $globals.MethodInheritanceTest);
  57890. $core.addMethod(
  57891. $core.method({
  57892. selector: "targetClassTop",
  57893. protocol: "accessing",
  57894. fn: function (){
  57895. var self=this,$self=this;
  57896. return $globals.Object;
  57897. },
  57898. args: [],
  57899. source: "targetClassTop\x0a\x09^ Object",
  57900. referencedClasses: ["Object"],
  57901. messageSends: []
  57902. }),
  57903. $globals.MethodInheritanceTest);
  57904. $core.addMethod(
  57905. $core.method({
  57906. selector: "tearDown",
  57907. protocol: "initialization",
  57908. fn: function (){
  57909. var self=this,$self=this;
  57910. return $core.withContext(function($ctx1) {
  57911. $recv((function(){
  57912. return $core.withContext(function($ctx2) {
  57913. return $self._deinstallTop();
  57914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57915. }))._on_do_($globals.Error,(function(){
  57916. }));
  57917. $ctx1.sendIdx["on:do:"]=1;
  57918. $recv((function(){
  57919. return $core.withContext(function($ctx2) {
  57920. return $self._deinstallMiddle();
  57921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57922. }))._on_do_($globals.Error,(function(){
  57923. }));
  57924. $ctx1.sendIdx["on:do:"]=2;
  57925. $recv((function(){
  57926. return $core.withContext(function($ctx2) {
  57927. return $self._deinstallBottom();
  57928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57929. }))._on_do_($globals.Error,(function(){
  57930. }));
  57931. return self;
  57932. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  57933. },
  57934. args: [],
  57935. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  57936. referencedClasses: ["Error"],
  57937. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  57938. }),
  57939. $globals.MethodInheritanceTest);
  57940. $core.addMethod(
  57941. $core.method({
  57942. selector: "testMNU11",
  57943. protocol: "tests",
  57944. fn: function (){
  57945. var self=this,$self=this;
  57946. return $core.withContext(function($ctx1) {
  57947. $self["@performBlock"]=(function(x){
  57948. return $core.withContext(function($ctx2) {
  57949. return $recv(x)._foo();
  57950. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57951. });
  57952. $self._shouldMNU();
  57953. $ctx1.sendIdx["shouldMNU"]=1;
  57954. $self._installTop_("foo ^ false");
  57955. $ctx1.sendIdx["installTop:"]=1;
  57956. $self._installTop_("foo ^ true");
  57957. $self._deinstallTop();
  57958. $self._shouldMNU();
  57959. return self;
  57960. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  57961. },
  57962. args: [],
  57963. 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",
  57964. referencedClasses: [],
  57965. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  57966. }),
  57967. $globals.MethodInheritanceTest);
  57968. $core.addMethod(
  57969. $core.method({
  57970. selector: "testMNU22",
  57971. protocol: "tests",
  57972. fn: function (){
  57973. var self=this,$self=this;
  57974. return $core.withContext(function($ctx1) {
  57975. $self["@performBlock"]=(function(x){
  57976. return $core.withContext(function($ctx2) {
  57977. return $recv(x)._foo();
  57978. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57979. });
  57980. $self._shouldMNU();
  57981. $ctx1.sendIdx["shouldMNU"]=1;
  57982. $self._installMiddle_("foo ^ false");
  57983. $ctx1.sendIdx["installMiddle:"]=1;
  57984. $self._installMiddle_("foo ^ true");
  57985. $self._deinstallMiddle();
  57986. $self._shouldMNU();
  57987. return self;
  57988. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  57989. },
  57990. args: [],
  57991. 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",
  57992. referencedClasses: [],
  57993. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  57994. }),
  57995. $globals.MethodInheritanceTest);
  57996. $core.addMethod(
  57997. $core.method({
  57998. selector: "testReturns1",
  57999. protocol: "tests",
  58000. fn: function (){
  58001. var self=this,$self=this;
  58002. return $core.withContext(function($ctx1) {
  58003. $self["@performBlock"]=(function(x){
  58004. return $core.withContext(function($ctx2) {
  58005. return $recv(x)._foo();
  58006. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58007. });
  58008. $self._installTop_("foo ^ false");
  58009. $ctx1.sendIdx["installTop:"]=1;
  58010. $self._shouldReturn_(false);
  58011. $ctx1.sendIdx["shouldReturn:"]=1;
  58012. $self._installTop_("foo ^ true");
  58013. $self._shouldReturn_(true);
  58014. return self;
  58015. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58016. },
  58017. args: [],
  58018. 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",
  58019. referencedClasses: [],
  58020. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58021. }),
  58022. $globals.MethodInheritanceTest);
  58023. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58024. $core.addMethod(
  58025. $core.method({
  58026. selector: "testAbs",
  58027. protocol: "tests",
  58028. fn: function (){
  58029. var self=this,$self=this;
  58030. return $core.withContext(function($ctx1) {
  58031. var $1;
  58032. $1=(4)._abs();
  58033. $ctx1.sendIdx["abs"]=1;
  58034. $self._assert_equals_($1,(4));
  58035. $ctx1.sendIdx["assert:equals:"]=1;
  58036. $self._assert_equals_((-4)._abs(),(4));
  58037. return self;
  58038. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58039. },
  58040. args: [],
  58041. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58042. referencedClasses: [],
  58043. messageSends: ["assert:equals:", "abs"]
  58044. }),
  58045. $globals.NumberTest);
  58046. $core.addMethod(
  58047. $core.method({
  58048. selector: "testArithmetic",
  58049. protocol: "tests",
  58050. fn: function (){
  58051. var self=this,$self=this;
  58052. return $core.withContext(function($ctx1) {
  58053. var $1,$2,$3,$5,$4;
  58054. $1=(1.5).__plus((1));
  58055. $ctx1.sendIdx["+"]=1;
  58056. $self._assert_equals_($1,(2.5));
  58057. $ctx1.sendIdx["assert:equals:"]=1;
  58058. $2=(2).__minus((1));
  58059. $ctx1.sendIdx["-"]=1;
  58060. $self._assert_equals_($2,(1));
  58061. $ctx1.sendIdx["assert:equals:"]=2;
  58062. $self._assert_equals_((-2).__minus((1)),(-3));
  58063. $ctx1.sendIdx["assert:equals:"]=3;
  58064. $self._assert_equals_((12).__slash((2)),(6));
  58065. $ctx1.sendIdx["assert:equals:"]=4;
  58066. $3=(3).__star((4));
  58067. $ctx1.sendIdx["*"]=1;
  58068. $self._assert_equals_($3,(12));
  58069. $ctx1.sendIdx["assert:equals:"]=5;
  58070. $self._assert_equals_((7).__slash_slash((2)),(3));
  58071. $ctx1.sendIdx["assert:equals:"]=6;
  58072. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58073. $ctx1.sendIdx["assert:equals:"]=7;
  58074. $5=(1).__plus((2));
  58075. $ctx1.sendIdx["+"]=2;
  58076. $4=$recv($5).__star((3));
  58077. $ctx1.sendIdx["*"]=2;
  58078. $self._assert_equals_($4,(9));
  58079. $ctx1.sendIdx["assert:equals:"]=8;
  58080. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58081. return self;
  58082. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58083. },
  58084. args: [],
  58085. 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",
  58086. referencedClasses: [],
  58087. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58088. }),
  58089. $globals.NumberTest);
  58090. $core.addMethod(
  58091. $core.method({
  58092. selector: "testAsNumber",
  58093. protocol: "tests",
  58094. fn: function (){
  58095. var self=this,$self=this;
  58096. return $core.withContext(function($ctx1) {
  58097. $self._assert_equals_((3)._asNumber(),(3));
  58098. return self;
  58099. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58100. },
  58101. args: [],
  58102. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58103. referencedClasses: [],
  58104. messageSends: ["assert:equals:", "asNumber"]
  58105. }),
  58106. $globals.NumberTest);
  58107. $core.addMethod(
  58108. $core.method({
  58109. selector: "testBetweenAnd",
  58110. protocol: "tests",
  58111. fn: function (){
  58112. var self=this,$self=this;
  58113. return $core.withContext(function($ctx1) {
  58114. var $1,$3,$2,$5,$4;
  58115. $1=(4)._between_and_((3),(5));
  58116. $ctx1.sendIdx["between:and:"]=1;
  58117. $self._assert_($1);
  58118. $ctx1.sendIdx["assert:"]=1;
  58119. $3=(1)._between_and_((5),(6));
  58120. $ctx1.sendIdx["between:and:"]=2;
  58121. $2=$recv($3)._not();
  58122. $ctx1.sendIdx["not"]=1;
  58123. $self._assert_($2);
  58124. $ctx1.sendIdx["assert:"]=2;
  58125. $5=(90)._between_and_((67),(87));
  58126. $ctx1.sendIdx["between:and:"]=3;
  58127. $4=$recv($5)._not();
  58128. $self._assert_($4);
  58129. $ctx1.sendIdx["assert:"]=3;
  58130. $self._assert_((1)._between_and_((1),(1)));
  58131. return self;
  58132. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58133. },
  58134. args: [],
  58135. 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).",
  58136. referencedClasses: [],
  58137. messageSends: ["assert:", "between:and:", "not"]
  58138. }),
  58139. $globals.NumberTest);
  58140. $core.addMethod(
  58141. $core.method({
  58142. selector: "testBitAnd",
  58143. protocol: "tests",
  58144. fn: function (){
  58145. var self=this,$self=this;
  58146. return $core.withContext(function($ctx1) {
  58147. var $1,$2;
  58148. $1=(15)._bitAnd_((2));
  58149. $ctx1.sendIdx["bitAnd:"]=1;
  58150. $self._assert_equals_($1,(2));
  58151. $ctx1.sendIdx["assert:equals:"]=1;
  58152. $2=(15)._bitAnd_((15));
  58153. $ctx1.sendIdx["bitAnd:"]=2;
  58154. $self._assert_equals_($2,(15));
  58155. $ctx1.sendIdx["assert:equals:"]=2;
  58156. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58157. return self;
  58158. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58159. },
  58160. args: [],
  58161. 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",
  58162. referencedClasses: [],
  58163. messageSends: ["assert:equals:", "bitAnd:"]
  58164. }),
  58165. $globals.NumberTest);
  58166. $core.addMethod(
  58167. $core.method({
  58168. selector: "testBitNot",
  58169. protocol: "tests",
  58170. fn: function (){
  58171. var self=this,$self=this;
  58172. return $core.withContext(function($ctx1) {
  58173. var $1,$2;
  58174. $1=(2)._bitNot();
  58175. $ctx1.sendIdx["bitNot"]=1;
  58176. $self._assert_equals_($1,(-3));
  58177. $ctx1.sendIdx["assert:equals:"]=1;
  58178. $2=(-1)._bitNot();
  58179. $ctx1.sendIdx["bitNot"]=2;
  58180. $self._assert_equals_($2,(0));
  58181. $ctx1.sendIdx["assert:equals:"]=2;
  58182. $self._assert_equals_((-1022)._bitNot(),(1021));
  58183. return self;
  58184. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58185. },
  58186. args: [],
  58187. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58188. referencedClasses: [],
  58189. messageSends: ["assert:equals:", "bitNot"]
  58190. }),
  58191. $globals.NumberTest);
  58192. $core.addMethod(
  58193. $core.method({
  58194. selector: "testBitOr",
  58195. protocol: "tests",
  58196. fn: function (){
  58197. var self=this,$self=this;
  58198. return $core.withContext(function($ctx1) {
  58199. var $1,$2;
  58200. $1=(2)._bitOr_((4));
  58201. $ctx1.sendIdx["bitOr:"]=1;
  58202. $self._assert_equals_($1,(6));
  58203. $ctx1.sendIdx["assert:equals:"]=1;
  58204. $2=(7)._bitOr_((2));
  58205. $ctx1.sendIdx["bitOr:"]=2;
  58206. $self._assert_equals_($2,(7));
  58207. $ctx1.sendIdx["assert:equals:"]=2;
  58208. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58209. return self;
  58210. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58211. },
  58212. args: [],
  58213. 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",
  58214. referencedClasses: [],
  58215. messageSends: ["assert:equals:", "bitOr:"]
  58216. }),
  58217. $globals.NumberTest);
  58218. $core.addMethod(
  58219. $core.method({
  58220. selector: "testBitXor",
  58221. protocol: "tests",
  58222. fn: function (){
  58223. var self=this,$self=this;
  58224. return $core.withContext(function($ctx1) {
  58225. var $1,$2,$3;
  58226. $1=(2)._bitXor_((4));
  58227. $ctx1.sendIdx["bitXor:"]=1;
  58228. $self._assert_equals_($1,(6));
  58229. $ctx1.sendIdx["assert:equals:"]=1;
  58230. $2=(7)._bitXor_((2));
  58231. $ctx1.sendIdx["bitXor:"]=2;
  58232. $self._assert_equals_($2,(5));
  58233. $ctx1.sendIdx["assert:equals:"]=2;
  58234. $3=(-1)._bitXor_((1021));
  58235. $ctx1.sendIdx["bitXor:"]=3;
  58236. $self._assert_equals_($3,(-1022));
  58237. $ctx1.sendIdx["assert:equals:"]=3;
  58238. $self._assert_equals_((91)._bitXor_((91)),(0));
  58239. return self;
  58240. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58241. },
  58242. args: [],
  58243. 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",
  58244. referencedClasses: [],
  58245. messageSends: ["assert:equals:", "bitXor:"]
  58246. }),
  58247. $globals.NumberTest);
  58248. $core.addMethod(
  58249. $core.method({
  58250. selector: "testCeiling",
  58251. protocol: "tests",
  58252. fn: function (){
  58253. var self=this,$self=this;
  58254. return $core.withContext(function($ctx1) {
  58255. var $1,$2;
  58256. $1=(1.2)._ceiling();
  58257. $ctx1.sendIdx["ceiling"]=1;
  58258. $self._assert_equals_($1,(2));
  58259. $ctx1.sendIdx["assert:equals:"]=1;
  58260. $2=(-1.2)._ceiling();
  58261. $ctx1.sendIdx["ceiling"]=2;
  58262. $self._assert_equals_($2,(-1));
  58263. $ctx1.sendIdx["assert:equals:"]=2;
  58264. $self._assert_equals_((1)._ceiling(),(1));
  58265. return self;
  58266. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58267. },
  58268. args: [],
  58269. 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.",
  58270. referencedClasses: [],
  58271. messageSends: ["assert:equals:", "ceiling"]
  58272. }),
  58273. $globals.NumberTest);
  58274. $core.addMethod(
  58275. $core.method({
  58276. selector: "testComparison",
  58277. protocol: "tests",
  58278. fn: function (){
  58279. var self=this,$self=this;
  58280. return $core.withContext(function($ctx1) {
  58281. var $1,$2,$3,$4;
  58282. $1=(3).__gt((2));
  58283. $ctx1.sendIdx[">"]=1;
  58284. $self._assert_($1);
  58285. $ctx1.sendIdx["assert:"]=1;
  58286. $2=(2).__lt((3));
  58287. $ctx1.sendIdx["<"]=1;
  58288. $self._assert_($2);
  58289. $ctx1.sendIdx["assert:"]=2;
  58290. $self._deny_((3).__lt((2)));
  58291. $ctx1.sendIdx["deny:"]=1;
  58292. $self._deny_((2).__gt((3)));
  58293. $3=(3).__gt_eq((3));
  58294. $ctx1.sendIdx[">="]=1;
  58295. $self._assert_($3);
  58296. $ctx1.sendIdx["assert:"]=3;
  58297. $self._assert_((3.1).__gt_eq((3)));
  58298. $ctx1.sendIdx["assert:"]=4;
  58299. $4=(3).__lt_eq((3));
  58300. $ctx1.sendIdx["<="]=1;
  58301. $self._assert_($4);
  58302. $ctx1.sendIdx["assert:"]=5;
  58303. $self._assert_((3).__lt_eq((3.1)));
  58304. return self;
  58305. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58306. },
  58307. args: [],
  58308. 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",
  58309. referencedClasses: [],
  58310. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58311. }),
  58312. $globals.NumberTest);
  58313. $core.addMethod(
  58314. $core.method({
  58315. selector: "testCopying",
  58316. protocol: "tests",
  58317. fn: function (){
  58318. var self=this,$self=this;
  58319. return $core.withContext(function($ctx1) {
  58320. var $1;
  58321. $1=$recv((1)._copy()).__eq_eq((1));
  58322. $ctx1.sendIdx["=="]=1;
  58323. $self._assert_($1);
  58324. $ctx1.sendIdx["assert:"]=1;
  58325. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58326. return self;
  58327. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58328. },
  58329. args: [],
  58330. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58331. referencedClasses: [],
  58332. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58333. }),
  58334. $globals.NumberTest);
  58335. $core.addMethod(
  58336. $core.method({
  58337. selector: "testDegreesToRadians",
  58338. protocol: "tests",
  58339. fn: function (){
  58340. var self=this,$self=this;
  58341. return $core.withContext(function($ctx1) {
  58342. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58343. return self;
  58344. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58345. },
  58346. args: [],
  58347. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58348. referencedClasses: ["Number"],
  58349. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58350. }),
  58351. $globals.NumberTest);
  58352. $core.addMethod(
  58353. $core.method({
  58354. selector: "testEquality",
  58355. protocol: "tests",
  58356. fn: function (){
  58357. var self=this,$self=this;
  58358. return $core.withContext(function($ctx1) {
  58359. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58360. $1=(1).__eq((1));
  58361. $ctx1.sendIdx["="]=1;
  58362. $self._assert_($1);
  58363. $ctx1.sendIdx["assert:"]=1;
  58364. $2=(0).__eq((0));
  58365. $ctx1.sendIdx["="]=2;
  58366. $self._assert_($2);
  58367. $ctx1.sendIdx["assert:"]=2;
  58368. $3=(1).__eq((0));
  58369. $ctx1.sendIdx["="]=3;
  58370. $self._deny_($3);
  58371. $ctx1.sendIdx["deny:"]=1;
  58372. $5=(1)._yourself();
  58373. $ctx1.sendIdx["yourself"]=1;
  58374. $4=$recv($5).__eq((1));
  58375. $ctx1.sendIdx["="]=4;
  58376. $self._assert_($4);
  58377. $ctx1.sendIdx["assert:"]=3;
  58378. $7=(1)._yourself();
  58379. $ctx1.sendIdx["yourself"]=2;
  58380. $6=(1).__eq($7);
  58381. $ctx1.sendIdx["="]=5;
  58382. $self._assert_($6);
  58383. $ctx1.sendIdx["assert:"]=4;
  58384. $9=(1)._yourself();
  58385. $ctx1.sendIdx["yourself"]=3;
  58386. $8=$recv($9).__eq((1)._yourself());
  58387. $ctx1.sendIdx["="]=6;
  58388. $self._assert_($8);
  58389. $10=(0).__eq(false);
  58390. $ctx1.sendIdx["="]=7;
  58391. $self._deny_($10);
  58392. $ctx1.sendIdx["deny:"]=2;
  58393. $11=false.__eq((0));
  58394. $ctx1.sendIdx["="]=8;
  58395. $self._deny_($11);
  58396. $ctx1.sendIdx["deny:"]=3;
  58397. $12="".__eq((0));
  58398. $ctx1.sendIdx["="]=9;
  58399. $self._deny_($12);
  58400. $ctx1.sendIdx["deny:"]=4;
  58401. $self._deny_((0).__eq(""));
  58402. return self;
  58403. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58404. },
  58405. args: [],
  58406. 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 = ''",
  58407. referencedClasses: [],
  58408. messageSends: ["assert:", "=", "deny:", "yourself"]
  58409. }),
  58410. $globals.NumberTest);
  58411. $core.addMethod(
  58412. $core.method({
  58413. selector: "testFloor",
  58414. protocol: "tests",
  58415. fn: function (){
  58416. var self=this,$self=this;
  58417. return $core.withContext(function($ctx1) {
  58418. var $1,$2;
  58419. $1=(1.2)._floor();
  58420. $ctx1.sendIdx["floor"]=1;
  58421. $self._assert_equals_($1,(1));
  58422. $ctx1.sendIdx["assert:equals:"]=1;
  58423. $2=(-1.2)._floor();
  58424. $ctx1.sendIdx["floor"]=2;
  58425. $self._assert_equals_($2,(-2));
  58426. $ctx1.sendIdx["assert:equals:"]=2;
  58427. $self._assert_equals_((1)._floor(),(1));
  58428. return self;
  58429. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58430. },
  58431. args: [],
  58432. 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.",
  58433. referencedClasses: [],
  58434. messageSends: ["assert:equals:", "floor"]
  58435. }),
  58436. $globals.NumberTest);
  58437. $core.addMethod(
  58438. $core.method({
  58439. selector: "testHexNumbers",
  58440. protocol: "tests",
  58441. fn: function (){
  58442. var self=this,$self=this;
  58443. return $core.withContext(function($ctx1) {
  58444. var $1,$2,$3,$4,$5;
  58445. $self._assert_equals_((9),(9));
  58446. $ctx1.sendIdx["assert:equals:"]=1;
  58447. $1=(10)._truncated();
  58448. $ctx1.sendIdx["truncated"]=1;
  58449. $self._assert_equals_($1,(10));
  58450. $ctx1.sendIdx["assert:equals:"]=2;
  58451. $2=(11)._truncated();
  58452. $ctx1.sendIdx["truncated"]=2;
  58453. $self._assert_equals_($2,(11));
  58454. $ctx1.sendIdx["assert:equals:"]=3;
  58455. $3=(12)._truncated();
  58456. $ctx1.sendIdx["truncated"]=3;
  58457. $self._assert_equals_($3,(12));
  58458. $ctx1.sendIdx["assert:equals:"]=4;
  58459. $4=(13)._truncated();
  58460. $ctx1.sendIdx["truncated"]=4;
  58461. $self._assert_equals_($4,(13));
  58462. $ctx1.sendIdx["assert:equals:"]=5;
  58463. $5=(14)._truncated();
  58464. $ctx1.sendIdx["truncated"]=5;
  58465. $self._assert_equals_($5,(14));
  58466. $ctx1.sendIdx["assert:equals:"]=6;
  58467. $self._assert_equals_((15)._truncated(),(15));
  58468. return self;
  58469. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58470. },
  58471. args: [],
  58472. 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",
  58473. referencedClasses: [],
  58474. messageSends: ["assert:equals:", "truncated"]
  58475. }),
  58476. $globals.NumberTest);
  58477. $core.addMethod(
  58478. $core.method({
  58479. selector: "testIdentity",
  58480. protocol: "tests",
  58481. fn: function (){
  58482. var self=this,$self=this;
  58483. return $core.withContext(function($ctx1) {
  58484. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58485. $1=(1).__eq_eq((1));
  58486. $ctx1.sendIdx["=="]=1;
  58487. $self._assert_($1);
  58488. $ctx1.sendIdx["assert:"]=1;
  58489. $2=(0).__eq_eq((0));
  58490. $ctx1.sendIdx["=="]=2;
  58491. $self._assert_($2);
  58492. $ctx1.sendIdx["assert:"]=2;
  58493. $3=(1).__eq_eq((0));
  58494. $ctx1.sendIdx["=="]=3;
  58495. $self._deny_($3);
  58496. $ctx1.sendIdx["deny:"]=1;
  58497. $5=(1)._yourself();
  58498. $ctx1.sendIdx["yourself"]=1;
  58499. $4=$recv($5).__eq_eq((1));
  58500. $ctx1.sendIdx["=="]=4;
  58501. $self._assert_($4);
  58502. $ctx1.sendIdx["assert:"]=3;
  58503. $7=(1)._yourself();
  58504. $ctx1.sendIdx["yourself"]=2;
  58505. $6=(1).__eq_eq($7);
  58506. $ctx1.sendIdx["=="]=5;
  58507. $self._assert_($6);
  58508. $ctx1.sendIdx["assert:"]=4;
  58509. $9=(1)._yourself();
  58510. $ctx1.sendIdx["yourself"]=3;
  58511. $8=$recv($9).__eq_eq((1)._yourself());
  58512. $ctx1.sendIdx["=="]=6;
  58513. $self._assert_($8);
  58514. $self._deny_((1).__eq_eq((2)));
  58515. return self;
  58516. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58517. },
  58518. args: [],
  58519. 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",
  58520. referencedClasses: [],
  58521. messageSends: ["assert:", "==", "deny:", "yourself"]
  58522. }),
  58523. $globals.NumberTest);
  58524. $core.addMethod(
  58525. $core.method({
  58526. selector: "testInvalidHexNumbers",
  58527. protocol: "tests",
  58528. fn: function (){
  58529. var self=this,$self=this;
  58530. return $core.withContext(function($ctx1) {
  58531. $self._should_raise_((function(){
  58532. return $core.withContext(function($ctx2) {
  58533. return (16)._rG();
  58534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58535. }),$globals.MessageNotUnderstood);
  58536. $ctx1.sendIdx["should:raise:"]=1;
  58537. $self._should_raise_((function(){
  58538. return $core.withContext(function($ctx2) {
  58539. return (16)._rg();
  58540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58541. }),$globals.MessageNotUnderstood);
  58542. $ctx1.sendIdx["should:raise:"]=2;
  58543. $self._should_raise_((function(){
  58544. return $core.withContext(function($ctx2) {
  58545. return (16)._rH();
  58546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58547. }),$globals.MessageNotUnderstood);
  58548. $ctx1.sendIdx["should:raise:"]=3;
  58549. $self._should_raise_((function(){
  58550. return $core.withContext(function($ctx2) {
  58551. return (16)._rh();
  58552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58553. }),$globals.MessageNotUnderstood);
  58554. $ctx1.sendIdx["should:raise:"]=4;
  58555. $self._should_raise_((function(){
  58556. return $core.withContext(function($ctx2) {
  58557. return (16)._rI();
  58558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58559. }),$globals.MessageNotUnderstood);
  58560. $ctx1.sendIdx["should:raise:"]=5;
  58561. $self._should_raise_((function(){
  58562. return $core.withContext(function($ctx2) {
  58563. return (16)._ri();
  58564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58565. }),$globals.MessageNotUnderstood);
  58566. $ctx1.sendIdx["should:raise:"]=6;
  58567. $self._should_raise_((function(){
  58568. return $core.withContext(function($ctx2) {
  58569. return (16)._rJ();
  58570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58571. }),$globals.MessageNotUnderstood);
  58572. $ctx1.sendIdx["should:raise:"]=7;
  58573. $self._should_raise_((function(){
  58574. return $core.withContext(function($ctx2) {
  58575. return (16)._rj();
  58576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58577. }),$globals.MessageNotUnderstood);
  58578. $ctx1.sendIdx["should:raise:"]=8;
  58579. $self._should_raise_((function(){
  58580. return $core.withContext(function($ctx2) {
  58581. return (16)._rK();
  58582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58583. }),$globals.MessageNotUnderstood);
  58584. $ctx1.sendIdx["should:raise:"]=9;
  58585. $self._should_raise_((function(){
  58586. return $core.withContext(function($ctx2) {
  58587. return (16)._rk();
  58588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  58589. }),$globals.MessageNotUnderstood);
  58590. $ctx1.sendIdx["should:raise:"]=10;
  58591. $self._should_raise_((function(){
  58592. return $core.withContext(function($ctx2) {
  58593. return (16)._rL();
  58594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  58595. }),$globals.MessageNotUnderstood);
  58596. $ctx1.sendIdx["should:raise:"]=11;
  58597. $self._should_raise_((function(){
  58598. return $core.withContext(function($ctx2) {
  58599. return (16)._rl();
  58600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  58601. }),$globals.MessageNotUnderstood);
  58602. $ctx1.sendIdx["should:raise:"]=12;
  58603. $self._should_raise_((function(){
  58604. return $core.withContext(function($ctx2) {
  58605. return (16)._rM();
  58606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  58607. }),$globals.MessageNotUnderstood);
  58608. $ctx1.sendIdx["should:raise:"]=13;
  58609. $self._should_raise_((function(){
  58610. return $core.withContext(function($ctx2) {
  58611. return (16)._rm();
  58612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  58613. }),$globals.MessageNotUnderstood);
  58614. $ctx1.sendIdx["should:raise:"]=14;
  58615. $self._should_raise_((function(){
  58616. return $core.withContext(function($ctx2) {
  58617. return (16)._rN();
  58618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  58619. }),$globals.MessageNotUnderstood);
  58620. $ctx1.sendIdx["should:raise:"]=15;
  58621. $self._should_raise_((function(){
  58622. return $core.withContext(function($ctx2) {
  58623. return (16)._rn();
  58624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  58625. }),$globals.MessageNotUnderstood);
  58626. $ctx1.sendIdx["should:raise:"]=16;
  58627. $self._should_raise_((function(){
  58628. return $core.withContext(function($ctx2) {
  58629. return (16)._rO();
  58630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  58631. }),$globals.MessageNotUnderstood);
  58632. $ctx1.sendIdx["should:raise:"]=17;
  58633. $self._should_raise_((function(){
  58634. return $core.withContext(function($ctx2) {
  58635. return (16)._ro();
  58636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  58637. }),$globals.MessageNotUnderstood);
  58638. $ctx1.sendIdx["should:raise:"]=18;
  58639. $self._should_raise_((function(){
  58640. return $core.withContext(function($ctx2) {
  58641. return (16)._rP();
  58642. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  58643. }),$globals.MessageNotUnderstood);
  58644. $ctx1.sendIdx["should:raise:"]=19;
  58645. $self._should_raise_((function(){
  58646. return $core.withContext(function($ctx2) {
  58647. return (16)._rp();
  58648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  58649. }),$globals.MessageNotUnderstood);
  58650. $ctx1.sendIdx["should:raise:"]=20;
  58651. $self._should_raise_((function(){
  58652. return $core.withContext(function($ctx2) {
  58653. return (16)._rQ();
  58654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  58655. }),$globals.MessageNotUnderstood);
  58656. $ctx1.sendIdx["should:raise:"]=21;
  58657. $self._should_raise_((function(){
  58658. return $core.withContext(function($ctx2) {
  58659. return (16)._rq();
  58660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  58661. }),$globals.MessageNotUnderstood);
  58662. $ctx1.sendIdx["should:raise:"]=22;
  58663. $self._should_raise_((function(){
  58664. return $core.withContext(function($ctx2) {
  58665. return (16)._rR();
  58666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  58667. }),$globals.MessageNotUnderstood);
  58668. $ctx1.sendIdx["should:raise:"]=23;
  58669. $self._should_raise_((function(){
  58670. return $core.withContext(function($ctx2) {
  58671. return (16)._rr();
  58672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  58673. }),$globals.MessageNotUnderstood);
  58674. $ctx1.sendIdx["should:raise:"]=24;
  58675. $self._should_raise_((function(){
  58676. return $core.withContext(function($ctx2) {
  58677. return (16)._rS();
  58678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  58679. }),$globals.MessageNotUnderstood);
  58680. $ctx1.sendIdx["should:raise:"]=25;
  58681. $self._should_raise_((function(){
  58682. return $core.withContext(function($ctx2) {
  58683. return (16)._rs();
  58684. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  58685. }),$globals.MessageNotUnderstood);
  58686. $ctx1.sendIdx["should:raise:"]=26;
  58687. $self._should_raise_((function(){
  58688. return $core.withContext(function($ctx2) {
  58689. return (16)._rT();
  58690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  58691. }),$globals.MessageNotUnderstood);
  58692. $ctx1.sendIdx["should:raise:"]=27;
  58693. $self._should_raise_((function(){
  58694. return $core.withContext(function($ctx2) {
  58695. return (16)._rt();
  58696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  58697. }),$globals.MessageNotUnderstood);
  58698. $ctx1.sendIdx["should:raise:"]=28;
  58699. $self._should_raise_((function(){
  58700. return $core.withContext(function($ctx2) {
  58701. return (16)._rU();
  58702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  58703. }),$globals.MessageNotUnderstood);
  58704. $ctx1.sendIdx["should:raise:"]=29;
  58705. $self._should_raise_((function(){
  58706. return $core.withContext(function($ctx2) {
  58707. return (16)._ru();
  58708. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  58709. }),$globals.MessageNotUnderstood);
  58710. $ctx1.sendIdx["should:raise:"]=30;
  58711. $self._should_raise_((function(){
  58712. return $core.withContext(function($ctx2) {
  58713. return (16)._rV();
  58714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  58715. }),$globals.MessageNotUnderstood);
  58716. $ctx1.sendIdx["should:raise:"]=31;
  58717. $self._should_raise_((function(){
  58718. return $core.withContext(function($ctx2) {
  58719. return (16)._rv();
  58720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  58721. }),$globals.MessageNotUnderstood);
  58722. $ctx1.sendIdx["should:raise:"]=32;
  58723. $self._should_raise_((function(){
  58724. return $core.withContext(function($ctx2) {
  58725. return (16)._rW();
  58726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  58727. }),$globals.MessageNotUnderstood);
  58728. $ctx1.sendIdx["should:raise:"]=33;
  58729. $self._should_raise_((function(){
  58730. return $core.withContext(function($ctx2) {
  58731. return (16)._rw();
  58732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  58733. }),$globals.MessageNotUnderstood);
  58734. $ctx1.sendIdx["should:raise:"]=34;
  58735. $self._should_raise_((function(){
  58736. return $core.withContext(function($ctx2) {
  58737. return (16)._rX();
  58738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  58739. }),$globals.MessageNotUnderstood);
  58740. $ctx1.sendIdx["should:raise:"]=35;
  58741. $self._should_raise_((function(){
  58742. return $core.withContext(function($ctx2) {
  58743. return (16)._rx();
  58744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  58745. }),$globals.MessageNotUnderstood);
  58746. $ctx1.sendIdx["should:raise:"]=36;
  58747. $self._should_raise_((function(){
  58748. return $core.withContext(function($ctx2) {
  58749. return (16)._rY();
  58750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  58751. }),$globals.MessageNotUnderstood);
  58752. $ctx1.sendIdx["should:raise:"]=37;
  58753. $self._should_raise_((function(){
  58754. return $core.withContext(function($ctx2) {
  58755. return (16)._ry();
  58756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  58757. }),$globals.MessageNotUnderstood);
  58758. $ctx1.sendIdx["should:raise:"]=38;
  58759. $self._should_raise_((function(){
  58760. return $core.withContext(function($ctx2) {
  58761. return (16)._rZ();
  58762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  58763. }),$globals.MessageNotUnderstood);
  58764. $ctx1.sendIdx["should:raise:"]=39;
  58765. $self._should_raise_((function(){
  58766. return $core.withContext(function($ctx2) {
  58767. return (16)._rz();
  58768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  58769. }),$globals.MessageNotUnderstood);
  58770. $ctx1.sendIdx["should:raise:"]=40;
  58771. $self._should_raise_((function(){
  58772. return $core.withContext(function($ctx2) {
  58773. return (11259375)._Z();
  58774. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  58775. }),$globals.MessageNotUnderstood);
  58776. return self;
  58777. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  58778. },
  58779. args: [],
  58780. 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.",
  58781. referencedClasses: ["MessageNotUnderstood"],
  58782. 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"]
  58783. }),
  58784. $globals.NumberTest);
  58785. $core.addMethod(
  58786. $core.method({
  58787. selector: "testLog",
  58788. protocol: "tests",
  58789. fn: function (){
  58790. var self=this,$self=this;
  58791. return $core.withContext(function($ctx1) {
  58792. $self._assert_equals_((10000)._log(),(4));
  58793. $ctx1.sendIdx["assert:equals:"]=1;
  58794. $self._assert_equals_((512)._log_((2)),(9));
  58795. $ctx1.sendIdx["assert:equals:"]=2;
  58796. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  58797. return self;
  58798. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  58799. },
  58800. args: [],
  58801. 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.",
  58802. referencedClasses: ["Number"],
  58803. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  58804. }),
  58805. $globals.NumberTest);
  58806. $core.addMethod(
  58807. $core.method({
  58808. selector: "testMinMax",
  58809. protocol: "tests",
  58810. fn: function (){
  58811. var self=this,$self=this;
  58812. return $core.withContext(function($ctx1) {
  58813. var $1,$2;
  58814. $self._assert_equals_((2)._max_((5)),(5));
  58815. $ctx1.sendIdx["assert:equals:"]=1;
  58816. $self._assert_equals_((2)._min_((5)),(2));
  58817. $ctx1.sendIdx["assert:equals:"]=2;
  58818. $1=(2)._min_max_((5),(3));
  58819. $ctx1.sendIdx["min:max:"]=1;
  58820. $self._assert_equals_($1,(3));
  58821. $ctx1.sendIdx["assert:equals:"]=3;
  58822. $2=(7)._min_max_((5),(3));
  58823. $ctx1.sendIdx["min:max:"]=2;
  58824. $self._assert_equals_($2,(5));
  58825. $ctx1.sendIdx["assert:equals:"]=4;
  58826. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  58827. return self;
  58828. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  58829. },
  58830. args: [],
  58831. 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.",
  58832. referencedClasses: [],
  58833. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  58834. }),
  58835. $globals.NumberTest);
  58836. $core.addMethod(
  58837. $core.method({
  58838. selector: "testNegated",
  58839. protocol: "tests",
  58840. fn: function (){
  58841. var self=this,$self=this;
  58842. return $core.withContext(function($ctx1) {
  58843. var $1;
  58844. $1=(3)._negated();
  58845. $ctx1.sendIdx["negated"]=1;
  58846. $self._assert_equals_($1,(-3));
  58847. $ctx1.sendIdx["assert:equals:"]=1;
  58848. $self._assert_equals_((-3)._negated(),(3));
  58849. return self;
  58850. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  58851. },
  58852. args: [],
  58853. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  58854. referencedClasses: [],
  58855. messageSends: ["assert:equals:", "negated"]
  58856. }),
  58857. $globals.NumberTest);
  58858. $core.addMethod(
  58859. $core.method({
  58860. selector: "testPrintShowingDecimalPlaces",
  58861. protocol: "tests",
  58862. fn: function (){
  58863. var self=this,$self=this;
  58864. return $core.withContext(function($ctx1) {
  58865. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  58866. $1=(23)._printShowingDecimalPlaces_((2));
  58867. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  58868. $self._assert_equals_($1,"23.00");
  58869. $ctx1.sendIdx["assert:equals:"]=1;
  58870. $2=(23.5698)._printShowingDecimalPlaces_((2));
  58871. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  58872. $self._assert_equals_($2,"23.57");
  58873. $ctx1.sendIdx["assert:equals:"]=2;
  58874. $4=(234.567)._negated();
  58875. $ctx1.sendIdx["negated"]=1;
  58876. $3=$recv($4)._printShowingDecimalPlaces_((5));
  58877. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  58878. $self._assert_equals_($3,"-234.56700");
  58879. $ctx1.sendIdx["assert:equals:"]=3;
  58880. $5=(23.4567)._printShowingDecimalPlaces_((0));
  58881. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  58882. $self._assert_equals_($5,"23");
  58883. $ctx1.sendIdx["assert:equals:"]=4;
  58884. $6=(23.5567)._printShowingDecimalPlaces_((0));
  58885. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  58886. $self._assert_equals_($6,"24");
  58887. $ctx1.sendIdx["assert:equals:"]=5;
  58888. $8=(23.4567)._negated();
  58889. $ctx1.sendIdx["negated"]=2;
  58890. $7=$recv($8)._printShowingDecimalPlaces_((0));
  58891. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  58892. $self._assert_equals_($7,"-23");
  58893. $ctx1.sendIdx["assert:equals:"]=6;
  58894. $10=(23.5567)._negated();
  58895. $ctx1.sendIdx["negated"]=3;
  58896. $9=$recv($10)._printShowingDecimalPlaces_((0));
  58897. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  58898. $self._assert_equals_($9,"-24");
  58899. $ctx1.sendIdx["assert:equals:"]=7;
  58900. $11=(100000000)._printShowingDecimalPlaces_((1));
  58901. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  58902. $self._assert_equals_($11,"100000000.0");
  58903. $ctx1.sendIdx["assert:equals:"]=8;
  58904. $12=(0.98)._printShowingDecimalPlaces_((5));
  58905. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  58906. $self._assert_equals_($12,"0.98000");
  58907. $ctx1.sendIdx["assert:equals:"]=9;
  58908. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  58909. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  58910. $self._assert_equals_($13,"-0.98");
  58911. $ctx1.sendIdx["assert:equals:"]=10;
  58912. $14=(2.567)._printShowingDecimalPlaces_((2));
  58913. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  58914. $self._assert_equals_($14,"2.57");
  58915. $ctx1.sendIdx["assert:equals:"]=11;
  58916. $15=(-2.567)._printShowingDecimalPlaces_((2));
  58917. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  58918. $self._assert_equals_($15,"-2.57");
  58919. $ctx1.sendIdx["assert:equals:"]=12;
  58920. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  58921. return self;
  58922. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  58923. },
  58924. args: [],
  58925. 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'.",
  58926. referencedClasses: [],
  58927. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  58928. }),
  58929. $globals.NumberTest);
  58930. $core.addMethod(
  58931. $core.method({
  58932. selector: "testPrintStringBase",
  58933. protocol: "tests",
  58934. fn: function (){
  58935. var self=this,$self=this;
  58936. return $core.withContext(function($ctx1) {
  58937. var $1,$2,$3;
  58938. $1=(15)._printStringBase_((2));
  58939. $ctx1.sendIdx["printStringBase:"]=1;
  58940. $self._assert_equals_($1,"1111");
  58941. $ctx1.sendIdx["assert:equals:"]=1;
  58942. $2=(15)._printStringBase_((16));
  58943. $ctx1.sendIdx["printStringBase:"]=2;
  58944. $self._assert_equals_($2,"f");
  58945. $ctx1.sendIdx["assert:equals:"]=2;
  58946. $3=(256)._printStringBase_((16));
  58947. $ctx1.sendIdx["printStringBase:"]=3;
  58948. $self._assert_equals_($3,"100");
  58949. $ctx1.sendIdx["assert:equals:"]=3;
  58950. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  58951. return self;
  58952. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  58953. },
  58954. args: [],
  58955. 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'",
  58956. referencedClasses: [],
  58957. messageSends: ["assert:equals:", "printStringBase:"]
  58958. }),
  58959. $globals.NumberTest);
  58960. $core.addMethod(
  58961. $core.method({
  58962. selector: "testRadiansToDegrees",
  58963. protocol: "tests",
  58964. fn: function (){
  58965. var self=this,$self=this;
  58966. return $core.withContext(function($ctx1) {
  58967. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  58968. return self;
  58969. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  58970. },
  58971. args: [],
  58972. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  58973. referencedClasses: ["Number"],
  58974. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  58975. }),
  58976. $globals.NumberTest);
  58977. $core.addMethod(
  58978. $core.method({
  58979. selector: "testRaisedTo",
  58980. protocol: "tests",
  58981. fn: function (){
  58982. var self=this,$self=this;
  58983. return $core.withContext(function($ctx1) {
  58984. var $1,$2,$3;
  58985. $1=(2)._raisedTo_((4));
  58986. $ctx1.sendIdx["raisedTo:"]=1;
  58987. $self._assert_equals_($1,(16));
  58988. $ctx1.sendIdx["assert:equals:"]=1;
  58989. $2=(2)._raisedTo_((0));
  58990. $ctx1.sendIdx["raisedTo:"]=2;
  58991. $self._assert_equals_($2,(1));
  58992. $ctx1.sendIdx["assert:equals:"]=2;
  58993. $3=(2)._raisedTo_((-3));
  58994. $ctx1.sendIdx["raisedTo:"]=3;
  58995. $self._assert_equals_($3,(0.125));
  58996. $ctx1.sendIdx["assert:equals:"]=3;
  58997. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  58998. $ctx1.sendIdx["assert:equals:"]=4;
  58999. $self._assert_equals_((2).__star_star((4)),(16));
  59000. return self;
  59001. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59002. },
  59003. args: [],
  59004. 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.",
  59005. referencedClasses: [],
  59006. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59007. }),
  59008. $globals.NumberTest);
  59009. $core.addMethod(
  59010. $core.method({
  59011. selector: "testRounded",
  59012. protocol: "tests",
  59013. fn: function (){
  59014. var self=this,$self=this;
  59015. return $core.withContext(function($ctx1) {
  59016. var $1,$2;
  59017. $1=(3)._rounded();
  59018. $ctx1.sendIdx["rounded"]=1;
  59019. $self._assert_equals_($1,(3));
  59020. $ctx1.sendIdx["assert:equals:"]=1;
  59021. $2=(3.212)._rounded();
  59022. $ctx1.sendIdx["rounded"]=2;
  59023. $self._assert_equals_($2,(3));
  59024. $ctx1.sendIdx["assert:equals:"]=2;
  59025. $self._assert_equals_((3.51)._rounded(),(4));
  59026. return self;
  59027. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59028. },
  59029. args: [],
  59030. 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",
  59031. referencedClasses: [],
  59032. messageSends: ["assert:equals:", "rounded"]
  59033. }),
  59034. $globals.NumberTest);
  59035. $core.addMethod(
  59036. $core.method({
  59037. selector: "testSign",
  59038. protocol: "tests",
  59039. fn: function (){
  59040. var self=this,$self=this;
  59041. return $core.withContext(function($ctx1) {
  59042. var $1,$2;
  59043. $1=(5)._sign();
  59044. $ctx1.sendIdx["sign"]=1;
  59045. $self._assert_equals_($1,(1));
  59046. $ctx1.sendIdx["assert:equals:"]=1;
  59047. $2=(0)._sign();
  59048. $ctx1.sendIdx["sign"]=2;
  59049. $self._assert_equals_($2,(0));
  59050. $ctx1.sendIdx["assert:equals:"]=2;
  59051. $self._assert_equals_((-1.4)._sign(),(-1));
  59052. return self;
  59053. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59054. },
  59055. args: [],
  59056. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59057. referencedClasses: [],
  59058. messageSends: ["assert:equals:", "sign"]
  59059. }),
  59060. $globals.NumberTest);
  59061. $core.addMethod(
  59062. $core.method({
  59063. selector: "testSqrt",
  59064. protocol: "tests",
  59065. fn: function (){
  59066. var self=this,$self=this;
  59067. return $core.withContext(function($ctx1) {
  59068. var $1;
  59069. $1=(4)._sqrt();
  59070. $ctx1.sendIdx["sqrt"]=1;
  59071. $self._assert_equals_($1,(2));
  59072. $ctx1.sendIdx["assert:equals:"]=1;
  59073. $self._assert_equals_((16)._sqrt(),(4));
  59074. return self;
  59075. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59076. },
  59077. args: [],
  59078. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59079. referencedClasses: [],
  59080. messageSends: ["assert:equals:", "sqrt"]
  59081. }),
  59082. $globals.NumberTest);
  59083. $core.addMethod(
  59084. $core.method({
  59085. selector: "testSquared",
  59086. protocol: "tests",
  59087. fn: function (){
  59088. var self=this,$self=this;
  59089. return $core.withContext(function($ctx1) {
  59090. $self._assert_equals_((4)._squared(),(16));
  59091. return self;
  59092. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59093. },
  59094. args: [],
  59095. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59096. referencedClasses: [],
  59097. messageSends: ["assert:equals:", "squared"]
  59098. }),
  59099. $globals.NumberTest);
  59100. $core.addMethod(
  59101. $core.method({
  59102. selector: "testTimesRepeat",
  59103. protocol: "tests",
  59104. fn: function (){
  59105. var self=this,$self=this;
  59106. var i;
  59107. return $core.withContext(function($ctx1) {
  59108. i=(0);
  59109. (0)._timesRepeat_((function(){
  59110. return $core.withContext(function($ctx2) {
  59111. i=$recv(i).__plus((1));
  59112. $ctx2.sendIdx["+"]=1;
  59113. return i;
  59114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59115. }));
  59116. $ctx1.sendIdx["timesRepeat:"]=1;
  59117. $self._assert_equals_(i,(0));
  59118. $ctx1.sendIdx["assert:equals:"]=1;
  59119. (5)._timesRepeat_((function(){
  59120. return $core.withContext(function($ctx2) {
  59121. i=$recv(i).__plus((1));
  59122. return i;
  59123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59124. }));
  59125. $self._assert_equals_(i,(5));
  59126. return self;
  59127. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59128. },
  59129. args: [],
  59130. 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",
  59131. referencedClasses: [],
  59132. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59133. }),
  59134. $globals.NumberTest);
  59135. $core.addMethod(
  59136. $core.method({
  59137. selector: "testTo",
  59138. protocol: "tests",
  59139. fn: function (){
  59140. var self=this,$self=this;
  59141. return $core.withContext(function($ctx1) {
  59142. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59143. return self;
  59144. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59145. },
  59146. args: [],
  59147. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59148. referencedClasses: [],
  59149. messageSends: ["assert:equals:", "to:"]
  59150. }),
  59151. $globals.NumberTest);
  59152. $core.addMethod(
  59153. $core.method({
  59154. selector: "testToBy",
  59155. protocol: "tests",
  59156. fn: function (){
  59157. var self=this,$self=this;
  59158. return $core.withContext(function($ctx1) {
  59159. var $1;
  59160. $1=(0)._to_by_((6),(2));
  59161. $ctx1.sendIdx["to:by:"]=1;
  59162. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59163. $self._should_raise_((function(){
  59164. return $core.withContext(function($ctx2) {
  59165. return (1)._to_by_((4),(0));
  59166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59167. }),$globals.Error);
  59168. return self;
  59169. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59170. },
  59171. args: [],
  59172. 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",
  59173. referencedClasses: ["Error"],
  59174. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59175. }),
  59176. $globals.NumberTest);
  59177. $core.addMethod(
  59178. $core.method({
  59179. selector: "testTrigonometry",
  59180. protocol: "tests",
  59181. fn: function (){
  59182. var self=this,$self=this;
  59183. return $core.withContext(function($ctx1) {
  59184. var $1;
  59185. $self._assert_equals_((0)._cos(),(1));
  59186. $ctx1.sendIdx["assert:equals:"]=1;
  59187. $self._assert_equals_((0)._sin(),(0));
  59188. $ctx1.sendIdx["assert:equals:"]=2;
  59189. $self._assert_equals_((0)._tan(),(0));
  59190. $ctx1.sendIdx["assert:equals:"]=3;
  59191. $self._assert_equals_((1)._arcCos(),(0));
  59192. $ctx1.sendIdx["assert:equals:"]=4;
  59193. $self._assert_equals_((0)._arcSin(),(0));
  59194. $ctx1.sendIdx["assert:equals:"]=5;
  59195. $self._assert_equals_((0)._arcTan(),(0));
  59196. $ctx1.sendIdx["assert:equals:"]=6;
  59197. $1=(0)._arcTan_((1));
  59198. $ctx1.sendIdx["arcTan:"]=1;
  59199. $self._assert_equals_($1,(0));
  59200. $ctx1.sendIdx["assert:equals:"]=7;
  59201. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59202. return self;
  59203. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59204. },
  59205. args: [],
  59206. 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)",
  59207. referencedClasses: ["Number"],
  59208. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59209. }),
  59210. $globals.NumberTest);
  59211. $core.addMethod(
  59212. $core.method({
  59213. selector: "testTruncated",
  59214. protocol: "tests",
  59215. fn: function (){
  59216. var self=this,$self=this;
  59217. return $core.withContext(function($ctx1) {
  59218. var $1,$2;
  59219. $1=(3)._truncated();
  59220. $ctx1.sendIdx["truncated"]=1;
  59221. $self._assert_equals_($1,(3));
  59222. $ctx1.sendIdx["assert:equals:"]=1;
  59223. $2=(3.212)._truncated();
  59224. $ctx1.sendIdx["truncated"]=2;
  59225. $self._assert_equals_($2,(3));
  59226. $ctx1.sendIdx["assert:equals:"]=2;
  59227. $self._assert_equals_((3.51)._truncated(),(3));
  59228. return self;
  59229. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59230. },
  59231. args: [],
  59232. 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",
  59233. referencedClasses: [],
  59234. messageSends: ["assert:equals:", "truncated"]
  59235. }),
  59236. $globals.NumberTest);
  59237. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59238. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59239. $core.addMethod(
  59240. $core.method({
  59241. selector: "foo",
  59242. protocol: "not yet classified",
  59243. fn: function (){
  59244. var self=this,$self=this;
  59245. return $self["@foo"];
  59246. },
  59247. args: [],
  59248. source: "foo\x0a\x09^ foo",
  59249. referencedClasses: [],
  59250. messageSends: []
  59251. }),
  59252. $globals.ObjectMock);
  59253. $core.addMethod(
  59254. $core.method({
  59255. selector: "foo:",
  59256. protocol: "not yet classified",
  59257. fn: function (anObject){
  59258. var self=this,$self=this;
  59259. $self["@foo"]=anObject;
  59260. return self;
  59261. },
  59262. args: ["anObject"],
  59263. source: "foo: anObject\x0a\x09foo := anObject",
  59264. referencedClasses: [],
  59265. messageSends: []
  59266. }),
  59267. $globals.ObjectMock);
  59268. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59269. $core.addMethod(
  59270. $core.method({
  59271. selector: "notDefined",
  59272. protocol: "tests",
  59273. fn: function (){
  59274. var self=this,$self=this;
  59275. return $core.withContext(function($ctx1) {
  59276. return void 0;;
  59277. return self;
  59278. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59279. },
  59280. args: [],
  59281. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59282. referencedClasses: [],
  59283. messageSends: []
  59284. }),
  59285. $globals.ObjectTest);
  59286. $core.addMethod(
  59287. $core.method({
  59288. selector: "testBasicAccess",
  59289. protocol: "tests",
  59290. fn: function (){
  59291. var self=this,$self=this;
  59292. var o;
  59293. return $core.withContext(function($ctx1) {
  59294. var $1;
  59295. o=$recv($globals.Object)._new();
  59296. $recv(o)._basicAt_put_("a",(1));
  59297. $1=$recv(o)._basicAt_("a");
  59298. $ctx1.sendIdx["basicAt:"]=1;
  59299. $self._assert_equals_($1,(1));
  59300. $ctx1.sendIdx["assert:equals:"]=1;
  59301. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59302. return self;
  59303. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59304. },
  59305. args: [],
  59306. 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",
  59307. referencedClasses: ["Object"],
  59308. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59309. }),
  59310. $globals.ObjectTest);
  59311. $core.addMethod(
  59312. $core.method({
  59313. selector: "testBasicPerform",
  59314. protocol: "tests",
  59315. fn: function (){
  59316. var self=this,$self=this;
  59317. var o;
  59318. return $core.withContext(function($ctx1) {
  59319. o=$recv($globals.Object)._new();
  59320. $recv(o)._basicAt_put_("func",(function(){
  59321. return "hello";
  59322. }));
  59323. $ctx1.sendIdx["basicAt:put:"]=1;
  59324. $recv(o)._basicAt_put_("func2",(function(a){
  59325. return $core.withContext(function($ctx2) {
  59326. return $recv(a).__plus((1));
  59327. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59328. }));
  59329. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59330. $ctx1.sendIdx["assert:equals:"]=1;
  59331. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59332. return self;
  59333. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59334. },
  59335. args: [],
  59336. 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",
  59337. referencedClasses: ["Object"],
  59338. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59339. }),
  59340. $globals.ObjectTest);
  59341. $core.addMethod(
  59342. $core.method({
  59343. selector: "testDNU",
  59344. protocol: "tests",
  59345. fn: function (){
  59346. var self=this,$self=this;
  59347. return $core.withContext(function($ctx1) {
  59348. $self._should_raise_((function(){
  59349. return $core.withContext(function($ctx2) {
  59350. return $recv($recv($globals.Object)._new())._foo();
  59351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59352. }),$globals.MessageNotUnderstood);
  59353. return self;
  59354. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59355. },
  59356. args: [],
  59357. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59358. referencedClasses: ["Object", "MessageNotUnderstood"],
  59359. messageSends: ["should:raise:", "foo", "new"]
  59360. }),
  59361. $globals.ObjectTest);
  59362. $core.addMethod(
  59363. $core.method({
  59364. selector: "testEquality",
  59365. protocol: "tests",
  59366. fn: function (){
  59367. var self=this,$self=this;
  59368. var o;
  59369. return $core.withContext(function($ctx1) {
  59370. var $1,$2,$4,$3;
  59371. o=$recv($globals.Object)._new();
  59372. $ctx1.sendIdx["new"]=1;
  59373. $1=$recv(o).__eq($recv($globals.Object)._new());
  59374. $ctx1.sendIdx["="]=1;
  59375. $self._deny_($1);
  59376. $2=$recv(o).__eq(o);
  59377. $ctx1.sendIdx["="]=2;
  59378. $self._assert_($2);
  59379. $ctx1.sendIdx["assert:"]=1;
  59380. $4=$recv(o)._yourself();
  59381. $ctx1.sendIdx["yourself"]=1;
  59382. $3=$recv($4).__eq(o);
  59383. $ctx1.sendIdx["="]=3;
  59384. $self._assert_($3);
  59385. $ctx1.sendIdx["assert:"]=2;
  59386. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59387. return self;
  59388. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59389. },
  59390. args: [],
  59391. 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)",
  59392. referencedClasses: ["Object"],
  59393. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59394. }),
  59395. $globals.ObjectTest);
  59396. $core.addMethod(
  59397. $core.method({
  59398. selector: "testHalt",
  59399. protocol: "tests",
  59400. fn: function (){
  59401. var self=this,$self=this;
  59402. return $core.withContext(function($ctx1) {
  59403. $self._should_raise_((function(){
  59404. return $core.withContext(function($ctx2) {
  59405. return $recv($recv($globals.Object)._new())._halt();
  59406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59407. }),$globals.Error);
  59408. return self;
  59409. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59410. },
  59411. args: [],
  59412. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59413. referencedClasses: ["Object", "Error"],
  59414. messageSends: ["should:raise:", "halt", "new"]
  59415. }),
  59416. $globals.ObjectTest);
  59417. $core.addMethod(
  59418. $core.method({
  59419. selector: "testIdentity",
  59420. protocol: "tests",
  59421. fn: function (){
  59422. var self=this,$self=this;
  59423. var o;
  59424. return $core.withContext(function($ctx1) {
  59425. var $1,$2,$4,$3;
  59426. o=$recv($globals.Object)._new();
  59427. $ctx1.sendIdx["new"]=1;
  59428. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59429. $ctx1.sendIdx["=="]=1;
  59430. $self._deny_($1);
  59431. $2=$recv(o).__eq_eq(o);
  59432. $ctx1.sendIdx["=="]=2;
  59433. $self._assert_($2);
  59434. $ctx1.sendIdx["assert:"]=1;
  59435. $4=$recv(o)._yourself();
  59436. $ctx1.sendIdx["yourself"]=1;
  59437. $3=$recv($4).__eq_eq(o);
  59438. $ctx1.sendIdx["=="]=3;
  59439. $self._assert_($3);
  59440. $ctx1.sendIdx["assert:"]=2;
  59441. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59442. return self;
  59443. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59444. },
  59445. args: [],
  59446. 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",
  59447. referencedClasses: ["Object"],
  59448. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59449. }),
  59450. $globals.ObjectTest);
  59451. $core.addMethod(
  59452. $core.method({
  59453. selector: "testIfNil",
  59454. protocol: "tests",
  59455. fn: function (){
  59456. var self=this,$self=this;
  59457. return $core.withContext(function($ctx1) {
  59458. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59459. $2=$recv($globals.Object)._new();
  59460. $ctx1.sendIdx["new"]=1;
  59461. $1=$recv($2)._isNil();
  59462. $self._deny_($1);
  59463. $ctx1.sendIdx["deny:"]=1;
  59464. $5=$recv($globals.Object)._new();
  59465. $ctx1.sendIdx["new"]=2;
  59466. if(($receiver = $5) == null || $receiver.a$nil){
  59467. $4=true;
  59468. } else {
  59469. $4=$5;
  59470. }
  59471. $3=$recv($4).__eq(true);
  59472. $self._deny_($3);
  59473. $7=$recv($globals.Object)._new();
  59474. $ctx1.sendIdx["new"]=3;
  59475. if(($receiver = $7) == null || $receiver.a$nil){
  59476. $6=$7;
  59477. } else {
  59478. $6=true;
  59479. }
  59480. $self._assert_equals_($6,true);
  59481. $ctx1.sendIdx["assert:equals:"]=1;
  59482. $9=$recv($globals.Object)._new();
  59483. $ctx1.sendIdx["new"]=4;
  59484. if(($receiver = $9) == null || $receiver.a$nil){
  59485. $8=false;
  59486. } else {
  59487. $8=true;
  59488. }
  59489. $self._assert_equals_($8,true);
  59490. $ctx1.sendIdx["assert:equals:"]=2;
  59491. $11=$recv($globals.Object)._new();
  59492. if(($receiver = $11) == null || $receiver.a$nil){
  59493. $10=false;
  59494. } else {
  59495. $10=true;
  59496. }
  59497. $self._assert_equals_($10,true);
  59498. return self;
  59499. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59500. },
  59501. args: [],
  59502. 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",
  59503. referencedClasses: ["Object"],
  59504. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59505. }),
  59506. $globals.ObjectTest);
  59507. $core.addMethod(
  59508. $core.method({
  59509. selector: "testInstVars",
  59510. protocol: "tests",
  59511. fn: function (){
  59512. var self=this,$self=this;
  59513. var o;
  59514. return $core.withContext(function($ctx1) {
  59515. var $1,$2;
  59516. o=$recv($globals.ObjectMock)._new();
  59517. $1=$recv(o)._instVarAt_("foo");
  59518. $ctx1.sendIdx["instVarAt:"]=1;
  59519. $self._assert_equals_($1,nil);
  59520. $ctx1.sendIdx["assert:equals:"]=1;
  59521. $recv(o)._instVarAt_put_("foo",(1));
  59522. $2=$recv(o)._instVarAt_("foo");
  59523. $ctx1.sendIdx["instVarAt:"]=2;
  59524. $self._assert_equals_($2,(1));
  59525. $ctx1.sendIdx["assert:equals:"]=2;
  59526. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59527. return self;
  59528. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59529. },
  59530. args: [],
  59531. 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",
  59532. referencedClasses: ["ObjectMock"],
  59533. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59534. }),
  59535. $globals.ObjectTest);
  59536. $core.addMethod(
  59537. $core.method({
  59538. selector: "testNilUndefined",
  59539. protocol: "tests",
  59540. fn: function (){
  59541. var self=this,$self=this;
  59542. return $core.withContext(function($ctx1) {
  59543. $self._assert_equals_($self._notDefined(),nil);
  59544. return self;
  59545. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59546. },
  59547. args: [],
  59548. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59549. referencedClasses: [],
  59550. messageSends: ["assert:equals:", "notDefined"]
  59551. }),
  59552. $globals.ObjectTest);
  59553. $core.addMethod(
  59554. $core.method({
  59555. selector: "testYourself",
  59556. protocol: "tests",
  59557. fn: function (){
  59558. var self=this,$self=this;
  59559. var o;
  59560. return $core.withContext(function($ctx1) {
  59561. o=$recv($globals.ObjectMock)._new();
  59562. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59563. return self;
  59564. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59565. },
  59566. args: [],
  59567. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59568. referencedClasses: ["ObjectMock"],
  59569. messageSends: ["new", "assert:", "==", "yourself"]
  59570. }),
  59571. $globals.ObjectTest);
  59572. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59573. $core.addMethod(
  59574. $core.method({
  59575. selector: "testAccessing",
  59576. protocol: "tests",
  59577. fn: function (){
  59578. var self=this,$self=this;
  59579. return $core.withContext(function($ctx1) {
  59580. var $2,$1,$3,$6,$5,$4;
  59581. $2=$recv($globals.Point)._x_y_((3),(4));
  59582. $ctx1.sendIdx["x:y:"]=1;
  59583. $1=$recv($2)._x();
  59584. $ctx1.sendIdx["x"]=1;
  59585. $self._assert_equals_($1,(3));
  59586. $ctx1.sendIdx["assert:equals:"]=1;
  59587. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  59588. $ctx1.sendIdx["y"]=1;
  59589. $self._assert_equals_($3,(4));
  59590. $ctx1.sendIdx["assert:equals:"]=2;
  59591. $6=$recv($globals.Point)._new();
  59592. $ctx1.sendIdx["new"]=1;
  59593. $5=$recv($6)._x_((3));
  59594. $4=$recv($5)._x();
  59595. $self._assert_equals_($4,(3));
  59596. $ctx1.sendIdx["assert:equals:"]=3;
  59597. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  59598. return self;
  59599. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  59600. },
  59601. args: [],
  59602. 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",
  59603. referencedClasses: ["Point"],
  59604. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  59605. }),
  59606. $globals.PointTest);
  59607. $core.addMethod(
  59608. $core.method({
  59609. selector: "testAngle",
  59610. protocol: "tests",
  59611. fn: function (){
  59612. var self=this,$self=this;
  59613. return $core.withContext(function($ctx1) {
  59614. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  59615. return self;
  59616. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  59617. },
  59618. args: [],
  59619. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  59620. referencedClasses: ["Number"],
  59621. messageSends: ["assert:equals:", "angle", "@", "pi"]
  59622. }),
  59623. $globals.PointTest);
  59624. $core.addMethod(
  59625. $core.method({
  59626. selector: "testArithmetic",
  59627. protocol: "tests",
  59628. fn: function (){
  59629. var self=this,$self=this;
  59630. return $core.withContext(function($ctx1) {
  59631. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  59632. $2=(3).__at((4));
  59633. $ctx1.sendIdx["@"]=1;
  59634. $3=(3).__at((4));
  59635. $ctx1.sendIdx["@"]=2;
  59636. $1=$recv($2).__star($3);
  59637. $4=$recv($globals.Point)._x_y_((9),(16));
  59638. $ctx1.sendIdx["x:y:"]=1;
  59639. $self._assert_equals_($1,$4);
  59640. $ctx1.sendIdx["assert:equals:"]=1;
  59641. $6=(3).__at((4));
  59642. $ctx1.sendIdx["@"]=3;
  59643. $7=(3).__at((4));
  59644. $ctx1.sendIdx["@"]=4;
  59645. $5=$recv($6).__plus($7);
  59646. $8=$recv($globals.Point)._x_y_((6),(8));
  59647. $ctx1.sendIdx["x:y:"]=2;
  59648. $self._assert_equals_($5,$8);
  59649. $ctx1.sendIdx["assert:equals:"]=2;
  59650. $10=(3).__at((4));
  59651. $ctx1.sendIdx["@"]=5;
  59652. $11=(3).__at((4));
  59653. $ctx1.sendIdx["@"]=6;
  59654. $9=$recv($10).__minus($11);
  59655. $12=$recv($globals.Point)._x_y_((0),(0));
  59656. $ctx1.sendIdx["x:y:"]=3;
  59657. $self._assert_equals_($9,$12);
  59658. $ctx1.sendIdx["assert:equals:"]=3;
  59659. $14=(6).__at((8));
  59660. $ctx1.sendIdx["@"]=7;
  59661. $13=$recv($14).__slash((3).__at((4)));
  59662. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  59663. return self;
  59664. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  59665. },
  59666. args: [],
  59667. 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)",
  59668. referencedClasses: ["Point"],
  59669. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  59670. }),
  59671. $globals.PointTest);
  59672. $core.addMethod(
  59673. $core.method({
  59674. selector: "testAt",
  59675. protocol: "tests",
  59676. fn: function (){
  59677. var self=this,$self=this;
  59678. return $core.withContext(function($ctx1) {
  59679. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  59680. return self;
  59681. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  59682. },
  59683. args: [],
  59684. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  59685. referencedClasses: ["Point"],
  59686. messageSends: ["assert:equals:", "@", "x:y:"]
  59687. }),
  59688. $globals.PointTest);
  59689. $core.addMethod(
  59690. $core.method({
  59691. selector: "testComparison",
  59692. protocol: "tests",
  59693. fn: function (){
  59694. var self=this,$self=this;
  59695. return $core.withContext(function($ctx1) {
  59696. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  59697. $2=(3).__at((4));
  59698. $ctx1.sendIdx["@"]=1;
  59699. $3=(4).__at((5));
  59700. $ctx1.sendIdx["@"]=2;
  59701. $1=$recv($2).__lt($3);
  59702. $ctx1.sendIdx["<"]=1;
  59703. $self._assert_($1);
  59704. $ctx1.sendIdx["assert:"]=1;
  59705. $5=(3).__at((4));
  59706. $ctx1.sendIdx["@"]=3;
  59707. $6=(4).__at((4));
  59708. $ctx1.sendIdx["@"]=4;
  59709. $4=$recv($5).__lt($6);
  59710. $self._deny_($4);
  59711. $ctx1.sendIdx["deny:"]=1;
  59712. $8=(4).__at((5));
  59713. $ctx1.sendIdx["@"]=5;
  59714. $9=(4).__at((5));
  59715. $ctx1.sendIdx["@"]=6;
  59716. $7=$recv($8).__lt_eq($9);
  59717. $ctx1.sendIdx["<="]=1;
  59718. $self._assert_($7);
  59719. $ctx1.sendIdx["assert:"]=2;
  59720. $11=(4).__at((5));
  59721. $ctx1.sendIdx["@"]=7;
  59722. $12=(3).__at((5));
  59723. $ctx1.sendIdx["@"]=8;
  59724. $10=$recv($11).__lt_eq($12);
  59725. $self._deny_($10);
  59726. $ctx1.sendIdx["deny:"]=2;
  59727. $14=(5).__at((6));
  59728. $ctx1.sendIdx["@"]=9;
  59729. $15=(4).__at((5));
  59730. $ctx1.sendIdx["@"]=10;
  59731. $13=$recv($14).__gt($15);
  59732. $ctx1.sendIdx[">"]=1;
  59733. $self._assert_($13);
  59734. $ctx1.sendIdx["assert:"]=3;
  59735. $17=(5).__at((6));
  59736. $ctx1.sendIdx["@"]=11;
  59737. $18=(6).__at((6));
  59738. $ctx1.sendIdx["@"]=12;
  59739. $16=$recv($17).__gt($18);
  59740. $self._deny_($16);
  59741. $ctx1.sendIdx["deny:"]=3;
  59742. $20=(4).__at((5));
  59743. $ctx1.sendIdx["@"]=13;
  59744. $21=(4).__at((5));
  59745. $ctx1.sendIdx["@"]=14;
  59746. $19=$recv($20).__gt_eq($21);
  59747. $ctx1.sendIdx[">="]=1;
  59748. $self._assert_($19);
  59749. $23=(4).__at((5));
  59750. $ctx1.sendIdx["@"]=15;
  59751. $22=$recv($23).__gt_eq((5).__at((5)));
  59752. $self._deny_($22);
  59753. return self;
  59754. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  59755. },
  59756. args: [],
  59757. 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)",
  59758. referencedClasses: [],
  59759. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  59760. }),
  59761. $globals.PointTest);
  59762. $core.addMethod(
  59763. $core.method({
  59764. selector: "testDotProduct",
  59765. protocol: "tests",
  59766. fn: function (){
  59767. var self=this,$self=this;
  59768. return $core.withContext(function($ctx1) {
  59769. var $2,$1;
  59770. $2=(2).__at((3));
  59771. $ctx1.sendIdx["@"]=1;
  59772. $1=$recv($2)._dotProduct_((3).__at((7)));
  59773. $self._assert_equals_($1,(27));
  59774. return self;
  59775. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  59776. },
  59777. args: [],
  59778. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  59779. referencedClasses: [],
  59780. messageSends: ["assert:equals:", "dotProduct:", "@"]
  59781. }),
  59782. $globals.PointTest);
  59783. $core.addMethod(
  59784. $core.method({
  59785. selector: "testEgality",
  59786. protocol: "tests",
  59787. fn: function (){
  59788. var self=this,$self=this;
  59789. return $core.withContext(function($ctx1) {
  59790. var $2,$3,$1,$5,$4;
  59791. $2=(3).__at((4));
  59792. $ctx1.sendIdx["@"]=1;
  59793. $3=(3).__at((4));
  59794. $ctx1.sendIdx["@"]=2;
  59795. $1=$recv($2).__eq($3);
  59796. $ctx1.sendIdx["="]=1;
  59797. $self._assert_($1);
  59798. $5=(3).__at((5));
  59799. $ctx1.sendIdx["@"]=3;
  59800. $4=$recv($5).__eq((3).__at((6)));
  59801. $self._deny_($4);
  59802. return self;
  59803. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  59804. },
  59805. args: [],
  59806. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  59807. referencedClasses: [],
  59808. messageSends: ["assert:", "=", "@", "deny:"]
  59809. }),
  59810. $globals.PointTest);
  59811. $core.addMethod(
  59812. $core.method({
  59813. selector: "testNew",
  59814. protocol: "tests",
  59815. fn: function (){
  59816. var self=this,$self=this;
  59817. return $core.withContext(function($ctx1) {
  59818. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  59819. $3=$recv($globals.Point)._new();
  59820. $ctx1.sendIdx["new"]=1;
  59821. $2=$recv($3)._x_((3));
  59822. $ctx1.sendIdx["x:"]=1;
  59823. $1=$recv($2)._y();
  59824. $ctx1.sendIdx["y"]=1;
  59825. $self._assert_equals_($1,nil);
  59826. $ctx1.sendIdx["assert:equals:"]=1;
  59827. $7=$recv($globals.Point)._new();
  59828. $ctx1.sendIdx["new"]=2;
  59829. $6=$recv($7)._x_((3));
  59830. $5=$recv($6)._x();
  59831. $ctx1.sendIdx["x"]=1;
  59832. $4=$recv($5).__eq((0));
  59833. $ctx1.sendIdx["="]=1;
  59834. $self._deny_($4);
  59835. $ctx1.sendIdx["deny:"]=1;
  59836. $10=$recv($globals.Point)._new();
  59837. $ctx1.sendIdx["new"]=3;
  59838. $9=$recv($10)._y_((4));
  59839. $ctx1.sendIdx["y:"]=1;
  59840. $8=$recv($9)._x();
  59841. $self._assert_equals_($8,nil);
  59842. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  59843. return self;
  59844. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  59845. },
  59846. args: [],
  59847. 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",
  59848. referencedClasses: ["Point"],
  59849. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  59850. }),
  59851. $globals.PointTest);
  59852. $core.addMethod(
  59853. $core.method({
  59854. selector: "testNormal",
  59855. protocol: "tests",
  59856. fn: function (){
  59857. var self=this,$self=this;
  59858. return $core.withContext(function($ctx1) {
  59859. var $2,$1;
  59860. $2=(1).__at((0));
  59861. $ctx1.sendIdx["@"]=1;
  59862. $1=$recv($2)._normal();
  59863. $self._assert_equals_($1,(0).__at((1)));
  59864. return self;
  59865. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  59866. },
  59867. args: [],
  59868. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  59869. referencedClasses: [],
  59870. messageSends: ["assert:equals:", "normal", "@"]
  59871. }),
  59872. $globals.PointTest);
  59873. $core.addMethod(
  59874. $core.method({
  59875. selector: "testNormalized",
  59876. protocol: "tests",
  59877. fn: function (){
  59878. var self=this,$self=this;
  59879. return $core.withContext(function($ctx1) {
  59880. var $2,$1,$3,$5,$4;
  59881. $2=(0).__at((2));
  59882. $ctx1.sendIdx["@"]=1;
  59883. $1=$recv($2)._normalized();
  59884. $ctx1.sendIdx["normalized"]=1;
  59885. $3=(0).__at((1));
  59886. $ctx1.sendIdx["@"]=2;
  59887. $self._assert_equals_($1,$3);
  59888. $ctx1.sendIdx["assert:equals:"]=1;
  59889. $5=(0).__at((0));
  59890. $ctx1.sendIdx["@"]=3;
  59891. $4=$recv($5)._normalized();
  59892. $self._assert_equals_($4,(0).__at((0)));
  59893. return self;
  59894. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  59895. },
  59896. args: [],
  59897. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  59898. referencedClasses: [],
  59899. messageSends: ["assert:equals:", "normalized", "@"]
  59900. }),
  59901. $globals.PointTest);
  59902. $core.addMethod(
  59903. $core.method({
  59904. selector: "testPolarCoordinates",
  59905. protocol: "tests",
  59906. fn: function (){
  59907. var self=this,$self=this;
  59908. return $core.withContext(function($ctx1) {
  59909. var $2,$1;
  59910. $2=(1).__at((0));
  59911. $ctx1.sendIdx["@"]=1;
  59912. $1=$recv($2)._r();
  59913. $ctx1.sendIdx["r"]=1;
  59914. $self._assert_equals_($1,(1));
  59915. $ctx1.sendIdx["assert:equals:"]=1;
  59916. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  59917. return self;
  59918. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  59919. },
  59920. args: [],
  59921. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  59922. referencedClasses: [],
  59923. messageSends: ["assert:equals:", "r", "@"]
  59924. }),
  59925. $globals.PointTest);
  59926. $core.addMethod(
  59927. $core.method({
  59928. selector: "testRectangleCreation",
  59929. protocol: "tests",
  59930. fn: function (){
  59931. var self=this,$self=this;
  59932. return $core.withContext(function($ctx1) {
  59933. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  59934. $2=(1).__at((1));
  59935. $ctx1.sendIdx["@"]=1;
  59936. $3=(2).__at((2));
  59937. $ctx1.sendIdx["@"]=2;
  59938. $1=$recv($2)._corner_($3);
  59939. $5=(1).__at((1));
  59940. $ctx1.sendIdx["@"]=3;
  59941. $6=(2).__at((2));
  59942. $ctx1.sendIdx["@"]=4;
  59943. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  59944. $self._assert_equals_($1,$4);
  59945. $ctx1.sendIdx["assert:equals:"]=1;
  59946. $8=(1).__at((1));
  59947. $ctx1.sendIdx["@"]=5;
  59948. $9=(2).__at((2));
  59949. $ctx1.sendIdx["@"]=6;
  59950. $7=$recv($8)._rectangle_($9);
  59951. $11=(1).__at((1));
  59952. $ctx1.sendIdx["@"]=7;
  59953. $12=(2).__at((2));
  59954. $ctx1.sendIdx["@"]=8;
  59955. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  59956. $self._assert_equals_($7,$10);
  59957. $ctx1.sendIdx["assert:equals:"]=2;
  59958. $14=(1).__at((1));
  59959. $ctx1.sendIdx["@"]=9;
  59960. $15=(2).__at((2));
  59961. $ctx1.sendIdx["@"]=10;
  59962. $13=$recv($14)._extent_($15);
  59963. $17=(1).__at((1));
  59964. $ctx1.sendIdx["@"]=11;
  59965. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  59966. $self._assert_equals_($13,$16);
  59967. return self;
  59968. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  59969. },
  59970. args: [],
  59971. 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)",
  59972. referencedClasses: ["Rectangle"],
  59973. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  59974. }),
  59975. $globals.PointTest);
  59976. $core.addMethod(
  59977. $core.method({
  59978. selector: "testTranslateBy",
  59979. protocol: "tests",
  59980. fn: function (){
  59981. var self=this,$self=this;
  59982. return $core.withContext(function($ctx1) {
  59983. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  59984. $2=(3).__at((3));
  59985. $ctx1.sendIdx["@"]=1;
  59986. $3=(0).__at((1));
  59987. $ctx1.sendIdx["@"]=2;
  59988. $1=$recv($2)._translateBy_($3);
  59989. $ctx1.sendIdx["translateBy:"]=1;
  59990. $4=(3).__at((4));
  59991. $ctx1.sendIdx["@"]=3;
  59992. $self._assert_equals_($1,$4);
  59993. $ctx1.sendIdx["assert:equals:"]=1;
  59994. $6=(3).__at((3));
  59995. $ctx1.sendIdx["@"]=4;
  59996. $8=(1)._negated();
  59997. $ctx1.sendIdx["negated"]=1;
  59998. $7=(0).__at($8);
  59999. $ctx1.sendIdx["@"]=5;
  60000. $5=$recv($6)._translateBy_($7);
  60001. $ctx1.sendIdx["translateBy:"]=2;
  60002. $9=(3).__at((2));
  60003. $ctx1.sendIdx["@"]=6;
  60004. $self._assert_equals_($5,$9);
  60005. $ctx1.sendIdx["assert:equals:"]=2;
  60006. $11=(3).__at((3));
  60007. $ctx1.sendIdx["@"]=7;
  60008. $12=(2).__at((3));
  60009. $ctx1.sendIdx["@"]=8;
  60010. $10=$recv($11)._translateBy_($12);
  60011. $ctx1.sendIdx["translateBy:"]=3;
  60012. $13=(5).__at((6));
  60013. $ctx1.sendIdx["@"]=9;
  60014. $self._assert_equals_($10,$13);
  60015. $ctx1.sendIdx["assert:equals:"]=3;
  60016. $15=(3).__at((3));
  60017. $ctx1.sendIdx["@"]=10;
  60018. $16=$recv((3)._negated()).__at((0));
  60019. $ctx1.sendIdx["@"]=11;
  60020. $14=$recv($15)._translateBy_($16);
  60021. $self._assert_equals_($14,(0).__at((3)));
  60022. return self;
  60023. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60024. },
  60025. args: [],
  60026. 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.",
  60027. referencedClasses: [],
  60028. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60029. }),
  60030. $globals.PointTest);
  60031. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60032. $core.addMethod(
  60033. $core.method({
  60034. selector: "testNextIfAbsent",
  60035. protocol: "tests",
  60036. fn: function (){
  60037. var self=this,$self=this;
  60038. var queue;
  60039. return $core.withContext(function($ctx1) {
  60040. var $2,$1;
  60041. queue=$recv($globals.Queue)._new();
  60042. $recv(queue)._nextPut_("index1");
  60043. $2=$recv(queue)._nextIfAbsent_("empty");
  60044. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60045. $1=$recv($2).__eq("index1");
  60046. $ctx1.sendIdx["="]=1;
  60047. $self._assert_($1);
  60048. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60049. return self;
  60050. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60051. },
  60052. args: [],
  60053. 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'",
  60054. referencedClasses: ["Queue"],
  60055. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60056. }),
  60057. $globals.QueueTest);
  60058. $core.addMethod(
  60059. $core.method({
  60060. selector: "testQueueNext",
  60061. protocol: "tests",
  60062. fn: function (){
  60063. var self=this,$self=this;
  60064. var queue;
  60065. return $core.withContext(function($ctx1) {
  60066. var $1,$3,$2,$5,$4;
  60067. queue=$recv($globals.Queue)._new();
  60068. $1=queue;
  60069. $recv($1)._nextPut_("index1");
  60070. $ctx1.sendIdx["nextPut:"]=1;
  60071. $recv($1)._nextPut_("index2");
  60072. $3=$recv(queue)._next();
  60073. $ctx1.sendIdx["next"]=1;
  60074. $2=$recv($3).__eq("index1");
  60075. $ctx1.sendIdx["="]=1;
  60076. $self._assert_($2);
  60077. $5=$recv(queue)._next();
  60078. $ctx1.sendIdx["next"]=2;
  60079. $4=$recv($5).__eq("index");
  60080. $self._deny_($4);
  60081. $self._should_raise_((function(){
  60082. return $core.withContext(function($ctx2) {
  60083. return $recv(queue)._next();
  60084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60085. }),$globals.Error);
  60086. return self;
  60087. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60088. },
  60089. args: [],
  60090. 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",
  60091. referencedClasses: ["Queue", "Error"],
  60092. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60093. }),
  60094. $globals.QueueTest);
  60095. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60096. $core.addMethod(
  60097. $core.method({
  60098. selector: "testAtRandomNumber",
  60099. protocol: "tests",
  60100. fn: function (){
  60101. var self=this,$self=this;
  60102. var val;
  60103. return $core.withContext(function($ctx1) {
  60104. (100)._timesRepeat_((function(){
  60105. return $core.withContext(function($ctx2) {
  60106. val=(10)._atRandom();
  60107. val;
  60108. $self._assert_($recv(val).__gt((0)));
  60109. $ctx2.sendIdx["assert:"]=1;
  60110. return $self._assert_($recv(val).__lt((11)));
  60111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60112. }));
  60113. return self;
  60114. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60115. },
  60116. args: [],
  60117. 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]",
  60118. referencedClasses: [],
  60119. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60120. }),
  60121. $globals.RandomTest);
  60122. $core.addMethod(
  60123. $core.method({
  60124. selector: "testAtRandomSequenceableCollection",
  60125. protocol: "tests",
  60126. fn: function (){
  60127. var self=this,$self=this;
  60128. var val;
  60129. return $core.withContext(function($ctx1) {
  60130. var $3,$4,$2,$1;
  60131. (100)._timesRepeat_((function(){
  60132. return $core.withContext(function($ctx2) {
  60133. val="abc"._atRandom();
  60134. val;
  60135. $3=$recv(val).__eq("a");
  60136. $ctx2.sendIdx["="]=1;
  60137. $4=$recv(val).__eq("b");
  60138. $ctx2.sendIdx["="]=2;
  60139. $2=$recv($3).__or($4);
  60140. $1=$recv($2).__or($recv(val).__eq("c"));
  60141. $ctx2.sendIdx["|"]=1;
  60142. return $self._assert_($1);
  60143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60144. }));
  60145. return self;
  60146. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60147. },
  60148. args: [],
  60149. 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].",
  60150. referencedClasses: [],
  60151. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60152. }),
  60153. $globals.RandomTest);
  60154. $core.addMethod(
  60155. $core.method({
  60156. selector: "textNext",
  60157. protocol: "tests",
  60158. fn: function (){
  60159. var self=this,$self=this;
  60160. return $core.withContext(function($ctx1) {
  60161. var $1;
  60162. (10000)._timesRepeat_((function(){
  60163. var current,next;
  60164. return $core.withContext(function($ctx2) {
  60165. next=$recv($recv($globals.Random)._new())._next();
  60166. next;
  60167. $self._assert_($recv(next).__gt_eq((0)));
  60168. $ctx2.sendIdx["assert:"]=1;
  60169. $self._assert_($recv(next).__lt((1)));
  60170. $1=$recv(current).__eq(next);
  60171. $ctx2.sendIdx["="]=1;
  60172. $self._deny_($1);
  60173. return $recv(next).__eq(current);
  60174. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60175. }));
  60176. return self;
  60177. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60178. },
  60179. args: [],
  60180. 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 ]",
  60181. referencedClasses: ["Random"],
  60182. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60183. }),
  60184. $globals.RandomTest);
  60185. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60186. $core.addMethod(
  60187. $core.method({
  60188. selector: "testContainsPoint",
  60189. protocol: "tests",
  60190. fn: function (){
  60191. var self=this,$self=this;
  60192. var rect;
  60193. return $core.withContext(function($ctx1) {
  60194. var $1,$2,$4,$5,$3;
  60195. $1=(0).__at((0));
  60196. $ctx1.sendIdx["@"]=1;
  60197. $2=(4).__at((4));
  60198. $ctx1.sendIdx["@"]=2;
  60199. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60200. $4=rect;
  60201. $5=(1).__at((2));
  60202. $ctx1.sendIdx["@"]=3;
  60203. $3=$recv($4)._containsPoint_($5);
  60204. $ctx1.sendIdx["containsPoint:"]=1;
  60205. $self._assert_($3);
  60206. $ctx1.sendIdx["assert:"]=1;
  60207. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60208. return self;
  60209. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60210. },
  60211. args: [],
  60212. 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.",
  60213. referencedClasses: ["Rectangle"],
  60214. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60215. }),
  60216. $globals.RectangleTest);
  60217. $core.addMethod(
  60218. $core.method({
  60219. selector: "testContainsRect",
  60220. protocol: "tests",
  60221. fn: function (){
  60222. var self=this,$self=this;
  60223. return $core.withContext(function($ctx1) {
  60224. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60225. $3=(0).__at((0));
  60226. $ctx1.sendIdx["@"]=1;
  60227. $4=(6).__at((6));
  60228. $ctx1.sendIdx["@"]=2;
  60229. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60230. $ctx1.sendIdx["origin:corner:"]=1;
  60231. $6=(1).__at((1));
  60232. $ctx1.sendIdx["@"]=3;
  60233. $7=(5).__at((5));
  60234. $ctx1.sendIdx["@"]=4;
  60235. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60236. $ctx1.sendIdx["origin:corner:"]=2;
  60237. $1=$recv($2)._containsRect_($5);
  60238. $ctx1.sendIdx["containsRect:"]=1;
  60239. $self._assert_($1);
  60240. $ctx1.sendIdx["assert:"]=1;
  60241. $11=(0).__at((0));
  60242. $ctx1.sendIdx["@"]=5;
  60243. $12=(6).__at((6));
  60244. $ctx1.sendIdx["@"]=6;
  60245. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60246. $ctx1.sendIdx["origin:corner:"]=3;
  60247. $14=(1).__at((-1));
  60248. $ctx1.sendIdx["@"]=7;
  60249. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60250. $9=$recv($10)._containsRect_($13);
  60251. $8=$recv($9)._not();
  60252. $self._assert_($8);
  60253. return self;
  60254. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60255. },
  60256. args: [],
  60257. 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.",
  60258. referencedClasses: ["Rectangle"],
  60259. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60260. }),
  60261. $globals.RectangleTest);
  60262. $core.addMethod(
  60263. $core.method({
  60264. selector: "testOriginExtent",
  60265. protocol: "tests",
  60266. fn: function (){
  60267. var self=this,$self=this;
  60268. var rectangle;
  60269. return $core.withContext(function($ctx1) {
  60270. var $1,$2,$3,$4;
  60271. $1=(3).__at((4));
  60272. $ctx1.sendIdx["@"]=1;
  60273. $2=(7).__at((8));
  60274. $ctx1.sendIdx["@"]=2;
  60275. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60276. $3=$recv(rectangle)._origin();
  60277. $4=(3).__at((4));
  60278. $ctx1.sendIdx["@"]=3;
  60279. $self._assert_equals_($3,$4);
  60280. $ctx1.sendIdx["assert:equals:"]=1;
  60281. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60282. return self;
  60283. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60284. },
  60285. args: [],
  60286. 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.",
  60287. referencedClasses: ["Rectangle"],
  60288. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60289. }),
  60290. $globals.RectangleTest);
  60291. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60292. $core.addMethod(
  60293. $core.method({
  60294. selector: "collectionClass",
  60295. protocol: "accessing",
  60296. fn: function (){
  60297. var self=this,$self=this;
  60298. return $core.withContext(function($ctx1) {
  60299. return $recv($self._class())._collectionClass();
  60300. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60301. },
  60302. args: [],
  60303. source: "collectionClass\x0a\x09^ self class collectionClass",
  60304. referencedClasses: [],
  60305. messageSends: ["collectionClass", "class"]
  60306. }),
  60307. $globals.StreamTest);
  60308. $core.addMethod(
  60309. $core.method({
  60310. selector: "newCollection",
  60311. protocol: "accessing",
  60312. fn: function (){
  60313. var self=this,$self=this;
  60314. return $core.withContext(function($ctx1) {
  60315. return $recv($self._collectionClass())._new();
  60316. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60317. },
  60318. args: [],
  60319. source: "newCollection\x0a\x09^ self collectionClass new",
  60320. referencedClasses: [],
  60321. messageSends: ["new", "collectionClass"]
  60322. }),
  60323. $globals.StreamTest);
  60324. $core.addMethod(
  60325. $core.method({
  60326. selector: "newStream",
  60327. protocol: "accessing",
  60328. fn: function (){
  60329. var self=this,$self=this;
  60330. return $core.withContext(function($ctx1) {
  60331. return $recv($recv($self._collectionClass())._new())._stream();
  60332. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60333. },
  60334. args: [],
  60335. source: "newStream\x0a\x09^ self collectionClass new stream",
  60336. referencedClasses: [],
  60337. messageSends: ["stream", "new", "collectionClass"]
  60338. }),
  60339. $globals.StreamTest);
  60340. $core.addMethod(
  60341. $core.method({
  60342. selector: "testAtStartAtEnd",
  60343. protocol: "tests",
  60344. fn: function (){
  60345. var self=this,$self=this;
  60346. var stream;
  60347. return $core.withContext(function($ctx1) {
  60348. var $1,$2,$3,$4;
  60349. stream=$self._newStream();
  60350. $1=$recv(stream)._atStart();
  60351. $ctx1.sendIdx["atStart"]=1;
  60352. $self._assert_($1);
  60353. $ctx1.sendIdx["assert:"]=1;
  60354. $2=$recv(stream)._atEnd();
  60355. $ctx1.sendIdx["atEnd"]=1;
  60356. $self._assert_($2);
  60357. $ctx1.sendIdx["assert:"]=2;
  60358. $recv(stream)._nextPutAll_($self._newCollection());
  60359. $3=$recv(stream)._atEnd();
  60360. $ctx1.sendIdx["atEnd"]=2;
  60361. $self._assert_($3);
  60362. $4=$recv(stream)._atStart();
  60363. $ctx1.sendIdx["atStart"]=2;
  60364. $self._deny_($4);
  60365. $ctx1.sendIdx["deny:"]=1;
  60366. $recv(stream)._position_((1));
  60367. $self._deny_($recv(stream)._atEnd());
  60368. $ctx1.sendIdx["deny:"]=2;
  60369. $self._deny_($recv(stream)._atStart());
  60370. return self;
  60371. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60372. },
  60373. args: [],
  60374. 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",
  60375. referencedClasses: [],
  60376. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60377. }),
  60378. $globals.StreamTest);
  60379. $core.addMethod(
  60380. $core.method({
  60381. selector: "testContents",
  60382. protocol: "tests",
  60383. fn: function (){
  60384. var self=this,$self=this;
  60385. var stream;
  60386. return $core.withContext(function($ctx1) {
  60387. var $1,$2;
  60388. stream=$self._newStream();
  60389. $1=stream;
  60390. $2=$self._newCollection();
  60391. $ctx1.sendIdx["newCollection"]=1;
  60392. $recv($1)._nextPutAll_($2);
  60393. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60394. return self;
  60395. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60396. },
  60397. args: [],
  60398. 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",
  60399. referencedClasses: [],
  60400. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60401. }),
  60402. $globals.StreamTest);
  60403. $core.addMethod(
  60404. $core.method({
  60405. selector: "testIsEmpty",
  60406. protocol: "tests",
  60407. fn: function (){
  60408. var self=this,$self=this;
  60409. var stream;
  60410. return $core.withContext(function($ctx1) {
  60411. var $1;
  60412. stream=$self._newStream();
  60413. $1=$recv(stream)._isEmpty();
  60414. $ctx1.sendIdx["isEmpty"]=1;
  60415. $self._assert_($1);
  60416. $recv(stream)._nextPutAll_($self._newCollection());
  60417. $self._deny_($recv(stream)._isEmpty());
  60418. return self;
  60419. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60420. },
  60421. args: [],
  60422. 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",
  60423. referencedClasses: [],
  60424. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60425. }),
  60426. $globals.StreamTest);
  60427. $core.addMethod(
  60428. $core.method({
  60429. selector: "testPosition",
  60430. protocol: "tests",
  60431. fn: function (){
  60432. var self=this,$self=this;
  60433. var collection,stream;
  60434. return $core.withContext(function($ctx1) {
  60435. var $1,$2,$3;
  60436. collection=$self._newCollection();
  60437. stream=$self._newStream();
  60438. $recv(stream)._nextPutAll_(collection);
  60439. $1=$recv(stream)._position();
  60440. $ctx1.sendIdx["position"]=1;
  60441. $self._assert_equals_($1,$recv(collection)._size());
  60442. $ctx1.sendIdx["assert:equals:"]=1;
  60443. $recv(stream)._position_((0));
  60444. $2=$recv(stream)._position();
  60445. $ctx1.sendIdx["position"]=2;
  60446. $self._assert_equals_($2,(0));
  60447. $ctx1.sendIdx["assert:equals:"]=2;
  60448. $recv(stream)._next();
  60449. $ctx1.sendIdx["next"]=1;
  60450. $3=$recv(stream)._position();
  60451. $ctx1.sendIdx["position"]=3;
  60452. $self._assert_equals_($3,(1));
  60453. $ctx1.sendIdx["assert:equals:"]=3;
  60454. $recv(stream)._next();
  60455. $self._assert_equals_($recv(stream)._position(),(2));
  60456. return self;
  60457. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60458. },
  60459. args: [],
  60460. 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",
  60461. referencedClasses: [],
  60462. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60463. }),
  60464. $globals.StreamTest);
  60465. $core.addMethod(
  60466. $core.method({
  60467. selector: "testReading",
  60468. protocol: "tests",
  60469. fn: function (){
  60470. var self=this,$self=this;
  60471. var stream,collection;
  60472. return $core.withContext(function($ctx1) {
  60473. var $1,$2;
  60474. collection=$self._newCollection();
  60475. stream=$self._newStream();
  60476. $1=stream;
  60477. $recv($1)._nextPutAll_(collection);
  60478. $recv($1)._position_((0));
  60479. $recv(collection)._do_((function(each){
  60480. return $core.withContext(function($ctx2) {
  60481. $2=$recv(stream)._next();
  60482. $ctx2.sendIdx["next"]=1;
  60483. return $self._assert_equals_($2,each);
  60484. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60485. }));
  60486. $self._assert_($recv($recv(stream)._next())._isNil());
  60487. return self;
  60488. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60489. },
  60490. args: [],
  60491. 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",
  60492. referencedClasses: [],
  60493. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60494. }),
  60495. $globals.StreamTest);
  60496. $core.addMethod(
  60497. $core.method({
  60498. selector: "testStreamContents",
  60499. protocol: "tests",
  60500. fn: function (){
  60501. var self=this,$self=this;
  60502. return self;
  60503. },
  60504. args: [],
  60505. source: "testStreamContents",
  60506. referencedClasses: [],
  60507. messageSends: []
  60508. }),
  60509. $globals.StreamTest);
  60510. $core.addMethod(
  60511. $core.method({
  60512. selector: "testWrite",
  60513. protocol: "tests",
  60514. fn: function (){
  60515. var self=this,$self=this;
  60516. var stream,collection;
  60517. return $core.withContext(function($ctx1) {
  60518. collection=$self._newCollection();
  60519. stream=$self._newStream();
  60520. $recv(collection)._do_((function(each){
  60521. return $core.withContext(function($ctx2) {
  60522. return $recv(stream).__lt_lt(each);
  60523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60524. }));
  60525. $self._assert_equals_($recv(stream)._contents(),collection);
  60526. return self;
  60527. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60528. },
  60529. args: [],
  60530. 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",
  60531. referencedClasses: [],
  60532. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60533. }),
  60534. $globals.StreamTest);
  60535. $core.addMethod(
  60536. $core.method({
  60537. selector: "testWriting",
  60538. protocol: "tests",
  60539. fn: function (){
  60540. var self=this,$self=this;
  60541. var stream,collection;
  60542. return $core.withContext(function($ctx1) {
  60543. var $1;
  60544. collection=$self._newCollection();
  60545. stream=$self._newStream();
  60546. $ctx1.sendIdx["newStream"]=1;
  60547. $recv(collection)._do_((function(each){
  60548. return $core.withContext(function($ctx2) {
  60549. return $recv(stream)._nextPut_(each);
  60550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60551. }));
  60552. $1=$recv(stream)._contents();
  60553. $ctx1.sendIdx["contents"]=1;
  60554. $self._assert_equals_($1,collection);
  60555. $ctx1.sendIdx["assert:equals:"]=1;
  60556. stream=$self._newStream();
  60557. $recv(stream)._nextPutAll_(collection);
  60558. $self._assert_equals_($recv(stream)._contents(),collection);
  60559. return self;
  60560. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60561. },
  60562. args: [],
  60563. 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",
  60564. referencedClasses: [],
  60565. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60566. }),
  60567. $globals.StreamTest);
  60568. $core.addMethod(
  60569. $core.method({
  60570. selector: "collectionClass",
  60571. protocol: "accessing",
  60572. fn: function (){
  60573. var self=this,$self=this;
  60574. return nil;
  60575. },
  60576. args: [],
  60577. source: "collectionClass\x0a\x09^ nil",
  60578. referencedClasses: [],
  60579. messageSends: []
  60580. }),
  60581. $globals.StreamTest.a$cls);
  60582. $core.addMethod(
  60583. $core.method({
  60584. selector: "isAbstract",
  60585. protocol: "testing",
  60586. fn: function (){
  60587. var self=this,$self=this;
  60588. return $core.withContext(function($ctx1) {
  60589. return $recv($self._collectionClass())._isNil();
  60590. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  60591. },
  60592. args: [],
  60593. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  60594. referencedClasses: [],
  60595. messageSends: ["isNil", "collectionClass"]
  60596. }),
  60597. $globals.StreamTest.a$cls);
  60598. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60599. $core.addMethod(
  60600. $core.method({
  60601. selector: "newCollection",
  60602. protocol: "accessing",
  60603. fn: function (){
  60604. var self=this,$self=this;
  60605. return $core.withContext(function($ctx1) {
  60606. return [true,(1),(3).__at((4)),"foo"];
  60607. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  60608. },
  60609. args: [],
  60610. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  60611. referencedClasses: [],
  60612. messageSends: ["@"]
  60613. }),
  60614. $globals.ArrayStreamTest);
  60615. $core.addMethod(
  60616. $core.method({
  60617. selector: "collectionClass",
  60618. protocol: "accessing",
  60619. fn: function (){
  60620. var self=this,$self=this;
  60621. return $globals.Array;
  60622. },
  60623. args: [],
  60624. source: "collectionClass\x0a\x09^ Array",
  60625. referencedClasses: ["Array"],
  60626. messageSends: []
  60627. }),
  60628. $globals.ArrayStreamTest.a$cls);
  60629. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60630. $core.addMethod(
  60631. $core.method({
  60632. selector: "newCollection",
  60633. protocol: "accessing",
  60634. fn: function (){
  60635. var self=this,$self=this;
  60636. return "hello world";
  60637. },
  60638. args: [],
  60639. source: "newCollection\x0a\x09^ 'hello world'",
  60640. referencedClasses: [],
  60641. messageSends: []
  60642. }),
  60643. $globals.StringStreamTest);
  60644. $core.addMethod(
  60645. $core.method({
  60646. selector: "collectionClass",
  60647. protocol: "accessing",
  60648. fn: function (){
  60649. var self=this,$self=this;
  60650. return $globals.String;
  60651. },
  60652. args: [],
  60653. source: "collectionClass\x0a\x09^ String",
  60654. referencedClasses: ["String"],
  60655. messageSends: []
  60656. }),
  60657. $globals.StringStreamTest.a$cls);
  60658. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  60659. $core.addMethod(
  60660. $core.method({
  60661. selector: "testCopying",
  60662. protocol: "tests",
  60663. fn: function (){
  60664. var self=this,$self=this;
  60665. return $core.withContext(function($ctx1) {
  60666. $self._assert_equals_(nil._copy(),nil);
  60667. return self;
  60668. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  60669. },
  60670. args: [],
  60671. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  60672. referencedClasses: [],
  60673. messageSends: ["assert:equals:", "copy"]
  60674. }),
  60675. $globals.UndefinedTest);
  60676. $core.addMethod(
  60677. $core.method({
  60678. selector: "testDeepCopy",
  60679. protocol: "tests",
  60680. fn: function (){
  60681. var self=this,$self=this;
  60682. return $core.withContext(function($ctx1) {
  60683. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  60684. return self;
  60685. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  60686. },
  60687. args: [],
  60688. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  60689. referencedClasses: [],
  60690. messageSends: ["assert:", "=", "deepCopy"]
  60691. }),
  60692. $globals.UndefinedTest);
  60693. $core.addMethod(
  60694. $core.method({
  60695. selector: "testIfNil",
  60696. protocol: "tests",
  60697. fn: function (){
  60698. var self=this,$self=this;
  60699. return $core.withContext(function($ctx1) {
  60700. var $1,$3,$2,$4,$6,$5,$receiver;
  60701. if(($receiver = nil) == null || $receiver.a$nil){
  60702. $1=true;
  60703. } else {
  60704. $1=nil;
  60705. }
  60706. $self._assert_equals_($1,true);
  60707. $ctx1.sendIdx["assert:equals:"]=1;
  60708. if(($receiver = nil) == null || $receiver.a$nil){
  60709. $3=nil;
  60710. } else {
  60711. $3=true;
  60712. }
  60713. $2=$recv($3).__eq(true);
  60714. $ctx1.sendIdx["="]=1;
  60715. $self._deny_($2);
  60716. $ctx1.sendIdx["deny:"]=1;
  60717. if(($receiver = nil) == null || $receiver.a$nil){
  60718. $4=true;
  60719. } else {
  60720. $4=false;
  60721. }
  60722. $self._assert_equals_($4,true);
  60723. if(($receiver = nil) == null || $receiver.a$nil){
  60724. $6=false;
  60725. } else {
  60726. $6=true;
  60727. }
  60728. $5=$recv($6).__eq(true);
  60729. $self._deny_($5);
  60730. return self;
  60731. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  60732. },
  60733. args: [],
  60734. 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",
  60735. referencedClasses: [],
  60736. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  60737. }),
  60738. $globals.UndefinedTest);
  60739. $core.addMethod(
  60740. $core.method({
  60741. selector: "testIsNil",
  60742. protocol: "tests",
  60743. fn: function (){
  60744. var self=this,$self=this;
  60745. return $core.withContext(function($ctx1) {
  60746. $self._assert_(nil._isNil());
  60747. $self._deny_(nil._notNil());
  60748. return self;
  60749. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  60750. },
  60751. args: [],
  60752. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  60753. referencedClasses: [],
  60754. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  60755. }),
  60756. $globals.UndefinedTest);
  60757. });
  60758. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  60759. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  60760. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  60761. $core.addPackage("Platform-DOM-Tests");
  60762. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  60763. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  60764. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  60765. $core.addMethod(
  60766. $core.method({
  60767. selector: "testEntityConversion",
  60768. protocol: "testing",
  60769. fn: function (){
  60770. var self=this,$self=this;
  60771. return $core.withContext(function($ctx1) {
  60772. var $1;
  60773. $1=$recv($globals.PlatformDom)._isFeasible();
  60774. if($core.assert($1)){
  60775. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  60776. }
  60777. return self;
  60778. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  60779. },
  60780. args: [],
  60781. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  60782. referencedClasses: ["PlatformDom"],
  60783. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  60784. }),
  60785. $globals.PlatformDomTest);
  60786. $core.addMethod(
  60787. $core.method({
  60788. selector: "testTextContentDoesNotRunScript",
  60789. protocol: "testing",
  60790. fn: function (){
  60791. var self=this,$self=this;
  60792. return $core.withContext(function($ctx1) {
  60793. var $1;
  60794. $1=$recv($globals.PlatformDom)._isFeasible();
  60795. if($core.assert($1)){
  60796. $self._shouldnt_raise_((function(){
  60797. return $core.withContext(function($ctx2) {
  60798. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  60799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60800. }),$globals.Error);
  60801. }
  60802. return self;
  60803. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  60804. },
  60805. args: [],
  60806. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  60807. referencedClasses: ["PlatformDom", "Error"],
  60808. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  60809. }),
  60810. $globals.PlatformDomTest);
  60811. });
  60812. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  60813. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  60814. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  60815. $core.addPackage("SUnit-Tests");
  60816. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  60817. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  60818. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  60819. $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.";
  60820. $core.addMethod(
  60821. $core.method({
  60822. selector: "setUp",
  60823. protocol: "running",
  60824. fn: function (){
  60825. var self=this,$self=this;
  60826. return $core.withContext(function($ctx1) {
  60827. $self["@empty"]=$recv($globals.Set)._new();
  60828. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  60829. return self;
  60830. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  60831. },
  60832. args: [],
  60833. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  60834. referencedClasses: ["Set"],
  60835. messageSends: ["new", "with:with:"]
  60836. }),
  60837. $globals.ExampleSetTest);
  60838. $core.addMethod(
  60839. $core.method({
  60840. selector: "testAdd",
  60841. protocol: "tests",
  60842. fn: function (){
  60843. var self=this,$self=this;
  60844. return $core.withContext(function($ctx1) {
  60845. $recv($self["@empty"])._add_((5));
  60846. $self._assert_($recv($self["@empty"])._includes_((5)));
  60847. return self;
  60848. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  60849. },
  60850. args: [],
  60851. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  60852. referencedClasses: [],
  60853. messageSends: ["add:", "assert:", "includes:"]
  60854. }),
  60855. $globals.ExampleSetTest);
  60856. $core.addMethod(
  60857. $core.method({
  60858. selector: "testGrow",
  60859. protocol: "tests",
  60860. fn: function (){
  60861. var self=this,$self=this;
  60862. return $core.withContext(function($ctx1) {
  60863. $recv($self["@empty"])._addAll_((1)._to_((100)));
  60864. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  60865. return self;
  60866. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  60867. },
  60868. args: [],
  60869. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  60870. referencedClasses: [],
  60871. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  60872. }),
  60873. $globals.ExampleSetTest);
  60874. $core.addMethod(
  60875. $core.method({
  60876. selector: "testIllegal",
  60877. protocol: "tests",
  60878. fn: function (){
  60879. var self=this,$self=this;
  60880. return $core.withContext(function($ctx1) {
  60881. $self._should_raise_((function(){
  60882. return $core.withContext(function($ctx2) {
  60883. return $recv($self["@empty"])._at_((5));
  60884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60885. }),$globals.Error);
  60886. $ctx1.sendIdx["should:raise:"]=1;
  60887. $self._should_raise_((function(){
  60888. return $core.withContext(function($ctx2) {
  60889. return $recv($self["@empty"])._at_put_((5),"abc");
  60890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  60891. }),$globals.Error);
  60892. return self;
  60893. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  60894. },
  60895. args: [],
  60896. 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",
  60897. referencedClasses: ["Error"],
  60898. messageSends: ["should:raise:", "at:", "at:put:"]
  60899. }),
  60900. $globals.ExampleSetTest);
  60901. $core.addMethod(
  60902. $core.method({
  60903. selector: "testIncludes",
  60904. protocol: "tests",
  60905. fn: function (){
  60906. var self=this,$self=this;
  60907. return $core.withContext(function($ctx1) {
  60908. var $1;
  60909. $1=$recv($self["@full"])._includes_((5));
  60910. $ctx1.sendIdx["includes:"]=1;
  60911. $self._assert_($1);
  60912. $ctx1.sendIdx["assert:"]=1;
  60913. $self._assert_($recv($self["@full"])._includes_("abc"));
  60914. return self;
  60915. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  60916. },
  60917. args: [],
  60918. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  60919. referencedClasses: [],
  60920. messageSends: ["assert:", "includes:"]
  60921. }),
  60922. $globals.ExampleSetTest);
  60923. $core.addMethod(
  60924. $core.method({
  60925. selector: "testOccurrences",
  60926. protocol: "tests",
  60927. fn: function (){
  60928. var self=this,$self=this;
  60929. return $core.withContext(function($ctx1) {
  60930. var $1,$2;
  60931. $1=$recv($self["@empty"])._occurrencesOf_((0));
  60932. $ctx1.sendIdx["occurrencesOf:"]=1;
  60933. $self._assert_equals_($1,(0));
  60934. $ctx1.sendIdx["assert:equals:"]=1;
  60935. $2=$recv($self["@full"])._occurrencesOf_((5));
  60936. $ctx1.sendIdx["occurrencesOf:"]=2;
  60937. $self._assert_equals_($2,(1));
  60938. $ctx1.sendIdx["assert:equals:"]=2;
  60939. $recv($self["@full"])._add_((5));
  60940. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  60941. return self;
  60942. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  60943. },
  60944. args: [],
  60945. 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",
  60946. referencedClasses: [],
  60947. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  60948. }),
  60949. $globals.ExampleSetTest);
  60950. $core.addMethod(
  60951. $core.method({
  60952. selector: "testRemove",
  60953. protocol: "tests",
  60954. fn: function (){
  60955. var self=this,$self=this;
  60956. return $core.withContext(function($ctx1) {
  60957. var $1;
  60958. $recv($self["@full"])._remove_((5));
  60959. $1=$recv($self["@full"])._includes_("abc");
  60960. $ctx1.sendIdx["includes:"]=1;
  60961. $self._assert_($1);
  60962. $self._deny_($recv($self["@full"])._includes_((5)));
  60963. return self;
  60964. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  60965. },
  60966. args: [],
  60967. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  60968. referencedClasses: [],
  60969. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  60970. }),
  60971. $globals.ExampleSetTest);
  60972. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  60973. $core.addMethod(
  60974. $core.method({
  60975. selector: "fakeError",
  60976. protocol: "helpers",
  60977. fn: function (){
  60978. var self=this,$self=this;
  60979. return $core.withContext(function($ctx1) {
  60980. $self["@flag"]="bad";
  60981. $self._timeout_((30));
  60982. $self["@flag"]=$recv($self._async_((function(){
  60983. return $core.withContext(function($ctx2) {
  60984. $self["@flag"]="ok";
  60985. $self["@flag"];
  60986. return $self._error_("Intentional");
  60987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60988. })))._valueWithTimeout_((20));
  60989. return self;
  60990. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  60991. },
  60992. args: [],
  60993. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  60994. referencedClasses: [],
  60995. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  60996. }),
  60997. $globals.SUnitAsyncTest);
  60998. $core.addMethod(
  60999. $core.method({
  61000. selector: "fakeErrorFailingInTearDown",
  61001. protocol: "helpers",
  61002. fn: function (){
  61003. var self=this,$self=this;
  61004. return $core.withContext(function($ctx1) {
  61005. $self["@flag"]="bad";
  61006. $self._timeout_((30));
  61007. $self["@flag"]=$recv($self._async_((function(){
  61008. return $core.withContext(function($ctx2) {
  61009. return $self._error_("Intentional");
  61010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61011. })))._valueWithTimeout_((20));
  61012. return self;
  61013. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61014. },
  61015. args: [],
  61016. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61017. referencedClasses: [],
  61018. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61019. }),
  61020. $globals.SUnitAsyncTest);
  61021. $core.addMethod(
  61022. $core.method({
  61023. selector: "fakeFailure",
  61024. protocol: "helpers",
  61025. fn: function (){
  61026. var self=this,$self=this;
  61027. return $core.withContext(function($ctx1) {
  61028. $self["@flag"]="bad";
  61029. $self._timeout_((30));
  61030. $self["@flag"]=$recv($self._async_((function(){
  61031. return $core.withContext(function($ctx2) {
  61032. $self["@flag"]="ok";
  61033. $self["@flag"];
  61034. return $self._assert_(false);
  61035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61036. })))._valueWithTimeout_((20));
  61037. return self;
  61038. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61039. },
  61040. args: [],
  61041. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61042. referencedClasses: [],
  61043. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61044. }),
  61045. $globals.SUnitAsyncTest);
  61046. $core.addMethod(
  61047. $core.method({
  61048. selector: "fakeMultipleTimeoutFailing",
  61049. protocol: "helpers",
  61050. fn: function (){
  61051. var self=this,$self=this;
  61052. return $core.withContext(function($ctx1) {
  61053. var $1;
  61054. $self._timeout_((100));
  61055. $ctx1.sendIdx["timeout:"]=1;
  61056. $1=$self._async_((function(){
  61057. return $core.withContext(function($ctx2) {
  61058. $self._timeout_((20));
  61059. return $recv($self._async_((function(){
  61060. return $core.withContext(function($ctx3) {
  61061. return $self._finished();
  61062. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61063. })))._valueWithTimeout_((30));
  61064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61065. }));
  61066. $ctx1.sendIdx["async:"]=1;
  61067. $recv($1)._valueWithTimeout_((20));
  61068. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61069. return self;
  61070. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61071. },
  61072. args: [],
  61073. 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",
  61074. referencedClasses: [],
  61075. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61076. }),
  61077. $globals.SUnitAsyncTest);
  61078. $core.addMethod(
  61079. $core.method({
  61080. selector: "fakeMultipleTimeoutPassing",
  61081. protocol: "helpers",
  61082. fn: function (){
  61083. var self=this,$self=this;
  61084. return $core.withContext(function($ctx1) {
  61085. var $1;
  61086. $self._timeout_((20));
  61087. $ctx1.sendIdx["timeout:"]=1;
  61088. $1=$self._async_((function(){
  61089. return $core.withContext(function($ctx2) {
  61090. $self._timeout_((40));
  61091. return $recv($self._async_((function(){
  61092. return $core.withContext(function($ctx3) {
  61093. return $self._finished();
  61094. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61095. })))._valueWithTimeout_((20));
  61096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61097. }));
  61098. $ctx1.sendIdx["async:"]=1;
  61099. $recv($1)._valueWithTimeout_((10));
  61100. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61101. return self;
  61102. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61103. },
  61104. args: [],
  61105. 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",
  61106. referencedClasses: [],
  61107. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61108. }),
  61109. $globals.SUnitAsyncTest);
  61110. $core.addMethod(
  61111. $core.method({
  61112. selector: "fakeTimeout",
  61113. protocol: "helpers",
  61114. fn: function (){
  61115. var self=this,$self=this;
  61116. return $core.withContext(function($ctx1) {
  61117. $self._timeout_((10));
  61118. $recv($self._async_((function(){
  61119. return $core.withContext(function($ctx2) {
  61120. return $self._finished();
  61121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61122. })))._valueWithTimeout_((20));
  61123. return self;
  61124. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61125. },
  61126. args: [],
  61127. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61128. referencedClasses: [],
  61129. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61130. }),
  61131. $globals.SUnitAsyncTest);
  61132. $core.addMethod(
  61133. $core.method({
  61134. selector: "selectorSetOf:",
  61135. protocol: "private",
  61136. fn: function (aCollection){
  61137. var self=this,$self=this;
  61138. return $core.withContext(function($ctx1) {
  61139. return $recv($recv(aCollection)._collect_((function(each){
  61140. return $core.withContext(function($ctx2) {
  61141. return $recv(each)._selector();
  61142. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61143. })))._asSet();
  61144. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61145. },
  61146. args: ["aCollection"],
  61147. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61148. referencedClasses: [],
  61149. messageSends: ["asSet", "collect:", "selector"]
  61150. }),
  61151. $globals.SUnitAsyncTest);
  61152. $core.addMethod(
  61153. $core.method({
  61154. selector: "setUp",
  61155. protocol: "running",
  61156. fn: function (){
  61157. var self=this,$self=this;
  61158. $self["@flag"]="ok";
  61159. return self;
  61160. },
  61161. args: [],
  61162. source: "setUp\x0a\x09flag := 'ok'",
  61163. referencedClasses: [],
  61164. messageSends: []
  61165. }),
  61166. $globals.SUnitAsyncTest);
  61167. $core.addMethod(
  61168. $core.method({
  61169. selector: "tearDown",
  61170. protocol: "running",
  61171. fn: function (){
  61172. var self=this,$self=this;
  61173. return $core.withContext(function($ctx1) {
  61174. $self._assert_equals_("ok",$self["@flag"]);
  61175. return self;
  61176. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61177. },
  61178. args: [],
  61179. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61180. referencedClasses: [],
  61181. messageSends: ["assert:equals:"]
  61182. }),
  61183. $globals.SUnitAsyncTest);
  61184. $core.addMethod(
  61185. $core.method({
  61186. selector: "testAsyncErrorsAndFailures",
  61187. protocol: "tests",
  61188. fn: function (){
  61189. var self=this,$self=this;
  61190. var suite,runner,result,assertBlock;
  61191. return $core.withContext(function($ctx1) {
  61192. var $1,$2,$3,$4;
  61193. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61194. return $core.withContext(function($ctx2) {
  61195. return $recv($self._class())._selector_(each);
  61196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61197. }));
  61198. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61199. $self._timeout_((200));
  61200. result=$recv(runner)._result();
  61201. $ctx1.sendIdx["result"]=1;
  61202. assertBlock=$self._async_((function(){
  61203. return $core.withContext(function($ctx2) {
  61204. $1=$self._selectorSetOf_($recv(result)._errors());
  61205. $ctx2.sendIdx["selectorSetOf:"]=1;
  61206. $2=["fakeError"]._asSet();
  61207. $ctx2.sendIdx["asSet"]=1;
  61208. $self._assert_equals_($1,$2);
  61209. $ctx2.sendIdx["assert:equals:"]=1;
  61210. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61211. return $self._finished();
  61212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61213. }));
  61214. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61215. return $core.withContext(function($ctx2) {
  61216. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61217. if($core.assert($3)){
  61218. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61219. return $recv($4)._ifTrue_(assertBlock);
  61220. }
  61221. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61222. }));
  61223. $recv(runner)._run();
  61224. return self;
  61225. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61226. },
  61227. args: [],
  61228. 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",
  61229. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61230. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61231. }),
  61232. $globals.SUnitAsyncTest);
  61233. $core.addMethod(
  61234. $core.method({
  61235. selector: "testAsyncNeedsTimeout",
  61236. protocol: "tests",
  61237. fn: function (){
  61238. var self=this,$self=this;
  61239. return $core.withContext(function($ctx1) {
  61240. $self._should_raise_((function(){
  61241. return $core.withContext(function($ctx2) {
  61242. return $self._async_((function(){
  61243. }));
  61244. $ctx2.sendIdx["async:"]=1;
  61245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61246. }),$globals.Error);
  61247. $self._timeout_((0));
  61248. $self._shouldnt_raise_((function(){
  61249. return $core.withContext(function($ctx2) {
  61250. return $self._async_((function(){
  61251. }));
  61252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61253. }),$globals.Error);
  61254. $self._finished();
  61255. return self;
  61256. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61257. },
  61258. args: [],
  61259. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61260. referencedClasses: ["Error"],
  61261. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61262. }),
  61263. $globals.SUnitAsyncTest);
  61264. $core.addMethod(
  61265. $core.method({
  61266. selector: "testFinishedNeedsTimeout",
  61267. protocol: "tests",
  61268. fn: function (){
  61269. var self=this,$self=this;
  61270. return $core.withContext(function($ctx1) {
  61271. $self._should_raise_((function(){
  61272. return $core.withContext(function($ctx2) {
  61273. return $self._finished();
  61274. $ctx2.sendIdx["finished"]=1;
  61275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61276. }),$globals.Error);
  61277. $self._timeout_((0));
  61278. $self._shouldnt_raise_((function(){
  61279. return $core.withContext(function($ctx2) {
  61280. return $self._finished();
  61281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61282. }),$globals.Error);
  61283. return self;
  61284. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61285. },
  61286. args: [],
  61287. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61288. referencedClasses: ["Error"],
  61289. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61290. }),
  61291. $globals.SUnitAsyncTest);
  61292. $core.addMethod(
  61293. $core.method({
  61294. selector: "testIsAsyncReturnsCorrectValues",
  61295. protocol: "tests",
  61296. fn: function (){
  61297. var self=this,$self=this;
  61298. return $core.withContext(function($ctx1) {
  61299. var $1,$2;
  61300. $1=$self._isAsync();
  61301. $ctx1.sendIdx["isAsync"]=1;
  61302. $self._deny_($1);
  61303. $ctx1.sendIdx["deny:"]=1;
  61304. $self._timeout_((0));
  61305. $2=$self._isAsync();
  61306. $ctx1.sendIdx["isAsync"]=2;
  61307. $self._assert_($2);
  61308. $self._finished();
  61309. $self._deny_($self._isAsync());
  61310. return self;
  61311. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61312. },
  61313. args: [],
  61314. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61315. referencedClasses: [],
  61316. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61317. }),
  61318. $globals.SUnitAsyncTest);
  61319. $core.addMethod(
  61320. $core.method({
  61321. selector: "testPass",
  61322. protocol: "tests",
  61323. fn: function (){
  61324. var self=this,$self=this;
  61325. return $core.withContext(function($ctx1) {
  61326. $self["@flag"]="bad";
  61327. $self._timeout_((10));
  61328. $self["@flag"]=$recv($self._async_((function(){
  61329. return $core.withContext(function($ctx2) {
  61330. $self._assert_(true);
  61331. $self._finished();
  61332. $self["@flag"]="ok";
  61333. return $self["@flag"];
  61334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61335. })))._valueWithTimeout_((5));
  61336. return self;
  61337. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61338. },
  61339. args: [],
  61340. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61341. referencedClasses: [],
  61342. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61343. }),
  61344. $globals.SUnitAsyncTest);
  61345. $core.addMethod(
  61346. $core.method({
  61347. selector: "testTimeouts",
  61348. protocol: "tests",
  61349. fn: function (){
  61350. var self=this,$self=this;
  61351. var suite,runner,result,assertBlock;
  61352. return $core.withContext(function($ctx1) {
  61353. var $1,$2,$3;
  61354. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61355. return $core.withContext(function($ctx2) {
  61356. return $recv($self._class())._selector_(each);
  61357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61358. }));
  61359. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61360. $self._timeout_((200));
  61361. result=$recv(runner)._result();
  61362. $ctx1.sendIdx["result"]=1;
  61363. assertBlock=$self._async_((function(){
  61364. return $core.withContext(function($ctx2) {
  61365. $1=$self._selectorSetOf_($recv(result)._errors());
  61366. $ctx2.sendIdx["selectorSetOf:"]=1;
  61367. $self._assert_equals_($1,$recv($globals.Set)._new());
  61368. $ctx2.sendIdx["assert:equals:"]=1;
  61369. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61370. return $self._finished();
  61371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61372. }));
  61373. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61374. return $core.withContext(function($ctx2) {
  61375. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61376. if($core.assert($2)){
  61377. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61378. return $recv($3)._ifTrue_(assertBlock);
  61379. }
  61380. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61381. }));
  61382. $recv(runner)._run();
  61383. return self;
  61384. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61385. },
  61386. args: [],
  61387. 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",
  61388. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61389. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61390. }),
  61391. $globals.SUnitAsyncTest);
  61392. $core.addMethod(
  61393. $core.method({
  61394. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61395. protocol: "tests",
  61396. fn: function (){
  61397. var self=this,$self=this;
  61398. var x;
  61399. return $core.withContext(function($ctx1) {
  61400. var $1;
  61401. $self["@flag"]="bad";
  61402. $self._timeout_((10));
  61403. x=(0);
  61404. $1=$self._async_((function(){
  61405. return $core.withContext(function($ctx2) {
  61406. $self._finished();
  61407. $ctx2.sendIdx["finished"]=1;
  61408. $self["@flag"]="ok";
  61409. $self["@flag"];
  61410. x=$recv(x).__plus((1));
  61411. $ctx2.sendIdx["+"]=1;
  61412. x;
  61413. return $self._assert_equals_(x,(1));
  61414. $ctx2.sendIdx["assert:equals:"]=1;
  61415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61416. }));
  61417. $ctx1.sendIdx["async:"]=1;
  61418. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61419. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61420. $self["@flag"]=$recv($self._async_((function(){
  61421. return $core.withContext(function($ctx2) {
  61422. $self._finished();
  61423. $self["@flag"]="ok";
  61424. $self["@flag"];
  61425. x=$recv(x).__plus((1));
  61426. x;
  61427. return $self._assert_equals_(x,(1));
  61428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61429. })))._valueWithTimeout_((0));
  61430. return self;
  61431. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61432. },
  61433. args: [],
  61434. 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.",
  61435. referencedClasses: [],
  61436. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61437. }),
  61438. $globals.SUnitAsyncTest);
  61439. });
  61440. define('amber/devel',[
  61441. './lang',
  61442. './brikz', // pre-fetch, dep of ./boot
  61443. './kernel-checks', // pre-fetch, dep of ./boot
  61444. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61445. './kernel-language', // pre-fetch, dep of ./boot
  61446. './boot', // pre-fetch, class loader
  61447. './deploy', // pre-fetch, dep of ./lang
  61448. // --- packages of the development only Amber begin here ---
  61449. 'amber_core/Platform-DOM',
  61450. 'amber_core/SUnit',
  61451. 'amber_core/Compiler-Tests',
  61452. 'amber_core/Kernel-Tests',
  61453. 'amber_core/Platform-DOM-Tests',
  61454. 'amber_core/SUnit-Tests'
  61455. // --- packages of the development only Amber end here ---
  61456. ], function (amber) {
  61457. return amber;
  61458. });
  61459. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61460. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61461. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61462. $core.addPackage("Platform-Node");
  61463. ($core.packageDescriptors||$core.packages)["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  61464. ($core.packageDescriptors||$core.packages)["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61465. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61466. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61467. $core.addMethod(
  61468. $core.method({
  61469. selector: "globals",
  61470. protocol: "accessing",
  61471. fn: function (){
  61472. var self=this,$self=this;
  61473. return global;
  61474. },
  61475. args: [],
  61476. source: "globals\x0a\x09^ global",
  61477. referencedClasses: [],
  61478. messageSends: []
  61479. }),
  61480. $globals.NodePlatform);
  61481. $core.addMethod(
  61482. $core.method({
  61483. selector: "newXhr",
  61484. protocol: "accessing",
  61485. fn: function (){
  61486. var self=this,$self=this;
  61487. return $core.withContext(function($ctx1) {
  61488. var $receiver;
  61489. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61490. $self._error_("XMLHttpRequest not available.");
  61491. } else {
  61492. return $recv($globals.XMLHttpRequest)._new();
  61493. }
  61494. return self;
  61495. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61496. },
  61497. args: [],
  61498. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61499. referencedClasses: ["XMLHttpRequest"],
  61500. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61501. }),
  61502. $globals.NodePlatform);
  61503. $core.addMethod(
  61504. $core.method({
  61505. selector: "initialize",
  61506. protocol: "testing",
  61507. fn: function (){
  61508. var self=this,$self=this;
  61509. return $core.withContext(function($ctx1) {
  61510. var $1;
  61511. $1=$self._isFeasible();
  61512. if($core.assert($1)){
  61513. $recv($globals.Platform)._registerIfNone_($self._new());
  61514. }
  61515. return self;
  61516. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61517. },
  61518. args: [],
  61519. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61520. referencedClasses: ["Platform"],
  61521. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61522. }),
  61523. $globals.NodePlatform.a$cls);
  61524. $core.addMethod(
  61525. $core.method({
  61526. selector: "isFeasible",
  61527. protocol: "testing",
  61528. fn: function (){
  61529. var self=this,$self=this;
  61530. return $core.withContext(function($ctx1) {
  61531. return typeof global !== "undefined";
  61532. return self;
  61533. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61534. },
  61535. args: [],
  61536. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61537. referencedClasses: [],
  61538. messageSends: []
  61539. }),
  61540. $globals.NodePlatform.a$cls);
  61541. });
  61542. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61543. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61544. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61545. $core.addPackage("AmberCli");
  61546. ($core.packageDescriptors||$core.packages)["AmberCli"].innerEval = function (expr) { return eval(expr); };
  61547. ($core.packageDescriptors||$core.packages)["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  61548. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61549. $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.";
  61550. $core.addMethod(
  61551. $core.method({
  61552. selector: "commandLineSwitches",
  61553. protocol: "commandline",
  61554. fn: function (){
  61555. var self=this,$self=this;
  61556. var switches;
  61557. return $core.withContext(function($ctx1) {
  61558. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61559. return $core.withContext(function($ctx2) {
  61560. return $recv(each)._selector();
  61561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61562. }));
  61563. $ctx1.sendIdx["collect:"]=1;
  61564. switches=$recv(switches)._select_((function(each){
  61565. return $core.withContext(function($ctx2) {
  61566. return $recv(each)._match_("^[^:]*:$");
  61567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61568. }));
  61569. switches=$recv(switches)._collect_((function(each){
  61570. return $core.withContext(function($ctx2) {
  61571. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61573. }));
  61574. return switches;
  61575. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61576. },
  61577. args: [],
  61578. 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",
  61579. referencedClasses: [],
  61580. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61581. }),
  61582. $globals.AmberCli.a$cls);
  61583. $core.addMethod(
  61584. $core.method({
  61585. selector: "config:",
  61586. protocol: "commands",
  61587. fn: function (args){
  61588. var self=this,$self=this;
  61589. return $core.withContext(function($ctx1) {
  61590. $recv($recv($globals.Configurator)._new())._start();
  61591. return self;
  61592. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  61593. },
  61594. args: ["args"],
  61595. source: "config: args\x0a\x09Configurator new start",
  61596. referencedClasses: ["Configurator"],
  61597. messageSends: ["start", "new"]
  61598. }),
  61599. $globals.AmberCli.a$cls);
  61600. $core.addMethod(
  61601. $core.method({
  61602. selector: "handleArguments:",
  61603. protocol: "commandline",
  61604. fn: function (args){
  61605. var self=this,$self=this;
  61606. var selector;
  61607. return $core.withContext(function($ctx1) {
  61608. var $1;
  61609. $1=$recv(args)._first();
  61610. $ctx1.sendIdx["first"]=1;
  61611. selector=$self._selectorForCommandLineSwitch_($1);
  61612. $recv(args)._remove_($recv(args)._first());
  61613. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  61614. return self;
  61615. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  61616. },
  61617. args: ["args"],
  61618. 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)",
  61619. referencedClasses: ["Array"],
  61620. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  61621. }),
  61622. $globals.AmberCli.a$cls);
  61623. $core.addMethod(
  61624. $core.method({
  61625. selector: "help:",
  61626. protocol: "commands",
  61627. fn: function (args){
  61628. var self=this,$self=this;
  61629. return $core.withContext(function($ctx1) {
  61630. $recv($globals.Transcript)._show_("Available commands");
  61631. $recv($self._commandLineSwitches())._do_((function(each){
  61632. return $core.withContext(function($ctx2) {
  61633. return $recv(console)._log_(each);
  61634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61635. }));
  61636. return self;
  61637. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  61638. },
  61639. args: ["args"],
  61640. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  61641. referencedClasses: ["Transcript"],
  61642. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  61643. }),
  61644. $globals.AmberCli.a$cls);
  61645. $core.addMethod(
  61646. $core.method({
  61647. selector: "init:",
  61648. protocol: "commands",
  61649. fn: function (args){
  61650. var self=this,$self=this;
  61651. return $core.withContext(function($ctx1) {
  61652. $recv($recv($globals.Initer)._new())._start();
  61653. return self;
  61654. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  61655. },
  61656. args: ["args"],
  61657. source: "init: args\x0a\x09Initer new start",
  61658. referencedClasses: ["Initer"],
  61659. messageSends: ["start", "new"]
  61660. }),
  61661. $globals.AmberCli.a$cls);
  61662. $core.addMethod(
  61663. $core.method({
  61664. selector: "main",
  61665. protocol: "startup",
  61666. fn: function (){
  61667. var self=this,$self=this;
  61668. var args,packageJSON;
  61669. return $core.withContext(function($ctx1) {
  61670. var $7,$6,$5,$4,$3,$2,$1;
  61671. var $early={};
  61672. try {
  61673. packageJSON=$recv(require)._value_("../package.json");
  61674. $7=$recv(packageJSON)._version();
  61675. $ctx1.sendIdx["version"]=1;
  61676. $6="Welcome to Amber CLI version ".__comma($7);
  61677. $5=$recv($6).__comma(" (Amber ");
  61678. $ctx1.sendIdx[","]=5;
  61679. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  61680. $ctx1.sendIdx[","]=4;
  61681. $3=$recv($4).__comma(", NodeJS ");
  61682. $ctx1.sendIdx[","]=3;
  61683. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  61684. $ctx1.sendIdx[","]=2;
  61685. $1=$recv($2).__comma(").");
  61686. $ctx1.sendIdx[","]=1;
  61687. $recv($globals.Transcript)._show_($1);
  61688. args=$recv(process)._argv();
  61689. $recv(args)._removeFrom_to_((1),(2));
  61690. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  61691. return $core.withContext(function($ctx2) {
  61692. return $self._help_(nil);
  61693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61694. }),(function(){
  61695. return $core.withContext(function($ctx2) {
  61696. throw $early=[$self._handleArguments_(args)];
  61697. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61698. }));
  61699. return self;
  61700. }
  61701. catch(e) {if(e===$early)return e[0]; throw e}
  61702. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  61703. },
  61704. args: [],
  61705. 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]",
  61706. referencedClasses: ["Transcript", "Smalltalk"],
  61707. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  61708. }),
  61709. $globals.AmberCli.a$cls);
  61710. $core.addMethod(
  61711. $core.method({
  61712. selector: "repl:",
  61713. protocol: "commands",
  61714. fn: function (args){
  61715. var self=this,$self=this;
  61716. return $core.withContext(function($ctx1) {
  61717. return $recv($recv($globals.Repl)._new())._createInterface();
  61718. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  61719. },
  61720. args: ["args"],
  61721. source: "repl: args\x0a\x09^ Repl new createInterface",
  61722. referencedClasses: ["Repl"],
  61723. messageSends: ["createInterface", "new"]
  61724. }),
  61725. $globals.AmberCli.a$cls);
  61726. $core.addMethod(
  61727. $core.method({
  61728. selector: "selectorForCommandLineSwitch:",
  61729. protocol: "commandline",
  61730. fn: function (aSwitch){
  61731. var self=this,$self=this;
  61732. var command,selector;
  61733. return $core.withContext(function($ctx1) {
  61734. var $1;
  61735. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  61736. if($core.assert($1)){
  61737. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  61738. return $core.withContext(function($ctx2) {
  61739. return $recv($recv(each)._second())._asUppercase();
  61740. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61741. }))).__comma(":");
  61742. selector;
  61743. } else {
  61744. selector="help:";
  61745. selector;
  61746. }
  61747. return selector;
  61748. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  61749. },
  61750. args: ["aSwitch"],
  61751. 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",
  61752. referencedClasses: [],
  61753. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  61754. }),
  61755. $globals.AmberCli.a$cls);
  61756. $core.addMethod(
  61757. $core.method({
  61758. selector: "serve:",
  61759. protocol: "commands",
  61760. fn: function (args){
  61761. var self=this,$self=this;
  61762. return $core.withContext(function($ctx1) {
  61763. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  61764. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  61765. },
  61766. args: ["args"],
  61767. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  61768. referencedClasses: ["FileServer"],
  61769. messageSends: ["start", "createServerWithArguments:"]
  61770. }),
  61771. $globals.AmberCli.a$cls);
  61772. $core.addMethod(
  61773. $core.method({
  61774. selector: "version:",
  61775. protocol: "commands",
  61776. fn: function (arguments_){
  61777. var self=this,$self=this;
  61778. return self;
  61779. },
  61780. args: ["arguments"],
  61781. source: "version: arguments",
  61782. referencedClasses: [],
  61783. messageSends: []
  61784. }),
  61785. $globals.AmberCli.a$cls);
  61786. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  61787. $core.addMethod(
  61788. $core.method({
  61789. selector: "dirname",
  61790. protocol: "private",
  61791. fn: function (){
  61792. var self=this,$self=this;
  61793. return $core.withContext(function($ctx1) {
  61794. return __dirname;
  61795. return self;
  61796. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  61797. },
  61798. args: [],
  61799. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  61800. referencedClasses: [],
  61801. messageSends: []
  61802. }),
  61803. $globals.BaseFileManipulator);
  61804. $core.addMethod(
  61805. $core.method({
  61806. selector: "initialize",
  61807. protocol: "initialization",
  61808. fn: function (){
  61809. var self=this,$self=this;
  61810. return $core.withContext(function($ctx1) {
  61811. (
  61812. $ctx1.supercall = true,
  61813. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61814. $ctx1.supercall = false;
  61815. $self["@path"]=$recv(require)._value_("path");
  61816. $ctx1.sendIdx["value:"]=1;
  61817. $self["@fs"]=$recv(require)._value_("fs");
  61818. return self;
  61819. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  61820. },
  61821. args: [],
  61822. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  61823. referencedClasses: [],
  61824. messageSends: ["initialize", "value:"]
  61825. }),
  61826. $globals.BaseFileManipulator);
  61827. $core.addMethod(
  61828. $core.method({
  61829. selector: "rootDirname",
  61830. protocol: "private",
  61831. fn: function (){
  61832. var self=this,$self=this;
  61833. return $core.withContext(function($ctx1) {
  61834. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  61835. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  61836. },
  61837. args: [],
  61838. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  61839. referencedClasses: [],
  61840. messageSends: ["join:with:", "dirname"]
  61841. }),
  61842. $globals.BaseFileManipulator);
  61843. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  61844. $core.addMethod(
  61845. $core.method({
  61846. selector: "initialize",
  61847. protocol: "initialization",
  61848. fn: function (){
  61849. var self=this,$self=this;
  61850. return $core.withContext(function($ctx1) {
  61851. (
  61852. $ctx1.supercall = true,
  61853. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  61854. $ctx1.supercall = false;
  61855. return self;
  61856. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  61857. },
  61858. args: [],
  61859. source: "initialize\x0a\x09super initialize",
  61860. referencedClasses: [],
  61861. messageSends: ["initialize"]
  61862. }),
  61863. $globals.Configurator);
  61864. $core.addMethod(
  61865. $core.method({
  61866. selector: "start",
  61867. protocol: "action",
  61868. fn: function (){
  61869. var self=this,$self=this;
  61870. return $core.withContext(function($ctx1) {
  61871. var $receiver;
  61872. $self._writeConfigThenDo_((function(err){
  61873. return $core.withContext(function($ctx2) {
  61874. if(($receiver = err) == null || $receiver.a$nil){
  61875. return $recv(process)._exit();
  61876. } else {
  61877. return $recv(process)._exit_((111));
  61878. }
  61879. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  61880. }));
  61881. return self;
  61882. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  61883. },
  61884. args: [],
  61885. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  61886. referencedClasses: [],
  61887. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  61888. }),
  61889. $globals.Configurator);
  61890. $core.addMethod(
  61891. $core.method({
  61892. selector: "writeConfigThenDo:",
  61893. protocol: "action",
  61894. fn: function (aBlock){
  61895. var self=this,$self=this;
  61896. return $core.withContext(function($ctx1) {
  61897. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  61898. return self;
  61899. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  61900. },
  61901. args: ["aBlock"],
  61902. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  61903. referencedClasses: [],
  61904. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  61905. }),
  61906. $globals.Configurator);
  61907. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  61908. $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.";
  61909. $core.addMethod(
  61910. $core.method({
  61911. selector: "base64Decode:",
  61912. protocol: "private",
  61913. fn: function (aString){
  61914. var self=this,$self=this;
  61915. return $core.withContext(function($ctx1) {
  61916. return (new Buffer(aString, "base64").toString());
  61917. return self;
  61918. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  61919. },
  61920. args: ["aString"],
  61921. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  61922. referencedClasses: [],
  61923. messageSends: []
  61924. }),
  61925. $globals.FileServer);
  61926. $core.addMethod(
  61927. $core.method({
  61928. selector: "basePath",
  61929. protocol: "accessing",
  61930. fn: function (){
  61931. var self=this,$self=this;
  61932. return $core.withContext(function($ctx1) {
  61933. var $1,$receiver;
  61934. $1=$self["@basePath"];
  61935. if(($receiver = $1) == null || $receiver.a$nil){
  61936. return $recv($self._class())._defaultBasePath();
  61937. } else {
  61938. return $1;
  61939. }
  61940. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  61941. },
  61942. args: [],
  61943. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  61944. referencedClasses: [],
  61945. messageSends: ["ifNil:", "defaultBasePath", "class"]
  61946. }),
  61947. $globals.FileServer);
  61948. $core.addMethod(
  61949. $core.method({
  61950. selector: "basePath:",
  61951. protocol: "accessing",
  61952. fn: function (aString){
  61953. var self=this,$self=this;
  61954. return $core.withContext(function($ctx1) {
  61955. $self["@basePath"]=aString;
  61956. $self._validateBasePath();
  61957. return self;
  61958. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  61959. },
  61960. args: ["aString"],
  61961. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  61962. referencedClasses: [],
  61963. messageSends: ["validateBasePath"]
  61964. }),
  61965. $globals.FileServer);
  61966. $core.addMethod(
  61967. $core.method({
  61968. selector: "checkDirectoryLayout",
  61969. protocol: "initialization",
  61970. fn: function (){
  61971. var self=this,$self=this;
  61972. return $core.withContext(function($ctx1) {
  61973. var $1;
  61974. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  61975. if(!$core.assert($1)){
  61976. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  61977. $ctx1.sendIdx["warn:"]=1;
  61978. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  61979. $ctx1.sendIdx["warn:"]=2;
  61980. $recv(console)._warn_(" You can also specify a page to be served by default,");
  61981. $ctx1.sendIdx["warn:"]=3;
  61982. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  61983. }
  61984. return self;
  61985. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  61986. },
  61987. args: [],
  61988. 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.'].",
  61989. referencedClasses: [],
  61990. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  61991. }),
  61992. $globals.FileServer);
  61993. $core.addMethod(
  61994. $core.method({
  61995. selector: "fallbackPage",
  61996. protocol: "accessing",
  61997. fn: function (){
  61998. var self=this,$self=this;
  61999. return $self["@fallbackPage"];
  62000. },
  62001. args: [],
  62002. source: "fallbackPage\x0a\x09^ fallbackPage",
  62003. referencedClasses: [],
  62004. messageSends: []
  62005. }),
  62006. $globals.FileServer);
  62007. $core.addMethod(
  62008. $core.method({
  62009. selector: "fallbackPage:",
  62010. protocol: "accessing",
  62011. fn: function (aString){
  62012. var self=this,$self=this;
  62013. $self["@fallbackPage"]=aString;
  62014. return self;
  62015. },
  62016. args: ["aString"],
  62017. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62018. referencedClasses: [],
  62019. messageSends: []
  62020. }),
  62021. $globals.FileServer);
  62022. $core.addMethod(
  62023. $core.method({
  62024. selector: "handleGETRequest:respondTo:",
  62025. protocol: "request handling",
  62026. fn: function (aRequest,aResponse){
  62027. var self=this,$self=this;
  62028. var uri,filename;
  62029. return $core.withContext(function($ctx1) {
  62030. var $1;
  62031. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62032. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62033. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62034. return $core.withContext(function($ctx2) {
  62035. if($core.assert(aBoolean)){
  62036. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62037. if($core.assert($1)){
  62038. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62039. } else {
  62040. return $self._respondFileNamed_to_(filename,aResponse);
  62041. }
  62042. } else {
  62043. return $self._respondNotFoundTo_(aResponse);
  62044. }
  62045. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62046. }));
  62047. return self;
  62048. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62049. },
  62050. args: ["aRequest", "aResponse"],
  62051. 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]]]",
  62052. referencedClasses: [],
  62053. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62054. }),
  62055. $globals.FileServer);
  62056. $core.addMethod(
  62057. $core.method({
  62058. selector: "handleOPTIONSRequest:respondTo:",
  62059. protocol: "request handling",
  62060. fn: function (aRequest,aResponse){
  62061. var self=this,$self=this;
  62062. return $core.withContext(function($ctx1) {
  62063. $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)]));
  62064. $recv(aResponse)._end();
  62065. return self;
  62066. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62067. },
  62068. args: ["aRequest", "aResponse"],
  62069. 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",
  62070. referencedClasses: [],
  62071. messageSends: ["writeHead:options:", "end"]
  62072. }),
  62073. $globals.FileServer);
  62074. $core.addMethod(
  62075. $core.method({
  62076. selector: "handlePUTRequest:respondTo:",
  62077. protocol: "request handling",
  62078. fn: function (aRequest,aResponse){
  62079. var self=this,$self=this;
  62080. var file,stream;
  62081. return $core.withContext(function($ctx1) {
  62082. var $1,$2,$3,$4;
  62083. $1=$self._isAuthenticated_(aRequest);
  62084. if(!$core.assert($1)){
  62085. $self._respondAuthenticationRequiredTo_(aResponse);
  62086. return nil;
  62087. }
  62088. file=".".__comma($recv(aRequest)._url());
  62089. $ctx1.sendIdx[","]=1;
  62090. stream=$recv($self["@fs"])._createWriteStream_(file);
  62091. $recv(stream)._on_do_("error",(function(error){
  62092. return $core.withContext(function($ctx2) {
  62093. $2=console;
  62094. $3="Error creating WriteStream for file ".__comma(file);
  62095. $ctx2.sendIdx[","]=2;
  62096. $recv($2)._warn_($3);
  62097. $ctx2.sendIdx["warn:"]=1;
  62098. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62099. $ctx2.sendIdx["warn:"]=2;
  62100. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62101. return $self._respondNotCreatedTo_(aResponse);
  62102. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62103. }));
  62104. $ctx1.sendIdx["on:do:"]=1;
  62105. $recv(stream)._on_do_("close",(function(){
  62106. return $core.withContext(function($ctx2) {
  62107. return $self._respondCreatedTo_(aResponse);
  62108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62109. }));
  62110. $ctx1.sendIdx["on:do:"]=2;
  62111. $recv(aRequest)._setEncoding_("utf8");
  62112. $recv(aRequest)._on_do_("data",(function(data){
  62113. return $core.withContext(function($ctx2) {
  62114. return $recv(stream)._write_(data);
  62115. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62116. }));
  62117. $ctx1.sendIdx["on:do:"]=3;
  62118. $recv(aRequest)._on_do_("end",(function(){
  62119. return $core.withContext(function($ctx2) {
  62120. $4=$recv(stream)._writable();
  62121. if($core.assert($4)){
  62122. return $recv(stream)._end();
  62123. }
  62124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62125. }));
  62126. return self;
  62127. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62128. },
  62129. args: ["aRequest", "aResponse"],
  62130. 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]]",
  62131. referencedClasses: [],
  62132. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62133. }),
  62134. $globals.FileServer);
  62135. $core.addMethod(
  62136. $core.method({
  62137. selector: "handleRequest:respondTo:",
  62138. protocol: "request handling",
  62139. fn: function (aRequest,aResponse){
  62140. var self=this,$self=this;
  62141. return $core.withContext(function($ctx1) {
  62142. var $2,$1,$4,$3,$5;
  62143. $2=$recv(aRequest)._method();
  62144. $ctx1.sendIdx["method"]=1;
  62145. $1=$recv($2).__eq("PUT");
  62146. $ctx1.sendIdx["="]=1;
  62147. if($core.assert($1)){
  62148. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62149. }
  62150. $4=$recv(aRequest)._method();
  62151. $ctx1.sendIdx["method"]=2;
  62152. $3=$recv($4).__eq("GET");
  62153. $ctx1.sendIdx["="]=2;
  62154. if($core.assert($3)){
  62155. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62156. }
  62157. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62158. if($core.assert($5)){
  62159. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62160. }
  62161. return self;
  62162. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62163. },
  62164. args: ["aRequest", "aResponse"],
  62165. 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]",
  62166. referencedClasses: [],
  62167. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62168. }),
  62169. $globals.FileServer);
  62170. $core.addMethod(
  62171. $core.method({
  62172. selector: "host",
  62173. protocol: "accessing",
  62174. fn: function (){
  62175. var self=this,$self=this;
  62176. return $self["@host"];
  62177. },
  62178. args: [],
  62179. source: "host\x0a\x09^ host",
  62180. referencedClasses: [],
  62181. messageSends: []
  62182. }),
  62183. $globals.FileServer);
  62184. $core.addMethod(
  62185. $core.method({
  62186. selector: "host:",
  62187. protocol: "accessing",
  62188. fn: function (hostname){
  62189. var self=this,$self=this;
  62190. $self["@host"]=hostname;
  62191. return self;
  62192. },
  62193. args: ["hostname"],
  62194. source: "host: hostname\x0a\x09host := hostname",
  62195. referencedClasses: [],
  62196. messageSends: []
  62197. }),
  62198. $globals.FileServer);
  62199. $core.addMethod(
  62200. $core.method({
  62201. selector: "initialize",
  62202. protocol: "initialization",
  62203. fn: function (){
  62204. var self=this,$self=this;
  62205. return $core.withContext(function($ctx1) {
  62206. var $1;
  62207. (
  62208. $ctx1.supercall = true,
  62209. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62210. $ctx1.supercall = false;
  62211. $self["@http"]=$self._require_("http");
  62212. $ctx1.sendIdx["require:"]=1;
  62213. $self["@util"]=$self._require_("util");
  62214. $ctx1.sendIdx["require:"]=2;
  62215. $self["@url"]=$self._require_("url");
  62216. $1=$self._class();
  62217. $ctx1.sendIdx["class"]=1;
  62218. $self["@host"]=$recv($1)._defaultHost();
  62219. $self["@port"]=$recv($self._class())._defaultPort();
  62220. $self["@username"]=nil;
  62221. $self["@password"]=nil;
  62222. $self["@fallbackPage"]=nil;
  62223. return self;
  62224. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62225. },
  62226. args: [],
  62227. 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.",
  62228. referencedClasses: [],
  62229. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62230. }),
  62231. $globals.FileServer);
  62232. $core.addMethod(
  62233. $core.method({
  62234. selector: "isAuthenticated:",
  62235. protocol: "private",
  62236. fn: function (aRequest){
  62237. var self=this,$self=this;
  62238. var header,token,auth,parts;
  62239. return $core.withContext(function($ctx1) {
  62240. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62241. var $early={};
  62242. try {
  62243. $2=$recv($self["@username"])._isNil();
  62244. $ctx1.sendIdx["isNil"]=1;
  62245. $1=$recv($2)._and_((function(){
  62246. return $core.withContext(function($ctx2) {
  62247. return $recv($self["@password"])._isNil();
  62248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62249. }));
  62250. $ctx1.sendIdx["and:"]=1;
  62251. if($core.assert($1)){
  62252. return true;
  62253. }
  62254. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62255. $ctx1.sendIdx["at:"]=1;
  62256. if(($receiver = $3) == null || $receiver.a$nil){
  62257. header="";
  62258. } else {
  62259. header=$3;
  62260. }
  62261. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62262. throw $early=[false];
  62263. }),(function(){
  62264. return $core.withContext(function($ctx2) {
  62265. $4=$recv(header)._tokenize_(" ");
  62266. $ctx2.sendIdx["tokenize:"]=1;
  62267. if(($receiver = $4) == null || $receiver.a$nil){
  62268. token="";
  62269. } else {
  62270. token=$4;
  62271. }
  62272. token;
  62273. $5=$recv(token)._at_((2));
  62274. $ctx2.sendIdx["at:"]=2;
  62275. auth=$self._base64Decode_($5);
  62276. auth;
  62277. parts=$recv(auth)._tokenize_(":");
  62278. parts;
  62279. $8=$self["@username"];
  62280. $9=$recv(parts)._at_((1));
  62281. $ctx2.sendIdx["at:"]=3;
  62282. $7=$recv($8).__eq($9);
  62283. $ctx2.sendIdx["="]=1;
  62284. $6=$recv($7)._and_((function(){
  62285. return $core.withContext(function($ctx3) {
  62286. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62287. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62288. }));
  62289. if($core.assert($6)){
  62290. throw $early=[true];
  62291. } else {
  62292. throw $early=[false];
  62293. }
  62294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62295. }));
  62296. return self;
  62297. }
  62298. catch(e) {if(e===$early)return e[0]; throw e}
  62299. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62300. },
  62301. args: ["aRequest"],
  62302. 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].",
  62303. referencedClasses: [],
  62304. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62305. }),
  62306. $globals.FileServer);
  62307. $core.addMethod(
  62308. $core.method({
  62309. selector: "password:",
  62310. protocol: "accessing",
  62311. fn: function (aPassword){
  62312. var self=this,$self=this;
  62313. $self["@password"]=aPassword;
  62314. return self;
  62315. },
  62316. args: ["aPassword"],
  62317. source: "password: aPassword\x0a\x09password := aPassword.",
  62318. referencedClasses: [],
  62319. messageSends: []
  62320. }),
  62321. $globals.FileServer);
  62322. $core.addMethod(
  62323. $core.method({
  62324. selector: "port",
  62325. protocol: "accessing",
  62326. fn: function (){
  62327. var self=this,$self=this;
  62328. return $self["@port"];
  62329. },
  62330. args: [],
  62331. source: "port\x0a\x09^ port",
  62332. referencedClasses: [],
  62333. messageSends: []
  62334. }),
  62335. $globals.FileServer);
  62336. $core.addMethod(
  62337. $core.method({
  62338. selector: "port:",
  62339. protocol: "accessing",
  62340. fn: function (aNumber){
  62341. var self=this,$self=this;
  62342. $self["@port"]=aNumber;
  62343. return self;
  62344. },
  62345. args: ["aNumber"],
  62346. source: "port: aNumber\x0a\x09port := aNumber",
  62347. referencedClasses: [],
  62348. messageSends: []
  62349. }),
  62350. $globals.FileServer);
  62351. $core.addMethod(
  62352. $core.method({
  62353. selector: "require:",
  62354. protocol: "private",
  62355. fn: function (aModuleString){
  62356. var self=this,$self=this;
  62357. return $core.withContext(function($ctx1) {
  62358. return $recv(require)._value_(aModuleString);
  62359. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62360. },
  62361. args: ["aModuleString"],
  62362. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62363. referencedClasses: [],
  62364. messageSends: ["value:"]
  62365. }),
  62366. $globals.FileServer);
  62367. $core.addMethod(
  62368. $core.method({
  62369. selector: "respondAuthenticationRequiredTo:",
  62370. protocol: "request handling",
  62371. fn: function (aResponse){
  62372. var self=this,$self=this;
  62373. return $core.withContext(function($ctx1) {
  62374. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62375. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62376. $recv(aResponse)._end();
  62377. return self;
  62378. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62379. },
  62380. args: ["aResponse"],
  62381. 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.",
  62382. referencedClasses: [],
  62383. messageSends: ["writeHead:options:", "write:", "end"]
  62384. }),
  62385. $globals.FileServer);
  62386. $core.addMethod(
  62387. $core.method({
  62388. selector: "respondCreatedTo:",
  62389. protocol: "request handling",
  62390. fn: function (aResponse){
  62391. var self=this,$self=this;
  62392. return $core.withContext(function($ctx1) {
  62393. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62394. $recv(aResponse)._end();
  62395. return self;
  62396. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62397. },
  62398. args: ["aResponse"],
  62399. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62400. referencedClasses: [],
  62401. messageSends: ["writeHead:options:", "end"]
  62402. }),
  62403. $globals.FileServer);
  62404. $core.addMethod(
  62405. $core.method({
  62406. selector: "respondDirectoryNamed:from:to:",
  62407. protocol: "request handling",
  62408. fn: function (aDirname,aUrl,aResponse){
  62409. var self=this,$self=this;
  62410. return $core.withContext(function($ctx1) {
  62411. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62412. $2=$recv(aUrl)._pathname();
  62413. $ctx1.sendIdx["pathname"]=1;
  62414. $1=$recv($2)._endsWith_("/");
  62415. if($core.assert($1)){
  62416. $3=$recv(aDirname).__comma("index.html");
  62417. $ctx1.sendIdx[","]=1;
  62418. $self._respondFileNamed_to_($3,aResponse);
  62419. } else {
  62420. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62421. $7=$recv(aUrl)._search();
  62422. if(($receiver = $7) == null || $receiver.a$nil){
  62423. $6="";
  62424. } else {
  62425. $6=$7;
  62426. }
  62427. $4=$recv($5).__comma($6);
  62428. $ctx1.sendIdx[","]=2;
  62429. $self._respondRedirect_to_($4,aResponse);
  62430. }
  62431. return self;
  62432. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62433. },
  62434. args: ["aDirname", "aUrl", "aResponse"],
  62435. 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]",
  62436. referencedClasses: [],
  62437. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62438. }),
  62439. $globals.FileServer);
  62440. $core.addMethod(
  62441. $core.method({
  62442. selector: "respondFileNamed:to:",
  62443. protocol: "request handling",
  62444. fn: function (aFilename,aResponse){
  62445. var self=this,$self=this;
  62446. var type,filename;
  62447. return $core.withContext(function($ctx1) {
  62448. var $1,$2,$3,$4;
  62449. filename=aFilename;
  62450. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62451. return $core.withContext(function($ctx2) {
  62452. $1=$recv(ex)._notNil();
  62453. if($core.assert($1)){
  62454. $2=console;
  62455. $3=$recv(filename).__comma(" does not exist");
  62456. $ctx2.sendIdx[","]=1;
  62457. $recv($2)._log_($3);
  62458. return $self._respondNotFoundTo_(aResponse);
  62459. } else {
  62460. type=$recv($self._class())._mimeTypeFor_(filename);
  62461. type;
  62462. $4=$recv(type).__eq("application/javascript");
  62463. if($core.assert($4)){
  62464. type=$recv(type).__comma(";charset=utf-8");
  62465. type;
  62466. }
  62467. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62468. $recv(aResponse)._write_encoding_(file,"binary");
  62469. return $recv(aResponse)._end();
  62470. }
  62471. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62472. }));
  62473. return self;
  62474. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62475. },
  62476. args: ["aFilename", "aResponse"],
  62477. 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]]",
  62478. referencedClasses: [],
  62479. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62480. }),
  62481. $globals.FileServer);
  62482. $core.addMethod(
  62483. $core.method({
  62484. selector: "respondInternalErrorTo:",
  62485. protocol: "request handling",
  62486. fn: function (aResponse){
  62487. var self=this,$self=this;
  62488. return $core.withContext(function($ctx1) {
  62489. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62490. $recv(aResponse)._write_("500 Internal server error");
  62491. $recv(aResponse)._end();
  62492. return self;
  62493. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62494. },
  62495. args: ["aResponse"],
  62496. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62497. referencedClasses: [],
  62498. messageSends: ["writeHead:options:", "write:", "end"]
  62499. }),
  62500. $globals.FileServer);
  62501. $core.addMethod(
  62502. $core.method({
  62503. selector: "respondNotCreatedTo:",
  62504. protocol: "request handling",
  62505. fn: function (aResponse){
  62506. var self=this,$self=this;
  62507. return $core.withContext(function($ctx1) {
  62508. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62509. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62510. $recv(aResponse)._end();
  62511. return self;
  62512. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62513. },
  62514. args: ["aResponse"],
  62515. 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.",
  62516. referencedClasses: [],
  62517. messageSends: ["writeHead:options:", "write:", "end"]
  62518. }),
  62519. $globals.FileServer);
  62520. $core.addMethod(
  62521. $core.method({
  62522. selector: "respondNotFoundTo:",
  62523. protocol: "request handling",
  62524. fn: function (aResponse){
  62525. var self=this,$self=this;
  62526. return $core.withContext(function($ctx1) {
  62527. var $2,$1;
  62528. $2=$self._fallbackPage();
  62529. $ctx1.sendIdx["fallbackPage"]=1;
  62530. $1=$recv($2)._isNil();
  62531. if(!$core.assert($1)){
  62532. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62533. }
  62534. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62535. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62536. $ctx1.sendIdx["write:"]=1;
  62537. $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>");
  62538. $ctx1.sendIdx["write:"]=2;
  62539. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62540. $ctx1.sendIdx["write:"]=3;
  62541. $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>");
  62542. $ctx1.sendIdx["write:"]=4;
  62543. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62544. $ctx1.sendIdx["write:"]=5;
  62545. $recv(aResponse)._write_("</ul></p></body></html>");
  62546. $recv(aResponse)._end();
  62547. return self;
  62548. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62549. },
  62550. args: ["aResponse"],
  62551. 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",
  62552. referencedClasses: [],
  62553. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62554. }),
  62555. $globals.FileServer);
  62556. $core.addMethod(
  62557. $core.method({
  62558. selector: "respondOKTo:",
  62559. protocol: "request handling",
  62560. fn: function (aResponse){
  62561. var self=this,$self=this;
  62562. return $core.withContext(function($ctx1) {
  62563. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62564. $recv(aResponse)._end();
  62565. return self;
  62566. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62567. },
  62568. args: ["aResponse"],
  62569. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62570. referencedClasses: [],
  62571. messageSends: ["writeHead:options:", "end"]
  62572. }),
  62573. $globals.FileServer);
  62574. $core.addMethod(
  62575. $core.method({
  62576. selector: "respondRedirect:to:",
  62577. protocol: "request handling",
  62578. fn: function (aString,aResponse){
  62579. var self=this,$self=this;
  62580. return $core.withContext(function($ctx1) {
  62581. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62582. $recv(aResponse)._end();
  62583. return self;
  62584. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62585. },
  62586. args: ["aString", "aResponse"],
  62587. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62588. referencedClasses: [],
  62589. messageSends: ["writeHead:options:", "end"]
  62590. }),
  62591. $globals.FileServer);
  62592. $core.addMethod(
  62593. $core.method({
  62594. selector: "start",
  62595. protocol: "starting",
  62596. fn: function (){
  62597. var self=this,$self=this;
  62598. return $core.withContext(function($ctx1) {
  62599. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  62600. $self._checkDirectoryLayout();
  62601. $1=$recv($self["@http"])._createServer_((function(request,response){
  62602. return $core.withContext(function($ctx2) {
  62603. return $self._handleRequest_respondTo_(request,response);
  62604. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  62605. }));
  62606. $recv($1)._on_do_("error",(function(error){
  62607. return $core.withContext(function($ctx2) {
  62608. $2=console;
  62609. $3="Error starting server: ".__comma(error);
  62610. $ctx2.sendIdx[","]=1;
  62611. return $recv($2)._log_($3);
  62612. $ctx2.sendIdx["log:"]=1;
  62613. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62614. }));
  62615. $ctx1.sendIdx["on:do:"]=1;
  62616. $recv($1)._on_do_("listening",(function(){
  62617. return $core.withContext(function($ctx2) {
  62618. $4=console;
  62619. $8=$self._host();
  62620. $ctx2.sendIdx["host"]=1;
  62621. $7="Starting file server on http://".__comma($8);
  62622. $6=$recv($7).__comma(":");
  62623. $ctx2.sendIdx[","]=3;
  62624. $10=$self._port();
  62625. $ctx2.sendIdx["port"]=1;
  62626. $9=$recv($10)._asString();
  62627. $5=$recv($6).__comma($9);
  62628. $ctx2.sendIdx[","]=2;
  62629. return $recv($4)._log_($5);
  62630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62631. }));
  62632. $recv($1)._listen_host_($self._port(),$self._host());
  62633. return self;
  62634. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  62635. },
  62636. args: [],
  62637. 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.",
  62638. referencedClasses: [],
  62639. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  62640. }),
  62641. $globals.FileServer);
  62642. $core.addMethod(
  62643. $core.method({
  62644. selector: "startOn:",
  62645. protocol: "starting",
  62646. fn: function (aPort){
  62647. var self=this,$self=this;
  62648. return $core.withContext(function($ctx1) {
  62649. $self._port_(aPort);
  62650. $self._start();
  62651. return self;
  62652. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  62653. },
  62654. args: ["aPort"],
  62655. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  62656. referencedClasses: [],
  62657. messageSends: ["port:", "start"]
  62658. }),
  62659. $globals.FileServer);
  62660. $core.addMethod(
  62661. $core.method({
  62662. selector: "username:",
  62663. protocol: "accessing",
  62664. fn: function (aUsername){
  62665. var self=this,$self=this;
  62666. $self["@username"]=aUsername;
  62667. return self;
  62668. },
  62669. args: ["aUsername"],
  62670. source: "username: aUsername\x0a\x09username := aUsername.",
  62671. referencedClasses: [],
  62672. messageSends: []
  62673. }),
  62674. $globals.FileServer);
  62675. $core.addMethod(
  62676. $core.method({
  62677. selector: "validateBasePath",
  62678. protocol: "private",
  62679. fn: function (){
  62680. var self=this,$self=this;
  62681. return $core.withContext(function($ctx1) {
  62682. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  62683. $1=$self["@fs"];
  62684. $2=$self._basePath();
  62685. $ctx1.sendIdx["basePath"]=1;
  62686. $recv($1)._stat_then_($2,(function(err,stat){
  62687. return $core.withContext(function($ctx2) {
  62688. if(($receiver = err) == null || $receiver.a$nil){
  62689. $3=$recv(stat)._isDirectory();
  62690. if(!$core.assert($3)){
  62691. $4=console;
  62692. $7=$self._basePath();
  62693. $ctx2.sendIdx["basePath"]=2;
  62694. $6="Warning: --base-path parameter ".__comma($7);
  62695. $ctx2.sendIdx[","]=2;
  62696. $5=$recv($6).__comma(" is not a directory.");
  62697. $ctx2.sendIdx[","]=1;
  62698. return $recv($4)._warn_($5);
  62699. $ctx2.sendIdx["warn:"]=1;
  62700. }
  62701. } else {
  62702. $8=console;
  62703. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  62704. $ctx2.sendIdx[","]=3;
  62705. return $recv($8)._warn_($9);
  62706. }
  62707. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  62708. }));
  62709. return self;
  62710. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  62711. },
  62712. args: [],
  62713. 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.' ]].",
  62714. referencedClasses: [],
  62715. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  62716. }),
  62717. $globals.FileServer);
  62718. $core.addMethod(
  62719. $core.method({
  62720. selector: "withBasePath:",
  62721. protocol: "private",
  62722. fn: function (aBaseRelativePath){
  62723. var self=this,$self=this;
  62724. return $core.withContext(function($ctx1) {
  62725. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  62726. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  62727. },
  62728. args: ["aBaseRelativePath"],
  62729. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  62730. referencedClasses: [],
  62731. messageSends: ["join:with:", "basePath"]
  62732. }),
  62733. $globals.FileServer);
  62734. $core.addMethod(
  62735. $core.method({
  62736. selector: "writeData:toFileNamed:",
  62737. protocol: "private",
  62738. fn: function (data,aFilename){
  62739. var self=this,$self=this;
  62740. return $core.withContext(function($ctx1) {
  62741. $recv(console)._log_(aFilename);
  62742. return self;
  62743. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  62744. },
  62745. args: ["data", "aFilename"],
  62746. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  62747. referencedClasses: [],
  62748. messageSends: ["log:"]
  62749. }),
  62750. $globals.FileServer);
  62751. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  62752. $core.addMethod(
  62753. $core.method({
  62754. selector: "commandLineSwitches",
  62755. protocol: "accessing",
  62756. fn: function (){
  62757. var self=this,$self=this;
  62758. var switches;
  62759. return $core.withContext(function($ctx1) {
  62760. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  62761. return $core.withContext(function($ctx2) {
  62762. return $recv(each)._selector();
  62763. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62764. }));
  62765. $ctx1.sendIdx["collect:"]=1;
  62766. switches=$recv(switches)._select_((function(each){
  62767. return $core.withContext(function($ctx2) {
  62768. return $recv(each)._match_("^[^:]*:$");
  62769. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62770. }));
  62771. switches=$recv(switches)._collect_((function(each){
  62772. return $core.withContext(function($ctx2) {
  62773. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  62774. $ctx2.sendIdx["replace:with:"]=1;
  62775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  62776. }));
  62777. return switches;
  62778. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  62779. },
  62780. args: [],
  62781. 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",
  62782. referencedClasses: [],
  62783. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  62784. }),
  62785. $globals.FileServer.a$cls);
  62786. $core.addMethod(
  62787. $core.method({
  62788. selector: "createServerWithArguments:",
  62789. protocol: "initialization",
  62790. fn: function (options){
  62791. var self=this,$self=this;
  62792. var server,popFront,front,optionName,optionValue,switches;
  62793. return $core.withContext(function($ctx1) {
  62794. var $1,$2,$3,$4,$5,$6,$7,$8;
  62795. var $early={};
  62796. try {
  62797. switches=$self._commandLineSwitches();
  62798. server=$self._new();
  62799. $recv(options)._ifEmpty_((function(){
  62800. throw $early=[server];
  62801. }));
  62802. $1=$recv($recv(options)._size())._even();
  62803. if(!$core.assert($1)){
  62804. $recv(console)._log_("Using default parameters.");
  62805. $ctx1.sendIdx["log:"]=1;
  62806. $2=console;
  62807. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  62808. $ctx1.sendIdx[","]=1;
  62809. $recv($2)._log_($3);
  62810. $ctx1.sendIdx["log:"]=2;
  62811. $4=console;
  62812. $5="Use any of the following ones: ".__comma(switches);
  62813. $ctx1.sendIdx[","]=2;
  62814. $recv($4)._log_($5);
  62815. $ctx1.sendIdx["log:"]=3;
  62816. return server;
  62817. }
  62818. popFront=(function(args){
  62819. return $core.withContext(function($ctx2) {
  62820. front=$recv(args)._first();
  62821. front;
  62822. $recv(args)._remove_(front);
  62823. return front;
  62824. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  62825. });
  62826. $recv((function(){
  62827. return $core.withContext(function($ctx2) {
  62828. return $recv(options)._notEmpty();
  62829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  62830. }))._whileTrue_((function(){
  62831. return $core.withContext(function($ctx2) {
  62832. optionName=$recv(popFront)._value_(options);
  62833. $ctx2.sendIdx["value:"]=1;
  62834. optionName;
  62835. optionValue=$recv(popFront)._value_(options);
  62836. optionValue;
  62837. $6=$recv(switches)._includes_(optionName);
  62838. if($core.assert($6)){
  62839. optionName=$self._selectorForCommandLineSwitch_(optionName);
  62840. optionName;
  62841. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  62842. } else {
  62843. $7=console;
  62844. $8=$recv(optionName).__comma(" is not a valid commandline option");
  62845. $ctx2.sendIdx[","]=3;
  62846. $recv($7)._log_($8);
  62847. $ctx2.sendIdx["log:"]=4;
  62848. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  62849. }
  62850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62851. }));
  62852. return server;
  62853. }
  62854. catch(e) {if(e===$early)return e[0]; throw e}
  62855. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  62856. },
  62857. args: ["options"],
  62858. 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.",
  62859. referencedClasses: ["Array"],
  62860. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  62861. }),
  62862. $globals.FileServer.a$cls);
  62863. $core.addMethod(
  62864. $core.method({
  62865. selector: "defaultBasePath",
  62866. protocol: "accessing",
  62867. fn: function (){
  62868. var self=this,$self=this;
  62869. return "./";
  62870. },
  62871. args: [],
  62872. source: "defaultBasePath\x0a\x09^ './'",
  62873. referencedClasses: [],
  62874. messageSends: []
  62875. }),
  62876. $globals.FileServer.a$cls);
  62877. $core.addMethod(
  62878. $core.method({
  62879. selector: "defaultHost",
  62880. protocol: "accessing",
  62881. fn: function (){
  62882. var self=this,$self=this;
  62883. return "127.0.0.1";
  62884. },
  62885. args: [],
  62886. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  62887. referencedClasses: [],
  62888. messageSends: []
  62889. }),
  62890. $globals.FileServer.a$cls);
  62891. $core.addMethod(
  62892. $core.method({
  62893. selector: "defaultMimeTypes",
  62894. protocol: "accessing",
  62895. fn: function (){
  62896. var self=this,$self=this;
  62897. 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"]);
  62898. },
  62899. args: [],
  62900. 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}",
  62901. referencedClasses: [],
  62902. messageSends: []
  62903. }),
  62904. $globals.FileServer.a$cls);
  62905. $core.addMethod(
  62906. $core.method({
  62907. selector: "defaultPort",
  62908. protocol: "accessing",
  62909. fn: function (){
  62910. var self=this,$self=this;
  62911. return (4000);
  62912. },
  62913. args: [],
  62914. source: "defaultPort\x0a\x09^ 4000",
  62915. referencedClasses: [],
  62916. messageSends: []
  62917. }),
  62918. $globals.FileServer.a$cls);
  62919. $core.addMethod(
  62920. $core.method({
  62921. selector: "main",
  62922. protocol: "initialization",
  62923. fn: function (){
  62924. var self=this,$self=this;
  62925. var fileServer,args;
  62926. return $core.withContext(function($ctx1) {
  62927. var $1;
  62928. var $early={};
  62929. try {
  62930. args=$recv(process)._argv();
  62931. $recv(args)._removeFrom_to_((1),(3));
  62932. $recv(args)._detect_ifNone_((function(each){
  62933. return $core.withContext(function($ctx2) {
  62934. $1=$recv(each).__eq("--help");
  62935. if($core.assert($1)){
  62936. return $recv($globals.FileServer)._printHelp();
  62937. }
  62938. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62939. }),(function(){
  62940. return $core.withContext(function($ctx2) {
  62941. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  62942. fileServer;
  62943. throw $early=[$recv(fileServer)._start()];
  62944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62945. }));
  62946. return self;
  62947. }
  62948. catch(e) {if(e===$early)return e[0]; throw e}
  62949. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  62950. },
  62951. args: [],
  62952. 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]",
  62953. referencedClasses: ["FileServer"],
  62954. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  62955. }),
  62956. $globals.FileServer.a$cls);
  62957. $core.addMethod(
  62958. $core.method({
  62959. selector: "mimeTypeFor:",
  62960. protocol: "accessing",
  62961. fn: function (aString){
  62962. var self=this,$self=this;
  62963. return $core.withContext(function($ctx1) {
  62964. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  62965. return "text/plain";
  62966. }));
  62967. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  62968. },
  62969. args: ["aString"],
  62970. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  62971. referencedClasses: [],
  62972. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  62973. }),
  62974. $globals.FileServer.a$cls);
  62975. $core.addMethod(
  62976. $core.method({
  62977. selector: "mimeTypes",
  62978. protocol: "accessing",
  62979. fn: function (){
  62980. var self=this,$self=this;
  62981. return $core.withContext(function($ctx1) {
  62982. var $1,$receiver;
  62983. $1=$self["@mimeTypes"];
  62984. if(($receiver = $1) == null || $receiver.a$nil){
  62985. $self["@mimeTypes"]=$self._defaultMimeTypes();
  62986. return $self["@mimeTypes"];
  62987. } else {
  62988. return $1;
  62989. }
  62990. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  62991. },
  62992. args: [],
  62993. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  62994. referencedClasses: [],
  62995. messageSends: ["ifNil:", "defaultMimeTypes"]
  62996. }),
  62997. $globals.FileServer.a$cls);
  62998. $core.addMethod(
  62999. $core.method({
  63000. selector: "printHelp",
  63001. protocol: "accessing",
  63002. fn: function (){
  63003. var self=this,$self=this;
  63004. return $core.withContext(function($ctx1) {
  63005. $recv(console)._log_("Available commandline options are:");
  63006. $ctx1.sendIdx["log:"]=1;
  63007. $recv(console)._log_("--help");
  63008. $ctx1.sendIdx["log:"]=2;
  63009. $recv($self._commandLineSwitches())._do_((function(each){
  63010. return $core.withContext(function($ctx2) {
  63011. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63013. }));
  63014. return self;
  63015. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63016. },
  63017. args: [],
  63018. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63019. referencedClasses: [],
  63020. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63021. }),
  63022. $globals.FileServer.a$cls);
  63023. $core.addMethod(
  63024. $core.method({
  63025. selector: "selectorForCommandLineSwitch:",
  63026. protocol: "accessing",
  63027. fn: function (aSwitch){
  63028. var self=this,$self=this;
  63029. return $core.withContext(function($ctx1) {
  63030. var $1;
  63031. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63032. return $core.withContext(function($ctx2) {
  63033. return $recv($recv(each)._second())._asUppercase();
  63034. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63035. }));
  63036. $ctx1.sendIdx["replace:with:"]=1;
  63037. return $recv($1).__comma(":");
  63038. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63039. },
  63040. args: ["aSwitch"],
  63041. 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 ]), ':'",
  63042. referencedClasses: [],
  63043. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63044. }),
  63045. $globals.FileServer.a$cls);
  63046. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63047. $core.addMethod(
  63048. $core.method({
  63049. selector: "bowerInstallThenDo:",
  63050. protocol: "action",
  63051. fn: function (aBlock){
  63052. var self=this,$self=this;
  63053. var child;
  63054. return $core.withContext(function($ctx1) {
  63055. var $1,$3,$2;
  63056. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("bower","bower"),["install"]);
  63057. $1=child;
  63058. $recv($1)._on_do_("error",aBlock);
  63059. $ctx1.sendIdx["on:do:"]=1;
  63060. $recv($1)._on_do_("close",(function(code){
  63061. return $core.withContext(function($ctx2) {
  63062. $3=$recv(code).__eq((0));
  63063. if($core.assert($3)){
  63064. $2=nil;
  63065. } else {
  63066. $2=code;
  63067. }
  63068. return $recv(aBlock)._value_($2);
  63069. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63070. }));
  63071. return self;
  63072. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63073. },
  63074. args: ["aBlock"],
  63075. 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 ]) ]",
  63076. referencedClasses: [],
  63077. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63078. }),
  63079. $globals.Initer);
  63080. $core.addMethod(
  63081. $core.method({
  63082. selector: "finishMessage",
  63083. protocol: "action",
  63084. fn: function (){
  63085. var self=this,$self=this;
  63086. return $core.withContext(function($ctx1) {
  63087. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63088. $recv((function(){
  63089. }))._valueWithTimeout_((600));
  63090. return self;
  63091. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63092. },
  63093. args: [],
  63094. 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",
  63095. referencedClasses: ["String"],
  63096. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63097. }),
  63098. $globals.Initer);
  63099. $core.addMethod(
  63100. $core.method({
  63101. selector: "gruntInitThenDo:",
  63102. protocol: "action",
  63103. fn: function (aBlock){
  63104. var self=this,$self=this;
  63105. var child,sanitizedTemplatePath;
  63106. return $core.withContext(function($ctx1) {
  63107. var $1,$3,$2;
  63108. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63109. $ctx1.sendIdx["replace:with:"]=1;
  63110. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63111. $1=child;
  63112. $recv($1)._on_do_("error",aBlock);
  63113. $ctx1.sendIdx["on:do:"]=1;
  63114. $recv($1)._on_do_("close",(function(code){
  63115. return $core.withContext(function($ctx2) {
  63116. $3=$recv(code).__eq((0));
  63117. if($core.assert($3)){
  63118. $2=nil;
  63119. } else {
  63120. $2=code;
  63121. }
  63122. return $recv(aBlock)._value_($2);
  63123. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63124. }));
  63125. return self;
  63126. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63127. },
  63128. args: ["aBlock"],
  63129. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\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 ]) ]",
  63130. referencedClasses: [],
  63131. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63132. }),
  63133. $globals.Initer);
  63134. $core.addMethod(
  63135. $core.method({
  63136. selector: "gruntThenDo:",
  63137. protocol: "action",
  63138. fn: function (aBlock){
  63139. var self=this,$self=this;
  63140. var child;
  63141. return $core.withContext(function($ctx1) {
  63142. var $1,$3,$2;
  63143. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  63144. $1=child;
  63145. $recv($1)._on_do_("error",aBlock);
  63146. $ctx1.sendIdx["on:do:"]=1;
  63147. $recv($1)._on_do_("close",(function(code){
  63148. return $core.withContext(function($ctx2) {
  63149. $3=$recv(code).__eq((0));
  63150. if($core.assert($3)){
  63151. $2=nil;
  63152. } else {
  63153. $2=code;
  63154. }
  63155. return $recv(aBlock)._value_($2);
  63156. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63157. }));
  63158. return self;
  63159. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63160. },
  63161. args: ["aBlock"],
  63162. 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 ]) ]",
  63163. referencedClasses: [],
  63164. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63165. }),
  63166. $globals.Initer);
  63167. $core.addMethod(
  63168. $core.method({
  63169. selector: "initialize",
  63170. protocol: "initialization",
  63171. fn: function (){
  63172. var self=this,$self=this;
  63173. return $core.withContext(function($ctx1) {
  63174. (
  63175. $ctx1.supercall = true,
  63176. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63177. $ctx1.supercall = false;
  63178. $self["@childProcess"]=$recv(require)._value_("child_process");
  63179. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63180. return self;
  63181. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63182. },
  63183. args: [],
  63184. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63185. referencedClasses: [],
  63186. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63187. }),
  63188. $globals.Initer);
  63189. $core.addMethod(
  63190. $core.method({
  63191. selector: "npmInstallThenDo:",
  63192. protocol: "action",
  63193. fn: function (aBlock){
  63194. var self=this,$self=this;
  63195. var child;
  63196. return $core.withContext(function($ctx1) {
  63197. var $1;
  63198. child=$recv($self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  63199. $1=$recv(child)._stdout();
  63200. $ctx1.sendIdx["stdout"]=1;
  63201. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63202. return self;
  63203. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63204. },
  63205. args: ["aBlock"],
  63206. 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 }",
  63207. referencedClasses: [],
  63208. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63209. }),
  63210. $globals.Initer);
  63211. $core.addMethod(
  63212. $core.method({
  63213. selector: "npmScriptForModule:named:",
  63214. protocol: "npm",
  63215. fn: function (aString,anotherString){
  63216. var self=this,$self=this;
  63217. var modulePath,packageJson,binSection,scriptPath;
  63218. return $core.withContext(function($ctx1) {
  63219. var $1,$3,$4,$2,$5;
  63220. $1=$self["@path"];
  63221. $3=$recv($globals.JSObjectProxy)._on_(require);
  63222. $4=$recv(aString).__comma("/package.json");
  63223. $ctx1.sendIdx[","]=1;
  63224. $2=$recv($3)._resolve_($4);
  63225. modulePath=$recv($1)._dirname_($2);
  63226. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63227. binSection=$recv(packageJson)._at_("bin");
  63228. $ctx1.sendIdx["at:"]=1;
  63229. $5=$recv(binSection)._isString();
  63230. if($core.assert($5)){
  63231. scriptPath=binSection;
  63232. } else {
  63233. scriptPath=$recv(binSection)._at_(anotherString);
  63234. }
  63235. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63236. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63237. },
  63238. args: ["aString", "anotherString"],
  63239. 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",
  63240. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  63241. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63242. }),
  63243. $globals.Initer);
  63244. $core.addMethod(
  63245. $core.method({
  63246. selector: "start",
  63247. protocol: "action",
  63248. fn: function (){
  63249. var self=this,$self=this;
  63250. return $core.withContext(function($ctx1) {
  63251. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  63252. $self._gruntInitThenDo_((function(error){
  63253. return $core.withContext(function($ctx2) {
  63254. if(($receiver = error) == null || $receiver.a$nil){
  63255. return $self._bowerInstallThenDo_((function(error2){
  63256. return $core.withContext(function($ctx3) {
  63257. if(($receiver = error2) == null || $receiver.a$nil){
  63258. return $self._npmInstallThenDo_((function(error3){
  63259. return $core.withContext(function($ctx4) {
  63260. if(($receiver = error3) == null || $receiver.a$nil){
  63261. return $self._gruntThenDo_((function(error4){
  63262. return $core.withContext(function($ctx5) {
  63263. if(($receiver = error4) == null || $receiver.a$nil){
  63264. $self._finishMessage();
  63265. return $recv(process)._exit();
  63266. } else {
  63267. $7=console;
  63268. $recv($7)._log_("grunt exec error:");
  63269. $ctx5.sendIdx["log:"]=7;
  63270. $recv($7)._log_(error4);
  63271. return $recv(process)._exit_((104));
  63272. }
  63273. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  63274. }));
  63275. } else {
  63276. $5=console;
  63277. $recv($5)._log_("npm install exec error:");
  63278. $ctx4.sendIdx["log:"]=5;
  63279. $6=$recv($5)._log_(error3);
  63280. $ctx4.sendIdx["log:"]=6;
  63281. $6;
  63282. return $recv(process)._exit_((103));
  63283. $ctx4.sendIdx["exit:"]=3;
  63284. }
  63285. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  63286. }));
  63287. } else {
  63288. $3=console;
  63289. $recv($3)._log_("bower install exec error:");
  63290. $ctx3.sendIdx["log:"]=3;
  63291. $4=$recv($3)._log_(error2);
  63292. $ctx3.sendIdx["log:"]=4;
  63293. $4;
  63294. return $recv(process)._exit_((102));
  63295. $ctx3.sendIdx["exit:"]=2;
  63296. }
  63297. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63298. }));
  63299. } else {
  63300. $1=console;
  63301. $recv($1)._log_("grunt-init exec error:");
  63302. $ctx2.sendIdx["log:"]=1;
  63303. $2=$recv($1)._log_(error);
  63304. $ctx2.sendIdx["log:"]=2;
  63305. $2;
  63306. return $recv(process)._exit_((101));
  63307. $ctx2.sendIdx["exit:"]=1;
  63308. }
  63309. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63310. }));
  63311. return self;
  63312. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63313. },
  63314. args: [],
  63315. 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 ]]]]]]]]",
  63316. referencedClasses: [],
  63317. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  63318. }),
  63319. $globals.Initer);
  63320. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63321. $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.";
  63322. $core.addMethod(
  63323. $core.method({
  63324. selector: "addVariableNamed:to:",
  63325. protocol: "private",
  63326. fn: function (aString,anObject){
  63327. var self=this,$self=this;
  63328. var newClass,newObject;
  63329. return $core.withContext(function($ctx1) {
  63330. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63331. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63332. newObject=$recv(newClass)._new();
  63333. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63334. return newObject;
  63335. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63336. },
  63337. args: ["aString", "anObject"],
  63338. 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",
  63339. referencedClasses: [],
  63340. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63341. }),
  63342. $globals.Repl);
  63343. $core.addMethod(
  63344. $core.method({
  63345. selector: "assignNewVariable:do:",
  63346. protocol: "private",
  63347. fn: function (buffer,aBlock){
  63348. var self=this,$self=this;
  63349. return $core.withContext(function($ctx1) {
  63350. var $2,$3,$1,$receiver;
  63351. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63352. var varName,value;
  63353. return $core.withContext(function($ctx2) {
  63354. if(($receiver = name) == null || $receiver.a$nil){
  63355. varName=$self._nextResultName();
  63356. } else {
  63357. varName=name;
  63358. }
  63359. varName;
  63360. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63361. $self["@session"];
  63362. $recv((function(){
  63363. return $core.withContext(function($ctx3) {
  63364. $2=$recv(varName).__comma(" := ");
  63365. if(($receiver = expr) == null || $receiver.a$nil){
  63366. $3=buffer;
  63367. } else {
  63368. $3=expr;
  63369. }
  63370. $1=$recv($2).__comma($3);
  63371. $ctx3.sendIdx[","]=1;
  63372. value=$self._eval_on_($1,$self["@session"]);
  63373. return value;
  63374. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63375. }))._on_do_($globals.Error,(function(e){
  63376. return $core.withContext(function($ctx3) {
  63377. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63378. value=nil;
  63379. return value;
  63380. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63381. }));
  63382. return $recv(aBlock)._value_value_(varName,value);
  63383. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63384. }));
  63385. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63386. },
  63387. args: ["buffer", "aBlock"],
  63388. 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]",
  63389. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63390. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63391. }),
  63392. $globals.Repl);
  63393. $core.addMethod(
  63394. $core.method({
  63395. selector: "clearScreen",
  63396. protocol: "actions",
  63397. fn: function (){
  63398. var self=this,$self=this;
  63399. var esc,cls;
  63400. return $core.withContext(function($ctx1) {
  63401. var $1;
  63402. esc=$recv($globals.String)._fromCharCode_((27));
  63403. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63404. $ctx1.sendIdx[","]=2;
  63405. cls=$recv($1).__comma("[0;0f");
  63406. $ctx1.sendIdx[","]=1;
  63407. $recv($recv(process)._stdout())._write_(cls);
  63408. $recv($self["@interface"])._prompt();
  63409. return self;
  63410. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63411. },
  63412. args: [],
  63413. 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",
  63414. referencedClasses: ["String"],
  63415. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63416. }),
  63417. $globals.Repl);
  63418. $core.addMethod(
  63419. $core.method({
  63420. selector: "close",
  63421. protocol: "actions",
  63422. fn: function (){
  63423. var self=this,$self=this;
  63424. return $core.withContext(function($ctx1) {
  63425. $recv($recv(process)._stdin())._destroy();
  63426. return self;
  63427. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63428. },
  63429. args: [],
  63430. source: "close\x0a\x09process stdin destroy",
  63431. referencedClasses: [],
  63432. messageSends: ["destroy", "stdin"]
  63433. }),
  63434. $globals.Repl);
  63435. $core.addMethod(
  63436. $core.method({
  63437. selector: "commands",
  63438. protocol: "accessing",
  63439. fn: function (){
  63440. var self=this,$self=this;
  63441. return $self["@commands"];
  63442. },
  63443. args: [],
  63444. source: "commands\x0a\x09^ commands",
  63445. referencedClasses: [],
  63446. messageSends: []
  63447. }),
  63448. $globals.Repl);
  63449. $core.addMethod(
  63450. $core.method({
  63451. selector: "createInterface",
  63452. protocol: "actions",
  63453. fn: function (){
  63454. var self=this,$self=this;
  63455. return $core.withContext(function($ctx1) {
  63456. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63457. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63458. return $core.withContext(function($ctx2) {
  63459. return $self._processLine_(buffer);
  63460. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63461. }));
  63462. $ctx1.sendIdx["on:do:"]=1;
  63463. $recv($self["@interface"])._on_do_("close",(function(){
  63464. return $core.withContext(function($ctx2) {
  63465. return $self._close();
  63466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63467. }));
  63468. $self._printWelcome();
  63469. $self._setupHotkeys();
  63470. $self._setPrompt();
  63471. $recv($self["@interface"])._prompt();
  63472. return self;
  63473. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63474. },
  63475. args: [],
  63476. 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",
  63477. referencedClasses: [],
  63478. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63479. }),
  63480. $globals.Repl);
  63481. $core.addMethod(
  63482. $core.method({
  63483. selector: "encapsulateVariable:withValue:in:",
  63484. protocol: "private",
  63485. fn: function (aString,anObject,aClass){
  63486. var self=this,$self=this;
  63487. var compiler;
  63488. return $core.withContext(function($ctx1) {
  63489. var $1,$4,$3,$2,$5,$6;
  63490. compiler=$recv($globals.Compiler)._new();
  63491. $1=compiler;
  63492. $4=$recv(aString).__comma(": anObject ^ ");
  63493. $ctx1.sendIdx[","]=3;
  63494. $3=$recv($4).__comma(aString);
  63495. $ctx1.sendIdx[","]=2;
  63496. $2=$recv($3).__comma(" := anObject");
  63497. $ctx1.sendIdx[","]=1;
  63498. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63499. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63500. $5=compiler;
  63501. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63502. $ctx1.sendIdx[","]=4;
  63503. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63504. return self;
  63505. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63506. },
  63507. args: ["aString", "anObject", "aClass"],
  63508. 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'.",
  63509. referencedClasses: ["Compiler"],
  63510. messageSends: ["new", "install:forClass:protocol:", ","]
  63511. }),
  63512. $globals.Repl);
  63513. $core.addMethod(
  63514. $core.method({
  63515. selector: "eval:",
  63516. protocol: "actions",
  63517. fn: function (buffer){
  63518. var self=this,$self=this;
  63519. return $core.withContext(function($ctx1) {
  63520. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63521. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63522. },
  63523. args: ["buffer"],
  63524. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63525. referencedClasses: ["DoIt"],
  63526. messageSends: ["eval:on:", "new"]
  63527. }),
  63528. $globals.Repl);
  63529. $core.addMethod(
  63530. $core.method({
  63531. selector: "eval:on:",
  63532. protocol: "actions",
  63533. fn: function (buffer,anObject){
  63534. var self=this,$self=this;
  63535. var result;
  63536. return $core.withContext(function($ctx1) {
  63537. var $1;
  63538. $recv(buffer)._ifNotEmpty_((function(){
  63539. return $core.withContext(function($ctx2) {
  63540. return $recv((function(){
  63541. return $core.withContext(function($ctx3) {
  63542. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63543. return result;
  63544. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63545. }))._tryCatch_((function(e){
  63546. return $core.withContext(function($ctx3) {
  63547. $1=$recv(e)._isSmalltalkError();
  63548. if($core.assert($1)){
  63549. return $recv(e)._resignal();
  63550. } else {
  63551. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63552. }
  63553. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63554. }));
  63555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63556. }));
  63557. return result;
  63558. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63559. },
  63560. args: ["buffer", "anObject"],
  63561. 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",
  63562. referencedClasses: ["Compiler"],
  63563. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  63564. }),
  63565. $globals.Repl);
  63566. $core.addMethod(
  63567. $core.method({
  63568. selector: "executeCommand:",
  63569. protocol: "private",
  63570. fn: function (aString){
  63571. var self=this,$self=this;
  63572. return $core.withContext(function($ctx1) {
  63573. var $1;
  63574. var $early={};
  63575. try {
  63576. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63577. return $core.withContext(function($ctx2) {
  63578. $1=$recv(names)._includes_(aString);
  63579. if($core.assert($1)){
  63580. $recv(cmd)._value();
  63581. throw $early=[true];
  63582. }
  63583. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63584. }));
  63585. return false;
  63586. }
  63587. catch(e) {if(e===$early)return e[0]; throw e}
  63588. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63589. },
  63590. args: ["aString"],
  63591. 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",
  63592. referencedClasses: [],
  63593. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63594. }),
  63595. $globals.Repl);
  63596. $core.addMethod(
  63597. $core.method({
  63598. selector: "initialize",
  63599. protocol: "initialization",
  63600. fn: function (){
  63601. var self=this,$self=this;
  63602. return $core.withContext(function($ctx1) {
  63603. (
  63604. $ctx1.supercall = true,
  63605. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63606. $ctx1.supercall = false;
  63607. $self["@session"]=$recv($globals.DoIt)._new();
  63608. $self["@readline"]=$recv(require)._value_("readline");
  63609. $ctx1.sendIdx["value:"]=1;
  63610. $self["@util"]=$recv(require)._value_("util");
  63611. $self._setupCommands();
  63612. return self;
  63613. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63614. },
  63615. args: [],
  63616. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63617. referencedClasses: ["DoIt"],
  63618. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63619. }),
  63620. $globals.Repl);
  63621. $core.addMethod(
  63622. $core.method({
  63623. selector: "instanceVariableNamesFor:",
  63624. protocol: "private",
  63625. fn: function (aClass){
  63626. var self=this,$self=this;
  63627. return $core.withContext(function($ctx1) {
  63628. var $1,$2,$receiver;
  63629. $1=$recv(aClass)._superclass();
  63630. $ctx1.sendIdx["superclass"]=1;
  63631. if(($receiver = $1) == null || $receiver.a$nil){
  63632. return $recv(aClass)._instanceVariableNames();
  63633. } else {
  63634. $2=$recv(aClass)._instanceVariableNames();
  63635. $ctx1.sendIdx["instanceVariableNames"]=1;
  63636. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  63637. }
  63638. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  63639. },
  63640. args: ["aClass"],
  63641. 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]",
  63642. referencedClasses: [],
  63643. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  63644. }),
  63645. $globals.Repl);
  63646. $core.addMethod(
  63647. $core.method({
  63648. selector: "isIdentifier:",
  63649. protocol: "private",
  63650. fn: function (aString){
  63651. var self=this,$self=this;
  63652. return $core.withContext(function($ctx1) {
  63653. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  63654. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  63655. },
  63656. args: ["aString"],
  63657. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  63658. referencedClasses: [],
  63659. messageSends: ["match:", "asRegexp"]
  63660. }),
  63661. $globals.Repl);
  63662. $core.addMethod(
  63663. $core.method({
  63664. selector: "isVariableDefined:",
  63665. protocol: "private",
  63666. fn: function (aString){
  63667. var self=this,$self=this;
  63668. return $core.withContext(function($ctx1) {
  63669. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  63670. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  63671. },
  63672. args: ["aString"],
  63673. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  63674. referencedClasses: [],
  63675. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  63676. }),
  63677. $globals.Repl);
  63678. $core.addMethod(
  63679. $core.method({
  63680. selector: "nextResultName",
  63681. protocol: "private",
  63682. fn: function (){
  63683. var self=this,$self=this;
  63684. return $core.withContext(function($ctx1) {
  63685. var $1,$receiver;
  63686. $1=$self["@resultCount"];
  63687. if(($receiver = $1) == null || $receiver.a$nil){
  63688. $self["@resultCount"]=(1);
  63689. } else {
  63690. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  63691. }
  63692. return "res".__comma($recv($self["@resultCount"])._asString());
  63693. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  63694. },
  63695. args: [],
  63696. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  63697. referencedClasses: [],
  63698. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  63699. }),
  63700. $globals.Repl);
  63701. $core.addMethod(
  63702. $core.method({
  63703. selector: "onKeyPress:",
  63704. protocol: "private",
  63705. fn: function (key){
  63706. var self=this,$self=this;
  63707. return $core.withContext(function($ctx1) {
  63708. var $1;
  63709. $1=$recv($recv(key)._ctrl())._and_((function(){
  63710. return $core.withContext(function($ctx2) {
  63711. return $recv($recv(key)._name()).__eq("l");
  63712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63713. }));
  63714. if($core.assert($1)){
  63715. $self._clearScreen();
  63716. }
  63717. return self;
  63718. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  63719. },
  63720. args: ["key"],
  63721. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  63722. referencedClasses: [],
  63723. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  63724. }),
  63725. $globals.Repl);
  63726. $core.addMethod(
  63727. $core.method({
  63728. selector: "parseAssignment:do:",
  63729. protocol: "private",
  63730. fn: function (aString,aBlock){
  63731. var self=this,$self=this;
  63732. var assignment;
  63733. return $core.withContext(function($ctx1) {
  63734. var $2,$1;
  63735. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  63736. return $core.withContext(function($ctx2) {
  63737. return $recv(s)._trimBoth();
  63738. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  63739. }));
  63740. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  63741. return $core.withContext(function($ctx2) {
  63742. $2=$recv(assignment)._first();
  63743. $ctx2.sendIdx["first"]=1;
  63744. return $self._isIdentifier_($2);
  63745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63746. }));
  63747. if($core.assert($1)){
  63748. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  63749. $ctx1.sendIdx["value:value:"]=1;
  63750. } else {
  63751. return $recv(aBlock)._value_value_(nil,nil);
  63752. }
  63753. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  63754. },
  63755. args: ["aString", "aBlock"],
  63756. 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 ]",
  63757. referencedClasses: [],
  63758. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  63759. }),
  63760. $globals.Repl);
  63761. $core.addMethod(
  63762. $core.method({
  63763. selector: "presentResultNamed:withValue:",
  63764. protocol: "private",
  63765. fn: function (varName,value){
  63766. var self=this,$self=this;
  63767. return $core.withContext(function($ctx1) {
  63768. var $3,$2,$1;
  63769. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  63770. $ctx1.sendIdx[","]=3;
  63771. $2=$recv($3).__comma(" = ");
  63772. $ctx1.sendIdx[","]=2;
  63773. $1=$recv($2).__comma($recv(value)._asString());
  63774. $ctx1.sendIdx[","]=1;
  63775. $recv($globals.Transcript)._show_($1);
  63776. $recv($globals.Transcript)._cr();
  63777. $recv($self["@interface"])._prompt();
  63778. return self;
  63779. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  63780. },
  63781. args: ["varName", "value"],
  63782. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  63783. referencedClasses: ["Transcript"],
  63784. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  63785. }),
  63786. $globals.Repl);
  63787. $core.addMethod(
  63788. $core.method({
  63789. selector: "printWelcome",
  63790. protocol: "actions",
  63791. fn: function (){
  63792. var self=this,$self=this;
  63793. return $core.withContext(function($ctx1) {
  63794. $recv($globals.Transcript)._show_("Type :q to exit.");
  63795. $recv($globals.Transcript)._cr();
  63796. return self;
  63797. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  63798. },
  63799. args: [],
  63800. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  63801. referencedClasses: ["Transcript"],
  63802. messageSends: ["show:", "cr"]
  63803. }),
  63804. $globals.Repl);
  63805. $core.addMethod(
  63806. $core.method({
  63807. selector: "processLine:",
  63808. protocol: "private",
  63809. fn: function (buffer){
  63810. var self=this,$self=this;
  63811. var show;
  63812. return $core.withContext(function($ctx1) {
  63813. var $1,$2;
  63814. show=(function(varName,value){
  63815. return $core.withContext(function($ctx2) {
  63816. return $self._presentResultNamed_withValue_(varName,value);
  63817. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  63818. });
  63819. $1=$self._executeCommand_(buffer);
  63820. if(!$core.assert($1)){
  63821. $2=$self._isVariableDefined_(buffer);
  63822. if($core.assert($2)){
  63823. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  63824. } else {
  63825. $self._assignNewVariable_do_(buffer,show);
  63826. }
  63827. }
  63828. return self;
  63829. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  63830. },
  63831. args: ["buffer"],
  63832. 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]]",
  63833. referencedClasses: [],
  63834. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  63835. }),
  63836. $globals.Repl);
  63837. $core.addMethod(
  63838. $core.method({
  63839. selector: "prompt",
  63840. protocol: "accessing",
  63841. fn: function (){
  63842. var self=this,$self=this;
  63843. return "amber >> ";
  63844. },
  63845. args: [],
  63846. source: "prompt\x0a\x09^ 'amber >> '",
  63847. referencedClasses: [],
  63848. messageSends: []
  63849. }),
  63850. $globals.Repl);
  63851. $core.addMethod(
  63852. $core.method({
  63853. selector: "setPreviousVariablesFor:from:",
  63854. protocol: "private",
  63855. fn: function (newObject,oldObject){
  63856. var self=this,$self=this;
  63857. return $core.withContext(function($ctx1) {
  63858. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  63859. return $core.withContext(function($ctx2) {
  63860. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  63861. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63862. }));
  63863. return self;
  63864. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  63865. },
  63866. args: ["newObject", "oldObject"],
  63867. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  63868. referencedClasses: [],
  63869. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  63870. }),
  63871. $globals.Repl);
  63872. $core.addMethod(
  63873. $core.method({
  63874. selector: "setPrompt",
  63875. protocol: "actions",
  63876. fn: function (){
  63877. var self=this,$self=this;
  63878. return $core.withContext(function($ctx1) {
  63879. $recv($self["@interface"])._setPrompt_($self._prompt());
  63880. return self;
  63881. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  63882. },
  63883. args: [],
  63884. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  63885. referencedClasses: [],
  63886. messageSends: ["setPrompt:", "prompt"]
  63887. }),
  63888. $globals.Repl);
  63889. $core.addMethod(
  63890. $core.method({
  63891. selector: "setupCommands",
  63892. protocol: "initialization",
  63893. fn: function (){
  63894. var self=this,$self=this;
  63895. return $core.withContext(function($ctx1) {
  63896. var $2,$1;
  63897. $2=$recv([":q"]).__minus_gt((function(){
  63898. return $core.withContext(function($ctx2) {
  63899. return $recv(process)._exit();
  63900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63901. }));
  63902. $ctx1.sendIdx["->"]=1;
  63903. $1=[$2,$recv([""]).__minus_gt((function(){
  63904. return $core.withContext(function($ctx2) {
  63905. return $recv($self["@interface"])._prompt();
  63906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63907. }))];
  63908. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  63909. return self;
  63910. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  63911. },
  63912. args: [],
  63913. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  63914. referencedClasses: ["Dictionary"],
  63915. messageSends: ["from:", "->", "exit", "prompt"]
  63916. }),
  63917. $globals.Repl);
  63918. $core.addMethod(
  63919. $core.method({
  63920. selector: "setupHotkeys",
  63921. protocol: "initialization",
  63922. fn: function (){
  63923. var self=this,$self=this;
  63924. return $core.withContext(function($ctx1) {
  63925. var $receiver;
  63926. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  63927. return $core.withContext(function($ctx2) {
  63928. if(($receiver = key) == null || $receiver.a$nil){
  63929. return key;
  63930. } else {
  63931. return $self._onKeyPress_(key);
  63932. }
  63933. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  63934. }));
  63935. return self;
  63936. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  63937. },
  63938. args: [],
  63939. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  63940. referencedClasses: [],
  63941. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  63942. }),
  63943. $globals.Repl);
  63944. $core.addMethod(
  63945. $core.method({
  63946. selector: "subclass:withVariable:",
  63947. protocol: "private",
  63948. fn: function (aClass,varName){
  63949. var self=this,$self=this;
  63950. return $core.withContext(function($ctx1) {
  63951. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  63952. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  63953. },
  63954. args: ["aClass", "varName"],
  63955. 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'",
  63956. referencedClasses: ["ClassBuilder"],
  63957. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  63958. }),
  63959. $globals.Repl);
  63960. $core.addMethod(
  63961. $core.method({
  63962. selector: "subclassNameFor:",
  63963. protocol: "private",
  63964. fn: function (aClass){
  63965. var self=this,$self=this;
  63966. return $core.withContext(function($ctx1) {
  63967. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  63968. $2=$recv(aClass)._name();
  63969. $ctx1.sendIdx["name"]=1;
  63970. $1=$recv($2)._matchesOf_("\x5cd+$");
  63971. $ctx1.sendIdx["matchesOf:"]=1;
  63972. if(($receiver = $1) == null || $receiver.a$nil){
  63973. return $recv($recv(aClass)._name()).__comma("2");
  63974. } else {
  63975. var counter;
  63976. $6=$recv(aClass)._name();
  63977. $ctx1.sendIdx["name"]=2;
  63978. $5=$recv($6)._matchesOf_("\x5cd+$");
  63979. $4=$recv($5)._first();
  63980. $3=$recv($4)._asNumber();
  63981. counter=$recv($3).__plus((1));
  63982. counter;
  63983. $7=$recv(aClass)._name();
  63984. $ctx1.sendIdx["name"]=3;
  63985. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  63986. }
  63987. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  63988. },
  63989. args: ["aClass"],
  63990. 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'].",
  63991. referencedClasses: [],
  63992. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  63993. }),
  63994. $globals.Repl);
  63995. $core.addMethod(
  63996. $core.method({
  63997. selector: "main",
  63998. protocol: "initialization",
  63999. fn: function (){
  64000. var self=this,$self=this;
  64001. return $core.withContext(function($ctx1) {
  64002. $recv($self._new())._createInterface();
  64003. return self;
  64004. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64005. },
  64006. args: [],
  64007. source: "main\x0a\x09self new createInterface",
  64008. referencedClasses: [],
  64009. messageSends: ["createInterface", "new"]
  64010. }),
  64011. $globals.Repl.a$cls);
  64012. });
  64013. (function () {
  64014. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64015. amber.initialize().then(function () {
  64016. amber.globals.AmberCli._main();
  64017. });
  64018. });
  64019. }());
  64020. require(["app"]);
  64021. });
  64022. define.require('__wrap__');
  64023. }((function amdefine(module, requireFn) {
  64024. 'use strict';
  64025. var defineCache = {},
  64026. loaderCache = {},
  64027. alreadyCalled = false,
  64028. path = require('path'),
  64029. makeRequire, stringRequire;
  64030. /**
  64031. * Trims the . and .. from an array of path segments.
  64032. * It will keep a leading path segment if a .. will become
  64033. * the first path segment, to help with module name lookups,
  64034. * which act like paths, but can be remapped. But the end result,
  64035. * all paths that use this function should look normalized.
  64036. * NOTE: this method MODIFIES the input array.
  64037. * @param {Array} ary the array of path segments.
  64038. */
  64039. function trimDots(ary) {
  64040. var i, part;
  64041. for (i = 0; ary[i]; i+= 1) {
  64042. part = ary[i];
  64043. if (part === '.') {
  64044. ary.splice(i, 1);
  64045. i -= 1;
  64046. } else if (part === '..') {
  64047. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64048. //End of the line. Keep at least one non-dot
  64049. //path segment at the front so it can be mapped
  64050. //correctly to disk. Otherwise, there is likely
  64051. //no path mapping for a path starting with '..'.
  64052. //This can still fail, but catches the most reasonable
  64053. //uses of ..
  64054. break;
  64055. } else if (i > 0) {
  64056. ary.splice(i - 1, 2);
  64057. i -= 2;
  64058. }
  64059. }
  64060. }
  64061. }
  64062. function normalize(name, baseName) {
  64063. var baseParts;
  64064. //Adjust any relative paths.
  64065. if (name && name.charAt(0) === '.') {
  64066. //If have a base name, try to normalize against it,
  64067. //otherwise, assume it is a top-level require that will
  64068. //be relative to baseUrl in the end.
  64069. if (baseName) {
  64070. baseParts = baseName.split('/');
  64071. baseParts = baseParts.slice(0, baseParts.length - 1);
  64072. baseParts = baseParts.concat(name.split('/'));
  64073. trimDots(baseParts);
  64074. name = baseParts.join('/');
  64075. }
  64076. }
  64077. return name;
  64078. }
  64079. /**
  64080. * Create the normalize() function passed to a loader plugin's
  64081. * normalize method.
  64082. */
  64083. function makeNormalize(relName) {
  64084. return function (name) {
  64085. return normalize(name, relName);
  64086. };
  64087. }
  64088. function makeLoad(id) {
  64089. function load(value) {
  64090. loaderCache[id] = value;
  64091. }
  64092. load.fromText = function (id, text) {
  64093. //This one is difficult because the text can/probably uses
  64094. //define, and any relative paths and requires should be relative
  64095. //to that id was it would be found on disk. But this would require
  64096. //bootstrapping a module/require fairly deeply from node core.
  64097. //Not sure how best to go about that yet.
  64098. throw new Error('amdefine does not implement load.fromText');
  64099. };
  64100. return load;
  64101. }
  64102. makeRequire = function (systemRequire, exports, module, relId) {
  64103. function amdRequire(deps, callback) {
  64104. if (typeof deps === 'string') {
  64105. //Synchronous, single module require('')
  64106. return stringRequire(systemRequire, exports, module, deps, relId);
  64107. } else {
  64108. //Array of dependencies with a callback.
  64109. //Convert the dependencies to modules.
  64110. deps = deps.map(function (depName) {
  64111. return stringRequire(systemRequire, exports, module, depName, relId);
  64112. });
  64113. //Wait for next tick to call back the require call.
  64114. if (callback) {
  64115. process.nextTick(function () {
  64116. callback.apply(null, deps);
  64117. });
  64118. }
  64119. }
  64120. }
  64121. amdRequire.toUrl = function (filePath) {
  64122. if (filePath.indexOf('.') === 0) {
  64123. return normalize(filePath, path.dirname(module.filename));
  64124. } else {
  64125. return filePath;
  64126. }
  64127. };
  64128. return amdRequire;
  64129. };
  64130. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64131. requireFn = requireFn || function req() {
  64132. return module.require.apply(module, arguments);
  64133. };
  64134. function runFactory(id, deps, factory) {
  64135. var r, e, m, result;
  64136. if (id) {
  64137. e = loaderCache[id] = {};
  64138. m = {
  64139. id: id,
  64140. uri: __filename,
  64141. exports: e
  64142. };
  64143. r = makeRequire(requireFn, e, m, id);
  64144. } else {
  64145. //Only support one define call per file
  64146. if (alreadyCalled) {
  64147. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64148. }
  64149. alreadyCalled = true;
  64150. //Use the real variables from node
  64151. //Use module.exports for exports, since
  64152. //the exports in here is amdefine exports.
  64153. e = module.exports;
  64154. m = module;
  64155. r = makeRequire(requireFn, e, m, module.id);
  64156. }
  64157. //If there are dependencies, they are strings, so need
  64158. //to convert them to dependency values.
  64159. if (deps) {
  64160. deps = deps.map(function (depName) {
  64161. return r(depName);
  64162. });
  64163. }
  64164. //Call the factory with the right dependencies.
  64165. if (typeof factory === 'function') {
  64166. result = factory.apply(m.exports, deps);
  64167. } else {
  64168. result = factory;
  64169. }
  64170. if (result !== undefined) {
  64171. m.exports = result;
  64172. if (id) {
  64173. loaderCache[id] = m.exports;
  64174. }
  64175. }
  64176. }
  64177. stringRequire = function (systemRequire, exports, module, id, relId) {
  64178. //Split the ID by a ! so that
  64179. var index = id.indexOf('!'),
  64180. originalId = id,
  64181. prefix, plugin;
  64182. if (index === -1) {
  64183. id = normalize(id, relId);
  64184. //Straight module lookup. If it is one of the special dependencies,
  64185. //deal with it, otherwise, delegate to node.
  64186. if (id === 'require') {
  64187. return makeRequire(systemRequire, exports, module, relId);
  64188. } else if (id === 'exports') {
  64189. return exports;
  64190. } else if (id === 'module') {
  64191. return module;
  64192. } else if (loaderCache.hasOwnProperty(id)) {
  64193. return loaderCache[id];
  64194. } else if (defineCache[id]) {
  64195. runFactory.apply(null, defineCache[id]);
  64196. return loaderCache[id];
  64197. } else {
  64198. if(systemRequire) {
  64199. return systemRequire(originalId);
  64200. } else {
  64201. throw new Error('No module with ID: ' + id);
  64202. }
  64203. }
  64204. } else {
  64205. //There is a plugin in play.
  64206. prefix = id.substring(0, index);
  64207. id = id.substring(index + 1, id.length);
  64208. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64209. if (plugin.normalize) {
  64210. id = plugin.normalize(id, makeNormalize(relId));
  64211. } else {
  64212. //Normalize the ID normally.
  64213. id = normalize(id, relId);
  64214. }
  64215. if (loaderCache[id]) {
  64216. return loaderCache[id];
  64217. } else {
  64218. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64219. return loaderCache[id];
  64220. }
  64221. }
  64222. };
  64223. //Create a define function specific to the module asking for amdefine.
  64224. function define(id, deps, factory) {
  64225. if (Array.isArray(id)) {
  64226. factory = deps;
  64227. deps = id;
  64228. id = undefined;
  64229. } else if (typeof id !== 'string') {
  64230. factory = id;
  64231. id = deps = undefined;
  64232. }
  64233. if (deps && !Array.isArray(deps)) {
  64234. factory = deps;
  64235. deps = undefined;
  64236. }
  64237. if (!deps) {
  64238. deps = ['require', 'exports', 'module'];
  64239. }
  64240. //Set up properties for this module. If an ID, then use
  64241. //internal cache. If no ID, then use the external variables
  64242. //for this node module.
  64243. if (id) {
  64244. //Put the module in deep freeze until there is a
  64245. //require call for it.
  64246. defineCache[id] = [id, deps, factory];
  64247. } else {
  64248. runFactory(id, deps, factory);
  64249. }
  64250. }
  64251. //define.require, which has access to all the values in the
  64252. //cache. Useful for AMD modules that all have IDs in the file,
  64253. //but need to finally export a value to node based on one of those
  64254. //IDs.
  64255. define.require = function (id) {
  64256. if (loaderCache[id]) {
  64257. return loaderCache[id];
  64258. }
  64259. if (defineCache[id]) {
  64260. runFactory.apply(null, defineCache[id]);
  64261. return loaderCache[id];
  64262. }
  64263. };
  64264. define.amd = {};
  64265. return define;
  64266. }(module)), require));